watch for specific values on params for useEffects w/ burnettk (#1271)
Co-authored-by: jasquat <jasquat@users.noreply.github.com>
This commit is contained in:
parent
917ee504cb
commit
8a773c81f8
|
@ -10,7 +10,7 @@ export const useUriListForPermissions = () => {
|
||||||
messageInstanceListPath: '/v1.0/messages',
|
messageInstanceListPath: '/v1.0/messages',
|
||||||
dataStoreListPath: '/v1.0/data-stores',
|
dataStoreListPath: '/v1.0/data-stores',
|
||||||
extensionListPath: '/v1.0/extensions',
|
extensionListPath: '/v1.0/extensions',
|
||||||
extensionPath: `/v1.0/extensions/${params.process_model}`,
|
extensionPath: `/v1.0/extensions/${params.page_identifier}`,
|
||||||
processGroupListPath: '/v1.0/process-groups',
|
processGroupListPath: '/v1.0/process-groups',
|
||||||
processGroupShowPath: `/v1.0/process-groups/${params.process_group_id}`,
|
processGroupShowPath: `/v1.0/process-groups/${params.process_group_id}`,
|
||||||
processInstanceActionPath: `/v1.0/process-instances/${params.process_model_id}/${params.process_instance_id}`,
|
processInstanceActionPath: `/v1.0/process-instances/${params.process_model_id}/${params.process_instance_id}`,
|
||||||
|
@ -40,7 +40,13 @@ export const useUriListForPermissions = () => {
|
||||||
userSearch: `/v1.0/users/search`,
|
userSearch: `/v1.0/users/search`,
|
||||||
userExists: `/v1.0/users/exists/by-username`,
|
userExists: `/v1.0/users/exists/by-username`,
|
||||||
};
|
};
|
||||||
}, [params]);
|
}, [
|
||||||
|
params.process_model_id,
|
||||||
|
params.file_name,
|
||||||
|
params.process_group_id,
|
||||||
|
params.process_instance_id,
|
||||||
|
params.page_identifier,
|
||||||
|
]);
|
||||||
|
|
||||||
return { targetUris };
|
return { targetUris };
|
||||||
};
|
};
|
||||||
|
|
|
@ -218,11 +218,7 @@ export default function Extension({
|
||||||
path: targetUris.extensionListPath,
|
path: targetUris.extensionListPath,
|
||||||
successCallback: processExtensionResult,
|
successCallback: processExtensionResult,
|
||||||
});
|
});
|
||||||
}, [
|
}, [setConfigsIfDesiredSchemaFile, targetUris.extensionListPath]);
|
||||||
setConfigsIfDesiredSchemaFile,
|
|
||||||
targetUris.extensionListPath,
|
|
||||||
targetUris.extensionPath,
|
|
||||||
]);
|
|
||||||
|
|
||||||
const processSubmitResult = (
|
const processSubmitResult = (
|
||||||
pageComponent: UiSchemaPageComponent,
|
pageComponent: UiSchemaPageComponent,
|
||||||
|
|
|
@ -20,7 +20,7 @@ export default function ProcessGroupEdit() {
|
||||||
path: `/process-groups/${params.process_group_id}`,
|
path: `/process-groups/${params.process_group_id}`,
|
||||||
successCallback: setProcessGroupsFromResult,
|
successCallback: setProcessGroupsFromResult,
|
||||||
});
|
});
|
||||||
}, [params]);
|
}, [params.process_group_id]);
|
||||||
|
|
||||||
if (processGroup) {
|
if (processGroup) {
|
||||||
setPageTitle([`Editing ${processGroup.display_name}`]);
|
setPageTitle([`Editing ${processGroup.display_name}`]);
|
||||||
|
|
|
@ -57,7 +57,7 @@ export default function ProcessInstanceReportEdit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
getProcessInstanceReport();
|
getProcessInstanceReport();
|
||||||
}, [params]);
|
}, [params.report_identifier]);
|
||||||
|
|
||||||
const editProcessInstanceReport = (event: any) => {
|
const editProcessInstanceReport = (event: any) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { Button, Table } from '@carbon/react';
|
import { Button, Table } from '@carbon/react';
|
||||||
import { useParams, Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { Can } from '@casl/react';
|
import { Can } from '@casl/react';
|
||||||
import HttpService from '../services/HttpService';
|
import HttpService from '../services/HttpService';
|
||||||
import { useUriListForPermissions } from '../hooks/UriListForPermissions';
|
import { useUriListForPermissions } from '../hooks/UriListForPermissions';
|
||||||
|
@ -9,7 +9,6 @@ import { PermissionsToCheck } from '../interfaces';
|
||||||
import { usePermissionFetcher } from '../hooks/PermissionService';
|
import { usePermissionFetcher } from '../hooks/PermissionService';
|
||||||
|
|
||||||
export default function ProcessInstanceReportList() {
|
export default function ProcessInstanceReportList() {
|
||||||
const params = useParams();
|
|
||||||
const [processInstanceReports, setProcessInstanceReports] = useState([]);
|
const [processInstanceReports, setProcessInstanceReports] = useState([]);
|
||||||
|
|
||||||
const { targetUris } = useUriListForPermissions();
|
const { targetUris } = useUriListForPermissions();
|
||||||
|
@ -23,7 +22,7 @@ export default function ProcessInstanceReportList() {
|
||||||
path: `/process-instances/reports`,
|
path: `/process-instances/reports`,
|
||||||
successCallback: setProcessInstanceReports,
|
successCallback: setProcessInstanceReports,
|
||||||
});
|
});
|
||||||
}, [params]);
|
}, []);
|
||||||
|
|
||||||
const buildTable = () => {
|
const buildTable = () => {
|
||||||
const rows = processInstanceReports.map((row) => {
|
const rows = processInstanceReports.map((row) => {
|
||||||
|
|
|
@ -237,6 +237,11 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
|
||||||
processInstanceShowPageBaseUrl = processInstanceShowPageBaseUrlAllVariant;
|
processInstanceShowPageBaseUrl = processInstanceShowPageBaseUrlAllVariant;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bpmnProcessGuid = searchParams.get('bpmn_process_guid');
|
||||||
|
const tab = searchParams.get('tab');
|
||||||
|
const taskSubTab = searchParams.get('taskSubTab');
|
||||||
|
const processIdentifier = searchParams.get('process_identifier');
|
||||||
|
|
||||||
const handleAddErrorInUseEffect = useCallback((value: ErrorForDisplay) => {
|
const handleAddErrorInUseEffect = useCallback((value: ErrorForDisplay) => {
|
||||||
addError(value);
|
addError(value);
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
@ -262,7 +267,6 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
|
||||||
if (typeof params.to_task_guid !== 'undefined') {
|
if (typeof params.to_task_guid !== 'undefined') {
|
||||||
taskParams = `${taskParams}&to_task_guid=${params.to_task_guid}`;
|
taskParams = `${taskParams}&to_task_guid=${params.to_task_guid}`;
|
||||||
}
|
}
|
||||||
const bpmnProcessGuid = searchParams.get('bpmn_process_guid');
|
|
||||||
if (bpmnProcessGuid) {
|
if (bpmnProcessGuid) {
|
||||||
taskParams = `${taskParams}&bpmn_process_guid=${bpmnProcessGuid}`;
|
taskParams = `${taskParams}&bpmn_process_guid=${bpmnProcessGuid}`;
|
||||||
}
|
}
|
||||||
|
@ -283,13 +287,12 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
|
||||||
ability,
|
ability,
|
||||||
handleAddErrorInUseEffect,
|
handleAddErrorInUseEffect,
|
||||||
params.to_task_guid,
|
params.to_task_guid,
|
||||||
searchParams,
|
|
||||||
taskListPath,
|
taskListPath,
|
||||||
|
bpmnProcessGuid,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const getProcessInstance = useCallback(() => {
|
const getProcessInstance = useCallback(() => {
|
||||||
let queryParams = '';
|
let queryParams = '';
|
||||||
const processIdentifier = searchParams.get('process_identifier');
|
|
||||||
if (processIdentifier) {
|
if (processIdentifier) {
|
||||||
queryParams = `?process_identifier=${processIdentifier}`;
|
queryParams = `?process_identifier=${processIdentifier}`;
|
||||||
}
|
}
|
||||||
|
@ -301,7 +304,12 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
|
||||||
path: `${apiPath}/${modifiedProcessModelId}/${params.process_instance_id}${queryParams}`,
|
path: `${apiPath}/${modifiedProcessModelId}/${params.process_instance_id}${queryParams}`,
|
||||||
successCallback: setProcessInstance,
|
successCallback: setProcessInstance,
|
||||||
});
|
});
|
||||||
}, [params, modifiedProcessModelId, searchParams, variant]);
|
}, [
|
||||||
|
params.process_instance_id,
|
||||||
|
modifiedProcessModelId,
|
||||||
|
variant,
|
||||||
|
processIdentifier,
|
||||||
|
]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (processInstance) {
|
if (processInstance) {
|
||||||
|
@ -320,20 +328,19 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
|
||||||
getProcessInstance();
|
getProcessInstance();
|
||||||
getActionableTaskList();
|
getActionableTaskList();
|
||||||
|
|
||||||
if (searchParams.get('tab')) {
|
if (tab) {
|
||||||
setSelectedTabIndex(parseInt(searchParams.get('tab') || '0', 10));
|
setSelectedTabIndex(parseInt(tab || '0', 10));
|
||||||
}
|
}
|
||||||
if (searchParams.get('taskSubTab')) {
|
if (taskSubTab) {
|
||||||
setSelectedTaskTabSubTab(
|
setSelectedTaskTabSubTab(parseInt(taskSubTab || '0', 10));
|
||||||
parseInt(searchParams.get('taskSubTab') || '0', 10)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}, [
|
}, [
|
||||||
permissionsLoaded,
|
permissionsLoaded,
|
||||||
getActionableTaskList,
|
getActionableTaskList,
|
||||||
getProcessInstance,
|
getProcessInstance,
|
||||||
searchParams,
|
tab,
|
||||||
|
taskSubTab,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const updateSearchParams = (value: string, key: string) => {
|
const updateSearchParams = (value: string, key: string) => {
|
||||||
|
@ -354,14 +361,12 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const queryParams = () => {
|
const queryParams = () => {
|
||||||
const processIdentifier = searchParams.get('process_identifier');
|
|
||||||
const callActivityTaskId = searchParams.get('bpmn_process_guid');
|
|
||||||
const queryParamArray = [];
|
const queryParamArray = [];
|
||||||
if (processIdentifier) {
|
if (processIdentifier) {
|
||||||
queryParamArray.push(`process_identifier=${processIdentifier}`);
|
queryParamArray.push(`process_identifier=${processIdentifier}`);
|
||||||
}
|
}
|
||||||
if (callActivityTaskId) {
|
if (bpmnProcessGuid) {
|
||||||
queryParamArray.push(`bpmn_process_guid=${callActivityTaskId}`);
|
queryParamArray.push(`bpmn_process_guid=${bpmnProcessGuid}`);
|
||||||
}
|
}
|
||||||
let queryParamString = '';
|
let queryParamString = '';
|
||||||
if (queryParamArray.length > 0) {
|
if (queryParamArray.length > 0) {
|
||||||
|
@ -790,15 +795,15 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
|
||||||
}
|
}
|
||||||
const dataObjectIdentifer = dataObjectRef.id;
|
const dataObjectIdentifer = dataObjectRef.id;
|
||||||
const parentProcess = shapeElement.businessObject.$parent;
|
const parentProcess = shapeElement.businessObject.$parent;
|
||||||
const processIdentifier = parentProcess.id;
|
const parentProcessIdentifier = parentProcess.id;
|
||||||
|
|
||||||
let additionalParams = '';
|
let additionalParams = '';
|
||||||
if (tasks) {
|
if (tasks) {
|
||||||
const matchingTask: Task | undefined = tasks.find((task: Task) => {
|
const matchingTask: Task | undefined = tasks.find((task: Task) => {
|
||||||
return task.bpmn_identifier === processIdentifier;
|
return task.bpmn_identifier === parentProcessIdentifier;
|
||||||
});
|
});
|
||||||
if (matchingTask) {
|
if (matchingTask) {
|
||||||
additionalParams = `?process_identifier=${processIdentifier}&bpmn_process_guid=${matchingTask.guid}`;
|
additionalParams = `?process_identifier=${parentProcessIdentifier}&bpmn_process_guid=${matchingTask.guid}`;
|
||||||
} else if (
|
} else if (
|
||||||
searchParams.get('process_identifier') &&
|
searchParams.get('process_identifier') &&
|
||||||
searchParams.get('bpmn_process_guid')
|
searchParams.get('bpmn_process_guid')
|
||||||
|
|
|
@ -32,7 +32,6 @@ import {
|
||||||
import { gray } from '@carbon/colors';
|
import { gray } from '@carbon/colors';
|
||||||
|
|
||||||
import Editor, { DiffEditor } from '@monaco-editor/react';
|
import Editor, { DiffEditor } from '@monaco-editor/react';
|
||||||
|
|
||||||
import MDEditor from '@uiw/react-md-editor';
|
import MDEditor from '@uiw/react-md-editor';
|
||||||
import HttpService from '../services/HttpService';
|
import HttpService from '../services/HttpService';
|
||||||
import ReactDiagramEditor from '../components/ReactDiagramEditor';
|
import ReactDiagramEditor from '../components/ReactDiagramEditor';
|
||||||
|
@ -191,7 +190,7 @@ export default function ProcessModelEditDiagram() {
|
||||||
successCallback: fileResult,
|
successCallback: fileResult,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [processModelPath, params]);
|
}, [processModelPath, params.file_name]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const bpmnProcessIds = processModelFile?.bpmn_process_ids;
|
const bpmnProcessIds = processModelFile?.bpmn_process_ids;
|
||||||
|
|
|
@ -93,7 +93,7 @@ export default function ReactFormEditor() {
|
||||||
successCallback: processResult,
|
successCallback: processResult,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [params, modifiedProcessModelId]);
|
}, [params.file_name, modifiedProcessModelId]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (processModelFile && processModel) {
|
if (processModelFile && processModel) {
|
||||||
|
|
|
@ -21,7 +21,7 @@ export default function SecretShow() {
|
||||||
path: `/secrets/${params.key}`,
|
path: `/secrets/${params.key}`,
|
||||||
successCallback: setSecret,
|
successCallback: setSecret,
|
||||||
});
|
});
|
||||||
}, [params]);
|
}, [params.key]);
|
||||||
|
|
||||||
const handleSecretValueChange = (event: any) => {
|
const handleSecretValueChange = (event: any) => {
|
||||||
if (secret) {
|
if (secret) {
|
||||||
|
|
Loading…
Reference in New Issue