Amy0104 commented on code in PR #11670:
URL: https://github.com/apache/dolphinscheduler/pull/11670#discussion_r960257969


##########
dolphinscheduler-ui/src/views/datasource/list/use-form.ts:
##########
@@ -118,6 +124,22 @@ export function useForm(id?: number) {
             return new Error(t('datasource.jdbc_format_tips'))
           }
         }
+      },
+      testFlag: {
+        trigger: ['input'],
+        validator() {
+          if (undefined === state.detailForm.testFlag) {
+            return new Error(t('datasource.datasource_test_flag_tips'))
+          }
+        }

Review Comment:
   For radios, it's better to set a default value.



##########
dolphinscheduler-ui/src/views/datasource/list/use-columns.ts:
##########
@@ -28,12 +28,13 @@ import {
 import { EditOutlined, DeleteOutlined } from '@vicons/antd'
 import JsonHighlight from './json-highlight'
 import ButtonLink from '@/components/button-link'
+import { IDataSource, TableColumns } from './types'

Review Comment:
   `import type` is better than `import` here, and `import type` should be in 
the last line.



##########
dolphinscheduler-ui/src/common/common.ts:
##########
@@ -49,6 +50,31 @@ export const bytesToSize = (bytes: number) => {
   return parseFloat((bytes / Math.pow(k, i)).toPrecision(3)) + ' ' + sizes[i]
 }
 
+export function renderEnvironmentalDistinctionCell(
+  testFlag: number | undefined,
+  t: Function
+) {
+  if (testFlag === 0) {
+    return h(
+      NTag,
+      { type: 'success', size: 'small' },
+      {
+        default: () => t('datasource.on_line')
+      }
+    )
+  } else if (testFlag === 1) {
+    return h(
+      NTag,
+      { type: 'warning', size: 'small' },
+      {
+        default: () => t('datasource.test')
+      }
+    )
+  } else {
+    return '-'
+  }
+}
+

Review Comment:
   The common folder is used for configuration-related information. It's better 
to move it to the util folder by a separate file.



##########
dolphinscheduler-ui/src/views/datasource/list/use-form.ts:
##########
@@ -27,7 +30,7 @@ import type {
   IDataSource
 } from './types'
 import utils from '@/utils'
-
+import { TypeReq } from '@/service/modules/data-source/types'

Review Comment:
   Same as above.



##########
dolphinscheduler-ui/src/views/datasource/list/use-form.ts:
##########
@@ -137,24 +159,52 @@ export function useForm(id?: number) {
     } else {
       state.showPrincipal = false
     }
+    if (state.detailForm.id === undefined) {
+      await getSameTypeTestDataSource()

Review Comment:
   It seems to be no need to reload the test options here. The test options 
need to be reloaded only when the test flag is changed to 0.



-- 
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