v2-dev-order
xiaojunnuo 2025-07-22 12:22:54 +08:00
parent 13dfca1749
commit b0f91f1eea
5 changed files with 46 additions and 43 deletions

View File

@ -352,6 +352,7 @@ export class Executor {
pipeline: this.pipeline, pipeline: this.pipeline,
runtime: this.runtime, runtime: this.runtime,
step, step,
define: cloneDeep(define),
lastStatus, lastStatus,
http, http,
download, download,

View File

@ -86,6 +86,7 @@ export type TaskInstanceContext = {
runtime: RunHistory; runtime: RunHistory;
//步骤定义 //步骤定义
step: Step; step: Step;
define: PluginDefine;
//日志 //日志
logger: ILogger; logger: ILogger;
//当前步骤输入参数跟上一次执行比较是否有变化 //当前步骤输入参数跟上一次执行比较是否有变化
@ -164,9 +165,7 @@ export abstract class AbstractTaskPlugin implements ITaskPlugin {
this.registerSecret(cert.one); this.registerSecret(cert.one);
} }
debugger if (this.ctx.define.onlyAdmin) {
// @ts-ignore
if (this.ctx.step.onlyAdmin) {
if (!this.isAdmin()) { if (!this.isAdmin()) {
throw new Error("只有管理员才能运行此任务"); throw new Error("只有管理员才能运行此任务");
} }

View File

@ -26,43 +26,45 @@
</template> </template>
<div class="flex-col h-100 w-100 overflow-hidden"> <div class="flex-col h-100 w-100 overflow-hidden">
<a-tabs v-model:active-key="pluginGroupActive" tab-position="left" class="flex-1 overflow-hidden"> <a-tabs v-model:active-key="pluginGroupActive" tab-position="left" class="flex-1 overflow-hidden">
<a-tab-pane v-for="group of computedPluginGroups" :key="group.key" class="scroll-y"> <template v-for="group of computedPluginGroups" :key="group.key">
<template #tab> <a-tab-pane v-if="(group.key === 'admin' && userStore.isAdmin) || group.key !== 'admin'" :key="group.key" class="scroll-y">
<div class="cd-step-form-tab-label"> <template #tab>
<fs-icon :icon="group.icon" class="mr-2" /> <div class="cd-step-form-tab-label">
<div>{{ group.title }}</div> <fs-icon :icon="group.icon" class="mr-2" />
</div> <div>{{ group.title }}</div>
</template> </div>
<a-row v-if="!group.plugins || group.plugins.length === 0" :gutter="10"> </template>
<a-col class="flex-o"> <a-row v-if="!group.plugins || group.plugins.length === 0" :gutter="10">
<div class="flex-o m-10">没有找到插件</div> <a-col class="flex-o">
</a-col> <div class="flex-o m-10">没有找到插件</div>
</a-row> </a-col>
<a-row v-else :gutter="10"> </a-row>
<a-col v-for="item of group.plugins" :key="item.key" class="step-plugin w-full md:w-[50%]"> <a-row v-else :gutter="10">
<a-card <a-col v-for="item of group.plugins" :key="item.key" class="step-plugin w-full md:w-[50%]">
hoverable <a-card
:class="{ current: item.name === currentStep.type }" hoverable
@click="stepTypeSelected(item)" :class="{ current: item.name === currentStep.type }"
@dblclick=" @click="stepTypeSelected(item)"
stepTypeSelected(item); @dblclick="
stepTypeSave(); stepTypeSelected(item);
" stepTypeSave();
> "
<a-card-meta> >
<template #title> <a-card-meta>
<fs-icon class="plugin-icon" :icon="item.icon || 'clarity:plugin-line'"></fs-icon> <template #title>
<span class="title" :title="item.title">{{ item.title }}</span> <fs-icon class="plugin-icon" :icon="item.icon || 'clarity:plugin-line'"></fs-icon>
<vip-button v-if="item.needPlus" mode="icon" /> <span class="title" :title="item.title">{{ item.title }}</span>
</template> <vip-button v-if="item.needPlus" mode="icon" />
<template #description> </template>
<span :title="item.desc" v-html="transformDesc(item.desc)"></span> <template #description>
</template> <span :title="item.desc" v-html="transformDesc(item.desc)"></span>
</a-card-meta> </template>
</a-card> </a-card-meta>
</a-col> </a-card>
</a-row> </a-col>
</a-tab-pane> </a-row>
</a-tab-pane>
</template>
</a-tabs> </a-tabs>
</div> </div>
<template #footer> <template #footer>
@ -124,6 +126,7 @@ import { useReference } from "/@/use/use-refrence";
import { useSettingStore } from "/@/store/settings"; import { useSettingStore } from "/@/store/settings";
import { mitter } from "/@/utils/util.mitt"; import { mitter } from "/@/utils/util.mitt";
import { utils } from "/@/utils"; import { utils } from "/@/utils";
import { useUserStore } from "/@/store/user";
defineOptions({ defineOptions({
name: "PiStepForm", name: "PiStepForm",
@ -138,7 +141,7 @@ const props = defineProps({
const emit = defineEmits(["update"]); const emit = defineEmits(["update"]);
const pluginStore = usePluginStore(); const pluginStore = usePluginStore();
const userStore = useUserStore();
function transformDesc(desc: string = "") { function transformDesc(desc: string = "") {
return utils.transformLink(desc); return utils.transformLink(desc);
} }

View File

@ -6,7 +6,7 @@ import { httpsServer } from '../../modules/auto/https/server.js';
title: '重启 Certd', title: '重启 Certd',
icon: 'mdi:restart', icon: 'mdi:restart',
desc: '【仅管理员可用】 重启 certd的https服务用于更新 Certd 的 ssl 证书', desc: '【仅管理员可用】 重启 certd的https服务用于更新 Certd 的 ssl 证书',
group: pluginGroups.other.key, group: pluginGroups.admin.key,
onlyAdmin:true, onlyAdmin:true,
default: { default: {
strategy: { strategy: {

View File

@ -11,7 +11,7 @@ export type CustomScriptContext = {
title: '自定义js脚本', title: '自定义js脚本',
icon: 'ri:javascript-line', icon: 'ri:javascript-line',
desc: '【仅管理员】运行自定义js脚本执行', desc: '【仅管理员】运行自定义js脚本执行',
group: pluginGroups.other.key, group: pluginGroups.admin.key,
showRunStrategy: true, showRunStrategy: true,
onlyAdmin: true, onlyAdmin: true,
default: { default: {