Renamed the checklist input type for consistency.
This commit is contained in:
parent
a52b05037b
commit
3286de24e7
@ -16,7 +16,7 @@ export enum InputType {
|
|||||||
hidden = "hidden",
|
hidden = "hidden",
|
||||||
image = "image",
|
image = "image",
|
||||||
month = "month",
|
month = "month",
|
||||||
multiselect = "multiselect",
|
checklist = "checklist",
|
||||||
number = "number",
|
number = "number",
|
||||||
password = "password",
|
password = "password",
|
||||||
radio = "radio",
|
radio = "radio",
|
||||||
@ -120,7 +120,6 @@ function Input(props: InputProps) {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<div className={flexClassName}>
|
<div className={flexClassName}>
|
||||||
{/* TEXTAREA */}
|
|
||||||
{type === InputType.textarea && (
|
{type === InputType.textarea && (
|
||||||
<textarea
|
<textarea
|
||||||
id={name}
|
id={name}
|
||||||
@ -133,8 +132,7 @@ function Input(props: InputProps) {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* MULTISELECT */}
|
{type === InputType.checklist && (
|
||||||
{type === InputType.multiselect && (
|
|
||||||
<Checklist
|
<Checklist
|
||||||
value={(value as string[]) ?? []}
|
value={(value as string[]) ?? []}
|
||||||
options={options ?? []}
|
options={options ?? []}
|
||||||
@ -149,7 +147,7 @@ function Input(props: InputProps) {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{/* ALL OTHER INPUT TYPES */}
|
{/* ALL OTHER INPUT TYPES */}
|
||||||
{type !== InputType.textarea && type !== InputType.multiselect && (
|
{type !== InputType.textarea && type !== InputType.checklist && (
|
||||||
<input
|
<input
|
||||||
{...rest}
|
{...rest}
|
||||||
id={name}
|
id={name}
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
|
import { InputType } from "../../../../../components/common/Input";
|
||||||
import { TaskDefinition } from "../../services/WorkflowTemplateService";
|
import { TaskDefinition } from "../../services/WorkflowTemplateService";
|
||||||
|
import { renderTaskField } from "../taskEditorHelpers";
|
||||||
import {
|
import {
|
||||||
CapabilityEditorProps,
|
CapabilityEditorProps,
|
||||||
capabilityEditorRegistryEntry,
|
capabilityEditorRegistryEntry,
|
||||||
@ -6,9 +8,20 @@ import {
|
|||||||
} from "../useCapabilityDefaults";
|
} from "../useCapabilityDefaults";
|
||||||
|
|
||||||
export const TagsEditor: React.FC<CapabilityEditorProps> = (props) => {
|
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 = (
|
const runValidation = (
|
||||||
@ -24,7 +37,9 @@ export function defaultsAssignment(
|
|||||||
task: TaskDefinition,
|
task: TaskDefinition,
|
||||||
tasks: TaskDefinition[],
|
tasks: TaskDefinition[],
|
||||||
ctx: defaultsContext,
|
ctx: defaultsContext,
|
||||||
) {}
|
) {
|
||||||
|
task.config.tags = [] as string[];
|
||||||
|
}
|
||||||
|
|
||||||
export const tagsEditorRegistryEntry: capabilityEditorRegistryEntry = {
|
export const tagsEditorRegistryEntry: capabilityEditorRegistryEntry = {
|
||||||
Editor: TagsEditor,
|
Editor: TagsEditor,
|
||||||
|
|||||||
@ -93,7 +93,7 @@ export const TaskCoreEditor: React.FC<CapabilityEditorProps> = (props) => {
|
|||||||
onChange,
|
onChange,
|
||||||
"predecessors",
|
"predecessors",
|
||||||
"Predecessors",
|
"Predecessors",
|
||||||
InputType.multiselect,
|
InputType.checklist,
|
||||||
fieldErrors,
|
fieldErrors,
|
||||||
"",
|
"",
|
||||||
0,
|
0,
|
||||||
|
|||||||
@ -31,7 +31,10 @@ export const TaskEditor: React.FC<TaskEditorProps> = ({
|
|||||||
|
|
||||||
for (const capability of taskMeta?.capabilities ?? []) {
|
for (const capability of taskMeta?.capabilities ?? []) {
|
||||||
const entry = capabilityEditorRegistry[capability];
|
const entry = capabilityEditorRegistry[capability];
|
||||||
if (!entry?.ValidationRunner) continue;
|
|
||||||
|
if (!entry?.ValidationRunner) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const validationErrors = entry.ValidationRunner(task, tasks);
|
const validationErrors = entry.ValidationRunner(task, tasks);
|
||||||
Object.assign(errors, validationErrors);
|
Object.assign(errors, validationErrors);
|
||||||
@ -65,7 +68,10 @@ export const TaskEditor: React.FC<TaskEditorProps> = ({
|
|||||||
<div>
|
<div>
|
||||||
{taskMeta?.capabilities.map((capability) => {
|
{taskMeta?.capabilities.map((capability) => {
|
||||||
const entry = capabilityEditorRegistry[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;
|
const Editor = entry.Editor;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user