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/08 04:02:14 UTC

[dolphinscheduler] branch dev updated: [Feature][UI Next][V1.0.0-Alpha] Fix startup global params not init bug (#8749)

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 799e2fd  [Feature][UI Next][V1.0.0-Alpha] Fix startup global params not init bug (#8749)
799e2fd is described below

commit 799e2fd215799be050e3a4c9e58e699e93fbd8f7
Author: Devosend <de...@gmail.com>
AuthorDate: Tue Mar 8 12:02:04 2022 +0800

    [Feature][UI Next][V1.0.0-Alpha] Fix startup global params not init bug (#8749)
---
 .../workflow/definition/components/start-modal.tsx  | 19 +++++++++++++++++--
 .../workflow/definition/components/use-modal.ts     | 21 ++++++++++++++++++---
 2 files changed, 35 insertions(+), 5 deletions(-)

diff --git a/dolphinscheduler-ui-next/src/views/projects/workflow/definition/components/start-modal.tsx b/dolphinscheduler-ui-next/src/views/projects/workflow/definition/components/start-modal.tsx
index 178a5db..488f8a4 100644
--- a/dolphinscheduler-ui-next/src/views/projects/workflow/definition/components/start-modal.tsx
+++ b/dolphinscheduler-ui-next/src/views/projects/workflow/definition/components/start-modal.tsx
@@ -15,7 +15,15 @@
  * limitations under the License.
  */
 
-import { defineComponent, PropType, toRefs, h, onMounted, ref } from 'vue'
+import {
+  defineComponent,
+  PropType,
+  toRefs,
+  h,
+  onMounted,
+  ref,
+  watch
+} from 'vue'
 import { useI18n } from 'vue-i18n'
 import Modal from '@/components/modal'
 import { useForm } from './use-form'
@@ -67,7 +75,8 @@ export default defineComponent({
       handleStartDefinition,
       getWorkerGroups,
       getAlertGroups,
-      getEnvironmentList
+      getEnvironmentList,
+      getStartParamsList
     } = useModal(startState, ctx)
 
     const hideModal = () => {
@@ -176,6 +185,11 @@ export default defineComponent({
       getEnvironmentList()
     })
 
+    watch(
+      () => props.row,
+      () => getStartParamsList(props.row.code)
+    )
+
     return {
       t,
       parallelismRef,
@@ -368,6 +382,7 @@ export default defineComponent({
                       pair
                       separator=':'
                       placeholder={['prop', 'value']}
+                      defaultValue={[item.prop, item.value]}
                       onUpdateValue={(param) =>
                         this.updateParamsList(index, param)
                       }
diff --git a/dolphinscheduler-ui-next/src/views/projects/workflow/definition/components/use-modal.ts b/dolphinscheduler-ui-next/src/views/projects/workflow/definition/components/use-modal.ts
index 3d93aef..750319d 100644
--- a/dolphinscheduler-ui-next/src/views/projects/workflow/definition/components/use-modal.ts
+++ b/dolphinscheduler-ui-next/src/views/projects/workflow/definition/components/use-modal.ts
@@ -18,10 +18,13 @@
 import _ from 'lodash'
 import { reactive, SetupContext } from 'vue'
 import { useI18n } from 'vue-i18n'
-import { useRouter } from 'vue-router'
+import { useRoute, useRouter } from 'vue-router'
 import type { Router } from 'vue-router'
 import { format } from 'date-fns'
-import { importProcessDefinition } from '@/service/modules/process-definition'
+import {
+  importProcessDefinition,
+  queryProcessDefinitionByCode
+} from '@/service/modules/process-definition'
 import { queryAllWorkerGroups } from '@/service/modules/worker-groups'
 import { queryAllEnvironmentList } from '@/service/modules/environment'
 import { listAlertGroupById } from '@/service/modules/alert-group'
@@ -39,9 +42,10 @@ export function useModal(
 ) {
   const { t } = useI18n()
   const router: Router = useRouter()
+  const route = useRoute()
 
   const variables = reactive({
-    projectCode: Number(router.currentRoute.value.params.projectCode),
+    projectCode: Number(route.params.projectCode),
     workerGroups: [],
     alertGroups: [],
     environmentList: [],
@@ -205,6 +209,16 @@ export function useModal(
     })
   }
 
+  const getStartParamsList = (code: number) => {
+    queryProcessDefinitionByCode(code, variables.projectCode)
+      .then((res: any) => {
+        variables.startParamsList = res.processDefinition.globalParamList
+      })
+      .catch((error: any) => {
+        window.$message.error(error.message)
+      })
+  }
+
   const getPreviewSchedule = () => {
     state.timingFormRef.validate(async (valid: any) => {
       if (!valid) {
@@ -244,6 +258,7 @@ export function useModal(
     getWorkerGroups,
     getAlertGroups,
     getEnvironmentList,
+    getStartParamsList,
     getPreviewSchedule
   }
 }