mirror of
https://github.com/harness/drone.git
synced 2025-05-05 05:01:46 +08:00
Remove Identifier
from UI - Replace with original Name
(#59)
* remove identifier from UI and replace it with original 'Name' * extend uid to length 100 * allow repo name of length 1
This commit is contained in:
parent
c7f852cbf4
commit
8fe80ab811
@ -14,9 +14,9 @@ const (
|
|||||||
minDisplayNameLength = 1
|
minDisplayNameLength = 1
|
||||||
maxDisplayNameLength = 256
|
maxDisplayNameLength = 256
|
||||||
|
|
||||||
minUIDLength = 2
|
minUIDLength = 1
|
||||||
maxUIDLength = 64
|
maxUIDLength = 100
|
||||||
uidRegex = "^[a-zA-Z_][a-zA-Z0-9-_]*$"
|
uidRegex = "^[a-zA-Z_][a-zA-Z0-9-_.]*$"
|
||||||
|
|
||||||
minEmailLength = 1
|
minEmailLength = 1
|
||||||
maxEmailLength = 250
|
maxEmailLength = 250
|
||||||
@ -33,7 +33,7 @@ var (
|
|||||||
minUIDLength, maxUIDLength),
|
minUIDLength, maxUIDLength),
|
||||||
}
|
}
|
||||||
ErrUIDRegex = &ValidationError{
|
ErrUIDRegex = &ValidationError{
|
||||||
"UID has to start with a letter (or _) and only contain the following characters [a-zA-Z0-9-_].",
|
"UID has to start with a letter (or _) and only contain the following characters [a-zA-Z0-9-_.].",
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrEmailLen = &ValidationError{
|
ErrEmailLen = &ValidationError{
|
||||||
|
@ -33,7 +33,7 @@ import { useStrings } from 'framework/strings'
|
|||||||
import {
|
import {
|
||||||
DEFAULT_BRANCH_NAME,
|
DEFAULT_BRANCH_NAME,
|
||||||
getErrorMessage,
|
getErrorMessage,
|
||||||
REGEX_VALID_IDENTIFIER,
|
REGEX_VALID_REPO_NAME,
|
||||||
SUGGESTED_BRANCH_NAMES,
|
SUGGESTED_BRANCH_NAMES,
|
||||||
Unknown
|
Unknown
|
||||||
} from 'utils/Utils'
|
} from 'utils/Utils'
|
||||||
@ -48,7 +48,7 @@ enum RepoVisibility {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface RepoFormData {
|
interface RepoFormData {
|
||||||
identifier: string
|
name: string
|
||||||
description: string
|
description: string
|
||||||
license: string
|
license: string
|
||||||
defaultBranch: string
|
defaultBranch: string
|
||||||
@ -58,7 +58,7 @@ interface RepoFormData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const formInitialValues: RepoFormData = {
|
const formInitialValues: RepoFormData = {
|
||||||
identifier: '',
|
name: '',
|
||||||
description: '',
|
description: '',
|
||||||
license: '',
|
license: '',
|
||||||
defaultBranch: 'main',
|
defaultBranch: 'main',
|
||||||
@ -122,7 +122,7 @@ export const NewRepoModalButton: React.FC<NewRepoModalButtonProps> = ({
|
|||||||
gitIgnore: get(formData, 'gitignore', 'none'),
|
gitIgnore: get(formData, 'gitignore', 'none'),
|
||||||
isPublic: get(formData, 'isPublic') === RepoVisibility.PUBLIC,
|
isPublic: get(formData, 'isPublic') === RepoVisibility.PUBLIC,
|
||||||
license: get(formData, 'license', 'none'),
|
license: get(formData, 'license', 'none'),
|
||||||
uid: get(formData, 'identifier', '').trim(),
|
uid: get(formData, 'name', '').trim(),
|
||||||
readme: get(formData, 'addReadme', false),
|
readme: get(formData, 'addReadme', false),
|
||||||
parentId: standalone ? space : 0
|
parentId: standalone ? space : 0
|
||||||
} as OpenapiCreateRepositoryRequest)
|
} as OpenapiCreateRepositoryRequest)
|
||||||
@ -159,22 +159,22 @@ export const NewRepoModalButton: React.FC<NewRepoModalButtonProps> = ({
|
|||||||
formName="editVariations"
|
formName="editVariations"
|
||||||
enableReinitialize={true}
|
enableReinitialize={true}
|
||||||
validationSchema={yup.object().shape({
|
validationSchema={yup.object().shape({
|
||||||
identifier: yup
|
name: yup
|
||||||
.string()
|
.string()
|
||||||
.trim()
|
.trim()
|
||||||
.required()
|
.required()
|
||||||
.matches(REGEX_VALID_IDENTIFIER, getString('validation.identifierPatternIsNotValid'))
|
.matches(REGEX_VALID_REPO_NAME, getString('validation.repoNamePatternIsNotValid'))
|
||||||
})}
|
})}
|
||||||
validateOnChange
|
validateOnChange
|
||||||
validateOnBlur
|
validateOnBlur
|
||||||
onSubmit={handleSubmit}>
|
onSubmit={handleSubmit}>
|
||||||
<FormikForm>
|
<FormikForm>
|
||||||
<FormInput.Text
|
<FormInput.Text
|
||||||
name="identifier"
|
name="name"
|
||||||
label={getString('identifier')}
|
label={getString('name')}
|
||||||
placeholder={getString('enterRepoIdentifier')}
|
placeholder={getString('enterRepoName')}
|
||||||
tooltipProps={{
|
tooltipProps={{
|
||||||
dataTooltipId: 'repositoryIdentifierTextField'
|
dataTooltipId: 'repositoryNameTextField'
|
||||||
}}
|
}}
|
||||||
inputGroup={{ autoFocus: true }}
|
inputGroup={{ autoFocus: true }}
|
||||||
/>
|
/>
|
||||||
|
@ -31,12 +31,11 @@ export interface StringsMap {
|
|||||||
editFile: string
|
editFile: string
|
||||||
email: string
|
email: string
|
||||||
enterDescription: string
|
enterDescription: string
|
||||||
enterRepoIdentifier: string
|
enterRepoName: string
|
||||||
existingAccount: string
|
existingAccount: string
|
||||||
failedToCreateRepo: string
|
failedToCreateRepo: string
|
||||||
files: string
|
files: string
|
||||||
history: string
|
history: string
|
||||||
identifier: string
|
|
||||||
inactiveBranches: string
|
inactiveBranches: string
|
||||||
loading: string
|
loading: string
|
||||||
name: string
|
name: string
|
||||||
@ -54,8 +53,8 @@ export interface StringsMap {
|
|||||||
'repos.activities': string
|
'repos.activities': string
|
||||||
'repos.data': string
|
'repos.data': string
|
||||||
'repos.enterBranchName': string
|
'repos.enterBranchName': string
|
||||||
'repos.identifier': string
|
|
||||||
'repos.lastChange': string
|
'repos.lastChange': string
|
||||||
|
'repos.name': string
|
||||||
'repos.noDataMessage': string
|
'repos.noDataMessage': string
|
||||||
'repos.updated': string
|
'repos.updated': string
|
||||||
repositories: string
|
repositories: string
|
||||||
@ -67,7 +66,7 @@ export interface StringsMap {
|
|||||||
status: string
|
status: string
|
||||||
updated: string
|
updated: string
|
||||||
'validation.gitBranchNameInvalid': string
|
'validation.gitBranchNameInvalid': string
|
||||||
'validation.identifierPatternIsNotValid': string
|
'validation.repoNamePatternIsNotValid': string
|
||||||
viewCommitDetails: string
|
viewCommitDetails: string
|
||||||
yourBranches: string
|
yourBranches: string
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ public: Public
|
|||||||
private: Private
|
private: Private
|
||||||
cancel: Cancel
|
cancel: Cancel
|
||||||
name: Name
|
name: Name
|
||||||
identifier: Identifier
|
|
||||||
search: Search
|
search: Search
|
||||||
description: Description
|
description: Description
|
||||||
repositories: Repositories
|
repositories: Repositories
|
||||||
@ -25,7 +24,7 @@ content: Content
|
|||||||
history: History
|
history: History
|
||||||
newRepo: New Repository
|
newRepo: New Repository
|
||||||
createRepo: Create Repository
|
createRepo: Create Repository
|
||||||
enterRepoIdentifier: Enter Repository Identifier
|
enterRepoName: Enter Repository Name
|
||||||
enterDescription: Enter a description (optional)
|
enterDescription: Enter a description (optional)
|
||||||
addLicense: Add License
|
addLicense: Add License
|
||||||
none: None
|
none: None
|
||||||
@ -53,7 +52,7 @@ searchBranches: Search branches
|
|||||||
updated: Updated
|
updated: Updated
|
||||||
cloneHTTPS: Clone with HTTPS
|
cloneHTTPS: Clone with HTTPS
|
||||||
repos:
|
repos:
|
||||||
identifier: Repo Identifier
|
name: Repo Name
|
||||||
data: Repo Data
|
data: Repo Data
|
||||||
activities: Monthly Activities
|
activities: Monthly Activities
|
||||||
updated: Updated Date
|
updated: Updated Date
|
||||||
@ -66,5 +65,5 @@ createRepoModal:
|
|||||||
publicLabel: Anyone on the internet can see this repository.
|
publicLabel: Anyone on the internet can see this repository.
|
||||||
privateLabel: You choose who can see and commit to this repository.
|
privateLabel: You choose who can see and commit to this repository.
|
||||||
validation:
|
validation:
|
||||||
identifierPatternIsNotValid: 'Identifier can only contain alphanumerics, _ and $'
|
repoNamePatternIsNotValid: "Name can only contain alphanumerics, '-', '_', '.', and '$'"
|
||||||
gitBranchNameInvalid: Branch name is invalid.
|
gitBranchNameInvalid: Branch name is invalid.
|
||||||
|
@ -56,7 +56,7 @@ export default function RepositoriesListing() {
|
|||||||
const columns: Column<TypesRepository>[] = useMemo(
|
const columns: Column<TypesRepository>[] = useMemo(
|
||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
Header: getString('repos.identifier'),
|
Header: getString('repos.name'),
|
||||||
width: 'calc(100% - 180px)',
|
width: 'calc(100% - 180px)',
|
||||||
Cell: ({ row }: CellProps<TypesRepository>) => {
|
Cell: ({ row }: CellProps<TypesRepository>) => {
|
||||||
const record = row.original
|
const record = row.original
|
||||||
|
@ -12,7 +12,7 @@ export const X_TOTAL_PAGES = 'x-total-pages'
|
|||||||
export const X_PER_PAGE = 'x-per-page'
|
export const X_PER_PAGE = 'x-per-page'
|
||||||
export type Unknown = any // eslint-disable-line @typescript-eslint/no-explicit-any
|
export type Unknown = any // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||||
export const DEFAULT_BRANCH_NAME = 'main'
|
export const DEFAULT_BRANCH_NAME = 'main'
|
||||||
export const REGEX_VALID_IDENTIFIER = /^[a-zA-Z_][0-9a-zA-Z_$]{0,63}$/
|
export const REGEX_VALID_REPO_NAME = /^[a-zA-Z_][0-9a-zA-Z-_.$]*$/
|
||||||
export const SUGGESTED_BRANCH_NAMES = [DEFAULT_BRANCH_NAME, 'master']
|
export const SUGGESTED_BRANCH_NAMES = [DEFAULT_BRANCH_NAME, 'master']
|
||||||
|
|
||||||
/** This utility shows a toaster without being bound to any component.
|
/** This utility shows a toaster without being bound to any component.
|
||||||
|
Loading…
Reference in New Issue
Block a user