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

liudongkai pushed a commit to branch 3.0.0-prepare
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/3.0.0-prepare by this push:
     new 4f37b7c377 fix space validate for create folder bug (#11106) (#11172)
4f37b7c377 is described below

commit 4f37b7c3774d38a191ddbdf7ab8af17d73a59c66
Author: Devosend <[email protected]>
AuthorDate: Wed Jul 27 17:16:58 2022 +0800

    fix space validate for create folder bug (#11106) (#11172)
    
    (cherry picked from commit 2f2de7f90e3cf8f77eb71558b86eab7fe87ed1a0)
---
 dolphinscheduler-ui/src/utils/trim.ts                | 20 ++++++++++++++++++++
 .../src/views/resource/file/folder/index.tsx         |  2 ++
 .../udf/resource/components/folder-modal.tsx         |  2 ++
 3 files changed, 24 insertions(+)

diff --git a/dolphinscheduler-ui/src/utils/trim.ts 
b/dolphinscheduler-ui/src/utils/trim.ts
new file mode 100644
index 0000000000..fc68e969a0
--- /dev/null
+++ b/dolphinscheduler-ui/src/utils/trim.ts
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export const noSpace = (value: string) => {
+  return value.indexOf(' ') === -1
+}
diff --git a/dolphinscheduler-ui/src/views/resource/file/folder/index.tsx 
b/dolphinscheduler-ui/src/views/resource/file/folder/index.tsx
index 88447ca8f3..c1742aa203 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 } 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'
 
@@ -66,6 +67,7 @@ export default defineComponent({
         <NForm rules={this.rules} ref='folderFormRef'>
           <NFormItem label={t('resource.file.folder_name')} path='name'>
             <NInput
+              allowInput={noSpace}
               v-model={[this.folderForm.name, 'value']}
               placeholder={t('resource.file.enter_name_tips')}
               class='input-directory-name'
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 be13ace5c8..0b18c0348e 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
@@ -19,6 +19,7 @@ import { defineComponent, toRefs, PropType, watch, computed } 
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'
@@ -97,6 +98,7 @@ export default defineComponent({
             path='name'
           >
             <NInput
+              allowInput={this.fileEdit ? undefined : noSpace}
               v-model={[this.folderForm.name, 'value']}
               placeholder={t('resource.udf.enter_name_tips')}
               class='input-directory-name'

Reply via email to