Skip to content

Commit

Permalink
400 - client -Use a more precise variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
ivicac committed Aug 1, 2023
1 parent df09951 commit 14e201e
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 100 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,30 +53,35 @@ const ProjectInstanceWorkflowList = ({

<ul>
{workflows?.map((workflow) => {
const names = workflow.tasks?.map(
const definitionNames = workflow.tasks?.map(
(task) => task.type.split('/')[0]
);

names?.forEach((name) => {
if (!workflowComponentDefinitions[name]) {
workflowComponentDefinitions[name] =
definitionNames?.forEach((definitionName) => {
if (!workflowComponentDefinitions[definitionName]) {
workflowComponentDefinitions[definitionName] =
componentDefinitions?.find(
(componentDefinition) =>
componentDefinition.name === name
componentDefinition.name ===
definitionName
);
}

if (!workflowTaskDispatcherDefinitions[name]) {
workflowTaskDispatcherDefinitions[name] =
if (
!workflowTaskDispatcherDefinitions[definitionName]
) {
workflowTaskDispatcherDefinitions[definitionName] =
taskDispatcherDefinitions?.find(
(taskDispatcherDefinition) =>
taskDispatcherDefinition.name === name
taskDispatcherDefinition.name ===
definitionName
);
}
});

const filteredNames = names?.filter(
(item, index) => names?.indexOf(item) === index
const filteredDefinitionNames = definitionNames?.filter(
(item, index) =>
definitionNames?.indexOf(item) === index
);

return (
Expand All @@ -95,48 +100,50 @@ const ProjectInstanceWorkflowList = ({
</div>

<div className="ml-6 flex">
{filteredNames?.map((name) => {
const componentDefinition =
workflowComponentDefinitions[
name
];
const taskDispatcherDefinition =
workflowTaskDispatcherDefinitions[
name
];

return (
<div
key={name}
className="mr-0.5 flex items-center justify-center rounded-full border p-1"
>
<TooltipProvider>
<Tooltip>
<TooltipTrigger>
<InlineSVG
className="h-5 w-5 flex-none"
key={
name
{filteredDefinitionNames?.map(
(name) => {
const componentDefinition =
workflowComponentDefinitions[
name
];
const taskDispatcherDefinition =
workflowTaskDispatcherDefinitions[
name
];

return (
<div
key={name}
className="mr-0.5 flex items-center justify-center rounded-full border p-1"
>
<TooltipProvider>
<Tooltip>
<TooltipTrigger>
<InlineSVG
className="h-5 w-5 flex-none"
key={
name
}
src={
componentDefinition?.icon
? componentDefinition?.icon
: taskDispatcherDefinition?.icon ??
''
}
/>
</TooltipTrigger>

<TooltipContent side="right">
{
componentDefinition?.title
}
src={
componentDefinition?.icon
? componentDefinition?.icon
: taskDispatcherDefinition?.icon ??
''
}
/>
</TooltipTrigger>

<TooltipContent side="right">
{
componentDefinition?.title
}
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
);
})}
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
);
}
)}
</div>

<div className="flex flex-1 justify-end text-sm">
Expand Down
107 changes: 58 additions & 49 deletions client/src/pages/automation/projects/ProjectWorkflowList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,35 @@ const ProjectWorkflowList = ({project}: {project: ProjectModel}) => {

<ul>
{workflows?.map((workflow) => {
const names = workflow.tasks?.map(
const definitionNames = workflow.tasks?.map(
(task) => task.type.split('/')[0]
);

names?.map((name) => {
if (!workflowComponentDefinitions[name]) {
workflowComponentDefinitions[name] =
definitionNames?.map((definitionName) => {
if (!workflowComponentDefinitions[definitionName]) {
workflowComponentDefinitions[definitionName] =
componentDefinitions?.find(
(componentDefinition) =>
componentDefinition.name === name
componentDefinition.name ===
definitionName
);
}

if (!workflowTaskDispatcherDefinitions[name]) {
workflowTaskDispatcherDefinitions[name] =
if (
!workflowTaskDispatcherDefinitions[definitionName]
) {
workflowTaskDispatcherDefinitions[definitionName] =
taskDispatcherDefinitions?.find(
(taskDispatcherDefinition) =>
taskDispatcherDefinition.name === name
taskDispatcherDefinition.name ===
definitionName
);
}
});

const filteredNames = names?.filter(
(item, index) => names?.indexOf(item) === index
const filteredDefinitionNames = definitionNames?.filter(
(item, index) =>
definitionNames?.indexOf(item) === index
);

return (
Expand All @@ -80,46 +85,50 @@ const ProjectWorkflowList = ({project}: {project: ProjectModel}) => {
</div>

<div className="ml-6 flex">
{filteredNames?.map((name) => {
const componentDefinition =
workflowComponentDefinitions[
name
];
const taskDispatcherDefinition =
workflowTaskDispatcherDefinitions[
name
];

return (
<div
key={name}
className="mr-0.5 flex items-center justify-center rounded-full border p-1"
>
<TooltipProvider>
<Tooltip>
<TooltipTrigger>
<InlineSVG
className="h-5 w-5 flex-none"
key={name}
src={
componentDefinition?.icon
? componentDefinition?.icon
: taskDispatcherDefinition?.icon ??
''
{filteredDefinitionNames?.map(
(name) => {
const componentDefinition =
workflowComponentDefinitions[
name
];
const taskDispatcherDefinition =
workflowTaskDispatcherDefinitions[
name
];

return (
<div
key={name}
className="mr-0.5 flex items-center justify-center rounded-full border p-1"
>
<TooltipProvider>
<Tooltip>
<TooltipTrigger>
<InlineSVG
className="h-5 w-5 flex-none"
key={
name
}
src={
componentDefinition?.icon
? componentDefinition?.icon
: taskDispatcherDefinition?.icon ??
''
}
/>
</TooltipTrigger>

<TooltipContent side="right">
{
componentDefinition?.title
}
/>
</TooltipTrigger>

<TooltipContent side="right">
{
componentDefinition?.title
}
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
);
})}
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
);
}
)}
</div>

<div className="flex flex-1 justify-end text-sm">
Expand Down

0 comments on commit 14e201e

Please sign in to comment.