call proceses through setProcesses to ensure we have up to date value and removed debug logs w/ burnettk
This commit is contained in:
parent
4fd716f10f
commit
338cf8fa5a
|
@ -42,7 +42,7 @@ class ProcessModelService(FileSystemService):
|
||||||
@classmethod
|
@classmethod
|
||||||
def path_to_id(cls, path: str) -> str:
|
def path_to_id(cls, path: str) -> str:
|
||||||
"""Replace the os path separator for the standard id separator."""
|
"""Replace the os path separator for the standard id separator."""
|
||||||
return path.replace(os.sep, '/')
|
return path.replace(os.sep, "/")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def is_group(cls, path: str) -> bool:
|
def is_group(cls, path: str) -> bool:
|
||||||
|
@ -233,7 +233,11 @@ class ProcessModelService(FileSystemService):
|
||||||
user = UserService.current_user()
|
user = UserService.current_user()
|
||||||
new_process_model_list = []
|
new_process_model_list = []
|
||||||
for process_model in process_models:
|
for process_model in process_models:
|
||||||
modified_process_model_id = ProcessModelInfo.modify_process_identifier_for_path_param(process_model.id)
|
modified_process_model_id = (
|
||||||
|
ProcessModelInfo.modify_process_identifier_for_path_param(
|
||||||
|
process_model.id
|
||||||
|
)
|
||||||
|
)
|
||||||
uri = f"/v1.0/process-instances/{modified_process_model_id}"
|
uri = f"/v1.0/process-instances/{modified_process_model_id}"
|
||||||
has_permission = AuthorizationService.user_has_permission(
|
has_permission = AuthorizationService.user_has_permission(
|
||||||
user=user, permission="create", target_uri=uri
|
user=user, permission="create", target_uri=uri
|
||||||
|
@ -427,7 +431,9 @@ class ProcessModelService(FileSystemService):
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
process_group_id = cls.path_to_id(dir_path.replace(FileSystemService.root_path(), ""))
|
process_group_id = cls.path_to_id(
|
||||||
|
dir_path.replace(FileSystemService.root_path(), "")
|
||||||
|
)
|
||||||
process_group = ProcessGroup(
|
process_group = ProcessGroup(
|
||||||
id="",
|
id="",
|
||||||
display_name=process_group_id,
|
display_name=process_group_id,
|
||||||
|
|
|
@ -265,12 +265,7 @@ export default function ReactDiagramEditor({
|
||||||
});
|
});
|
||||||
|
|
||||||
diagramModeler.on('spiff.callactivity.edit', (event: any) => {
|
diagramModeler.on('spiff.callactivity.edit', (event: any) => {
|
||||||
console.log('Received event spiff.callactivity.edit');
|
|
||||||
if (onLaunchBpmnEditor) {
|
if (onLaunchBpmnEditor) {
|
||||||
console.log(
|
|
||||||
'Calling function onLaunchBpmnEditor with ',
|
|
||||||
event.processId
|
|
||||||
);
|
|
||||||
onLaunchBpmnEditor(event.processId);
|
onLaunchBpmnEditor(event.processId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -121,10 +121,6 @@ export default function ProcessModelEditDiagram() {
|
||||||
Object.assign(item, { label });
|
Object.assign(item, { label });
|
||||||
return item;
|
return item;
|
||||||
});
|
});
|
||||||
console.log(
|
|
||||||
'Setting Process arrays with selection of length: ',
|
|
||||||
selectionArray.length
|
|
||||||
);
|
|
||||||
setProcesses(selectionArray);
|
setProcesses(selectionArray);
|
||||||
};
|
};
|
||||||
HttpService.makeCallToBackend({
|
HttpService.makeCallToBackend({
|
||||||
|
@ -791,7 +787,6 @@ export default function ProcessModelEditDiagram() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const processModelSelector = () => {
|
const processModelSelector = () => {
|
||||||
console.log('IN MODEL SELECTOR: ', processes);
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
open={showProcessSearch}
|
open={showProcessSearch}
|
||||||
|
@ -832,25 +827,30 @@ export default function ProcessModelEditDiagram() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onLaunchBpmnEditor = (processId: string) => {
|
const onLaunchBpmnEditor = (processId: string) => {
|
||||||
console.log('onLaunchBpmnEditor - processId: ', processId);
|
// using the "setState" method with a function gives us access to the
|
||||||
console.log('processes', processes);
|
// most current state of processes. Otherwise it uses the stale state
|
||||||
const processRef = processes.find((p) => {
|
// when passing the callback to a non-React component like bpmn-js:
|
||||||
return p.identifier === processId;
|
// https://stackoverflow.com/a/60643670/6090676
|
||||||
|
setProcesses((upToDateProcesses: ProcessReference[]) => {
|
||||||
|
const processRef = upToDateProcesses.find((p) => {
|
||||||
|
return p.identifier === processId;
|
||||||
|
});
|
||||||
|
if (processRef) {
|
||||||
|
const path = generatePath(
|
||||||
|
'/admin/process-models/:process_model_path/files/:file_name',
|
||||||
|
{
|
||||||
|
process_model_path: modifyProcessIdentifierForPathParam(
|
||||||
|
processRef.process_model_id
|
||||||
|
),
|
||||||
|
file_name: processRef.file_name,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
window.open(path);
|
||||||
|
}
|
||||||
|
return upToDateProcesses;
|
||||||
});
|
});
|
||||||
if (processRef) {
|
|
||||||
console.log('Found ProcessRef: ', processRef);
|
|
||||||
const path = generatePath(
|
|
||||||
'/admin/process-models/:process_model_path/files/:file_name',
|
|
||||||
{
|
|
||||||
process_model_path: modifyProcessIdentifierForPathParam(
|
|
||||||
processRef.process_model_id
|
|
||||||
),
|
|
||||||
file_name: processRef.file_name,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
window.open(path);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onLaunchJsonEditor = (fileName: string) => {
|
const onLaunchJsonEditor = (fileName: string) => {
|
||||||
const path = generatePath(
|
const path = generatePath(
|
||||||
'/admin/process-models/:process_model_id/form/:file_name',
|
'/admin/process-models/:process_model_id/form/:file_name',
|
||||||
|
|
Loading…
Reference in New Issue