This commit is contained in:
xiaojunnuo
2024-10-31 22:35:05 +08:00
parent 584378a32b
commit b817cb4a1b
13 changed files with 125 additions and 41 deletions

View File

@@ -84,6 +84,13 @@ export async function GetFiles(pipelineId: number) {
});
}
export async function GetCount() {
return await request({
url: apiPrefix + "/count",
method: "post"
});
}
export type CertInfo = {
crt: string;
key: string;

View File

@@ -438,6 +438,9 @@ export default function ({ crudExpose, context: { certdFormRef } }: CreateCrudOp
status: {
title: "状态",
type: "dict-select",
search: {
show: true
},
dict: dict({
data: statusUtil.getOptions()
}),

View File

@@ -1,7 +1,7 @@
<template>
<fs-page class="fs-pipeline-detail">
<pipeline-edit v-model:edit-mode="editMode" :pipeline-id="pipelineId" :options="pipelineOptionsRef"></pipeline-edit>
<a-tour v-model:current="tourCurrent" :open="tourOpen" :steps="tourSteps" @close="tourHandleOpen(false)" />
<a-tour v-bind="tour" v-model:current="tour.current" />
</fs-page>
</template>
@@ -14,6 +14,7 @@ import * as api from "./api";
import { useRoute } from "vue-router";
import { PipelineDetail, PipelineOptions, PluginGroups, RunHistory } from "./pipeline/type";
import { TourProps } from "ant-design-vue";
import { LocalStorage } from "/@/utils/util.storage";
defineOptions({
name: "PipelineDetail"
@@ -24,7 +25,7 @@ const pipelineId: Ref = ref(route.query.id);
const pipelineOptions: PipelineOptions = {
async getPipelineDetail({ pipelineId }) {
const detail = await api.GetDetail(pipelineId);
onLoaded();
onLoaded(detail);
return {
pipeline: {
id: detail.pipeline.id,
@@ -70,30 +71,37 @@ if (route.query.editMode !== "false") {
}
function useTour() {
const tourOpen = ref<boolean>(false);
const tourCurrent = ref(0);
//@ts-ignore
const tourSteps: TourProps["steps"] = ref([]);
const tour = ref({
open: false,
current: 0,
steps: [],
onClose: () => {
tour.value.open = false;
},
onFinish: () => {
tour.value.open = false;
LocalStorage.set("tour-off", true, 999999999);
}
});
const tourHandleOpen = (val: boolean): void => {
initSteps();
tourOpen.value = val;
tour.value.open = val;
};
function initSteps() {
//@ts-ignore
tourSteps.value = [
tour.value.steps = [
{
title: "恭喜创建证书流水线成功",
description: "这里就是我们刚创建的证书任务,点击可以修改证书申请参数",
description: "这里就是我们刚创建的证书任务点击可以修改证书申请参数",
target: () => {
return document.querySelector(".pipeline .stages .stage_0 .task");
}
},
{
title: "添加部署证书任务",
description: "证书申请成功之后还需要部署证书,点击这里可以添加部署任务",
description: "证书申请成功之后还需要部署证书,点击这里可以添加证书部署任务",
target: () => {
return document.querySelector(".pipeline .stages .last-stage .tasks .task");
}
@@ -109,18 +117,28 @@ function useTour() {
}
return {
tourOpen,
tourCurrent,
tourSteps,
tour,
tourHandleOpen
};
}
const { tourOpen, tourCurrent, tourSteps, tourHandleOpen } = useTour();
const { tour, tourHandleOpen } = useTour();
async function onLoaded() {
await nextTick();
tourHandleOpen(true);
async function onLoaded(pipeline: PipelineDetail) {
const count = LocalStorage.get("pipeline-count") ?? 0;
if (count > 1) {
return;
}
const off = LocalStorage.get("tour-off") ?? false;
if (off) {
return;
}
const res = await api.GetCount();
LocalStorage.set("pipeline-count", res.count);
if (res.count <= 1) {
await nextTick();
tourHandleOpen(true);
}
}
</script>
<style lang="less">

View File

@@ -10,7 +10,7 @@
<div class="text">
<div class="left">
<div>
<span>您好{{ userInfo.nickName || userInfo.username }} 欢迎使用 {{ siteInfo.title }}</span>
<span>您好{{ userInfo.nickName || userInfo.username }} 欢迎使用 {{ siteInfo.title }}</span>
</div>
<div>
<a-tag color="green" class="flex-inline"> <fs-icon icon="ion:time-outline" class="mr-5"></fs-icon> {{ now }}</a-tag>
@@ -215,7 +215,7 @@ onMounted(async () => {
flex-direction: column;
justify-content: center;
> div {
margin: 2px;
margin: 4px;
}
}
}