refactor: pipeline edit view

This commit is contained in:
xiaojunnuo
2022-10-26 09:02:47 +08:00
parent af919c2f6e
commit 370a28c10e
48 changed files with 1606 additions and 3 deletions
+60
View File
@@ -0,0 +1,60 @@
import { FormItemProps } from "@fast-crud/fast-crud";
import { Registrable } from "../registry";
import { pluginRegistry } from "./registry";
export type TaskInput = {
[key: string]: any;
};
export type TaskOutput = {
[key: string]: any;
};
export enum ContextScope {
global,
pipeline,
runtime,
}
export type Storage = {
scope: ContextScope;
path: string;
};
export type TaskOutputDefine = {
title: string;
key: string;
value?: any;
storage?: Storage;
};
export type TaskInputDefine = FormItemProps;
export type PluginDefine = Registrable & {
input: {
[key: string]: TaskInputDefine;
};
output: {
[key: string]: TaskOutputDefine;
};
};
export interface TaskPlugin {
execute(input: TaskInput): Promise<TaskOutput>;
}
export type OutputVO = {
key: string;
title: string;
value: any;
};
export function IsTask(define: (() => PluginDefine) | PluginDefine) {
return function (target: any) {
if (define instanceof Function) {
target.define = define();
} else {
target.define = define;
}
pluginRegistry.install(target);
};
}