Skip to content

Commit

Permalink
fix: 独立子流程任务状态降级 && master功能迁移 --ignore (TencentBlueKing#7381)
Browse files Browse the repository at this point in the history
* fix: 独立子流程任务状态降级 --ignore

* fix: 子任务节点重试点击报错问题修复 --ignore

* fix: 子流程节点中存在第三方插件节点勾选的变量,查找对应变量配置时接口报错修复 --ignore

* fix: 第三方插件执行详情输出展示问题修复 --bug=116432067
# Reviewed, transaction id: 3658
  • Loading branch information
ywywZhou authored Mar 11, 2024
1 parent c8333da commit 5eab49d
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 39 deletions.
10 changes: 10 additions & 0 deletions frontend/desktop/src/assets/html/index-dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
var BK_DOC_URL = ''
var FEEDBACK_URL = ''
var USERNAME = 'admin';
var TAM_PROJECT_ID = ""
// 用户身份: 管理员
var IS_SUPERUSER = 1;
// 用户身份: 职能化
Expand All @@ -38,18 +39,27 @@
var APP_CODE = 'bk_sops';
var FILE_UPLOAD_ENTRY = '/package/upload/';
var MAX_NODE_EXECUTE_TIMEOUT = 6000;
var PAAS_MAJOR_VERSION = 2
var MEMBER_SELECTOR_DATA_HOST = ''
var BK_DOMAIN = ''
var BK_PAAS_ESB_HOST = ''
var TASK_LIST_STATUS_FILTER_DAYS = 180
// 是否开启通知中心
var ENABLE_NOTICE_CENTER = true
// 任务状态版本
var TASK_STATUS_DISPLAY_VERSION ='v1'
function getCookie(name) {
var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
return (arr = document.cookie.match(reg)) ? unescape(arr[2]) : null;
}
</script>
<script src="https://cdn-go.cn/aegis/aegis-sdk/latest/aegis.min.js?_bid=3977"></script>
<script src="http://dev.{BK_PAAS_HOST}:8000/jsi18n/gcloud" type="text/javascript"></script>
<script src="http://dev.{BK_PAAS_HOST}:8000/static/core/js/paas_api.js" type="text/javascript"></script>
</head>
<body>
<div id="root"></div>
<script src="https://push.o.tencent.com/push.js"></script>
</body>

</html>
2 changes: 2 additions & 0 deletions frontend/desktop/src/assets/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
// 是否开启通知中心
var ENABLE_NOTICE_CENTER = {{ENABLE_NOTICE_CENTER}}
var MESSAGE_HELPER_URL = '{{MESSAGE_HELPER_URL}}'
// 任务状态版本
var TASK_STATUS_DISPLAY_VERSION ='{{TASK_STATUS_DISPLAY_VERSION}}'
function getCookie(name) {
var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
return (arr = document.cookie.match(reg)) ? unescape(arr[2]) : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,21 @@
{{ $t('跳过子流程') }}
</span>
</template>
<span v-if="isShowPauseBtn" @click.stop="onSubflowPauseResumeClick('pause')">
<i class="common-icon-dark-circle-pause"></i>
{{ $t('暂停执行') }}
</span>
<span v-if="isShowContinueBtn" @click.stop="onSubflowPauseResumeClick('resume')">
<i class="bk-icon icon-play-circle-shape"></i>
{{ $t('继续执行') }}
</span>
<span v-if="isShowForceFailBtn" @click.stop="$emit('onForceFail', node.id)">
<i class="common-icon-dark-force-fail"></i>
{{ $t('强制终止') }}
</span>
<!--如果状态状态版本为v1,独立子流程节点禁止操作-->
<template v-if="taskStatusDisplayVersion !== 'v1' || !isSubProcessNode">
<span v-if="isShowPauseBtn" @click.stop="onSubflowPauseResumeClick('pause')">
<i class="common-icon-dark-circle-pause"></i>
{{ $t('暂停执行') }}
</span>
<span v-if="isShowContinueBtn" @click.stop="onSubflowPauseResumeClick('resume')">
<i class="bk-icon icon-play-circle-shape"></i>
{{ $t('继续执行') }}
</span>
<span v-if="isShowForceFailBtn" @click.stop="$emit('onForceFail', node.id)">
<i class="common-icon-dark-force-fail"></i>
{{ $t('强制终止') }}
</span>
</template>
</template>
</div>
</div>
Expand All @@ -113,6 +116,11 @@
}
}
},
data () {
return {
taskStatusDisplayVersion: window.TASK_STATUS_DISPLAY_VERSION
}
},
computed: {
isOpenTooltip () {
if (this.node.mode === 'execute') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
const { auto_retry_info: autoRetryInfo = {} } = this.node
return {
h: !!Object.keys(autoRetryInfo).length,
m: autoRetryInfo.m || 0,
m: autoRetryInfo.auto_retry_times || 0,
c: autoRetryInfo.max_auto_retry_times || 10
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@click="onContinueClick">
{{ $t('继续执行') }}
</bk-button>
<template v-if="executingStates.includes(realTimeState.state)">
<template v-if="isShowExecStateRelatedBtn">
<bk-button
v-if="realTimeState.state !== 'PENDING_PROCESSING' && (isLegacySubProcess || isSubProcessNode)"
theme="primary"
Expand Down Expand Up @@ -110,6 +110,7 @@
},
data () {
return {
taskStatusDisplayVersion: window.TASK_STATUS_DISPLAY_VERSION,
executingStates: ['RUNNING', 'PENDING_PROCESSING', 'PENDING_APPROVAL', 'PENDING_CONFIRMATION']
}
},
Expand Down Expand Up @@ -181,6 +182,10 @@
return isShow
},
isShowContinueBtn () {
// 如果状态状态版本为v1,独立子流程节点禁止操作
if (this.taskStatusDisplayVersion === 'v1' && this.isSubProcessNode) {
return false
}
if (this.isLegacySubProcess) {
return [this.realTimeState.state, this.executeInfo.state].includes('SUSPENDED')
} else if (this.isSubProcessNode) {
Expand All @@ -190,6 +195,13 @@
}
return false
},
isShowExecStateRelatedBtn () {
// 如果状态状态版本为v1,独立子流程节点禁止操作
if (this.taskStatusDisplayVersion === 'v1' && this.isSubProcessNode) {
return false
}
return this.executingStates.includes(this.realTimeState.state)
},
location () {
const { node_id, subprocess_stack = [] } = this.nodeDetailConfig
return this.pipelineData.location.find(item => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
ext-cls="execute-info-tab"
@tab-change="onTabChange">
<bk-tab-panel name="record" v-if="!isCondition" :label="$t('执行详情')"></bk-tab-panel>
<bk-tab-panel name="config" v-if="isCondition || (!loading && ['ServiceActivity', 'SubProcess'].includes(nodeDetailConfig.type))" :label="$t('配置快照')"></bk-tab-panel>
<bk-tab-panel name="config" v-if="isCondition || ['ServiceActivity', 'SubProcess'].includes(nodeDetailConfig.type)" :label="$t('配置快照')"></bk-tab-panel>
<bk-tab-panel name="history" v-if="!isCondition" :label="$t('操作历史')"></bk-tab-panel>
<bk-tab-panel name="log" v-if="!isCondition" :label="$t('调用日志')"></bk-tab-panel>
</bk-tab>
Expand Down Expand Up @@ -340,23 +340,27 @@
})
} else {
if (this.isThirdPartyNode) {
const excludeList = []
outputsInfo = outputs.filter(item => {
if (!item.preset) {
excludeList.push(item)
}
return item.preset
})
excludeList.forEach(item => {
const output = this.pluginOutputs.find(output => output.key === item.key)
if (output) {
const { name, key } = output
const info = {
key,
name,
value: item.value
outputs.forEach(param => {
// 判断preset是否为true
if (param.preset) {
outputsInfo.push(param)
} else {
// 判断key是否与插件配置项对应
const output = this.pluginOutputs.find(output => output.key === param.key)
if (output) {
outputsInfo.push(param)
} else {
// 判断key是否变量
const varKey = `\${${param.key}}`
const varInfo = this.constants[varKey]
let isHooked = false
if (varInfo && varInfo.source_type === 'component_outputs') {
isHooked = this.nodeActivity.id in varInfo.source_info
}
if (isHooked) {
outputsInfo.push(param)
}
}
outputsInfo.push(info)
}
})
} else if (this.isLegacySubProcess) {
Expand Down Expand Up @@ -518,14 +522,39 @@
* 优先取 store 里的缓存
*/
async getAtomConfig (config) {
const { plugin, version, classify, name } = config
const { plugin, version, classify, name, isThird } = config
try {
// 先取标准节点缓存的数据
const pluginGroup = this.atomFormConfig[plugin]
if (pluginGroup && pluginGroup[version]) {
return pluginGroup[version]
}
await this.loadAtomConfig({ atom: plugin, version, classify, name, project_id: this.project_id })
// 第三方插件
if (isThird) {
const resp = await this.loadPluginServiceDetail({
plugin_code: plugin,
plugin_version: version,
with_app_detail: true
})
if (!resp.result) return
// 获取参数
const { forms, inputs } = resp.data
if (forms.renderform) {
// 获取host
const { origin } = window.location
const hostUrl = `${origin + window.SITE_URL}plugin_service/data_api/${plugin}/`
$.context.bk_plugin_api_host[plugin] = hostUrl
// 输入参数
$.atoms[plugin] = {}
const renderFrom = forms.renderform
/* eslint-disable-next-line */
eval(renderFrom)
} else {
$.atoms[plugin] = inputs
}
} else {
await this.loadAtomConfig({ atom: plugin, version, classify, name, project_id: this.project_id })
}
const config = $.atoms[plugin]
return config
} catch (e) {
Expand Down
11 changes: 5 additions & 6 deletions frontend/desktop/src/pages/task/TaskExecute/TaskOperation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1155,14 +1155,13 @@
componentData
}
},
async onRetryClick (id, info) {
async onRetryClick (id, info = {}) {
try {
const { taskId } = info || {}
this.subProcessTaskId = taskId
this.subProcessTaskId = info.taskId
// 独立子任务重试使用二次确认弹框
if (this.isChildTaskFlow || (info && info.isSubNode)) {
if (this.isChildTaskFlow || info.isSubNode) {
const nodeConfig = this.nodeTreePipelineData.activities[id]
const name = info ? info.name : nodeConfig.name
const name = info.name || nodeConfig.name
const title = info.isSubProcessNode
? this.$t('确定重试子流程【n】 ?', { n: name })
: this.$t('确定重试节点【n】 ?', { n: name })
Expand Down Expand Up @@ -1194,7 +1193,7 @@
})
return
}
const resp = await this.getInstanceRetryParams({ id: taskId || this.instance_id })
const resp = await this.getInstanceRetryParams({ id: info.taskId || this.instance_id })
if (resp.data.enable) {
this.openNodeInfoPanel('retryNode', i18n.t('重试节点'))
this.setNodeDetailConfig(id)
Expand Down

0 comments on commit 5eab49d

Please sign in to comment.