Renamed the checklist input type for consistency.

This commit is contained in:
Colin Dawson 2026-02-15 16:57:05 +00:00
parent a52b05037b
commit 3286de24e7
4 changed files with 30 additions and 11 deletions

View File

@ -16,7 +16,7 @@ export enum InputType {
hidden = "hidden",
image = "image",
month = "month",
multiselect = "multiselect",
checklist = "checklist",
number = "number",
password = "password",
radio = "radio",
@ -120,7 +120,6 @@ function Input(props: InputProps) {
)}
<div className={flexClassName}>
{/* TEXTAREA */}
{type === InputType.textarea && (
<textarea
id={name}
@ -133,8 +132,7 @@ function Input(props: InputProps) {
/>
)}
{/* MULTISELECT */}
{type === InputType.multiselect && (
{type === InputType.checklist && (
<Checklist
value={(value as string[]) ?? []}
options={options ?? []}
@ -149,7 +147,7 @@ function Input(props: InputProps) {
)}
{/* ALL OTHER INPUT TYPES */}
{type !== InputType.textarea && type !== InputType.multiselect && (
{type !== InputType.textarea && type !== InputType.checklist && (
<input
{...rest}
id={name}

View File

@ -1,4 +1,6 @@
import { InputType } from "../../../../../components/common/Input";
import { TaskDefinition } from "../../services/WorkflowTemplateService";
import { renderTaskField } from "../taskEditorHelpers";
import {
CapabilityEditorProps,
capabilityEditorRegistryEntry,
@ -6,9 +8,20 @@ import {
} from "../useCapabilityDefaults";
export const TagsEditor: React.FC<CapabilityEditorProps> = (props) => {
const { task, tasks, onChange, fieldErrors } = props;
const { task, onChange, fieldErrors } = props;
return <>Tags editor goes here</>;
return (
<>
{renderTaskField(
task,
onChange,
"tags",
"Tags",
InputType.text,
fieldErrors,
)}
</>
);
};
const runValidation = (
@ -24,7 +37,9 @@ export function defaultsAssignment(
task: TaskDefinition,
tasks: TaskDefinition[],
ctx: defaultsContext,
) {}
) {
task.config.tags = [] as string[];
}
export const tagsEditorRegistryEntry: capabilityEditorRegistryEntry = {
Editor: TagsEditor,

View File

@ -93,7 +93,7 @@ export const TaskCoreEditor: React.FC<CapabilityEditorProps> = (props) => {
onChange,
"predecessors",
"Predecessors",
InputType.multiselect,
InputType.checklist,
fieldErrors,
"",
0,

View File

@ -31,7 +31,10 @@ export const TaskEditor: React.FC<TaskEditorProps> = ({
for (const capability of taskMeta?.capabilities ?? []) {
const entry = capabilityEditorRegistry[capability];
if (!entry?.ValidationRunner) continue;
if (!entry?.ValidationRunner) {
continue;
}
const validationErrors = entry.ValidationRunner(task, tasks);
Object.assign(errors, validationErrors);
@ -65,7 +68,10 @@ export const TaskEditor: React.FC<TaskEditorProps> = ({
<div>
{taskMeta?.capabilities.map((capability) => {
const entry = capabilityEditorRegistry[capability];
if (!entry) return null;
if (!entry) {
console.log(`No editor entry found for capability ${capability}.`);
return null;
}
const Editor = entry.Editor;