mirror of
https://github.com/certd/certd.git
synced 2026-05-16 05:07:32 +08:00
chore:
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
<script setup lang="ts">
|
||||
import { inject, ref, watch } from "vue";
|
||||
|
||||
const props = defineProps<{
|
||||
inputKey?: string;
|
||||
modelValue?: string[];
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
"update:modelValue": any;
|
||||
}>();
|
||||
|
||||
const pipeline: any = inject("pipeline");
|
||||
|
||||
function findStepFromPipeline(targetStepId: string) {
|
||||
for (const stage of pipeline.value.stages) {
|
||||
for (const task of stage.tasks) {
|
||||
for (const step of task.steps) {
|
||||
if (step.id === targetStepId) {
|
||||
return step;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const errorRef = ref("");
|
||||
function getDomainFromPipeline(inputKey: string) {
|
||||
if (!inputKey) {
|
||||
errorRef.value = "请先选择域名证书";
|
||||
return;
|
||||
}
|
||||
const targetStepId = inputKey.split(".")[1];
|
||||
const certStep = findStepFromPipeline(targetStepId);
|
||||
if (!certStep) {
|
||||
errorRef.value = "找不到目标步骤,请先选择域名证书";
|
||||
return;
|
||||
}
|
||||
const domain = certStep.input["domains"];
|
||||
emit("update:modelValue", domain);
|
||||
}
|
||||
|
||||
watch(
|
||||
() => {
|
||||
return props.inputKey;
|
||||
},
|
||||
(inputKey: string) => {
|
||||
getDomainFromPipeline(inputKey);
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-select mode="tags" readonly :value="modelValue" />
|
||||
<div>{{ errorRef }}</div>
|
||||
</template>
|
||||
|
||||
<style lang="less"></style>
|
||||
Reference in New Issue
Block a user