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 {
|
interface AddTaskButtonProps {
|
||||||
taskType: string;
|
taskType: string;
|
||||||
onAdd: (selectedType: string) => void;
|
onAdd: (selectedType: TaskMetadata) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const AddTaskButton: React.FC<AddTaskButtonProps> = ({ taskType, onAdd }) => {
|
const AddTaskButton: React.FC<AddTaskButtonProps> = ({ taskType, onAdd }) => {
|
||||||
@ -50,7 +50,7 @@ const AddTaskButton: React.FC<AddTaskButtonProps> = ({ taskType, onAdd }) => {
|
|||||||
key={item.taskType}
|
key={item.taskType}
|
||||||
className="dropdown-item"
|
className="dropdown-item"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
onAdd(item.taskType);
|
onAdd(item);
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -1,6 +1,10 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { TaskDefinition } from "../services/WorkflowTemplateService";
|
import {
|
||||||
|
TaskDefinition,
|
||||||
|
TaskMetadata,
|
||||||
|
} from "../services/WorkflowTemplateService";
|
||||||
import AddTaskButton from "./AddTaskButton";
|
import AddTaskButton from "./AddTaskButton";
|
||||||
|
import { Namespaces } from "../../../../i18n/i18n";
|
||||||
|
|
||||||
interface TaskListProps {
|
interface TaskListProps {
|
||||||
tasks: TaskDefinition[];
|
tasks: TaskDefinition[];
|
||||||
@ -9,11 +13,13 @@ interface TaskListProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const TaskList: React.FC<TaskListProps> = ({ tasks, taskType, onChange }) => {
|
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 = {
|
const newTask: TaskDefinition = {
|
||||||
type: selectedType,
|
type: selectedType.taskType,
|
||||||
// Fill in any other required fields with defaults
|
|
||||||
// e.g. name: "", config: {}, etc.
|
config: { name: tTaskType(selectedType.displayName) },
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log("Add Task clicked");
|
console.log("Add Task clicked");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user