mirror of
https://github.com/certd/certd.git
synced 2026-05-15 20:47:31 +08:00
chore: 插件编辑与运行测试beta
This commit is contained in:
@@ -37,7 +37,6 @@ const domain = computed(() => {
|
||||
});
|
||||
|
||||
function onUpdated(res: { uploadCert: any }) {
|
||||
debugger;
|
||||
emit("update:modelValue", res.uploadCert);
|
||||
const domains = getAllDomainsFromCrt(res.uploadCert.crt);
|
||||
emit("updated", { domains });
|
||||
@@ -45,7 +44,6 @@ function onUpdated(res: { uploadCert: any }) {
|
||||
|
||||
const pipeline: any = inject("pipeline");
|
||||
function onUploadClick() {
|
||||
debugger;
|
||||
openUpdateCertDialog({
|
||||
onSubmit: onUpdated,
|
||||
});
|
||||
|
||||
@@ -30,20 +30,20 @@ import { Modal, notification } from "ant-design-vue";
|
||||
import * as api from "./api";
|
||||
|
||||
defineOptions({
|
||||
name: "PipelineManager"
|
||||
name: "PipelineManager",
|
||||
});
|
||||
|
||||
const certdFormRef = ref();
|
||||
const groupDictRef = dict({
|
||||
url: "/pi/pipeline/group/all",
|
||||
value: "id",
|
||||
label: "name"
|
||||
label: "name",
|
||||
});
|
||||
const selectedRowKeys = ref([]);
|
||||
const context: any = {
|
||||
certdFormRef,
|
||||
groupDictRef,
|
||||
selectedRowKeys
|
||||
selectedRowKeys,
|
||||
};
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context });
|
||||
|
||||
@@ -70,7 +70,7 @@ function batchDelete() {
|
||||
notification.success({ message: "删除成功" });
|
||||
await crudExpose.doRefresh();
|
||||
selectedRowKeys.value = [];
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -101,3 +101,11 @@ export async function SaveCommPluginConfigs(data: CommPluginConfig): Promise<voi
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
export async function DoTest(req: { id: number; input: any }): Promise<void> {
|
||||
return await request({
|
||||
url: apiPrefix + "/doTest",
|
||||
method: "post",
|
||||
data: req,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
</span>
|
||||
</div>
|
||||
<div class="more">
|
||||
<a-button type="primary" :loading="saveLoading" @click="doSave">保存</a-button>
|
||||
<a-button class="mr-1" type="primary" :loading="saveLoading" @click="doSave">保存</a-button>
|
||||
<a-button type="primary" @click="doTest">测试运行</a-button>
|
||||
</div>
|
||||
</template>
|
||||
<div class="pi-plugin-editor">
|
||||
@@ -34,6 +35,7 @@ import { onMounted, provide, ref } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
import * as api from "./api";
|
||||
import yaml from "js-yaml";
|
||||
import { notification } from "ant-design-vue";
|
||||
|
||||
const CertApplyPluginNames = ["CertApply", "CertApplyLego", "CertApplyUpload"];
|
||||
defineOptions({
|
||||
@@ -48,39 +50,53 @@ async function getPlugin() {
|
||||
const pluginObj = await api.GetObj(id);
|
||||
if (!pluginObj.metadata) {
|
||||
pluginObj.metadata = yaml.dump({
|
||||
input: [
|
||||
{
|
||||
key: "cert",
|
||||
input: {
|
||||
cert: {
|
||||
title: "前置任务生成的证书",
|
||||
component: {
|
||||
name: "output-selector",
|
||||
from: [...CertApplyPluginNames],
|
||||
},
|
||||
},
|
||||
],
|
||||
output: [],
|
||||
},
|
||||
output: {},
|
||||
});
|
||||
} else {
|
||||
pluginObj.metadata = "";
|
||||
}
|
||||
plugin.value = pluginObj;
|
||||
}
|
||||
getPlugin();
|
||||
onMounted(async () => {});
|
||||
|
||||
onMounted(async () => {
|
||||
getPlugin();
|
||||
});
|
||||
|
||||
provide("get:plugin", () => {
|
||||
return plugin;
|
||||
});
|
||||
|
||||
const saveLoading = ref(false);
|
||||
function doSave() {
|
||||
async function doSave() {
|
||||
saveLoading.value = true;
|
||||
try {
|
||||
// api.Save(plugin.value);
|
||||
await api.UpdateObj(plugin.value);
|
||||
notification.success({
|
||||
message: "保存成功",
|
||||
});
|
||||
} finally {
|
||||
saveLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function doTest() {
|
||||
await doSave();
|
||||
const result = await api.DoTest({
|
||||
id: plugin.value.id,
|
||||
input: {},
|
||||
});
|
||||
notification.success({
|
||||
message: "测试已开始",
|
||||
description: result,
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
|
||||
@@ -21,7 +21,7 @@ import { message, Modal } from "ant-design-vue";
|
||||
import { DeleteBatch } from "./api";
|
||||
|
||||
defineOptions({
|
||||
name: "SysPlugin"
|
||||
name: "SysPlugin",
|
||||
});
|
||||
const { crudBinding, crudRef, crudExpose, context } = useFs({ createCrudOptions });
|
||||
|
||||
@@ -36,7 +36,7 @@ const handleBatchDelete = () => {
|
||||
message.info("删除成功");
|
||||
crudExpose.doRefresh();
|
||||
selectedRowKeys.value = [];
|
||||
}
|
||||
},
|
||||
});
|
||||
} else {
|
||||
message.error("请先勾选记录");
|
||||
|
||||
Reference in New Issue
Block a user