Browse Source

convert process definition id to code (#6191)

2.0.7-release
Wangyizhi1 3 years ago committed by GitHub
parent
commit
b79630488d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue
  2. 8
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.vue
  3. 20
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/dependItemList.vue
  4. 6
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/nodeStatus.vue
  5. 60
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue
  6. 14
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/relatedItems.vue
  7. 14
      dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js

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

@ -31,6 +31,7 @@
@addTaskInfo="addTaskInfo" @addTaskInfo="addTaskInfo"
@close="closeTaskDrawer" @close="closeTaskDrawer"
@onSubProcess="toSubProcess" @onSubProcess="toSubProcess"
:type="type"
></m-form-model> ></m-form-model>
</el-drawer> </el-drawer>
<el-dialog <el-dialog

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

@ -21,7 +21,7 @@
<span class="go-subtask"> <span class="go-subtask">
<!-- Component can't pop up box to do component processing --> <!-- Component can't pop up box to do component processing -->
<m-log <m-log
v-if="taskInstance" v-if="type === 'instance' && taskInstance"
:item="backfillItem" :item="backfillItem"
:task-instance-id="taskInstance.id" :task-instance-id="taskInstance.id"
> >
@ -525,7 +525,11 @@
directives: { clickoutside }, directives: { clickoutside },
mixins: [disabledState], mixins: [disabledState],
props: { props: {
nodeData: Object nodeData: Object,
type: {
type: String,
default: ''
}
}, },
inject: ['dagChart'], inject: ['dagChart'],
methods: { methods: {

20
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/dependItemList.vue

@ -85,7 +85,7 @@
// add task list // add task list
let projectId = this.projectList[0].value let projectId = this.projectList[0].value
this._getProcessByProjectId(projectId).then(definitionList => { this._getProcessByProjectCode().then(definitionList => {
// dependItemList index // dependItemList index
let is = (value) => _.some(this.dependItemList, { definitionCode: value }) let is = (value) => _.some(this.dependItemList, { definitionCode: value })
let noArr = _.filter(definitionList, v => !is(v.value)) let noArr = _.filter(definitionList, v => !is(v.value))
@ -124,13 +124,13 @@
resolve() resolve()
}) })
}, },
_getProcessByProjectId (id) { _getProcessByProjectCode () {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.store.dispatch('dag/getProcessByProjectId', { projectId: id }).then(res => { this.store.dispatch('dag/getProcessByProjectCode').then(res => {
let definitionList = _.map(_.cloneDeep(res), v => { let definitionList = _.map(_.cloneDeep(res), v => {
return { return {
value: v.code, value: v.processDefinition.code,
label: v.name label: v.processDefinition.name
} }
}) })
resolve(definitionList) resolve(definitionList)
@ -143,11 +143,11 @@
_getDependItemList (codes, is = true) { _getDependItemList (codes, is = true) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (is) { if (is) {
this.store.dispatch('dag/getProcessTasksList', { processDefinitionCode: codes }).then(res => { this.store.dispatch('dag/getProcessTasksList', { code: codes }).then(res => {
resolve(['ALL'].concat(_.map(res, v => v.name))) resolve(['ALL'].concat(_.map(res, v => v.name)))
}) })
} else { } else {
this.store.dispatch('dag/getTaskListDefIdAll', { processDefinitionCodeList: codes }).then(res => { this.store.dispatch('dag/getTaskListDefIdAll', { codes: codes }).then(res => {
resolve(res) resolve(res)
}) })
} }
@ -157,7 +157,7 @@
* change process get dependItemList * change process get dependItemList
*/ */
_onChangeProjectId (value, itemIndex) { _onChangeProjectId (value, itemIndex) {
this._getProcessByProjectId(value).then(definitionList => { this._getProcessByProjectCode().then(definitionList => {
/* this.$set(this.dependItemList, itemIndex, this._dlOldParams(value, definitionList, item)) */ /* this.$set(this.dependItemList, itemIndex, this._dlOldParams(value, definitionList, item)) */
let definitionCode = definitionList[0].value let definitionCode = definitionList[0].value
this._getDependItemList(definitionCode).then(depTasksList => { this._getDependItemList(definitionCode).then(depTasksList => {
@ -245,7 +245,7 @@
if (!this.dependItemList.length) { if (!this.dependItemList.length) {
if (!this.projectList.length) return if (!this.projectList.length) return
let projectId = this.projectList[0].value let projectId = this.projectList[0].value
this._getProcessByProjectId(projectId).then(definitionList => { this._getProcessByProjectCode().then(definitionList => {
let value = definitionList[0].value let value = definitionList[0].value
this._getDependItemList(value).then(depTasksList => { this._getDependItemList(value).then(depTasksList => {
this.$emit('dependItemListEvent', _.concat(this.dependItemList, this._rtNewParams(value, definitionList, depTasksList, projectId))) this.$emit('dependItemListEvent', _.concat(this.dependItemList, this._rtNewParams(value, definitionList, depTasksList, projectId)))
@ -257,7 +257,7 @@
// get item list // get item list
this._getDependItemList(codes, false).then(res => { this._getDependItemList(codes, false).then(res => {
_.map(this.dependItemList, (v, i) => { _.map(this.dependItemList, (v, i) => {
this._getProcessByProjectId(v.projectId).then(definitionList => { this._getProcessByProjectCode().then(definitionList => {
this.$set(this.dependItemList, i, this._rtOldParams(v.definitionCode, definitionList, ['ALL'].concat(_.map(res[v.definitionCode] || [], v => v.name)), v)) this.$set(this.dependItemList, i, this._rtOldParams(v.definitionCode, definitionList, ['ALL'].concat(_.map(res[v.definitionCode] || [], v => v.name)), v))
}) })
}) })

6
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/nodeStatus.vue

@ -107,9 +107,9 @@
resolve() resolve()
}) })
}, },
_getProcessByProjectId (id) { _getProcessByProjectCode () {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.store.dispatch('dag/getProcessByProjectId', { projectId: id }).then(res => { this.store.dispatch('dag/getProcessByProjectCode').then(res => {
this.definitionList = _.map(_.cloneDeep(res), v => { this.definitionList = _.map(_.cloneDeep(res), v => {
return { return {
value: v.code, value: v.code,
@ -168,7 +168,7 @@
// get item list // get item list
this._getDependItemList(codes, false).then(res => { this._getDependItemList(codes, false).then(res => {
_.map(this.dependItemList, (v, i) => { _.map(this.dependItemList, (v, i) => {
this._getProcessByProjectId(v.projectId).then(definitionList => { this._getProcessByProjectCode().then(definitionList => {
this.$set(this.dependItemList, i, this._rtOldParams(v.definitionCode, ['ALL'].concat(_.map(res[v.definitionCode] || [], v => v.name)), v)) this.$set(this.dependItemList, i, this._rtOldParams(v.definitionCode, ['ALL'].concat(_.map(res[v.definitionCode] || [], v => v.name)), v))
}) })
}) })

60
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue

@ -115,12 +115,12 @@
:title="$t('Delete?')" :title="$t('Delete?')"
@onConfirm="_delete({},-1)" @onConfirm="_delete({},-1)"
> >
<el-button style="position: absolute; bottom: -48px; left: 19px;" type="primary" size="mini" :disabled="!strSelectIds" slot="reference">{{$t('Delete')}}</el-button> <el-button style="position: absolute; bottom: -48px; left: 19px;" type="primary" size="mini" :disabled="!strSelectCodes" slot="reference">{{$t('Delete')}}</el-button>
</el-popconfirm> </el-popconfirm>
</el-tooltip> </el-tooltip>
<el-button type="primary" size="mini" :disabled="!strSelectIds" style="position: absolute; bottom: -48px; left: 80px;" @click="_batchExport(item)" >{{$t('Export')}}</el-button> <el-button type="primary" size="mini" :disabled="!strSelectCodes" style="position: absolute; bottom: -48px; left: 80px;" @click="_batchExport(item)" >{{$t('Export')}}</el-button>
<span><el-button type="primary" size="mini" :disabled="!strSelectIds" style="position: absolute; bottom: -48px; left: 140px;" @click="_batchCopy(item)" >{{$t('Batch copy')}}</el-button></span> <span><el-button type="primary" size="mini" :disabled="!strSelectCodes" style="position: absolute; bottom: -48px; left: 140px;" @click="_batchCopy(item)" >{{$t('Batch copy')}}</el-button></span>
<el-button type="primary" size="mini" :disabled="!strSelectIds" style="position: absolute; bottom: -48px; left: 225px;" @click="_batchMove(item)" >{{$t('Batch move')}}</el-button> <el-button type="primary" size="mini" :disabled="!strSelectCodes" style="position: absolute; bottom: -48px; left: 225px;" @click="_batchMove(item)" >{{$t('Batch move')}}</el-button>
<el-drawer <el-drawer
:visible.sync="drawer" :visible.sync="drawer"
size="" size=""
@ -162,7 +162,7 @@
data () { data () {
return { return {
list: [], list: [],
strSelectIds: '', strSelectCodes: '',
checkAll: false, checkAll: false,
drawer: false, drawer: false,
versionData: { versionData: {
@ -243,7 +243,7 @@
* Timing manage * Timing manage
*/ */
_timingManage (item) { _timingManage (item) {
this.$router.push({ path: `/projects/${this.projectId}/definition/list/timing/${item.code}` }) this.$router.push({ path: `/projects/${this.projectCode}/definition/list/timing/${item.code}` })
}, },
/** /**
* delete * delete
@ -293,10 +293,10 @@
*/ */
_copyProcess (item) { _copyProcess (item) {
this.copyProcess({ this.copyProcess({
processDefinitionIds: item.id, codes: item.code,
targetProjectId: item.projectId targetProjectCode: item.projectCode
}).then(res => { }).then(res => {
this.strSelectIds = '' this.strSelectCodes = ''
this.$message.success(res.msg) this.$message.success(res.msg)
// $('body').find('.tooltip.fade.top.in').remove() // $('body').find('.tooltip.fade.top.in').remove()
this._onUpdate() this._onUpdate()
@ -310,10 +310,10 @@
*/ */
_moveProcess (item) { _moveProcess (item) {
this.moveProcess({ this.moveProcess({
processDefinitionIds: item.id, codes: item.code,
targetProjectId: item.projectId targetProjectCode: item.projectCode
}).then(res => { }).then(res => {
this.strSelectIds = '' this.strSelectCodes = ''
this.$message.success(res.msg) this.$message.success(res.msg)
$('body').find('.tooltip.fade.top.in').remove() $('body').find('.tooltip.fade.top.in').remove()
this._onUpdate() this._onUpdate()
@ -324,7 +324,7 @@
_export (item) { _export (item) {
this.exportDefinition({ this.exportDefinition({
processDefinitionIds: item.id, codes: item.code,
fileName: item.name fileName: item.name
}).catch(e => { }).catch(e => {
this.$message.error(e.msg || '') this.$message.error(e.msg || '')
@ -334,7 +334,7 @@
* switch version in process definition version list * switch version in process definition version list
* *
* @param version the version user want to change * @param version the version user want to change
* @param processDefinitionId the process definition id * @param processDefinitionCode the process definition code
* @param fromThis fromThis * @param fromThis fromThis
*/ */
mVersionSwitchProcessDefinitionVersion ({ version, processDefinitionCode, fromThis }) { mVersionSwitchProcessDefinitionVersion ({ version, processDefinitionCode, fromThis }) {
@ -353,7 +353,7 @@
* *
* @param pageNo page number * @param pageNo page number
* @param pageSize page size * @param pageSize page size
* @param processDefinitionId the process definition id of page version * @param processDefinitionCode the process definition Code of page version
* @param fromThis fromThis * @param fromThis fromThis
*/ */
mVersionGetProcessDefinitionVersionsPage ({ pageNo, pageSize, processDefinitionCode, fromThis }) { mVersionGetProcessDefinitionVersionsPage ({ pageNo, pageSize, processDefinitionCode, fromThis }) {
@ -374,7 +374,7 @@
* delete one version of process definition * delete one version of process definition
* *
* @param version the version need to delete * @param version the version need to delete
* @param processDefinitionId the process definition id user want to delete * @param processDefinitionCode the process definition code user want to delete
* @param fromThis fromThis * @param fromThis fromThis
*/ */
mVersionDeleteProcessDefinitionVersion ({ version, processDefinitionCode, fromThis }) { mVersionDeleteProcessDefinitionVersion ({ version, processDefinitionCode, fromThis }) {
@ -421,14 +421,14 @@
_batchExport () { _batchExport () {
this.exportDefinition({ this.exportDefinition({
processDefinitionIds: this.strSelectIds, codes: this.strSelectCodes,
fileName: 'process_' + new Date().getTime() fileName: 'process_' + new Date().getTime()
}).then(res => { }).then(res => {
this._onUpdate() this._onUpdate()
this.checkAll = false this.checkAll = false
this.strSelectIds = '' this.strSelectCodes = ''
}).catch(e => { }).catch(e => {
this.strSelectIds = '' this.strSelectCodes = ''
this.checkAll = false this.checkAll = false
this.$message.error(e.msg) this.$message.error(e.msg)
}) })
@ -440,8 +440,8 @@
this.relatedItemsDialog = true this.relatedItemsDialog = true
this.tmp = false this.tmp = false
}, },
onBatchCopy (item) { onBatchCopy (projectCode) {
this._copyProcess({ id: this.strSelectIds, projectId: item }) this._copyProcess({ code: this.strSelectCodes, projectCode: projectCode })
this.relatedItemsDialog = false this.relatedItemsDialog = false
}, },
closeRelatedItems () { closeRelatedItems () {
@ -454,8 +454,8 @@
this.tmp = true this.tmp = true
this.relatedItemsDialog = true this.relatedItemsDialog = true
}, },
onBatchMove (item) { onBatchMove (projectCode) {
this._moveProcess({ id: this.strSelectIds, projectId: item }) this._moveProcess({ code: this.strSelectCodes, projectCode: projectCode })
this.relatedItemsDialog = false this.relatedItemsDialog = false
}, },
/** /**
@ -478,22 +478,22 @@
*/ */
_arrDelChange (v) { _arrDelChange (v) {
let arr = [] let arr = []
arr = _.map(v, 'id') arr = _.map(v, 'code')
this.strSelectIds = _.join(arr, ',') this.strSelectCodes = _.join(arr, ',')
}, },
/** /**
* batch delete * batch delete
*/ */
_batchDelete () { _batchDelete () {
this.batchDeleteDefinition({ this.batchDeleteDefinition({
processDefinitionIds: this.strSelectIds codes: this.strSelectCodes
}).then(res => { }).then(res => {
this._onUpdate() this._onUpdate()
this.checkAll = false this.checkAll = false
this.strSelectIds = '' this.strSelectCodes = ''
this.$message.success(res.msg) this.$message.success(res.msg)
}).catch(e => { }).catch(e => {
this.strSelectIds = '' this.strSelectCodes = ''
this.checkAll = false this.checkAll = false
this.$message.error(e.msg || '') this.$message.error(e.msg || '')
}) })
@ -512,7 +512,7 @@
deep: true deep: true
}, },
pageNo () { pageNo () {
this.strSelectIds = '' this.strSelectCodes = ''
} }
}, },
created () { created () {
@ -520,7 +520,7 @@
mounted () { mounted () {
}, },
computed: { computed: {
...mapState('dag', ['projectId', 'projectCode']) ...mapState('dag', ['projectCode'])
}, },
components: { mVersions, mStart, mTiming, mRelatedItems } components: { mVersions, mStart, mTiming, mRelatedItems }
} }

14
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/relatedItems.vue

@ -26,11 +26,11 @@
<m-list-box-f> <m-list-box-f>
<template slot="name"><strong>*</strong>{{$t('Project Name')}}</template> <template slot="name"><strong>*</strong>{{$t('Project Name')}}</template>
<template slot="content"> <template slot="content">
<el-select v-model="itemId" size="small"> <el-select v-model="selected" size="small">
<el-option <el-option
v-for="item in itemList" v-for="item in itemList"
:key="item.id" :key="item.code"
:value="item.id" :value="item.code"
:label="item.name"> :label="item.name">
</el-option> </el-option>
</el-select> </el-select>
@ -52,7 +52,7 @@
return { return {
store, store,
itemList: [], itemList: [],
itemId: '' selected: ''
} }
}, },
props: { props: {
@ -65,14 +65,14 @@
_ok () { _ok () {
if (this._verification()) { if (this._verification()) {
if (this.tmp) { if (this.tmp) {
this.$emit('onBatchMove', this.itemId) this.$emit('onBatchMove', this.selected)
} else { } else {
this.$emit('onBatchCopy', this.itemId) this.$emit('onBatchCopy', this.selected)
} }
} }
}, },
_verification () { _verification () {
if (!this.itemId) { if (!this.selected) {
this.$message.warning(`${i18n.$t('Project name is required')}`) this.$message.warning(`${i18n.$t('Project name is required')}`)
return false return false
} }

14
dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js

@ -176,8 +176,8 @@ export default {
copyProcess ({ state }, payload) { copyProcess ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.post(`projects/${state.projectCode}/process-definition/batch-copy`, { io.post(`projects/${state.projectCode}/process-definition/batch-copy`, {
processDefinitionIds: payload.processDefinitionIds, codes: payload.codes,
targetProjectId: payload.targetProjectId targetProjectCode: payload.targetProjectCode
}, res => { }, res => {
resolve(res) resolve(res)
}).catch(e => { }).catch(e => {
@ -192,8 +192,8 @@ export default {
moveProcess ({ state }, payload) { moveProcess ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.post(`projects/${state.projectCode}/process-definition/batch-move`, { io.post(`projects/${state.projectCode}/process-definition/batch-move`, {
processDefinitionIds: payload.processDefinitionIds, codes: payload.codes,
targetProjectId: payload.targetProjectId targetProjectCode: payload.targetProjectCode
}, res => { }, res => {
resolve(res) resolve(res)
}).catch(e => { }).catch(e => {
@ -386,7 +386,7 @@ export default {
/** /**
* Get a list of process definitions by project id * Get a list of process definitions by project id
*/ */
getProcessByProjectId ({ state }, payload) { getProcessByProjectCode ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.get(`projects/${state.projectCode}/process-definition/all`, payload, res => { io.get(`projects/${state.projectCode}/process-definition/all`, payload, res => {
resolve(res.data) resolve(res.data)
@ -674,7 +674,7 @@ export default {
} }
} }
io.post(`projects/${state.projectCode}/process-definition/batch-export`, { processDefinitionIds: payload.processDefinitionIds }, res => { io.post(`projects/${state.projectCode}/process-definition/batch-export`, { codes: payload.codes }, res => {
downloadBlob(res, payload.fileName) downloadBlob(res, payload.fileName)
}, e => { }, e => {
@ -793,7 +793,7 @@ export default {
}, },
getTaskListDefIdAll ({ state }, payload) { getTaskListDefIdAll ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.get(`projects/${state.projectCode}/process-definition/tatch-query-tasks`, payload, res => { io.get(`projects/${state.projectCode}/process-definition/batch-query-tasks`, payload, res => {
resolve(res.data) resolve(res.data)
}).catch(e => { }).catch(e => {
reject(e) reject(e)

Loading…
Cancel
Save