You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by le...@apache.org on 2021/02/07 09:42:06 UTC
[incubator-dolphinscheduler] branch params-trans updated:
[Feature-#3805][server-UI] global params of UI (#4680)
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 74cf370 [Feature-#3805][server-UI] global params of UI (#4680)
74cf370 is described below
commit 74cf370f21b99c540e0e53011d4fa2d0caacc9c1
Author: renlu <90...@qq.com>
AuthorDate: Sun Feb 7 17:41:59 2021 +0800
[Feature-#3805][server-UI] global params of UI (#4680)
* gloabl
* 全局变量取值修改
* remove files
---
dolphinscheduler-ui.zip | Bin 0 -> 946313 bytes
.../src/js/conf/home/pages/dag/_source/dag.vue | 13 ++++++-
.../formModel/tasks/_source/localParams.vue | 4 +-
.../pages/dag/_source/formModel/tasks/shell.vue | 2 +-
.../src/js/conf/home/pages/dag/_source/udp/udp.vue | 42 +++++++++++++++++++--
.../src/js/conf/home/store/dag/mutations.js | 11 ++++++
6 files changed, 64 insertions(+), 8 deletions(-)
diff --git a/dolphinscheduler-ui.zip b/dolphinscheduler-ui.zip
new file mode 100644
index 0000000..1f11f8f
Binary files /dev/null and b/dolphinscheduler-ui.zip differ
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 c56d73f..9f747e6 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
@@ -268,7 +268,7 @@
},
methods: {
...mapActions('dag', ['saveDAGchart', 'updateInstance', 'updateDefinition', 'getTaskState', 'switchProcessDefinitionVersion', 'getProcessDefinitionVersionsPage', 'deleteProcessDefinitionVersion']),
- ...mapMutations('dag', ['addTasks', 'cacheTasks', 'resetParams', 'setIsEditDag', 'setName', 'addConnects']),
+ ...mapMutations('dag', ['addTasks', 'cacheTasks', 'resetParams', 'setIsEditDag', 'setName', 'addConnects', 'resetLocalParam']),
startRunning (item, startNodeList, sourceType) {
this.startData = item
this.startNodeList = startNodeList
@@ -377,7 +377,7 @@
// remove tip state dom
$('.w').find('.state-p').html('')
-
+ const newTask = []
data.forEach(v1 => {
idArr.forEach(v2 => {
if (v2.name === v1.name) {
@@ -387,6 +387,12 @@
taskList.forEach(item => {
if (item.name === v1.name) {
depState = item.state
+ const params = item.taskJson ? JSON.parse(item.taskJson).params : ''
+ let localParam = params.localParams || []
+ newTask.push({
+ id: v2.id,
+ localParam
+ })
}
})
dom.attr('data-state-id', v1.stateId)
@@ -403,6 +409,9 @@
findComponentDownward(this.$root, `${this.type}-details`)._reset()
}
}
+ if (!isReset) {
+ this.resetLocalParam(newTask)
+ }
resolve()
})
})
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/localParams.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/localParams.vue
index c001a20..89e0e88 100644
--- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/localParams.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/localParams.vue
@@ -21,7 +21,7 @@
:key="item.id"
@click="_getIndex($index)">
<el-input
- :disabled="isDetails"
+ :disabled="isDetails || item.ifFixed"
type="text"
size="small"
v-model="localParamsList[$index].prop"
@@ -68,7 +68,7 @@
@blur="_handleValue()"
:style="inputStyle">
</el-input>
- <span class="lt-add">
+ <span class="lt-add" v-show="!item.ifFixed">
<a href="javascript:" style="color:red;" @click="!isDetails && _removeUdp($index)" >
<em class="el-icon-delete" :class="_isDetails" data-toggle="tooltip" :title="$t('delete')" ></em>
</a>
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue
index 55b9aca..d66c9e6 100644
--- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue
@@ -46,7 +46,7 @@
ref="refLocalParams"
@on-local-params="_onLocalParams"
:udp-list="localParams"
- :hide="false">
+ :hide="true">
</m-local-params>
</div>
</m-list-box>
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 a040b4b..f2d9c4f 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
@@ -142,7 +142,12 @@
return true
},
_accuStore () {
- this.store.commit('dag/setGlobalParams', _.cloneDeep(this.udpList))
+ const udp = _.cloneDeep(this.udpList)
+ udp.forEach(u => {
+ delete u.ifFixed
+ })
+ this.store.commit('dag/setGlobalParams', udp)
+
this.store.commit('dag/setName', _.cloneDeep(this.name))
this.store.commit('dag/setTimeout', _.cloneDeep(this.timeout))
this.store.commit('dag/setTenantId', _.cloneDeep(this.tenantId))
@@ -203,8 +208,39 @@
},
created () {
const dag = _.cloneDeep(this.store.state.dag)
- this.udpList = dag.globalParams
- this.udpListCache = dag.globalParams
+
+ 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
diff --git a/dolphinscheduler-ui/src/js/conf/home/store/dag/mutations.js b/dolphinscheduler-ui/src/js/conf/home/store/dag/mutations.js
index 93614c0..27e0697 100755
--- a/dolphinscheduler-ui/src/js/conf/home/store/dag/mutations.js
+++ b/dolphinscheduler-ui/src/js/conf/home/store/dag/mutations.js
@@ -162,5 +162,16 @@ export default {
} else {
state.cacheTasks[payload.id] = payload
}
+ },
+ resetLocalParam (state, payload) {
+ const tasks = state.tasks
+ tasks.forEach((task, index) => {
+ payload.forEach(p => {
+ if (p.id === task.id) {
+ tasks[index].params.localParams = p.localParam
+ }
+ })
+ })
+ state.tasks = tasks
}
}