Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix workflow operations not refreshing #307

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,31 @@ import Notifications from "../../../shared/Notifications";
import {
getWorkflow,
getWorkflowOperations,
isFetchingWorkflowOperations,
} from "../../../../selectors/eventDetailsSelectors";
import EventDetailsTabHierarchyNavigation from "./EventDetailsTabHierarchyNavigation";
import { useAppDispatch, useAppSelector } from "../../../../store";
import { removeNotificationWizardForm } from "../../../../slices/notificationSlice";
import { fetchWorkflowOperationDetails, fetchWorkflowOperations } from "../../../../slices/eventDetailsSlice";
import { useTranslation } from "react-i18next";

/**
* This component manages the workflow operations for the workflows tab of the event details modal
*/
const EventDetailsWorkflowOperations = ({
// @ts-expect-error TS(7031): Binding element 'eventId' implicitly has an 'any' ... Remove this comment to see the full error message
eventId,
// @ts-expect-error TS(7031): Binding element 't' implicitly has an 'any' type.
t,
// @ts-expect-error TS(7031): Binding element 'setHierarchy' implicitly has an '... Remove this comment to see the full error message
setHierarchy,
}) => {
const { t } = useTranslation();
const dispatch = useAppDispatch();

const workflow = useAppSelector(state => getWorkflow(state));
const operations = useAppSelector(state => getWorkflowOperations(state));
const isFetching = useAppSelector(state => isFetchingWorkflowOperations(state));

const loadWorkflowOperations = async () => {
// Fetching workflow operations from server
await fetchWorkflowOperations({eventId, workflowId: workflow.wiid});
dispatch(fetchWorkflowOperations({eventId, workflowId: workflow.wiid}));
};

useEffect(() => {
Expand Down Expand Up @@ -78,64 +76,60 @@ const EventDetailsWorkflowOperations = ({
</header>
<div className="obj-container">
<table className="main-tbl">
{isFetching || (
<>
<thead>
<tr>
<th>
{
t(
"EVENTS.EVENTS.DETAILS.WORKFLOW_OPERATIONS.TABLE_HEADERS.STATUS"
) /* Status */
}
</th>
<th>
{
t(
"EVENTS.EVENTS.DETAILS.WORKFLOW_OPERATIONS.TABLE_HEADERS.TITLE"
) /* Title */
<thead>
<tr>
<th>
{
t(
"EVENTS.EVENTS.DETAILS.WORKFLOW_OPERATIONS.TABLE_HEADERS.STATUS"
) /* Status */
}
</th>
<th>
{
t(
"EVENTS.EVENTS.DETAILS.WORKFLOW_OPERATIONS.TABLE_HEADERS.TITLE"
) /* Title */
}
<i />
</th>
<th>
{
t(
"EVENTS.EVENTS.DETAILS.WORKFLOW_OPERATIONS.TABLE_HEADERS.DESCRIPTION"
) /* Description */
}
<i />
</th>
<th className="medium" />
</tr>
</thead>
<tbody>
{/* workflow operation details */}
{operations.entries.map((item, key) => (
<tr key={key}>
<td>{t(item.status)}</td>
<td>{item.title}</td>
<td>{item.description}</td>

{/* link to 'Operation Details' sub-Tab */}
<td>
<button
className="button-like-anchor details-link"
onClick={() =>
openSubTab("workflow-operation-details", key)
}
<i />
</th>
<th>
>
{
t(
"EVENTS.EVENTS.DETAILS.WORKFLOW_OPERATIONS.TABLE_HEADERS.DESCRIPTION"
) /* Description */
"EVENTS.EVENTS.DETAILS.MEDIA.DETAILS"
) /* Details */
}
<i />
</th>
<th className="medium" />
</tr>
</thead>
<tbody>
{/* workflow operation details */}
{operations.entries.map((item, key) => (
<tr key={key}>
<td>{t(item.status)}</td>
<td>{item.title}</td>
<td>{item.description}</td>

{/* link to 'Operation Details' sub-Tab */}
<td>
<button
className="button-like-anchor details-link"
onClick={() =>
openSubTab("workflow-operation-details", key)
}
>
{
t(
"EVENTS.EVENTS.DETAILS.MEDIA.DETAILS"
) /* Details */
}
</button>
</td>
</tr>
))}
</tbody>
</>
)}
</button>
</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion app/src/components/events/partials/modals/EventDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@ const EventDetails : React.FC<{
(workflowTabHierarchy === "workflow-operations" && (
<EventDetailsWorkflowOperations
eventId={eventId}
t={t}
setHierarchy={setWorkflowTabHierarchy}
/>
)) ||
Expand Down
Loading