diff --git a/packages/libs/lib-server/src/basic/base-service.ts b/packages/libs/lib-server/src/basic/base-service.ts index 72a8e369..973ed5c2 100644 --- a/packages/libs/lib-server/src/basic/base-service.ts +++ b/packages/libs/lib-server/src/basic/base-service.ts @@ -84,6 +84,7 @@ export abstract class BaseService { ...where, }); await this.modifyAfter(idArr); + return ids } resolveIdArr(ids: string | any[]) { diff --git a/packages/ui/certd-client/src/vben/layouts/basic/footer/footer.vue b/packages/ui/certd-client/src/vben/layouts/basic/footer/footer.vue index a28aa0c6..18599bfa 100644 --- a/packages/ui/certd-client/src/vben/layouts/basic/footer/footer.vue +++ b/packages/ui/certd-client/src/vben/layouts/basic/footer/footer.vue @@ -1,6 +1,6 @@ diff --git a/packages/ui/certd-client/src/views/certd/pipeline/template/crud.tsx b/packages/ui/certd-client/src/views/certd/pipeline/template/crud.tsx index 12640779..7153b138 100644 --- a/packages/ui/certd-client/src/views/certd/pipeline/template/crud.tsx +++ b/packages/ui/certd-client/src/views/certd/pipeline/template/crud.tsx @@ -37,6 +37,11 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat editRequest, delRequest, }, + addForm: { + onSuccess: ({ res }) => { + router.push({ path: "/certd/pipeline/template/edit", query: { templateId: res.id, editMode: "true" } }); + }, + }, form: { labelCol: { //固定label宽度 @@ -95,7 +100,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat show: true, }, column: { - width: 200, + width: 400, sorter: true, cellRender({ row, value }) { return {value}; @@ -117,8 +122,12 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat editForm: { show: false, }, - form: { + column: { show: false, + }, + form: { + show: true, + helper: "复制该流水线配置作为模版来源", component: { valuesFormat: { labelFormatter: (item: any) => { diff --git a/packages/ui/certd-client/src/views/certd/pipeline/template/edit.vue b/packages/ui/certd-client/src/views/certd/pipeline/template/edit.vue index 584a424d..6e74e8aa 100644 --- a/packages/ui/certd-client/src/views/certd/pipeline/template/edit.vue +++ b/packages/ui/certd-client/src/views/certd/pipeline/template/edit.vue @@ -7,18 +7,33 @@
- 保存 + 保存模版 + 使用模版 + 删除模版
-
- 原始任务参数 -
点击加号,将字段作为模版变量
+
+
+ 模版流水线参数 +
点击加号,将字段作为模版变量
+
+
+ + 修改模版流水线 + +
- +
@@ -36,6 +51,17 @@
+ +
+
+
还未绑定模版流水线
+
+ 创建新流水线作为模版 + 或 + 从已有流水线复制 +
+
+
@@ -60,7 +86,9 @@ import { templateApi } from "./api"; import { usePluginStore } from "/@/store/plugin"; import { useStepHelper } from "./utils"; import TemplateForm from "./form.vue"; - +import { Modal, notification } from "ant-design-vue"; +import { useTabbarStore } from "/@/vben/stores"; +import { useTemplate } from "./use"; const route = useRoute(); const templateId = route.query.templateId as string; @@ -79,6 +107,9 @@ const templateProps: Ref = ref({ }); const detail: Ref = ref(); async function getTemplateDetail() { + if (!templateId) { + return; + } const res = await templateApi.GetDetail(parseInt(templateId)); detail.value = res; templateProps.value = JSON.parse(res.template.content ?? "{input:{}}"); @@ -100,7 +131,7 @@ onMounted(async () => { const { getStepsMap } = useStepHelper(pluginStore); const steps = computed(() => { - if (!detail.value) { + if (!detail.value || !detail.value.pipeline) { return {}; } @@ -126,5 +157,36 @@ async function doSave() { title: detail.value.template.title, content: JSON.stringify(templateProps.value), }); + notification.success({ + message: "保存成功", + }); +} + +const tabbar = useTabbarStore(); +async function doDelete() { + Modal.confirm({ + title: "确定删除模版?", + content: "删除后,该模版流水线将不能再使用", + onOk() { + templateApi.DelObj(detail.value.template.id); + notification.success({ + message: "删除成功", + }); + tabbar.closeTab({ fullPath: route.fullPath } as any, router); + }, + }); +} + +async function bindPipelineByCreate() { + // + // openAddCertdPipelineDialog({ templateId: detail.value.template.id }); +} + +async function bindPipelineByCopy() {} + +const { openCreateFromTemplateDialog } = useTemplate(); + +async function useTemplateCreate() { + openCreateFromTemplateDialog({ templateId: detail.value.template.id }); } diff --git a/packages/ui/certd-client/src/views/certd/pipeline/template/form.vue b/packages/ui/certd-client/src/views/certd/pipeline/template/form.vue index 1035ef17..46ea4934 100644 --- a/packages/ui/certd-client/src/views/certd/pipeline/template/form.vue +++ b/packages/ui/certd-client/src/views/certd/pipeline/template/form.vue @@ -1,5 +1,5 @@