get breadcrumb on process group show (#862)
Co-authored-by: burnettk <burnettk@users.noreply.github.com>
This commit is contained in:
parent
d5c5bc12ae
commit
08547bbab7
|
@ -1,3 +1,4 @@
|
||||||
|
import { useEffect, useState } from 'react';
|
||||||
import { useParams, useNavigate } from 'react-router-dom';
|
import { useParams, useNavigate } from 'react-router-dom';
|
||||||
import { TrashCan, Edit } from '@carbon/icons-react';
|
import { TrashCan, Edit } from '@carbon/icons-react';
|
||||||
import { Button, Stack } from '@carbon/react';
|
import { Button, Stack } from '@carbon/react';
|
||||||
|
@ -6,9 +7,10 @@ import ProcessBreadcrumb from '../components/ProcessBreadcrumb';
|
||||||
import HttpService from '../services/HttpService';
|
import HttpService from '../services/HttpService';
|
||||||
import {
|
import {
|
||||||
modifyProcessIdentifierForPathParam,
|
modifyProcessIdentifierForPathParam,
|
||||||
|
setPageTitle,
|
||||||
unModifyProcessIdentifierForPathParam,
|
unModifyProcessIdentifierForPathParam,
|
||||||
} from '../helpers';
|
} from '../helpers';
|
||||||
import { PermissionsToCheck } from '../interfaces';
|
import { PermissionsToCheck, ProcessGroup } from '../interfaces';
|
||||||
import { useUriListForPermissions } from '../hooks/UriListForPermissions';
|
import { useUriListForPermissions } from '../hooks/UriListForPermissions';
|
||||||
import { usePermissionFetcher } from '../hooks/PermissionService';
|
import { usePermissionFetcher } from '../hooks/PermissionService';
|
||||||
import ProcessGroupListTiles from '../components/ProcessGroupListTiles';
|
import ProcessGroupListTiles from '../components/ProcessGroupListTiles';
|
||||||
|
@ -19,6 +21,8 @@ import useProcessGroupFetcher from '../hooks/useProcessGroupFetcher';
|
||||||
export default function ProcessGroupShow() {
|
export default function ProcessGroupShow() {
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const [processGroupForBreadcrumb, setProcessGroupForBreadcrumb] =
|
||||||
|
useState<ProcessGroup | null>(null);
|
||||||
|
|
||||||
const { targetUris } = useUriListForPermissions();
|
const { targetUris } = useUriListForPermissions();
|
||||||
const permissionRequestData: PermissionsToCheck = {
|
const permissionRequestData: PermissionsToCheck = {
|
||||||
|
@ -34,6 +38,17 @@ export default function ProcessGroupShow() {
|
||||||
);
|
);
|
||||||
const { processGroup } = useProcessGroupFetcher(unModifiedProcessGroupId);
|
const { processGroup } = useProcessGroupFetcher(unModifiedProcessGroupId);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const processResult = (result: ProcessGroup) => {
|
||||||
|
setProcessGroupForBreadcrumb(result);
|
||||||
|
setPageTitle([result.display_name]);
|
||||||
|
};
|
||||||
|
HttpService.makeCallToBackend({
|
||||||
|
path: `/process-groups/${params.process_group_id}`,
|
||||||
|
successCallback: processResult,
|
||||||
|
});
|
||||||
|
}, [params.process_group_id, setProcessGroupForBreadcrumb]);
|
||||||
|
|
||||||
const navigateToProcessGroups = (_result: any) => {
|
const navigateToProcessGroups = (_result: any) => {
|
||||||
navigate(`/process-groups`);
|
navigate(`/process-groups`);
|
||||||
};
|
};
|
||||||
|
@ -50,7 +65,7 @@ export default function ProcessGroupShow() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (processGroup && permissionsLoaded) {
|
if (processGroup && processGroupForBreadcrumb && permissionsLoaded) {
|
||||||
const modifiedProcessGroupId = modifyProcessIdentifierForPathParam(
|
const modifiedProcessGroupId = modifyProcessIdentifierForPathParam(
|
||||||
processGroup.id
|
processGroup.id
|
||||||
);
|
);
|
||||||
|
@ -63,7 +78,7 @@ export default function ProcessGroupShow() {
|
||||||
hotCrumbs={[
|
hotCrumbs={[
|
||||||
['Process Groups', '/process-groups'],
|
['Process Groups', '/process-groups'],
|
||||||
{
|
{
|
||||||
entityToExplode: processGroup,
|
entityToExplode: processGroupForBreadcrumb,
|
||||||
entityType: 'process-group',
|
entityType: 'process-group',
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
|
|
Loading…
Reference in New Issue