From ea61d7819df4f7cd72580f15c78cc99a5dac3aad Mon Sep 17 00:00:00 2001 From: jasquat Date: Fri, 18 Nov 2022 15:25:04 -0500 Subject: [PATCH] fixed eslint issues w/ burnettk --- .../src/components/ProcessGroupListTiles.tsx | 21 ++++---- .../src/components/ProcessModelForm.tsx | 15 +----- .../src/routes/ProcessGroupList.tsx | 2 +- .../src/routes/ProcessGroupShow.tsx | 49 +------------------ 4 files changed, 13 insertions(+), 74 deletions(-) diff --git a/spiffworkflow-frontend/src/components/ProcessGroupListTiles.tsx b/spiffworkflow-frontend/src/components/ProcessGroupListTiles.tsx index e6916e95b..839f2149b 100644 --- a/spiffworkflow-frontend/src/components/ProcessGroupListTiles.tsx +++ b/spiffworkflow-frontend/src/components/ProcessGroupListTiles.tsx @@ -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) { diff --git a/spiffworkflow-frontend/src/components/ProcessModelForm.tsx b/spiffworkflow-frontend/src/components/ProcessModelForm.tsx index d579d5997..10f4ffd30 100644 --- a/spiffworkflow-frontend/src/components/ProcessModelForm.tsx +++ b/spiffworkflow-frontend/src/components/ProcessModelForm.tsx @@ -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]$/); }; diff --git a/spiffworkflow-frontend/src/routes/ProcessGroupList.tsx b/spiffworkflow-frontend/src/routes/ProcessGroupList.tsx index ba4513bbb..4c448f086 100644 --- a/spiffworkflow-frontend/src/routes/ProcessGroupList.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessGroupList.tsx @@ -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'; diff --git a/spiffworkflow-frontend/src/routes/ProcessGroupShow.tsx b/spiffworkflow-frontend/src/routes/ProcessGroupShow.tsx index 31f5297e9..3d6a0ee4f 100644 --- a/spiffworkflow-frontend/src/routes/ProcessGroupShow.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessGroupShow.tsx @@ -27,11 +27,8 @@ export default function ProcessGroupShow() { const [processGroup, setProcessGroup] = useState(null); const [processModels, setProcessModels] = useState([]); - const [processGroups, setProcessGroups] = useState([]); const [modelPagination, setModelPagination] = useState(null); - const [groupPagination, setGroupPagination] = - useState(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 ( - - - - {row.id} - - - {row.display_name} - - ); - }); - return ( -
-

Process Groups

- - - - - - - - {rows} -
Process Group IdDisplay Name
-
- ); - }; - - if (processGroup && groupPagination && modelPagination) { + if (processGroup && modelPagination) { const { page, perPage } = getPageInfoFromSearchParams(searchParams); const modifiedProcessGroupId = modifyProcessModelPath(processGroup.id); return (