pref: 任务日志查看页面,增加强制重新运行按钮

pull/409/head
xiaojunnuo 2025-04-17 23:31:06 +08:00
parent 356ad28e41
commit 60ad077172
2 changed files with 22 additions and 11 deletions

View File

@ -4,10 +4,14 @@
<a-tab-pane v-for="item of detail.nodes" :key="item.node.id"> <a-tab-pane v-for="item of detail.nodes" :key="item.node.id">
<template #tab> <template #tab>
<div class="tab-title flex-between" :title="item.node.title"> <div class="tab-title flex-between" :title="item.node.title">
<span class="tab-title-text flex items-center md:w-40"> <span class="tab-title-text flex items-center md:w-48">
<pi-status-show class="mr-1" :status="item.node.status?.result" type="icon"></pi-status-show> <pi-status-show class="mr-1" :status="item.node.status?.result" type="icon"></pi-status-show>
<!-- <fs-icon icon="ion:chevron-forward-circle" class="text-md mr-1"></fs-icon>--> <!-- <fs-icon icon="ion:chevron-forward-circle" class="text-md mr-1"></fs-icon>-->
{{ item.node.title }} <span class="flex-1 ellipsis">{{ item.node.title }}</span>
<a-tooltip title="强制重新执行此步骤">
<fs-icon class="pointer color-blue ml-1" style="font-size: 16px" title="强制重新执行此步骤" icon="icon-park-outline:replay-music" @click="triggerRun(item.node.id)"></fs-icon>
</a-tooltip>
</span> </span>
</div> </div>
</template> </template>
@ -31,13 +35,14 @@ export default {
name: "PiTaskView", name: "PiTaskView",
components: { PiStatusShow }, components: { PiStatusShow },
props: {}, props: {},
emits: ["run"],
setup(props: any, ctx: any) { setup(props: any, ctx: any) {
const taskModal = ref({ const taskModal = ref({
open: false, open: false,
onOk() { onOk() {
taskViewClose(); taskViewClose();
}, },
cancelText: "关闭" cancelText: "关闭",
}); });
const { isMobile } = usePreferences(); const { isMobile } = usePreferences();
const tabPosition = computed(() => { const tabPosition = computed(() => {
@ -65,7 +70,7 @@ export default {
node: step, node: step,
type: "步骤", type: "步骤",
tab: 2, tab: 2,
logs: [] logs: [],
}); });
} }
for (let node of nodes) { for (let node of nodes) {
@ -82,7 +87,7 @@ export default {
list.push({ list.push({
time, time,
content, content,
color color,
}); });
} }
return list; return list;
@ -111,12 +116,12 @@ export default {
if (isBottom && el) { if (isBottom && el) {
el?.scrollTo({ el?.scrollTo({
top: el.scrollHeight, top: el.scrollHeight,
behavior: "smooth" behavior: "smooth",
}); });
} }
}, },
{ {
immediate: true immediate: true,
} }
); );
} }
@ -135,15 +140,21 @@ export default {
taskModal.value.open = false; taskModal.value.open = false;
}; };
function triggerRun(id: string) {
ctx.emit("run", id);
taskModal.value.open = false;
}
return { return {
detail, detail,
taskModal, taskModal,
activeKey, activeKey,
taskViewOpen, taskViewOpen,
taskViewClose, taskViewClose,
tabPosition tabPosition,
triggerRun,
}; };
} },
}; };
</script> </script>
@ -154,7 +165,7 @@ export default {
.tab-title-text { .tab-title-text {
display: flex; display: flex;
max-width: 180px; //max-width: 180px;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;

View File

@ -249,7 +249,7 @@
<pi-task-form ref="taskFormRef" :edit-mode="editMode"></pi-task-form> <pi-task-form ref="taskFormRef" :edit-mode="editMode"></pi-task-form>
<pi-trigger-form ref="triggerFormRef" :edit-mode="editMode"></pi-trigger-form> <pi-trigger-form ref="triggerFormRef" :edit-mode="editMode"></pi-trigger-form>
<pi-task-view ref="taskViewRef"></pi-task-view> <pi-task-view ref="taskViewRef" @run="run"></pi-task-view>
<PiNotificationForm ref="notificationFormRef" :edit-mode="editMode"></PiNotificationForm> <PiNotificationForm ref="notificationFormRef" :edit-mode="editMode"></PiNotificationForm>
</fs-page> </fs-page>
</template> </template>