highlight tasks even if they are in subprocesses of called activities w/ burnettk
This commit is contained in:
parent
924856a547
commit
0513413557
|
@ -548,6 +548,10 @@ def process_instance_task_list(
|
|||
spiff_tasks = processor.get_all_user_tasks()
|
||||
|
||||
subprocesses_by_child_task_ids = processor.get_subprocesses_by_child_task_ids()
|
||||
processor.get_highest_level_subprocesses_by_child_task_ids(
|
||||
subprocesses_by_child_task_ids
|
||||
)
|
||||
|
||||
tasks = []
|
||||
for spiff_task in spiff_tasks:
|
||||
calling_subprocess_task_id = subprocesses_by_child_task_ids.get(
|
||||
|
|
|
@ -646,6 +646,23 @@ class ProcessInstanceProcessor:
|
|||
subprocesses_by_child_task_ids[task_id] = subprocess_id
|
||||
return subprocesses_by_child_task_ids
|
||||
|
||||
def get_highest_level_subprocesses_by_child_task_ids(
|
||||
self, subprocesses_by_child_task_ids: dict
|
||||
) -> dict:
|
||||
"""Ensure task ids point to the top level subprocess id.
|
||||
|
||||
This is done by checking if a subprocess is also a task until the subprocess is no longer a task.
|
||||
"""
|
||||
for task_id, subprocess_id in subprocesses_by_child_task_ids.items():
|
||||
if subprocess_id in subprocesses_by_child_task_ids:
|
||||
subprocesses_by_child_task_ids[task_id] = (
|
||||
subprocesses_by_child_task_ids[subprocess_id]
|
||||
)
|
||||
self.get_highest_level_subprocesses_by_child_task_ids(
|
||||
subprocesses_by_child_task_ids
|
||||
)
|
||||
return subprocesses_by_child_task_ids
|
||||
|
||||
def save(self) -> None:
|
||||
"""Saves the current state of this processor to the database."""
|
||||
self.process_instance_model.bpmn_json = self.serialize()
|
||||
|
|
|
@ -219,6 +219,20 @@ export const refreshAtInterval = (
|
|||
};
|
||||
};
|
||||
|
||||
// bpmn:SubProcess shape elements do not have children
|
||||
// but their moddle elements / businessOjects have flowElements
|
||||
// that can include the moddleElement of the subprocesses
|
||||
const getChildProcessesFromModdleElement = (bpmnModdleElement: any) => {
|
||||
let elements: string[] = [];
|
||||
bpmnModdleElement.flowElements.forEach((c: any) => {
|
||||
if (c.$type === 'bpmn:SubProcess') {
|
||||
elements.push(c.id);
|
||||
elements = [...elements, ...getChildProcessesFromModdleElement(c)];
|
||||
}
|
||||
});
|
||||
return elements;
|
||||
};
|
||||
|
||||
const getChildProcesses = (bpmnElement: any) => {
|
||||
let elements: string[] = [];
|
||||
bpmnElement.children.forEach((c: any) => {
|
||||
|
@ -229,6 +243,10 @@ const getChildProcesses = (bpmnElement: any) => {
|
|||
elements = [...elements, ...getChildProcesses(c)];
|
||||
} else if (c.type === 'bpmn:SubProcess') {
|
||||
elements.push(c.id);
|
||||
elements = [
|
||||
...elements,
|
||||
...getChildProcessesFromModdleElement(c.businessObject),
|
||||
];
|
||||
}
|
||||
});
|
||||
return elements;
|
||||
|
|
|
@ -205,7 +205,6 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
|
|||
!callingSubprocessId ||
|
||||
callingSubprocessId === task.calling_subprocess_task_id
|
||||
) {
|
||||
console.log('callingSubprocessId', callingSubprocessId);
|
||||
if (task.state === 'COMPLETED') {
|
||||
(taskIds.completed as any).push(task);
|
||||
}
|
||||
|
|
|
@ -685,7 +685,7 @@ export default function ProcessModelShow() {
|
|||
perPageOptions={[2, 5, 25]}
|
||||
showReports={false}
|
||||
/>
|
||||
<span data-qa="process-model-show-permissions-loaded">true</span>
|
||||
<span data-qa="process-model-show-permissions-loaded" />
|
||||
</Can>
|
||||
</>
|
||||
);
|
||||
|
|
|
@ -10,9 +10,13 @@ import { BACKEND_BASE_URL } from '../config';
|
|||
// Some explanation:
|
||||
// https://dev.to/nilanth/how-to-secure-jwt-in-a-single-page-application-cko
|
||||
|
||||
// const getCurrentLocation = (queryParams: string = window.location.search) => {
|
||||
const getCurrentLocation = () => {
|
||||
// to trim off any query params
|
||||
return `${window.location.origin}${window.location.pathname}`;
|
||||
const queryParamString = '';
|
||||
// if (queryParams) {
|
||||
// queryParamString = `?${queryParams}`;
|
||||
// }
|
||||
return `${window.location.origin}${window.location.pathname}${queryParamString}`;
|
||||
};
|
||||
|
||||
const doLogin = () => {
|
||||
|
@ -60,18 +64,20 @@ const getPreferredUsername = () => {
|
|||
// FIXME: we could probably change this search to a hook
|
||||
// and then could use useSearchParams here instead
|
||||
const getAuthTokenFromParams = () => {
|
||||
const queryParams = window.location.search;
|
||||
const accessTokenMatch = queryParams.match(/.*\baccess_token=([^&]+).*/);
|
||||
const idTokenMatch = queryParams.match(/.*\bid_token=([^&]+).*/);
|
||||
if (accessTokenMatch) {
|
||||
const accessToken = accessTokenMatch[1];
|
||||
const queryParams = new URLSearchParams(window.location.search);
|
||||
const accessToken = queryParams.get('access_token');
|
||||
const idToken = queryParams.get('id_token');
|
||||
|
||||
queryParams.delete('access_token');
|
||||
queryParams.delete('id_token');
|
||||
|
||||
if (accessToken) {
|
||||
localStorage.setItem('jwtAccessToken', accessToken);
|
||||
if (idTokenMatch) {
|
||||
const idToken = idTokenMatch[1];
|
||||
if (idToken) {
|
||||
localStorage.setItem('jwtIdToken', idToken);
|
||||
}
|
||||
// to remove token query param
|
||||
window.location.href = getCurrentLocation();
|
||||
// window.location.href = `${getCurrentLocation(queryParams.toString())}`;
|
||||
window.location.href = `${getCurrentLocation()}`;
|
||||
} else if (!isLoggedIn()) {
|
||||
doLogin();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue