Browse Source

fix space validate for create folder bug (#11106)

3.1.0-release
Devosend 2 years ago committed by GitHub
parent
commit
2f2de7f90e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      dolphinscheduler-ui/src/utils/trim.ts
  2. 5
      dolphinscheduler-ui/src/views/resource/file/folder/index.tsx
  3. 14
      dolphinscheduler-ui/src/views/resource/udf/resource/components/folder-modal.tsx

4
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

5
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')}

14
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')}

Loading…
Cancel
Save