You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by so...@apache.org on 2022/07/22 09:08:23 UTC

[dolphinscheduler] branch dev updated: fix space validate for create folder bug (#11106)

This is an automated email from the ASF dual-hosted git repository.

songjian pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 2f2de7f90e fix space validate for create folder bug (#11106)
2f2de7f90e is described below

commit 2f2de7f90e3cf8f77eb71558b86eab7fe87ed1a0
Author: Devosend <de...@gmail.com>
AuthorDate: Fri Jul 22 17:08:12 2022 +0800

    fix space validate for create folder bug (#11106)
---
 dolphinscheduler-ui/src/utils/trim.ts                      |  4 ++++
 .../src/views/resource/file/folder/index.tsx               |  5 +++--
 .../resource/udf/resource/components/folder-modal.tsx      | 14 +++++++++++---
 3 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/dolphinscheduler-ui/src/utils/trim.ts b/dolphinscheduler-ui/src/utils/trim.ts
index d7f731bcd2..e08bf84c95 100644
--- a/dolphinscheduler-ui/src/utils/trim.ts
+++ b/dolphinscheduler-ui/src/utils/trim.ts
@@ -19,4 +19,8 @@ const trim = (value: string) => {
   return !value.startsWith(' ') && !value.endsWith(' ')
 }
 
+export const noSpace = (value: string) => {
+  return value.indexOf(' ') === -1
+}
+
 export default trim
diff --git a/dolphinscheduler-ui/src/views/resource/file/folder/index.tsx b/dolphinscheduler-ui/src/views/resource/file/folder/index.tsx
index 2fa0824c9a..cb48569ba4 100644
--- a/dolphinscheduler-ui/src/views/resource/file/folder/index.tsx
+++ b/dolphinscheduler-ui/src/views/resource/file/folder/index.tsx
@@ -19,6 +19,7 @@ import { defineComponent, toRefs, PropType, getCurrentInstance } from 'vue'
 import { NForm, NFormItem, NInput } from 'naive-ui'
 import { useI18n } from 'vue-i18n'
 import Modal from '@/components/modal'
+import { noSpace } from '@/utils/trim'
 import { useForm } from './use-form'
 import { useFolder } from './use-folder'
 
@@ -69,7 +70,7 @@ export default defineComponent({
         <NForm rules={this.rules} ref='folderFormRef'>
           <NFormItem label={t('resource.file.folder_name')} path='name'>
             <NInput
-                  allowInput={this.trim}
+              allowInput={noSpace}
               v-model={[this.folderForm.name, 'value']}
               placeholder={t('resource.file.enter_name_tips')}
               class='input-directory-name'
@@ -77,7 +78,7 @@ export default defineComponent({
           </NFormItem>
           <NFormItem label={t('resource.file.description')} path='description'>
             <NInput
-                  allowInput={this.trim}
+              allowInput={this.trim}
               type='textarea'
               v-model={[this.folderForm.description, 'value']}
               placeholder={t('resource.file.enter_description_tips')}
diff --git a/dolphinscheduler-ui/src/views/resource/udf/resource/components/folder-modal.tsx b/dolphinscheduler-ui/src/views/resource/udf/resource/components/folder-modal.tsx
index d0ae644010..89e253abea 100644
--- a/dolphinscheduler-ui/src/views/resource/udf/resource/components/folder-modal.tsx
+++ b/dolphinscheduler-ui/src/views/resource/udf/resource/components/folder-modal.tsx
@@ -15,10 +15,18 @@
  * limitations under the License.
  */
 
-import { defineComponent, toRefs, PropType, watch, computed, getCurrentInstance } from 'vue'
+import {
+  defineComponent,
+  toRefs,
+  PropType,
+  watch,
+  computed,
+  getCurrentInstance
+} from 'vue'
 import { NForm, NFormItem, NInput } from 'naive-ui'
 import { useI18n } from 'vue-i18n'
 import Modal from '@/components/modal'
+import { noSpace } from '@/utils/trim'
 import { useForm } from './use-form'
 import { useModal } from './use-modal'
 import type { IUdf } from '../types'
@@ -100,7 +108,7 @@ export default defineComponent({
             path='name'
           >
             <NInput
-                  allowInput={this.trim}
+              allowInput={this.fileEdit ? this.trim : noSpace}
               v-model={[this.folderForm.name, 'value']}
               placeholder={t('resource.udf.enter_name_tips')}
               class='input-directory-name'
@@ -108,7 +116,7 @@ export default defineComponent({
           </NFormItem>
           <NFormItem label={t('resource.udf.description')} path='description'>
             <NInput
-                  allowInput={this.trim}
+              allowInput={this.trim}
               type='textarea'
               v-model={[this.folderForm.description, 'value']}
               placeholder={t('resource.udf.enter_description_tips')}