1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
init (args) { if (this.tasks.length) { Dag.backfill(args) if (this.type === 'instance') { this._getTaskState(false).then(res => {}) this.setIntervalP = setInterval(() => { this._getTaskState(true).then(res => {}) }, 90000) } } else { Dag.create() } }, _getTaskState (isReset) { return new Promise((resolve, reject) => { this.getTaskState(this.urlParam.id).then(res => { let data = res.list let state = res.processInstanceState let taskList = res.taskList let idArr = allNodesId() const titleTpl = (item, desc) => { let $item = _.filter(taskList, v => v.name === item.name)[0] return `<div style="text-align: left">${i18n.$t('Name')}:${$item.name}</br>${i18n.$t('State')}:${desc}</br>${i18n.$t('type')}:${$item.taskType}</br>${i18n.$t('host')}:${$item.host || '-'}</br>${i18n.$t('Retry Count')}:${$item.retryTimes}</br>${i18n.$t('Submit Time')}:${formatDate($item.submitTime)}</br>${i18n.$t('Start Time')}:${formatDate($item.startTime)}</br>${i18n.$t('End Time')}:${$item.endTime ? formatDate($item.endTime) : '-'}</br></div>` }
$('.w').find('.state-p').html('') const newTask = [] data.forEach(v1 => { idArr.forEach(v2 => { if (v2.name === v1.name) { let dom = $(`#${v2.id}`) let state = dom.find('.state-p') let depState = '' 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) dom.attr('data-dependent-result', v1.dependentResult || '') dom.attr('data-dependent-depState', depState) state.append(`<strong class="${v1.icoUnicode} ${v1.isSpin ? 'as as-spin' : ''}" style="color:${v1.color}" data-toggle="tooltip" data-html="true" data-container="body"></strong>`) state.find('strong').attr('title', titleTpl(v2, v1.desc)) } }) }) if (state === 'PAUSE' || state === 'STOP' || state === 'FAILURE' || this.state === 'SUCCESS') { if (isReset) { findComponentDownward(this.$root, `${this.type}-details`)._reset() } } if (!isReset) { this.resetLocalParam(newTask) } resolve() }) }) }
|