Added support for IByPassable
This commit is contained in:
parent
066709eddb
commit
70e4258071
@ -0,0 +1,48 @@
|
||||
import { InputType } from "../../../../../components/common/Input";
|
||||
import { TaskDefinition } from "../../services/WorkflowTemplateService";
|
||||
import { renderTaskField } from "../taskEditorHelpers";
|
||||
import {
|
||||
CapabilityEditorProps,
|
||||
capabilityEditorRegistryEntry,
|
||||
defaultsContext,
|
||||
} from "../useCapabilityDefaults";
|
||||
|
||||
export const BypassableEditor: React.FC<CapabilityEditorProps> = (props) => {
|
||||
const { task, onChange, fieldErrors } = props;
|
||||
|
||||
return (
|
||||
<>
|
||||
{renderTaskField(
|
||||
task,
|
||||
onChange,
|
||||
"bypassable",
|
||||
"Bypassable",
|
||||
InputType.checkbox,
|
||||
fieldErrors,
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const runValidation = (
|
||||
task: TaskDefinition,
|
||||
tasks: TaskDefinition[],
|
||||
): Record<string, string> => {
|
||||
const errors: Record<string, string> = {};
|
||||
|
||||
return errors;
|
||||
};
|
||||
|
||||
export function defaultsAssignment(
|
||||
task: TaskDefinition,
|
||||
tasks: TaskDefinition[],
|
||||
ctx: defaultsContext,
|
||||
) {
|
||||
task.config.bypassable = false;
|
||||
}
|
||||
|
||||
export const bypassableEditorRegistryEntry: capabilityEditorRegistryEntry = {
|
||||
Editor: BypassableEditor,
|
||||
DefaultsAssignment: defaultsAssignment,
|
||||
ValidationRunner: runValidation,
|
||||
};
|
||||
@ -4,6 +4,7 @@ import { taskCoreEditorRegistryEntry } from "./CapabilityEditors/TaskCoreEditor"
|
||||
import { capabilityEditorRegistryEntry } from "./useCapabilityDefaults";
|
||||
import { outcomeOfApprovalVerdictRegistryEntry } from "./CapabilityEditors/OutcomeOfApprovalVerdictRegistryEntry";
|
||||
import { budgetEditorRegistryEntry } from "./CapabilityEditors/BudgetEditorRegistryEntry";
|
||||
import { bypassableEditorRegistryEntry } from "./CapabilityEditors/BypassableEditor";
|
||||
|
||||
export const capabilityEditorRegistry: Record<
|
||||
string,
|
||||
@ -14,4 +15,8 @@ export const capabilityEditorRegistry: Record<
|
||||
IBudget: budgetEditorRegistryEntry,
|
||||
"IAssignees<ITaskAssignee>": assigneesOfITaskAssigneeRegistryEntry,
|
||||
"IOutcome<ApprovalVerdict>": outcomeOfApprovalVerdictRegistryEntry,
|
||||
// IFormTemplate: null, //ToDo implement this
|
||||
IBypassable: bypassableEditorRegistryEntry,
|
||||
// "IStage<GeneralTaskAttribute>": null, //ToDo implement this
|
||||
// "IStage<ApprovalTaskAttribute>": null, //ToDo implement this
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user