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,
runtime: this.runtime,
step,
define: cloneDeep(define),
lastStatus,
http,
download,

View File

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

View File

@ -26,7 +26,8 @@
</template>
<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-tab-pane v-for="group of computedPluginGroups" :key="group.key" class="scroll-y">
<template v-for="group of computedPluginGroups" :key="group.key">
<a-tab-pane v-if="(group.key === 'admin' && userStore.isAdmin) || group.key !== 'admin'" :key="group.key" class="scroll-y">
<template #tab>
<div class="cd-step-form-tab-label">
<fs-icon :icon="group.icon" class="mr-2" />
@ -63,6 +64,7 @@
</a-col>
</a-row>
</a-tab-pane>
</template>
</a-tabs>
</div>
<template #footer>
@ -124,6 +126,7 @@ import { useReference } from "/@/use/use-refrence";
import { useSettingStore } from "/@/store/settings";
import { mitter } from "/@/utils/util.mitt";
import { utils } from "/@/utils";
import { useUserStore } from "/@/store/user";
defineOptions({
name: "PiStepForm",
@ -138,7 +141,7 @@ const props = defineProps({
const emit = defineEmits(["update"]);
const pluginStore = usePluginStore();
const userStore = useUserStore();
function transformDesc(desc: string = "") {
return utils.transformLink(desc);
}

View File

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

View File

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