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