Skip to content

Commit e2d516f

Browse files
authored
Optimize DAG page opening speed (#6830)
1 parent 5453f1e commit e2d516f

6 files changed

Lines changed: 40 additions & 32 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -659,10 +659,10 @@
659659
const processDefinitionId =
660660
this.backfillItem.params.processDefinitionId
661661
const process = this.processListS.find(
662-
(process) => process.processDefinition.id === processDefinitionId
662+
(def) => def.id === processDefinitionId
663663
)
664664
this.$emit('onSubProcess', {
665-
subProcessCode: process.processDefinition.code,
665+
subProcessCode: process.code,
666666
fromThis: this
667667
})
668668
}
@@ -949,7 +949,7 @@
949949
* Child workflow entry show/hide
950950
*/
951951
_isGoSubProcess () {
952-
return this.nodeData.taskType === 'SUB_PROCESS' && this.name
952+
return this.nodeData.taskType === 'SUB_PROCESS' && this.name && this.processListS && this.processListS.length > 0
953953
},
954954
taskInstance () {
955955
if (this.taskInstances.length > 0) {

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

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import i18n from '@/module/i18n'
4343
import disabledState from '@/module/mixin/disabledState'
4444
import mListBox from './_source/listBox'
45+
import { mapActions, mapState } from 'vuex'
4546
4647
export default {
4748
name: 'sub_process',
@@ -57,7 +58,11 @@
5758
props: {
5859
backfillItem: Object
5960
},
61+
computed: {
62+
...mapState('dag', ['processListS'])
63+
},
6064
methods: {
65+
...mapActions('dag', ['getProcessList']),
6166
/**
6267
* Node unified authentication parameters
6368
*/
@@ -82,6 +87,15 @@
8287
*/
8388
_handleName (id) {
8489
return _.filter(this.processDefinitionList, v => id === v.id)[0].name
90+
},
91+
/**
92+
* Get all processDefinition list
93+
*/
94+
getAllProcessDefinitions () {
95+
if (!this.processListS || this.processListS.length === 0) {
96+
return this.getProcessList()
97+
}
98+
return Promise.resolve(this.processListS)
8599
}
86100
},
87101
watch: {
@@ -92,32 +106,32 @@
92106
}
93107
},
94108
created () {
95-
let processListS = _.cloneDeep(this.store.state.dag.processListS)
96109
let code = null
97110
if (this.router.history.current.name === 'projects-instance-details') {
98111
code = this.router.history.current.query.code || null
99112
} else {
100113
code = this.router.history.current.params.code || null
101114
}
102-
this.processDefinitionList = processListS.map(v => {
103-
return {
104-
id: v.processDefinition.id,
105-
code: v.processDefinition.code,
106-
name: v.processDefinition.name,
107-
disabled: false
115+
this.getAllProcessDefinitions().then((processListS) => {
116+
this.processDefinitionList = processListS.map(def => {
117+
return {
118+
id: def.id,
119+
code: def.code,
120+
name: def.name,
121+
disabled: false
122+
}
123+
}).filter(a => (a.code + '') !== code)
124+
let o = this.backfillItem
125+
// Non-null objects represent backfill
126+
if (!_.isEmpty(o)) {
127+
this.wdiCurr = o.params.processDefinitionId
128+
} else {
129+
if (this.processDefinitionList.length) {
130+
this.wdiCurr = this.processDefinitionList[0].id
131+
this.$emit('on-set-process-name', this._handleName(this.wdiCurr))
132+
}
108133
}
109-
}).filter(a => (a.code + '') !== code)
110-
111-
let o = this.backfillItem
112-
// Non-null objects represent backfill
113-
if (!_.isEmpty(o)) {
114-
this.wdiCurr = o.params.processDefinitionId
115-
} else {
116-
if (this.processDefinitionList.length) {
117-
this.wdiCurr = this.processDefinitionList[0].id
118-
this.$emit('on-set-process-name', this._handleName(this.wdiCurr))
119-
}
120-
}
134+
})
121135
},
122136
mounted () {
123137
},

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
props: {},
4747
methods: {
4848
...mapMutations('dag', ['resetParams', 'setIsDetails']),
49-
...mapActions('dag', ['getProcessList', 'getProjectList', 'getResourcesList', 'getProcessDetails', 'getResourcesListJar']),
49+
...mapActions('dag', ['getProjectList', 'getResourcesList', 'getProcessDetails', 'getResourcesListJar']),
5050
...mapActions('security', ['getTenantList', 'getWorkerGroupsAll', 'getAlarmGroupsAll']),
5151
/**
5252
* init
@@ -59,8 +59,6 @@
5959
Promise.all([
6060
// Node details
6161
this.getProcessDetails(this.$route.params.code),
62-
// get process definition
63-
this.getProcessList(),
6462
// get project
6563
this.getProjectList(),
6664
// get resource

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
props: {},
4141
methods: {
4242
...mapMutations('dag', ['resetParams']),
43-
...mapActions('dag', ['getProcessList', 'getProjectList', 'getResourcesList', 'getResourcesListJar', 'getResourcesListJar']),
43+
...mapActions('dag', ['getProjectList', 'getResourcesList', 'getResourcesListJar', 'getResourcesListJar']),
4444
...mapActions('security', ['getTenantList', 'getWorkerGroupsAll', 'getAlarmGroupsAll']),
4545
/**
4646
* init
@@ -51,8 +51,6 @@
5151
this.resetParams()
5252
// Promise Get node needs data
5353
Promise.all([
54-
// get process definition
55-
this.getProcessList(),
5654
// get project
5755
this.getProjectList(),
5856
// get jar

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
props: {},
4444
methods: {
4545
...mapMutations('dag', ['setIsDetails', 'resetParams']),
46-
...mapActions('dag', ['getProcessList', 'getProjectList', 'getResourcesList', 'getInstancedetail', 'getResourcesListJar']),
46+
...mapActions('dag', ['getProjectList', 'getResourcesList', 'getInstancedetail', 'getResourcesListJar']),
4747
...mapActions('security', ['getTenantList', 'getWorkerGroupsAll', 'getAlarmGroupsAll']),
4848
/**
4949
* init
@@ -56,8 +56,6 @@
5656
Promise.all([
5757
// Process instance details
5858
this.getInstancedetail(this.$route.params.id),
59-
// get process definition
60-
this.getProcessList(),
6159
// get project
6260
this.getProjectList(),
6361
// get resources

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ export default {
352352
resolve()
353353
return
354354
}
355-
io.get(`projects/${state.projectCode}/process-definition/list`, payload, res => {
355+
io.get(`projects/${state.projectCode}/process-definition/simple-list`, payload, res => {
356356
state.processListS = res.data
357357
resolve(res.data)
358358
}).catch(res => {

0 commit comments

Comments
 (0)