mirror of
https://github.com/certd/certd.git
synced 2026-04-24 12:27:25 +08:00
perf: 支持已跳过的步骤重新运行
This commit is contained in:
@@ -45,6 +45,10 @@ h1, h2, h3, h4, h5, h6 {
|
||||
vertical-align: 0 !important;
|
||||
}
|
||||
|
||||
.pointer{
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.flex-center{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
@@ -122,3 +126,8 @@ h1, h2, h3, h4, h5, h6 {
|
||||
padding-bottom:3px;
|
||||
border-bottom: 1px solid #dedede;
|
||||
}
|
||||
|
||||
|
||||
.color-blue{
|
||||
color: #1890ff;
|
||||
}
|
||||
@@ -59,11 +59,11 @@ export function Save(pipelineEntity: any) {
|
||||
});
|
||||
}
|
||||
|
||||
export function Trigger(id: any) {
|
||||
export function Trigger(id: any, stepId?: string) {
|
||||
return request({
|
||||
url: apiPrefix + "/trigger",
|
||||
method: "post",
|
||||
params: { id }
|
||||
params: { id, stepId }
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as api from "./api";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { computed, ref } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes, useUi } from "@fast-crud/fast-crud";
|
||||
import { statusUtil } from "/@/views/certd/pipeline/pipeline/utils/util.status";
|
||||
import { nanoid } from "nanoid";
|
||||
import { message, Modal } from "ant-design-vue";
|
||||
@@ -29,9 +29,16 @@ export default function ({ crudExpose, context: { certdFormRef } }: CreateCrudOp
|
||||
};
|
||||
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
form.content = JSON.stringify({
|
||||
title: form.title
|
||||
});
|
||||
if (form.content == null) {
|
||||
form.content = JSON.stringify({
|
||||
title: form.title
|
||||
});
|
||||
} else {
|
||||
const content = JSON.parse(form.content);
|
||||
content.title = form.title;
|
||||
form.content = JSON.stringify(content);
|
||||
}
|
||||
|
||||
const res = await api.AddObj(form);
|
||||
lastResRef.value = res;
|
||||
return res;
|
||||
@@ -136,6 +143,18 @@ export default function ({ crudExpose, context: { certdFormRef } }: CreateCrudOp
|
||||
router.push({ path: "/certd/pipeline/detail", query: { id: row.id, editMode: "false" } });
|
||||
}
|
||||
},
|
||||
copy: {
|
||||
click: async (context) => {
|
||||
const { ui } = useUi();
|
||||
// @ts-ignore
|
||||
const row = context[ui.tableColumn.row];
|
||||
row.title = row.title + "_copy";
|
||||
await crudExpose.openCopy({
|
||||
row: row,
|
||||
index: context.index
|
||||
});
|
||||
}
|
||||
},
|
||||
config: {
|
||||
order: 1,
|
||||
title: null,
|
||||
|
||||
@@ -54,9 +54,9 @@ export default defineComponent({
|
||||
content: JSON.stringify(pipelineConfig)
|
||||
});
|
||||
},
|
||||
async doTrigger(options: { pipelineId: number }) {
|
||||
const { pipelineId } = options;
|
||||
await api.Trigger(pipelineId);
|
||||
async doTrigger(options: { pipelineId: number; stepId?: string }) {
|
||||
const { pipelineId, stepId } = options;
|
||||
await api.Trigger(pipelineId, stepId);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
</template>
|
||||
<p>
|
||||
<fs-date-format :model-value="runnable.status?.startTime"></fs-date-format>
|
||||
<a-tag class="ml-1" :color="status.color" :closable="status.value === 'start'" @close="cancelTask">
|
||||
<a-tag class="ml-5" :color="status.color" :closable="status.value === 'start'" @close="cancelTask">
|
||||
{{ status.label }}
|
||||
</a-tag>
|
||||
<a-tag v-if="isCurrent" class="pointer" color="green" :closable="true" @close="cancel">当前</a-tag>
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<span v-if="statusRef" class="pi-status-show">
|
||||
<span v-if="statusRef" class="pi-status-show flex-o">
|
||||
<template v-if="type === 'icon'">
|
||||
<fs-icon class="status-icon" v-bind="statusRef" :style="{ color: statusRef.color }" />
|
||||
</template>
|
||||
|
||||
@@ -82,10 +82,20 @@
|
||||
</div>
|
||||
<div class="task">
|
||||
<a-button shape="round" @click="taskEdit(stage, index, task, taskIndex)">
|
||||
<span class="flex-o w-100">
|
||||
<span class="ellipsis flex-1" :class="{ 'mr-15': editMode }">{{ task.title }}</span>
|
||||
<pi-status-show :status="task.status?.result"></pi-status-show>
|
||||
</span>
|
||||
<a-popover title="步骤">
|
||||
<!-- :open="true"-->
|
||||
<template #content>
|
||||
<div v-for="(item, index) of task.steps" class="flex-o w-100">
|
||||
<span class="ellipsis flex-1">{{ index + 1 }}. {{ item.title }} </span>
|
||||
<pi-status-show :status="item.status?.result"></pi-status-show>
|
||||
<fs-icon class="pointer color-blue" title="重新运行此步骤" icon="SyncOutlined" @click="run(item.id)"></fs-icon>
|
||||
</div>
|
||||
</template>
|
||||
<span class="flex-o w-100">
|
||||
<span class="ellipsis flex-1" :class="{ 'mr-15': editMode }">{{ task.title }}</span>
|
||||
<pi-status-show :status="task.status?.result"></pi-status-show>
|
||||
</span>
|
||||
</a-popover>
|
||||
</a-button>
|
||||
<fs-icon v-if="editMode" class="copy" title="复制" icon="ion:copy-outline" @click="taskCopy(stage, index, task)"></fs-icon>
|
||||
</div>
|
||||
@@ -226,10 +236,11 @@ import { nanoid } from "nanoid";
|
||||
import { PipelineDetail, PipelineOptions, PluginGroups, RunHistory } from "./type";
|
||||
import type { Runnable } from "@certd/pipeline";
|
||||
import PiHistoryTimelineItem from "/@/views/certd/pipeline/pipeline/component/history-timeline-item.vue";
|
||||
import { FsIcon } from "@fast-crud/fast-crud";
|
||||
export default defineComponent({
|
||||
name: "PipelineEdit",
|
||||
// eslint-disable-next-line vue/no-unused-components
|
||||
components: { PiHistoryTimelineItem, PiTaskForm, PiTriggerForm, PiTaskView, PiStatusShow, PiNotificationForm },
|
||||
components: { FsIcon, PiHistoryTimelineItem, PiTaskForm, PiTriggerForm, PiTaskView, PiStatusShow, PiNotificationForm },
|
||||
props: {
|
||||
pipelineId: {
|
||||
type: [Number, String],
|
||||
@@ -529,7 +540,7 @@ export default defineComponent({
|
||||
|
||||
function useActions() {
|
||||
const saveLoading = ref();
|
||||
const run = async () => {
|
||||
const run = async (stepId?: string) => {
|
||||
if (props.editMode) {
|
||||
message.warn("请先保存,再运行管道");
|
||||
return;
|
||||
@@ -549,11 +560,12 @@ export default defineComponent({
|
||||
//@ts-ignore
|
||||
await changeCurrentHistory(null);
|
||||
watchNewHistoryList();
|
||||
await props.options.doTrigger({ pipelineId: pipeline.value.id });
|
||||
await props.options.doTrigger({ pipelineId: pipeline.value.id, stepId: stepId });
|
||||
notification.success({ message: "管道已经开始运行" });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function toggleEditMode(editMode: boolean) {
|
||||
ctx.emit("update:editMode", editMode);
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ export class PluginGroups {
|
||||
}
|
||||
|
||||
export type PipelineOptions = {
|
||||
doTrigger(options: { pipelineId: number }): Promise<void>;
|
||||
doTrigger(options: { pipelineId: number; stepId?: string }): Promise<void>;
|
||||
doSave(pipelineConfig: Pipeline): Promise<void>;
|
||||
getPipelineDetail(query: { pipelineId: number }): Promise<PipelineDetail>;
|
||||
getHistoryList(query: { pipelineId: number }): Promise<RunHistory[]>;
|
||||
|
||||
Reference in New Issue
Block a user