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/03/27 03:33:34 UTC

[dolphinscheduler] branch dev updated: [Fix][UI Next][V1.0.0-Alpha] Fix the default items display error in SQOOP. (#9211)

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 0841cca  [Fix][UI Next][V1.0.0-Alpha] Fix the default items display error in SQOOP. (#9211)
0841cca is described below

commit 0841ccacc08bddc0e944a52fee1f49bf70c4bd40
Author: Amy0104 <97...@users.noreply.github.com>
AuthorDate: Sun Mar 27 11:33:28 2022 +0800

    [Fix][UI Next][V1.0.0-Alpha] Fix the default items display error in SQOOP. (#9211)
---
 dolphinscheduler-ui-next/src/components/form/fields/radio.ts  |  3 ++-
 .../src/components/form/get-elements-by-json.ts               |  4 ++--
 dolphinscheduler-ui-next/src/components/form/index.tsx        |  2 +-
 .../task/components/node/fields/use-sqoop-datasource.ts       |  4 ++--
 .../task/components/node/fields/use-sqoop-source-type.ts      | 11 ++++++++---
 .../task/components/node/fields/use-sqoop-target-type.ts      |  6 +++---
 6 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/dolphinscheduler-ui-next/src/components/form/fields/radio.ts b/dolphinscheduler-ui-next/src/components/form/fields/radio.ts
index 553680f..260756f 100644
--- a/dolphinscheduler-ui-next/src/components/form/fields/radio.ts
+++ b/dolphinscheduler-ui-next/src/components/form/fields/radio.ts
@@ -32,8 +32,9 @@ export function renderRadio(item: IJsonItem, fields: { [field: string]: any }) {
   return h(
     NRadioGroup,
     {
+      ...props,
       value: fields[field],
-      onUpdateValue: (value) => void (fields[field] = value)
+      onUpdateValue: (value: any) => void (fields[field] = value)
     },
     () =>
       h(NSpace, null, () =>
diff --git a/dolphinscheduler-ui-next/src/components/form/get-elements-by-json.ts b/dolphinscheduler-ui-next/src/components/form/get-elements-by-json.ts
index b25ed5f..753bdb1 100644
--- a/dolphinscheduler-ui-next/src/components/form/get-elements-by-json.ts
+++ b/dolphinscheduler-ui-next/src/components/form/get-elements-by-json.ts
@@ -31,7 +31,7 @@ export default function getElementByJson(
   const elements: IFormItem[] = []
   for (const item of json) {
     const mergedItem = isFunction(item) ? item() : item
-    const { name, value, field, validate, ...rest } = mergedItem
+    const { name, value, field, children, validate, ...rest } = mergedItem
     if (value || value === 0) {
       fields[field] = value
       initialValues[field] = value
@@ -41,7 +41,7 @@ export default function getElementByJson(
       showLabel: !!name,
       ...omit(rest, ['type', 'props', 'options']),
       label: name,
-      path: field,
+      path: !children ? field : '',
       widget: () => getField(item, fields, rules),
       span: toRef(mergedItem, 'span') as Ref<number>
     }
diff --git a/dolphinscheduler-ui-next/src/components/form/index.tsx b/dolphinscheduler-ui-next/src/components/form/index.tsx
index d4962df..7d9707f 100644
--- a/dolphinscheduler-ui-next/src/components/form/index.tsx
+++ b/dolphinscheduler-ui-next/src/components/form/index.tsx
@@ -60,7 +60,7 @@ const Form = defineComponent({
                   {...formItemProps}
                   span={unref(span) === void 0 ? 24 : unref(span)}
                   path={path}
-                  key={path}
+                  key={path || String(Date.now() + Math.random())}
                 >
                   {h(widget)}
                 </NFormItemGi>
diff --git a/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-sqoop-datasource.ts b/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-sqoop-datasource.ts
index 9832b73..28095ed 100644
--- a/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-sqoop-datasource.ts
+++ b/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-sqoop-datasource.ts
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-import { onMounted, ref, unref, Ref } from 'vue'
+import { onMounted, ref, Ref } from 'vue'
 import { queryDataSourceList } from '@/service/modules/data-source'
 import { useI18n } from 'vue-i18n'
 import type { IJsonItem, IDataBase } from '../types'
@@ -52,7 +52,7 @@ export function useDatasource(
       span: span,
       options: [{ label: 'MYSQL', value: 'MYSQL' }],
       validate: {
-        required: unref(span) !== 0
+        required: true
       }
     },
     {
diff --git a/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-sqoop-source-type.ts b/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-sqoop-source-type.ts
index f742c77..2f90a5a 100644
--- a/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-sqoop-source-type.ts
+++ b/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-sqoop-source-type.ts
@@ -33,7 +33,7 @@ export function useSourceType(
   const columnSpan = ref(0)
   const hiveSpan = ref(0)
   const hdfsSpan = ref(0)
-  const datasourceSpan = ref(0)
+  const datasourceSpan = ref(12)
   const resetSpan = () => {
     mysqlSpan.value =
       unCustomSpan.value && model.sourceType === 'MYSQL' ? 24 : 0
@@ -94,7 +94,7 @@ export function useSourceType(
     () => model.modelType,
     (modelType: ModelType) => {
       sourceTypes.value = getSourceTypesByModelType(modelType)
-      if (!sourceTypes.value.find((type) => model.sourceType === type.value)) {
+      if (!model.sourceType) {
         model.sourceType = sourceTypes.value[0].value
       }
     }
@@ -149,7 +149,12 @@ export function useSourceType(
           label: 'SQL',
           value: '1'
         }
-      ]
+      ],
+      props: {
+        'on-update:value': (value: '0' | '1') => {
+          model.targetType = value === '0' ? 'HIVE' : 'HDFS'
+        }
+      }
     },
     {
       type: 'input',
diff --git a/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-sqoop-target-type.ts b/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-sqoop-target-type.ts
index 114db2b..5949def 100644
--- a/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-sqoop-target-type.ts
+++ b/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-sqoop-target-type.ts
@@ -26,8 +26,8 @@ export function useTargetType(
   unCustomSpan: Ref<number>
 ): IJsonItem[] {
   const { t } = useI18n()
-  const hiveSpan = ref(24)
-  const hdfsSpan = ref(0)
+  const hiveSpan = ref(0)
+  const hdfsSpan = ref(24)
   const mysqlSpan = ref(0)
   const dataSourceSpan = ref(0)
   const updateSpan = ref(0)
@@ -103,7 +103,7 @@ export function useTargetType(
     () => [model.sourceType, model.srcQueryType],
     ([sourceType, srcQueryType]) => {
       targetTypes.value = getTargetTypesBySourceType(sourceType, srcQueryType)
-      if (!targetTypes.value.find((type) => model.targetType === type.value)) {
+      if (!model.targetType) {
         model.targetType = targetTypes.value[0].value
       }
     }