Browse Source

fix: handle project name length in frontend

pull/2416/head
Wing-Kam Wong 2 years ago
parent
commit
9422b42968
  1. 7
      packages/nc-gui/components/CreateOrEditProject.vue
  2. 7
      packages/nc-gui/pages/project/id.vue
  3. 10
      packages/nc-gui/pages/project/xcdb.vue

7
packages/nc-gui/components/CreateOrEditProject.vue

@ -89,7 +89,7 @@
ref="name" ref="name"
v-model="project.title" v-model="project.title"
v-ge="['project', 'name']" v-ge="['project', 'name']"
:rules="form.titleRequiredRule" :rules="form.titleValidationRule"
:height="20" :height="20"
:label="$t('placeholder.projName')" :label="$t('placeholder.projName')"
autofocus autofocus
@ -963,7 +963,10 @@ export default {
/** ************** START : form related ****************/ /** ************** START : form related ****************/
form: { form: {
portValidationRule: [v => /^\d+$/.test(v) || 'Not a valid port'], portValidationRule: [v => /^\d+$/.test(v) || 'Not a valid port'],
titleRequiredRule: [v => !!v || 'Title is required'], titleValidationRule: [
v => !!v || 'Title is required',
v => v.length <= 50 || 'Project name exceeds 50 characters',
],
requiredRule: [v => !!v || 'Field is required'], requiredRule: [v => !!v || 'Field is required'],
folderRequiredRule: [v => !!v || 'Folder path is required'] folderRequiredRule: [v => !!v || 'Folder path is required']
}, },

7
packages/nc-gui/pages/project/id.vue

@ -84,7 +84,7 @@
<v-text-field <v-text-field
v-model="project.title" v-model="project.title"
v-ge="['project','name']" v-ge="['project','name']"
:rules="form.titleRequiredRule" :rules="form.titleValidationRule"
:height="20" :height="20"
label="Enter Project Name" label="Enter Project Name"
autofocus autofocus
@ -650,7 +650,10 @@ export default {
/** ************** START : form related ****************/ /** ************** START : form related ****************/
form: { form: {
portValidationRule: [v => /^\d+$/.test(v) || 'Not a valid port'], portValidationRule: [v => /^\d+$/.test(v) || 'Not a valid port'],
titleRequiredRule: [v => !!v || 'Title is required'], titleValidationRule: [
v => !!v || 'Title is required',
v => v.length <= 50 || 'Project name exceeds 50 characters',
],
requiredRule: [v => !!v || 'Field is required'], requiredRule: [v => !!v || 'Field is required'],
folderRequiredRule: [v => !!v || 'Folder path is required'] folderRequiredRule: [v => !!v || 'Folder path is required']
}, },

10
packages/nc-gui/pages/project/xcdb.vue

@ -39,7 +39,7 @@
:full-width="false" :full-width="false"
class="nc-metadb-project-name" class="nc-metadb-project-name"
:label="$t('placeholder.projName')" :label="$t('placeholder.projName')"
:rules="[v => !!v || $t('general.required')]" :rules="form.titleValidationRule"
/> />
<!-- <div class="wrapper mb-5 mt-5"> <!-- <div class="wrapper mb-5 mt-5">
@ -109,7 +109,13 @@ export default {
icon: require('@/assets/img/grpc-icon-color.png'), icon: require('@/assets/img/grpc-icon-color.png'),
type: 'img' type: 'img'
}, */ }, */
] ],
form: {
titleValidationRule: [
v => !!v || 'Title is required',
v => v.length <= 50 || 'Project name exceeds 50 characters',
],
},
}), }),
computed: { computed: {
typeIcon() { typeIcon() {

Loading…
Cancel
Save