songjianet commented on a change in pull request #8133:
URL: https://github.com/apache/dolphinscheduler/pull/8133#discussion_r788446987



##########
File path: 
dolphinscheduler-ui-next/src/views/security/user-manage/components/use-modal.tsx
##########
@@ -0,0 +1,236 @@
+import { ref, watch, computed } from 'vue'
+import { useI18n } from 'vue-i18n'
+import { useMessage } from 'naive-ui'
+import { queryTenantList } from '@/service/modules/tenants'
+import { queryList } from '@/service/modules/queues'
+import {
+  createUser,
+  updateUser,
+  delUserById,
+  verifyUserName
+} from '@/service/modules/users'
+export type Mode = 'add' | 'edit' | 'delete'
+
+export function useModal() {
+  const message = useMessage()
+  const { t } = useI18n()
+  const show = ref(false)
+  const mode = ref<Mode>('add')
+  const user = ref()
+  const formRef = ref()
+  const formValues = ref({
+    userName: '',
+    userPassword: '',
+    tenantId: 0,
+    email: '',
+    queue: '',
+    phone: '',
+    state: 1
+  })
+  const tenants = ref<any[]>([])
+  const queues = ref<any[]>([])
+  const optionsLoading = ref(false)
+  const confirmLoading = ref(false)
+
+  const formRules = computed(() => {
+    return {
+      userName: {
+        required: true,
+        message: t('security.user.username_rule_msg'),
+        trigger: 'blur'
+      },
+      userPassword: {
+        required: mode.value === 'add',
+        validator(rule: any, value?: string) {
+          if (mode.value !== 'add' && !value) {
+            return true
+          }
+          const msg = t('security.user.user_password_rule_msg')
+          if (
+            !value ||
+            !/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$/.test(value)

Review comment:
       Regular can be put in utils/regex.

##########
File path: 
dolphinscheduler-ui-next/src/views/security/user-manage/components/use-modal.tsx
##########
@@ -0,0 +1,236 @@
+import { ref, watch, computed } from 'vue'

Review comment:
       If there is no file returned by dom, you do not need to use tsx, it is 
recommended to change it to ts.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to