Browse Source

[Feature-#3805][server-UI] global params of UI (#4680)

* gloabl

* 全局变量取值修改

* remove files
pull/3/MERGE
renlu 4 years ago committed by GitHub
parent
commit
74cf370f21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. BIN
      dolphinscheduler-ui.zip
  2. 13
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue
  3. 4
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/localParams.vue
  4. 2
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue
  5. 42
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/udp/udp.vue
  6. 11
      dolphinscheduler-ui/src/js/conf/home/store/dag/mutations.js

BIN
dolphinscheduler-ui.zip

Binary file not shown.

13
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue

@ -268,7 +268,7 @@
}, },
methods: { methods: {
...mapActions('dag', ['saveDAGchart', 'updateInstance', 'updateDefinition', 'getTaskState', 'switchProcessDefinitionVersion', 'getProcessDefinitionVersionsPage', 'deleteProcessDefinitionVersion']), ...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) { startRunning (item, startNodeList, sourceType) {
this.startData = item this.startData = item
this.startNodeList = startNodeList this.startNodeList = startNodeList
@ -377,7 +377,7 @@
// remove tip state dom // remove tip state dom
$('.w').find('.state-p').html('') $('.w').find('.state-p').html('')
const newTask = []
data.forEach(v1 => { data.forEach(v1 => {
idArr.forEach(v2 => { idArr.forEach(v2 => {
if (v2.name === v1.name) { if (v2.name === v1.name) {
@ -387,6 +387,12 @@
taskList.forEach(item => { taskList.forEach(item => {
if (item.name === v1.name) { if (item.name === v1.name) {
depState = item.state 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) dom.attr('data-state-id', v1.stateId)
@ -403,6 +409,9 @@
findComponentDownward(this.$root, `${this.type}-details`)._reset() findComponentDownward(this.$root, `${this.type}-details`)._reset()
} }
} }
if (!isReset) {
this.resetLocalParam(newTask)
}
resolve() resolve()
}) })
}) })

4
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/localParams.vue

@ -21,7 +21,7 @@
:key="item.id" :key="item.id"
@click="_getIndex($index)"> @click="_getIndex($index)">
<el-input <el-input
:disabled="isDetails" :disabled="isDetails || item.ifFixed"
type="text" type="text"
size="small" size="small"
v-model="localParamsList[$index].prop" v-model="localParamsList[$index].prop"
@ -68,7 +68,7 @@
@blur="_handleValue()" @blur="_handleValue()"
:style="inputStyle"> :style="inputStyle">
</el-input> </el-input>
<span class="lt-add"> <span class="lt-add" v-show="!item.ifFixed">
<a href="javascript:" style="color:red;" @click="!isDetails && _removeUdp($index)" > <a href="javascript:" style="color:red;" @click="!isDetails && _removeUdp($index)" >
<em class="el-icon-delete" :class="_isDetails" data-toggle="tooltip" :title="$t('delete')" ></em> <em class="el-icon-delete" :class="_isDetails" data-toggle="tooltip" :title="$t('delete')" ></em>
</a> </a>

2
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue

@ -46,7 +46,7 @@
ref="refLocalParams" ref="refLocalParams"
@on-local-params="_onLocalParams" @on-local-params="_onLocalParams"
:udp-list="localParams" :udp-list="localParams"
:hide="false"> :hide="true">
</m-local-params> </m-local-params>
</div> </div>
</m-list-box> </m-list-box>

42
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/udp/udp.vue

@ -142,7 +142,12 @@
return true return true
}, },
_accuStore () { _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/setName', _.cloneDeep(this.name))
this.store.commit('dag/setTimeout', _.cloneDeep(this.timeout)) this.store.commit('dag/setTimeout', _.cloneDeep(this.timeout))
this.store.commit('dag/setTenantId', _.cloneDeep(this.tenantId)) this.store.commit('dag/setTenantId', _.cloneDeep(this.tenantId))
@ -203,8 +208,39 @@
}, },
created () { created () {
const dag = _.cloneDeep(this.store.state.dag) 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.name = dag.name
this.originalName = dag.name this.originalName = dag.name
this.description = dag.description this.description = dag.description

11
dolphinscheduler-ui/src/js/conf/home/store/dag/mutations.js

@ -162,5 +162,16 @@ export default {
} else { } else {
state.cacheTasks[payload.id] = payload 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
} }
} }

Loading…
Cancel
Save