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
|
||||
def path_to_id(cls, path: str) -> str:
|
||||
"""Replace the os path separator for the standard id separator."""
|
||||
return path.replace(os.sep, '/')
|
||||
return path.replace(os.sep, "/")
|
||||
|
||||
@classmethod
|
||||
def is_group(cls, path: str) -> bool:
|
||||
|
@ -233,7 +233,11 @@ class ProcessModelService(FileSystemService):
|
|||
user = UserService.current_user()
|
||||
new_process_model_list = []
|
||||
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}"
|
||||
has_permission = AuthorizationService.user_has_permission(
|
||||
user=user, permission="create", target_uri=uri
|
||||
|
@ -427,7 +431,9 @@ class ProcessModelService(FileSystemService):
|
|||
),
|
||||
)
|
||||
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(
|
||||
id="",
|
||||
display_name=process_group_id,
|
||||
|
|
|
@ -265,12 +265,7 @@ export default function ReactDiagramEditor({
|
|||
});
|
||||
|
||||
diagramModeler.on('spiff.callactivity.edit', (event: any) => {
|
||||
console.log('Received event spiff.callactivity.edit');
|
||||
if (onLaunchBpmnEditor) {
|
||||
console.log(
|
||||
'Calling function onLaunchBpmnEditor with ',
|
||||
event.processId
|
||||
);
|
||||
onLaunchBpmnEditor(event.processId);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -121,10 +121,6 @@ export default function ProcessModelEditDiagram() {
|
|||
Object.assign(item, { label });
|
||||
return item;
|
||||
});
|
||||
console.log(
|
||||
'Setting Process arrays with selection of length: ',
|
||||
selectionArray.length
|
||||
);
|
||||
setProcesses(selectionArray);
|
||||
};
|
||||
HttpService.makeCallToBackend({
|
||||
|
@ -791,7 +787,6 @@ export default function ProcessModelEditDiagram() {
|
|||
};
|
||||
|
||||
const processModelSelector = () => {
|
||||
console.log('IN MODEL SELECTOR: ', processes);
|
||||
return (
|
||||
<Modal
|
||||
open={showProcessSearch}
|
||||
|
@ -832,25 +827,30 @@ export default function ProcessModelEditDiagram() {
|
|||
};
|
||||
|
||||
const onLaunchBpmnEditor = (processId: string) => {
|
||||
console.log('onLaunchBpmnEditor - processId: ', processId);
|
||||
console.log('processes', processes);
|
||||
const processRef = processes.find((p) => {
|
||||
return p.identifier === processId;
|
||||
// using the "setState" method with a function gives us access to the
|
||||
// most current state of processes. Otherwise it uses the stale state
|
||||
// when passing the callback to a non-React component like bpmn-js:
|
||||
// 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 path = generatePath(
|
||||
'/admin/process-models/:process_model_id/form/:file_name',
|
||||
|
|
Loading…
Reference in New Issue