This is an automated email from the ASF dual-hosted git repository.

leonbao pushed a commit to branch params-trans
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git


The following commit(s) were added to refs/heads/params-trans by this push:
     new d28c856  [Feature-#3805][server-UI] global params of UI (#4736)
d28c856 is described below

commit d28c856f5a2df64cdf2dfa62d2c8582e60998796
Author: renlu <[email protected]>
AuthorDate: Mon Feb 8 17:11:04 2021 +0800

    [Feature-#3805][server-UI] global params of UI (#4736)
    
    * gloabl
    
    * 全局变量取值修改
    
    * remove files
    
    * fixed
    
    * remove basicSetting
---
 dolphinscheduler-ui/.env                           |  2 +-
 .../src/js/conf/home/pages/dag/_source/dag.vue     |  6 +-
 .../src/js/conf/home/pages/dag/_source/udp/udp.vue | 72 ++++++++++++----------
 3 files changed, 46 insertions(+), 34 deletions(-)

diff --git a/dolphinscheduler-ui/.env b/dolphinscheduler-ui/.env
index e6b00a1..e676be6 100644
--- a/dolphinscheduler-ui/.env
+++ b/dolphinscheduler-ui/.env
@@ -14,7 +14,7 @@
  # limitations under the License.
 
 # back end interface address
-API_BASE = http://127.0.0.1:12345
+API_BASE = http://192.168.xx.xx:12345
 
 # If IP access is required for local development, remove the "#"
 #DEV_HOST = 192.168.xx.xx
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue 
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue
index 9f747e6..131641f 100755
--- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue
@@ -178,7 +178,7 @@
         :title="$t('Set the DAG diagram name')"
         :visible.sync="dialogVisible"
         width="auto">
-        <m-udp @onUdp="onUdpDialog" @close="closeDialog"></m-udp>
+        <m-udp ref="mUdp" @onUdp="onUdpDialog" @close="closeDialog"></m-udp>
       </el-dialog>
       <el-dialog
         :title="$t('Please set the parameters before starting')"
@@ -559,7 +559,11 @@
           this.$message.warning(`${i18n.$t('Failed to create node to save')}`)
           return
         }
+
         this.dialogVisible = true
+        this.$nextTick(() => {
+          this.$refs.mUdp.reloadParam()
+        })
       },
       /**
        * Return to the previous child node
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/udp/udp.vue 
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/udp/udp.vue
index f2d9c4f..614f8ef 100644
--- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/udp/udp.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/udp/udp.vue
@@ -196,6 +196,46 @@
        */
       close () {
         this.$emit('close')
+      },
+      /**
+       * reload localParam
+       */
+      reloadParam () {
+        const dag = _.cloneDeep(this.store.state.dag)
+        let fixedParam = []
+        const tasks = this.store.state.dag.tasks
+        for (const task of tasks) {
+          const localParam = task.params ? task.params.localParams : []
+          localParam.forEach(l => {
+            if (!fixedParam.some(f => { return f.prop === l.prop })) {
+              fixedParam.push(Object.assign({
+                ifFixed: true
+              }, l))
+            }
+          })
+        }
+
+        let globalParams = _.cloneDeep(dag.globalParams)
+
+        globalParams = globalParams.map(g => {
+          if (fixedParam.some(f => { return g.prop === f.prop })) {
+            fixedParam = fixedParam.filter(f => { return g.prop !== f.prop })
+            return Object.assign(g, {
+              ifFixed: true
+            })
+          } else {
+            return g
+          }
+        })
+        let udpList = [...fixedParam, ...globalParams].sort(s => {
+          if (s.ifFixed) {
+            return -1
+          } else {
+            return 1
+          }
+        })
+        this.udpList = udpList
+        this.udpListCache = udpList
       }
     },
     watch: {
@@ -209,38 +249,6 @@
     created () {
       const dag = _.cloneDeep(this.store.state.dag)
 
-      let fixedParam = []
-      const tasks = this.store.state.dag.tasks
-      for (const task of tasks) {
-        const localParam = task.params ? task.params.localParams : []
-        if (localParam && localParam.length > 0) {
-          fixedParam = fixedParam.concat(localParam)
-        }
-      }
-      fixedParam = fixedParam.map(f => {
-        return {
-          prop: f.prop,
-          value: f.value,
-          ifFixed: true
-        }
-      })
-
-      let globalParams = _.cloneDeep(dag.globalParams)
-
-      globalParams = globalParams.map(g => {
-        if (fixedParam.some(f => { return g.prop === f.prop })) {
-          fixedParam = fixedParam.filter(f => { return g.prop !== f.prop })
-          return Object.assign(g, {
-            ifFixed: true
-          })
-        } else {
-          return g
-        }
-      })
-
-      this.udpList = [...fixedParam, ...globalParams]
-      this.udpListCache = [...fixedParam, ...globalParams]
-
       this.name = dag.name
       this.originalName = dag.name
       this.description = dag.description

Reply via email to