The tasks display names are translated when adding a task to the task list.
This commit is contained in:
parent
9fb25fb698
commit
75f0a9c72e
@ -7,7 +7,7 @@ import { Namespaces } from "../../../../i18n/i18n";
|
||||
|
||||
interface AddTaskButtonProps {
|
||||
taskType: string;
|
||||
onAdd: (selectedType: string) => void;
|
||||
onAdd: (selectedType: TaskMetadata) => void;
|
||||
}
|
||||
|
||||
const AddTaskButton: React.FC<AddTaskButtonProps> = ({ taskType, onAdd }) => {
|
||||
@ -50,7 +50,7 @@ const AddTaskButton: React.FC<AddTaskButtonProps> = ({ taskType, onAdd }) => {
|
||||
key={item.taskType}
|
||||
className="dropdown-item"
|
||||
onClick={() => {
|
||||
onAdd(item.taskType);
|
||||
onAdd(item);
|
||||
setOpen(false);
|
||||
}}
|
||||
>
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
import React from "react";
|
||||
import { TaskDefinition } from "../services/WorkflowTemplateService";
|
||||
import {
|
||||
TaskDefinition,
|
||||
TaskMetadata,
|
||||
} from "../services/WorkflowTemplateService";
|
||||
import AddTaskButton from "./AddTaskButton";
|
||||
import { Namespaces } from "../../../../i18n/i18n";
|
||||
|
||||
interface TaskListProps {
|
||||
tasks: TaskDefinition[];
|
||||
@ -9,11 +13,13 @@ interface TaskListProps {
|
||||
}
|
||||
|
||||
const TaskList: React.FC<TaskListProps> = ({ tasks, taskType, onChange }) => {
|
||||
const handleAddTask = (selectedType: string) => {
|
||||
const { t: tTaskType } = useTranslation(Namespaces.TaskTypes);
|
||||
|
||||
const handleAddTask = (selectedType: TaskMetadata) => {
|
||||
const newTask: TaskDefinition = {
|
||||
type: selectedType,
|
||||
// Fill in any other required fields with defaults
|
||||
// e.g. name: "", config: {}, etc.
|
||||
type: selectedType.taskType,
|
||||
|
||||
config: { name: tTaskType(selectedType.displayName) },
|
||||
};
|
||||
|
||||
console.log("Add Task clicked");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user