fixed eslint issues w/ burnettk
This commit is contained in:
parent
75c3e9b4d4
commit
cb8e110f2c
|
@ -1,5 +1,5 @@
|
|||
import { ReactElement, useEffect, useState } from 'react';
|
||||
import { useNavigate, useSearchParams } from 'react-router-dom';
|
||||
import { useSearchParams } from 'react-router-dom';
|
||||
import {
|
||||
ArrowRight,
|
||||
// @ts-ignore
|
||||
|
@ -39,7 +39,7 @@ export default function ProcessGroupListTiles({
|
|||
path: `/process-groups${queryParams}`,
|
||||
successCallback: setProcessGroupsFromResult,
|
||||
});
|
||||
}, [searchParams]);
|
||||
}, [searchParams, processGroup]);
|
||||
|
||||
const processGroupDirectChildrenCount = (pg: ProcessGroup) => {
|
||||
return (pg.process_models || []).length + (pg.process_groups || []).length;
|
||||
|
@ -77,16 +77,15 @@ export default function ProcessGroupListTiles({
|
|||
};
|
||||
|
||||
const processGroupArea = () => {
|
||||
if (processGroups) {
|
||||
if (!processGroup || processGroups.length > 0) {
|
||||
return (
|
||||
<>
|
||||
{headerElement}
|
||||
{processGroupsDisplayArea()}
|
||||
</>
|
||||
);
|
||||
}
|
||||
if (processGroups && (!processGroup || processGroups.length > 0)) {
|
||||
return (
|
||||
<>
|
||||
{headerElement}
|
||||
{processGroupsDisplayArea()}
|
||||
</>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
if (processGroups) {
|
||||
|
|
|
@ -2,14 +2,9 @@ import { useState } from 'react';
|
|||
import { useNavigate } from 'react-router-dom';
|
||||
// @ts-ignore
|
||||
import { Button, ButtonSet, Form, Stack, TextInput } from '@carbon/react';
|
||||
import {
|
||||
getGroupFromModifiedModelId,
|
||||
modifyProcessModelPath,
|
||||
slugifyString,
|
||||
} from '../helpers';
|
||||
import { modifyProcessModelPath, slugifyString } from '../helpers';
|
||||
import HttpService from '../services/HttpService';
|
||||
import { ProcessModel } from '../interfaces';
|
||||
import ButtonWithConfirmation from './ButtonWithConfirmation';
|
||||
|
||||
type OwnProps = {
|
||||
mode: string;
|
||||
|
@ -40,14 +35,6 @@ export default function ProcessModelForm({
|
|||
}
|
||||
};
|
||||
|
||||
const navigateToProcessModels = (_result: any) => {
|
||||
navigate(
|
||||
`/admin/process-groups/${getGroupFromModifiedModelId(
|
||||
modifiedProcessModelPath
|
||||
)}`
|
||||
);
|
||||
};
|
||||
|
||||
const hasValidIdentifier = (identifierToCheck: string) => {
|
||||
return identifierToCheck.match(/^[a-z0-9][0-9a-z-]+[a-z0-9]$/);
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@ import {
|
|||
import { Can } from '@casl/react';
|
||||
import ProcessBreadcrumb from '../components/ProcessBreadcrumb';
|
||||
import HttpService from '../services/HttpService';
|
||||
import { modifyProcessModelPath, truncateString } from '../helpers';
|
||||
import { modifyProcessModelPath } from '../helpers';
|
||||
import { CarbonComboBoxSelection, PermissionsToCheck } from '../interfaces';
|
||||
import { useUriListForPermissions } from '../hooks/UriListForPermissions';
|
||||
import { usePermissionFetcher } from '../hooks/PermissionService';
|
||||
|
|
|
@ -27,11 +27,8 @@ export default function ProcessGroupShow() {
|
|||
|
||||
const [processGroup, setProcessGroup] = useState<ProcessGroup | null>(null);
|
||||
const [processModels, setProcessModels] = useState([]);
|
||||
const [processGroups, setProcessGroups] = useState([]);
|
||||
const [modelPagination, setModelPagination] =
|
||||
useState<PaginationObject | null>(null);
|
||||
const [groupPagination, setGroupPagination] =
|
||||
useState<PaginationObject | null>(null);
|
||||
|
||||
const { targetUris } = useUriListForPermissions();
|
||||
const permissionRequestData: PermissionsToCheck = {
|
||||
|
@ -48,10 +45,6 @@ export default function ProcessGroupShow() {
|
|||
setProcessModels(result.results);
|
||||
setModelPagination(result.pagination);
|
||||
};
|
||||
const setProcessGroupFromResult = (result: any) => {
|
||||
setProcessGroups(result.results);
|
||||
setGroupPagination(result.pagination);
|
||||
};
|
||||
const processResult = (result: any) => {
|
||||
setProcessGroup(result);
|
||||
const unmodifiedProcessGroupId = unModifyProcessModelPath(
|
||||
|
@ -61,10 +54,6 @@ export default function ProcessGroupShow() {
|
|||
path: `/process-models?process_group_identifier=${unmodifiedProcessGroupId}&per_page=${perPage}&page=${page}`,
|
||||
successCallback: setProcessModelFromResult,
|
||||
});
|
||||
HttpService.makeCallToBackend({
|
||||
path: `/process-groups?process_group_identifier=${unmodifiedProcessGroupId}&per_page=${perPage}&page=${page}`,
|
||||
successCallback: setProcessGroupFromResult,
|
||||
});
|
||||
};
|
||||
HttpService.makeCallToBackend({
|
||||
path: `/process-groups/${params.process_group_id}`,
|
||||
|
@ -110,43 +99,7 @@ export default function ProcessGroupShow() {
|
|||
);
|
||||
};
|
||||
|
||||
const buildGroupTable = () => {
|
||||
if (processGroup === null) {
|
||||
return null;
|
||||
}
|
||||
const rows = processGroups.map((row: ProcessGroup) => {
|
||||
const modifiedProcessGroupId: String = modifyProcessModelPath(row.id);
|
||||
return (
|
||||
<tr key={row.id}>
|
||||
<td>
|
||||
<Link
|
||||
to={`/admin/process-groups/${modifiedProcessGroupId}`}
|
||||
data-qa="process-model-show-link"
|
||||
>
|
||||
{row.id}
|
||||
</Link>
|
||||
</td>
|
||||
<td>{row.display_name}</td>
|
||||
</tr>
|
||||
);
|
||||
});
|
||||
return (
|
||||
<div>
|
||||
<h3>Process Groups</h3>
|
||||
<Table striped bordered>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Process Group Id</th>
|
||||
<th>Display Name</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{rows}</tbody>
|
||||
</Table>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
if (processGroup && groupPagination && modelPagination) {
|
||||
if (processGroup && modelPagination) {
|
||||
const { page, perPage } = getPageInfoFromSearchParams(searchParams);
|
||||
const modifiedProcessGroupId = modifyProcessModelPath(processGroup.id);
|
||||
return (
|
||||
|
|
Loading…
Reference in New Issue