Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

子流程交互优化 #7182

Merged
merged 2 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
const divInputDom = this.$el.querySelector('.div-input')
if (divInputDom) {
divInputDom.innerText = this.value
this.handleInputBlur()
this.updateInputHtml()
}
})
}
Expand All @@ -182,15 +182,15 @@
const divInputDom = this.$el.querySelector('.div-input')
divInputDom.innerText = this.value
} else {
this.handleInputBlur()
this.updateInputHtml()
}
},
formMode (val) {
if (val) {
this.$nextTick(() => {
const divInputDom = this.$el.querySelector('.div-input')
divInputDom.innerText = this.value
this.handleInputBlur()
this.updateInputHtml()
})
} else {
this.validate()
Expand All @@ -205,7 +205,7 @@
if (divInputDom) {
divInputDom.innerText = this.value
if (this.render && this.value) {
this.handleInputBlur()
this.updateInputHtml()
}
divInputDom.addEventListener('paste', this.handlePaste)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
const divInputDom = this.$el.querySelector('.div-input')
if (divInputDom) {
divInputDom.innerText = this.value
this.handleInputBlur()
this.updateInputHtml()
}
})
}
Expand All @@ -149,7 +149,7 @@
const divInputDom = this.$el.querySelector('.div-input')
divInputDom.innerText = this.value
} else {
this.handleInputBlur()
this.updateInputHtml()
}
}
},
Expand All @@ -162,7 +162,7 @@
const value = typeof this.value === 'string' ? this.value : JSON.stringify(this.value)
divInputDom.innerText = value
if (this.render && value) {
this.handleInputBlur()
this.updateInputHtml()
}
divInputDom.addEventListener('paste', this.handlePaste)
}
Expand Down
49 changes: 32 additions & 17 deletions frontend/desktop/src/pages/task/TaskExecute/ExecuteInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
</div>
</div>
</div>
<div class="action-wrapper" v-if="isShowActionWrap">
<div class="action-wrapper" v-if="isShowActionWrap && !loading">
<template v-if="executeInfo.state === 'RUNNING' && !isSubProcessNode">
<bk-button
v-if="nodeDetailConfig.component_code === 'pause_node'"
Expand Down Expand Up @@ -227,7 +227,7 @@
<script>
import i18n from '@/config/i18n/index.js'
import TemplateCanvas from '@/components/common/TemplateCanvas/index.vue'
import { mapState, mapMutations, mapActions } from 'vuex'
import { mapState, mapActions } from 'vuex'
import axios from 'axios'
import tools from '@/utils/tools.js'
import atomFilter from '@/utils/atomFilter.js'
Expand Down Expand Up @@ -332,8 +332,6 @@
loop: 1,
theExecuteTime: undefined,
isReadyStatus: true,
isShowSkipBtn: false,
isShowRetryBtn: false,
curActiveTab: 'record',
theExecuteRecord: 0,
executeRecord: {},
Expand All @@ -350,9 +348,6 @@
}
},
computed: {
...mapMutations('template/', [
'setLine'
]),
...mapState({
'atomFormConfig': state => state.atomForm.config,
'atomOutputConfig': state => state.atomForm.outputConfig,
Expand Down Expand Up @@ -441,6 +436,22 @@
isShowContinueBtn () {
return this.isLegacySubProcess && this.executeInfo.state === 'SUSPENDED'
},
isShowSkipBtn () {
let isShow = false
if (this.realTimeState.state === 'FAILED') {
const activity = this.pipelineData.activities[this.nodeDetailConfig.node_id]
isShow = this.location.type === 'tasknode' && activity.skippable
}
return isShow
},
isShowRetryBtn () {
let isShow = false
if (this.realTimeState.state === 'FAILED') {
const activity = this.pipelineData.activities[this.nodeDetailConfig.node_id]
isShow = this.location.type === 'tasknode' ? activity.retryable : false
}
return isShow
},
isShowActionWrap () {
// 任务终止时禁止节点操作
if (this.state === 'REVOKED') return false
Expand Down Expand Up @@ -508,7 +519,10 @@
this.loading = false
this.subprocessLoading = false
this.randomKey = new Date().getTime()
const nodeInfo = this.getNodeInfo(this.nodeData, val.root_node, val.node_id)
nodeInfo.dynamicLoad = false
} else {
this.executeInfo.state = ''
this.loadNodeInfo()
}
}
Expand Down Expand Up @@ -625,15 +639,6 @@
const pluginInfo = this.atomFormInfo[componentCode][version]
this.executeInfo.plugin_name = `${pluginInfo.group_name}-${pluginInfo.name}`
}
// 获取执行失败节点是否允许跳过,重试状态
if (this.realTimeState.state === 'FAILED') {
const activity = this.pipelineData.activities[this.nodeDetailConfig.node_id]
this.isShowSkipBtn = this.location.type === 'tasknode' && activity.skippable
this.isShowRetryBtn = this.location.type === 'tasknode' ? activity.retryable : false
} else {
this.isShowSkipBtn = false
this.isShowRetryBtn = false
}
} catch (e) {
this.theExecuteTime = undefined
this.executeInfo = {}
Expand Down Expand Up @@ -970,7 +975,14 @@
this.randomKey = new Date().getTime()
},
onNodeClick (node) {
const nodeInfo = this.getNodeInfo(this.nodeData, '', node)
let parentId = ''
const { node_id: nodeId, root_node: rootNode } = this.nodeDetailConfig
if (nodeId === this.subProcessPipeline.id) {
parentId = rootNode ? `${rootNode}-${nodeId}` : nodeId
} else {
parentId = rootNode
}
const nodeInfo = this.getNodeInfo(this.nodeData, parentId, node)
if (nodeInfo) {
nodeInfo && this.onSelectNode(nodeInfo)
const parentInstance = this.$parent.$parent
Expand Down Expand Up @@ -1500,6 +1512,9 @@
}
.bk-resize-layout-border {
border: none;
.bk-resize-layout-aside {
overflow: hidden;
}
}
.action-wrapper {
width: 100%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
if (state === 'CREATED') return this.$t('未执行')
// 如果整体任务执行完毕但有的节点没执行的话不展示描述
if (['FAILED', 'FINISHED'].includes(state) && state === 'READY') return this.$t('未执行')
return skip || error_ignored ? this.$t.t('失败后跳过') : state && TASK_STATE_DICT[state]
return skip || error_ignored ? this.$t('失败后跳过') : state && TASK_STATE_DICT[state]
}
},
mounted () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
{{ confirmBtnText }}
</bk-button>
</span>
<bk-button theme="default" data-test-id="taskExecute_form_cancelBtn" @click="onCancelRetry">{{ $t('取消') }}</bk-button>
<bk-button theme="default" :disabled="pending" data-test-id="taskExecute_form_cancelBtn" @click="onCancelRetry">{{ $t('取消') }}</bk-button>
</div>

<bk-button v-else theme="default" data-test-id="taskExecute_form_closeBtn" @click="onCancelRetry">{{ $t('关闭') }}</bk-button>
Expand Down
15 changes: 14 additions & 1 deletion frontend/desktop/src/pages/task/TaskExecute/NodeTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,20 @@
nodeId = val.split('-').slice(0, -1).join('-')
this.activeId = nodeId
}
this.setDefaultActiveId(this.treeData, nodeId)
// 根据父节点过滤节点树
let nodes = this.treeData
const parentId = val.split('-').slice(1)
if (parentId.length) {
parentId.forEach(id => {
nodes.some(item => {
if (item.id === id) {
nodes = item.children
return true
}
})
})
}
this.setDefaultActiveId(nodes, nodeId)
},
deep: true,
immediate: true
Expand Down
12 changes: 8 additions & 4 deletions frontend/desktop/src/pages/task/TaskExecute/NodeTreeItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
<span v-else-if="!node.conditionType" class="default-node" :class="nodeStateMap[node.state]"></span>
</div>
<!-- 节点名称 -->
<span v-bk-overflow-tips class="node-name">
<span>{{ node.title }}</span>
<span class="node-name">
<span class="name" v-bk-overflow-tips>{{ node.title }}</span>
<span v-if="node.conditionType && (!node.children || !node.children.length)" class="empty-branch">
{{ $t('(') + $t('空分支') + $t(')') }}
</span>
Expand Down Expand Up @@ -283,9 +283,13 @@
display: flex;
align-items: center;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
.name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.empty-branch {
flex-shrink: 0;
font-size: 12px;
color: #979ba5;
}
Expand Down
Loading
Loading