mirror of
https://github.com/certd/certd.git
synced 2026-05-15 20:47:31 +08:00
feat: cert download
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import { request } from "/src/api/service";
|
||||
const apiPrefix = "/pi/pipeline";
|
||||
|
||||
export function GetList(query) {
|
||||
const apiPrefix = "/pi/pipeline";
|
||||
const historyApiPrefix = "/pi/history";
|
||||
|
||||
export function GetList(query: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "post",
|
||||
@@ -9,7 +11,7 @@ export function GetList(query) {
|
||||
});
|
||||
}
|
||||
|
||||
export function AddObj(obj) {
|
||||
export function AddObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
@@ -17,7 +19,7 @@ export function AddObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function UpdateObj(obj) {
|
||||
export function UpdateObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
@@ -25,7 +27,7 @@ export function UpdateObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function DelObj(id) {
|
||||
export function DelObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
@@ -33,7 +35,7 @@ export function DelObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function GetObj(id) {
|
||||
export function GetObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "post",
|
||||
@@ -41,7 +43,7 @@ export function GetObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function GetDetail(id) {
|
||||
export function GetDetail(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/detail",
|
||||
method: "post",
|
||||
@@ -49,7 +51,7 @@ export function GetDetail(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function Save(pipelineEntity) {
|
||||
export function Save(pipelineEntity: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/save",
|
||||
method: "post",
|
||||
@@ -57,10 +59,18 @@ export function Save(pipelineEntity) {
|
||||
});
|
||||
}
|
||||
|
||||
export function Trigger(id) {
|
||||
export function Trigger(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/trigger",
|
||||
method: "post",
|
||||
params: { id }
|
||||
});
|
||||
}
|
||||
|
||||
export async function GetFiles(pipelineId: number) {
|
||||
return request({
|
||||
url: historyApiPrefix + "/files",
|
||||
method: "post",
|
||||
params: { pipelineId }
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ import { useRouter } from "vue-router";
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { statusUtil } from "/@/views/certd/pipeline/pipeline/utils/util.status";
|
||||
import { nanoid } from "nanoid";
|
||||
import { message } from "ant-design-vue";
|
||||
import { message, Modal } from "ant-design-vue";
|
||||
import { env } from "/@/utils/util.env";
|
||||
import { useUserStore } from "/@/store/modules/user";
|
||||
|
||||
export default function ({ crudExpose, context: { certdFormRef } }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const router = useRouter();
|
||||
@@ -73,6 +75,7 @@ export default function ({ crudExpose, context: { certdFormRef } }: CreateCrudOp
|
||||
router.push({ path: "/certd/pipeline/detail", query: { id, editMode: "true" } });
|
||||
});
|
||||
}
|
||||
const userStore = useUserStore();
|
||||
return {
|
||||
crudOptions: {
|
||||
request: {
|
||||
@@ -124,6 +127,33 @@ export default function ({ crudExpose, context: { certdFormRef } }: CreateCrudOp
|
||||
order: 2,
|
||||
icon: "ant-design:setting-outlined"
|
||||
},
|
||||
download: {
|
||||
order: 3,
|
||||
title: null,
|
||||
type: "link",
|
||||
icon: "ant-design:download-outlined",
|
||||
async click({ row }) {
|
||||
const files = await api.GetFiles(row.id);
|
||||
Modal.success({
|
||||
title: "文件下载",
|
||||
content: () => {
|
||||
const children = [];
|
||||
for (const file of files) {
|
||||
const downloadUrl = `${env.API}/pi/history/download?pipelineId=${row.id}&fileId=${file.id}`;
|
||||
children.push(
|
||||
<p>
|
||||
<a href={downloadUrl} target={"_blank"}>
|
||||
{file.filename}
|
||||
</a>
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
||||
return <div class={"mt-3"}>{children}</div>;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
remove: {
|
||||
order: 5
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
</template>
|
||||
<p>
|
||||
<fs-date-format :model-value="runnable.status?.startTime"></fs-date-format>
|
||||
<a-tag class="ml-10" :color="status.color">{{ status.label }}</a-tag>
|
||||
<a-tag class="ml-1" :color="status.color">{{ status.label }}</a-tag>
|
||||
|
||||
<a-tag v-if="isCurrent" class="pointer" color="green" :closable="true" @close="cancel">当前</a-tag>
|
||||
<a-tag v-else-if="!editMode" class="pointer" color="blue" @click="view">查看</a-tag>
|
||||
|
||||
+1
@@ -38,6 +38,7 @@
|
||||
options: [
|
||||
{ value: 'start', label: '开始时' },
|
||||
{ value: 'success', label: '成功时' },
|
||||
{ value: 'turnToSuccess', label: '错误转成功时' },
|
||||
{ value: 'error', label: '错误时' }
|
||||
]
|
||||
},
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<div style="margin-top: 10px">
|
||||
<a-button @click="formSubmit">提交表单</a-button>
|
||||
<a-button @click="formReset">重置表单</a-button>
|
||||
<a-button class="ml-10" @click="setFormDataTest">setFormData</a-button>
|
||||
<a-button class="ml-1" @click="setFormDataTest">setFormData</a-button>
|
||||
</div>
|
||||
</a-card>
|
||||
</a-col>
|
||||
|
||||
Reference in New Issue
Block a user