Skip to content

Commit bd3aba5

Browse files
committed
Open workflow details first
When clicking on the Workflow tab in the event details, the user is presented with a list of workflows to select from. Most of the time, the user will selected the latest workflow. So this patch selects it for them automatically. The list of workflows can still be accessed through the tab hierarch navigation.
1 parent 24d5715 commit bd3aba5

9 files changed

Lines changed: 404 additions & 357 deletions

src/components/events/partials/ModalTabsAndPages/EventDetailsTabHierarchyNavigation.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ const EventDetailsTabHierarchyNavigation = <T, >({
1919
subTabArgument1,
2020
translationKey2,
2121
subTabArgument2,
22+
translationKey3,
23+
subTabArgument3,
2224
}: {
2325
openSubTab: (tabType: T) => void,
2426
hierarchyDepth: number,
@@ -28,6 +30,8 @@ const EventDetailsTabHierarchyNavigation = <T, >({
2830
subTabArgument1?: T,
2931
translationKey2?: ParseKeys,
3032
subTabArgument2?: T,
33+
translationKey3?: ParseKeys,
34+
subTabArgument3?: T,
3135
}) => {
3236
const { t } = useTranslation();
3337

@@ -67,12 +71,25 @@ const EventDetailsTabHierarchyNavigation = <T, >({
6771
{hierarchyDepth > 1 && subTabArgument2 && (
6872
<ButtonLikeAnchor
6973
extraClassName="breadcrumb-link scope"
70-
style={styleNavHierarchy}
74+
style={
75+
hierarchyDepth === 2
76+
? styleNavHierarchy
77+
: styleNavHierarchyInactive
78+
}
7179
onClick={() => openSubTab(subTabArgument2)}
7280
>
7381
{translationKey2 && t(translationKey2)}
7482
</ButtonLikeAnchor>
7583
)}
84+
{hierarchyDepth > 2 && subTabArgument3 && (
85+
<ButtonLikeAnchor
86+
extraClassName="breadcrumb-link scope"
87+
style={styleNavHierarchy}
88+
onClick={() => openSubTab(subTabArgument3)}
89+
>
90+
{translationKey3 && t(translationKey3)}
91+
</ButtonLikeAnchor>
92+
)}
7693
</nav>
7794
);
7895
};

src/components/events/partials/ModalTabsAndPages/EventDetailsWorkflowDetails.tsx

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import {
1414
fetchWorkflowDetails,
1515
fetchWorkflowOperationDetails,
1616
fetchWorkflowOperations,
17+
fetchWorkflows,
18+
setModalWorkflowId,
1719
setModalWorkflowTabHierarchy,
1820
} from "../../../../slices/eventDetailsSlice";
1921
import { removeNotificationWizardForm } from "../../../../slices/notificationSlice";
@@ -43,8 +45,18 @@ const EventDetailsWorkflowDetails = ({
4345
const isFetching = useAppSelector(state => isFetchingWorkflowDetails(state));
4446

4547
useEffect(() => {
46-
dispatch(fetchWorkflowDetails({ eventId, workflowId }));
47-
// eslint-disable-next-line react-hooks/exhaustive-deps
48+
if (!workflowId) {
49+
dispatch(fetchWorkflows(eventId)).unwrap()
50+
.then(workflows => {
51+
const currentWorkflow = workflows.entries[workflows.entries.length - 1];
52+
dispatch(fetchWorkflowDetails({ eventId, workflowId: currentWorkflow.id }));
53+
dispatch(setModalWorkflowId(currentWorkflow.id));
54+
},
55+
);
56+
} else {
57+
dispatch(fetchWorkflowDetails({ eventId, workflowId }));
58+
}
59+
// eslint-disable-next-line react-hooks/exhaustive-deps
4860
}, []);
4961

5062
const openSubTab = (tabType: WorkflowTabHierarchy) => {
@@ -63,9 +75,11 @@ const EventDetailsWorkflowDetails = ({
6375
/* Hierarchy navigation */
6476
<EventDetailsTabHierarchyNavigation
6577
openSubTab={openSubTab}
66-
hierarchyDepth={0}
67-
translationKey0={"EVENTS.EVENTS.DETAILS.WORKFLOW_DETAILS.TITLE"}
68-
subTabArgument0={"workflow-details"}
78+
hierarchyDepth={1}
79+
translationKey0={"EVENTS.EVENTS.DETAILS.WORKFLOW_INSTANCES.TITLE"}
80+
subTabArgument0={"workflows"}
81+
translationKey1={"EVENTS.EVENTS.DETAILS.WORKFLOW_DETAILS.TITLE"}
82+
subTabArgument1={"workflow-details"}
6983
/>
7084
}
7185
>

src/components/events/partials/ModalTabsAndPages/EventDetailsWorkflowErrorDetails.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ const EventDetailsWorkflowErrorDetails = () => {
3434
/* Hierarchy navigation */
3535
<EventDetailsTabHierarchyNavigation
3636
openSubTab={openSubTab}
37-
hierarchyDepth={1}
38-
translationKey0={"EVENTS.EVENTS.DETAILS.WORKFLOW_DETAILS.TITLE"}
39-
subTabArgument0={"workflow-details"}
40-
translationKey1={
41-
"EVENTS.EVENTS.DETAILS.ERRORS_AND_WARNINGS.DETAILS.HEADER"
42-
}
43-
subTabArgument1={"workflow-error-details"}
37+
hierarchyDepth={2}
38+
translationKey0={"EVENTS.EVENTS.DETAILS.WORKFLOW_INSTANCES.TITLE"}
39+
subTabArgument0={"workflows"}
40+
translationKey1={"EVENTS.EVENTS.DETAILS.WORKFLOW_DETAILS.TITLE"}
41+
subTabArgument1={"workflow-details"}
42+
translationKey2={"EVENTS.EVENTS.DETAILS.ERRORS_AND_WARNINGS.DETAILS.HEADER"}
43+
subTabArgument2={"workflow-error-details"}
4444
/>
4545
}
4646
modalBodyChildren={<Notifications context="not_corner" />}

src/components/events/partials/ModalTabsAndPages/EventDetailsWorkflowOperationDetails.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@ const EventDetailsWorkflowOperationDetails = () => {
3434
/* Hierarchy navigation */
3535
<EventDetailsTabHierarchyNavigation
3636
openSubTab={openSubTab}
37-
hierarchyDepth={2}
38-
translationKey0={"EVENTS.EVENTS.DETAILS.WORKFLOW_DETAILS.TITLE"}
39-
subTabArgument0={"workflow-details"}
40-
translationKey1={"EVENTS.EVENTS.DETAILS.WORKFLOW_OPERATIONS.TITLE"}
41-
subTabArgument1={"workflow-operations"}
42-
translationKey2={"EVENTS.EVENTS.DETAILS.OPERATION_DETAILS.TITLE"}
43-
subTabArgument2={"workflow-operation-details"}
37+
hierarchyDepth={3}
38+
translationKey0={"EVENTS.EVENTS.DETAILS.WORKFLOW_INSTANCES.TITLE"}
39+
subTabArgument0={"workflows"}
40+
translationKey1={"EVENTS.EVENTS.DETAILS.WORKFLOW_DETAILS.TITLE"}
41+
subTabArgument1={"workflow-details"}
42+
translationKey2={"EVENTS.EVENTS.DETAILS.WORKFLOW_OPERATIONS.TITLE"}
43+
subTabArgument2={"workflow-operations"}
44+
translationKey3={"EVENTS.EVENTS.DETAILS.OPERATION_DETAILS.TITLE"}
45+
subTabArgument3={"workflow-operation-details"}
4446
/>
4547
}
4648
modalBodyChildren={<Notifications context="not_corner" />}

src/components/events/partials/ModalTabsAndPages/EventDetailsWorkflowOperations.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,13 @@ const EventDetailsWorkflowOperations = ({
6060
/* Hierarchy navigation */
6161
<EventDetailsTabHierarchyNavigation
6262
openSubTab={openSubTab}
63-
hierarchyDepth={1}
64-
translationKey0={"EVENTS.EVENTS.DETAILS.WORKFLOW_DETAILS.TITLE"}
65-
subTabArgument0={"workflow-details"}
66-
translationKey1={"EVENTS.EVENTS.DETAILS.WORKFLOW_OPERATIONS.TITLE"}
67-
subTabArgument1={"workflow-operations"}
63+
hierarchyDepth={2}
64+
translationKey0={"EVENTS.EVENTS.DETAILS.WORKFLOW_INSTANCES.TITLE"}
65+
subTabArgument0={"workflows"}
66+
translationKey1={"EVENTS.EVENTS.DETAILS.WORKFLOW_DETAILS.TITLE"}
67+
subTabArgument1={"workflow-details"}
68+
translationKey2={"EVENTS.EVENTS.DETAILS.WORKFLOW_OPERATIONS.TITLE"}
69+
subTabArgument2={"workflow-operations"}
6870
/>
6971
}
7072
modalBodyChildren={<Notifications context="not_corner" />}

0 commit comments

Comments
 (0)