Skip to content

Commit

Permalink
Merge pull request #1227 from hanshuaikang/feature/develop_by_han
Browse files Browse the repository at this point in the history
bugfix: 修复线条触发器不展示的问题
  • Loading branch information
hanshuaikang authored Nov 7, 2023
2 parents ba1f060 + 012bd09 commit c7233d4
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 1 deletion.
1 change: 1 addition & 0 deletions frontend/pc/src/i18n/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -2645,6 +2645,7 @@ export const m = {
'人都会收到单据代办通知,是否继续?如有疑问请咨询ITSM系统管理员。': 'Everyone will receive a notice of document agency. Do you want to continue? If in doubt, consult your ITSM system administrator.',
当前节点未设置节点描述: 'The node description is not set for the current node',
单据触发器: 'Ticket Trigger',
线条触发器: 'Transition Trigger',
节点: 'Node',
名称: 'Name',
设置为全局变量: 'Set as a global variable',
Expand Down
1 change: 1 addition & 0 deletions frontend/pc/src/i18n/lang/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -2714,6 +2714,7 @@ export const m = {
'人都会收到单据代办通知,是否继续?如有疑问请咨询ITSM系统管理员。': '人都会收到单据代办通知,是否继续?如有疑问请咨询ITSM系统管理员。',
当前节点未设置节点描述: '当前节点未设置节点描述',
单据触发器: '单据触发器',
线条触发器: '线条触发器',
节点: '节点',
名称: '名称',
设置为全局变量: '设置为全局变量',
Expand Down
52 changes: 52 additions & 0 deletions frontend/pc/src/views/ticket/details/taskInfo/taskHistory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,56 @@
</bk-table>
</div>
</bk-collapse-item>
<bk-collapse-item name="transition">
{{$t(`m['线条触发器']`)}}
<div slot="content" class="f13">
<bk-table
:header-cell-attributes="headerCellAttributes"
:data="transitionAction"
:size="'small'"
@sort-change="orderingClick">
<bk-table-column :label="$t(`m.task['执行时间']`)" :render-header="$renderHeader" :show-overflow-tooltip="true" :sortable="'custom'">
<template slot-scope="props">
<span :title="props.row.end_time">
{{props.row.end_time || '--'}}
</span>
</template>
</bk-table-column>
<bk-table-column :label="$t(`m.task['响应动作']`)" :render-header="$renderHeader" :show-overflow-tooltip="true">
<template slot-scope="props">
<span
:title="props.row.display_name"
style="color: #3A84FF;cursor: pointer"
@click="openDetail(props.row)">
{{props.row.component_name || '--'}}
</span>
</template>
</bk-table-column>
<bk-table-column :label="$t(`m.task['执行状态']`)" :render-header="$renderHeader" :show-overflow-tooltip="true" :sortable="'custom'">
<template slot-scope="props">
<span class="bk-status-success"
:class="{ 'bk-status-failed': props.row.status === 'FAILED' }"
:title="props.row.status_name">
{{props.row.status_name || '--'}}
</span>
</template>
</bk-table-column>
<bk-table-column :label="$t(`m.task['操作人']`)" :render-header="$renderHeader" :show-overflow-tooltip="true">
<template slot-scope="props">
<span :title="props.row.operator_username">
{{props.row.operator_username || '--'}}
</span>
</template>
</bk-table-column>
<div class="empty" slot="empty">
<empty
:is-error="listError"
@onRefresh="getHistoryList()">
</empty>
</div>
</bk-table>
</div>
</bk-collapse-item>
</bk-collapse>
</div>
<!-- 任务记录详情 -->
Expand Down Expand Up @@ -182,6 +232,7 @@
id: '',
},
ticketAction: [],
transitionAction: [],
nodeActions: [],
nodeIdMap: {},
listError: false,
Expand Down Expand Up @@ -216,6 +267,7 @@
// this.historyList = res.data.filter(item => item.status === 'FAILED' || item.status === 'SUCCEED');
// 单据触发器
this.ticketAction = res.data.ticket_actions.filter(item => item.status === 'FAILED' || item.status === 'SUCCEED');
this.transitionAction = res.data.transition.filter(item => item.status === 'FAILED' || item.status === 'SUCCEED');
// 节点触发器
this.nodeIdMap = res.data.state_map;
this.nodeActions = Object.keys(res.data.state).map(state => {
Expand Down
4 changes: 4 additions & 0 deletions itsm/ticket/views/ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -1080,12 +1080,15 @@ def trigger_actions_group(self, request, *args, **kwargs):
# 分组
ticket_actions = []
state_actions = {}
transition_actions = []
state_map = {}
for item in actions:
if item["signal_type"] == "STATE":
state_actions.setdefault(item["sender"], []).append(item)
if item["signal_type"] == "FLOW":
ticket_actions.append(item)
if item["signal_type"] == "TRANSITION":
transition_actions.append(item)

for state_id in state_actions.keys():
state_map[state_id] = instance.state(state_id)["name"]
Expand All @@ -1094,6 +1097,7 @@ def trigger_actions_group(self, request, *args, **kwargs):
{
"state": state_actions,
"ticket_actions": ticket_actions,
"transition": transition_actions,
"state_map": state_map,
}
)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# 请确保指定的包和版本号,可通过pip安装

# blueapps requirement
Django==3.2.4
Django==3.2.13
PyMySQL==0.6.7
mysqlclient==2.0.3
MarkupSafe==1.1.1
Expand Down

0 comments on commit c7233d4

Please sign in to comment.