mirror of https://github.com/certd/certd
parent
46a1b74799
commit
87853a2015
|
@ -67,6 +67,7 @@ export abstract class CertApplyBaseConvertPlugin extends AbstractTaskPlugin {
|
|||
|
||||
@TaskOutput({
|
||||
title: "域名证书",
|
||||
type: "cert",
|
||||
})
|
||||
cert?: CertInfo;
|
||||
|
||||
|
|
|
@ -87,6 +87,7 @@ export class CertApplyUploadPlugin extends CertApplyBaseConvertPlugin {
|
|||
|
||||
@TaskOutput({
|
||||
title: "证书MD5",
|
||||
type: "certMd5",
|
||||
})
|
||||
certMd5?: string;
|
||||
|
||||
|
|
|
@ -3,4 +3,4 @@ export { EVENT_CERT_APPLY_SUCCESS } from "./cert-plugin/base-convert.js";
|
|||
export * from "./cert-plugin/index.js";
|
||||
export * from "./cert-plugin/lego/index.js";
|
||||
export * from "./cert-plugin/custom/index.js";
|
||||
export const CertApplyPluginNames = ["CertApply", "CertApplyLego", "CertApplyUpload"];
|
||||
export const CertApplyPluginNames = [":cert:"];
|
||||
|
|
|
@ -54,8 +54,9 @@ function getDomainFromPipeline(inputKey: string) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!CertApplyPluginNames.includes(certStep.type)) {
|
||||
targetStepId = getStepIdFromInputKey(certStep.input?.cert);
|
||||
const firstLevelValue = certStep.input.cert;
|
||||
if (firstLevelValue && typeof firstLevelValue === "string" && firstLevelValue.indexOf(".") > 0) {
|
||||
targetStepId = getStepIdFromInputKey(firstLevelValue);
|
||||
certStep = findStepFromPipeline(targetStepId);
|
||||
if (!certStep) {
|
||||
errorRef.value = "找不到目标步骤,请先选择域名证书";
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
<script lang="ts">
|
||||
import { inject, onMounted, Ref, ref, watch } from "vue";
|
||||
import { usePluginStore } from "/@/store/plugin";
|
||||
|
||||
export default {
|
||||
name: "OutputSelector",
|
||||
|
@ -27,10 +28,11 @@ export default {
|
|||
const currentStepIndex = inject("currentStepIndex") as Ref<number>;
|
||||
const currentTask = inject("currentTask") as Ref<any>;
|
||||
|
||||
const getPluginGroups = inject("getPluginGroups") as any;
|
||||
const pluginGroups = getPluginGroups();
|
||||
function onCreate() {
|
||||
options.value = pluginGroups.getPreStepOutputOptions({
|
||||
const pluginStore = usePluginStore();
|
||||
|
||||
async function onCreate() {
|
||||
await pluginStore.init();
|
||||
options.value = pluginStore.group.getPreStepOutputOptions({
|
||||
pipeline: pipeline.value,
|
||||
currentStageIndex: currentStageIndex.value,
|
||||
currentTaskIndex: currentTaskIndex.value,
|
||||
|
@ -38,11 +40,38 @@ export default {
|
|||
currentTask: currentTask.value,
|
||||
});
|
||||
if (props.from) {
|
||||
let froms = [];
|
||||
if (typeof props.from === "string") {
|
||||
options.value = options.value.filter((item: any) => item.type === props.from);
|
||||
froms = [props.from];
|
||||
} else {
|
||||
options.value = options.value.filter((item: any) => props.from.includes(item.type));
|
||||
froms = props.from;
|
||||
}
|
||||
function match(from: string, item: any) {
|
||||
// pluginType:valueType:keyName
|
||||
if (from.includes(":")) {
|
||||
const [pluginType, valueType, keyName] = from.split(":");
|
||||
if (pluginType && item.type !== pluginType) {
|
||||
return false;
|
||||
}
|
||||
if (valueType && item.valueType !== valueType) {
|
||||
return false;
|
||||
}
|
||||
if (keyName && item.key !== keyName) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return item.type === from;
|
||||
}
|
||||
}
|
||||
options.value = options.value.filter((item: any) => {
|
||||
for (const from of froms) {
|
||||
if (match(from, item)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
if (props.modelValue != null) {
|
||||
|
@ -55,19 +84,10 @@ export default {
|
|||
ctx.emit("update:modelValue", value);
|
||||
}
|
||||
}
|
||||
onMounted(() => {
|
||||
onCreate();
|
||||
onMounted(async () => {
|
||||
await onCreate();
|
||||
});
|
||||
|
||||
watch(
|
||||
() => {
|
||||
return pluginGroups.value?.map;
|
||||
},
|
||||
() => {
|
||||
onCreate();
|
||||
}
|
||||
);
|
||||
|
||||
function onChanged(value: any) {
|
||||
ctx.emit("update:modelValue", value);
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
export const CertApplyPluginNames = ["CertApply", "CertApplyLego", "CertApplyUpload"];
|
||||
export const CertApplyPluginNames = [":cert:"];
|
||||
|
|
|
@ -87,10 +87,13 @@ export class PluginGroups {
|
|||
for (const step of steps) {
|
||||
const stepDefine = this.get(step.type);
|
||||
for (const key in stepDefine?.output) {
|
||||
const inputDefine = stepDefine.output[key];
|
||||
options.push({
|
||||
value: `step.${step.id}.${key}`,
|
||||
label: `${stepDefine.output[key].title}【from:${step.title}】`,
|
||||
label: `${inputDefine.title}【from:${step.title}】`,
|
||||
type: step.type,
|
||||
valueType: inputDefine.type,
|
||||
key: key,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -299,7 +299,7 @@ import { useSettingStore } from "/@/store/settings";
|
|||
import { useUserStore } from "/@/store/user";
|
||||
import TaskShortcuts from "./component/shortcut/task-shortcuts.vue";
|
||||
import { eachSteps, findStep } from "../utils";
|
||||
import { PluginGroups } from "/@/store/plugin";
|
||||
import { PluginGroups, usePluginStore } from "/@/store/plugin";
|
||||
import { getCronNextTimes } from "/@/components/cron-editor/utils";
|
||||
import { useCertViewer } from "/@/views/certd/pipeline/use";
|
||||
|
||||
|
@ -494,16 +494,15 @@ export default defineComponent({
|
|||
}
|
||||
);
|
||||
|
||||
const pluginGroupsRef: Ref<PluginGroups> = ref();
|
||||
|
||||
const pluginStore = usePluginStore();
|
||||
const fetchPlugins = async () => {
|
||||
pluginGroupsRef.value = await props.options.getPluginGroups();
|
||||
await pluginStore.init();
|
||||
};
|
||||
fetchPlugins();
|
||||
|
||||
provide("pipeline", pipeline);
|
||||
provide("getPluginGroups", () => {
|
||||
return pluginGroupsRef.value;
|
||||
return pluginStore.group;
|
||||
});
|
||||
provide("currentHistory", currentHistory);
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ export function getDefaultDeployPlugin() {
|
|||
let certApplyNames = ''
|
||||
for (const name of CertApplyPluginNames) {
|
||||
certApplyNames += `
|
||||
- ${name}`
|
||||
- "${name}"`
|
||||
}
|
||||
const metadata =`
|
||||
input: # 插件的输入参数
|
||||
|
|
|
@ -26,7 +26,7 @@ const regionDict = [
|
|||
title: '阿里云-上传证书到阿里云',
|
||||
icon: 'svg:icon-aliyun',
|
||||
group: pluginGroups.aliyun.key,
|
||||
desc: '如果不想在阿里云上同一份证书上传多次,可以把此任务作为前置任务,其他阿里云任务证书那一项选择此任务的输出',
|
||||
desc: '上传证书到阿里云数字证书管理服务(CAS),注意:不会部署到任何应用上;如果不想在阿里云上同一份证书上传多次,可以把此任务作为前置任务,其他阿里云任务证书那一项选择此任务的输出',
|
||||
default: {
|
||||
strategy: {
|
||||
runStrategy: RunStrategy.SkipWhenSucceed,
|
||||
|
|
Loading…
Reference in New Issue