mirror of
https://github.com/Kingsrook/qqq-frontend-material-dashboard.git
synced 2025-07-17 21:00:45 +00:00
CE-798 fix launching processes, because somehow that broke in here...
This commit is contained in:
@ -92,11 +92,22 @@ function QBreadcrumbs({icon, title, route, light}: Props): JSX.Element
|
|||||||
let accumulatedPath = "";
|
let accumulatedPath = "";
|
||||||
for (let i = 0; i < routes.length; i++)
|
for (let i = 0; i < routes.length; i++)
|
||||||
{
|
{
|
||||||
|
////////////////////////////////////////////////////////
|
||||||
|
// avoid showing "saved view" as a breadcrumb element //
|
||||||
|
////////////////////////////////////////////////////////
|
||||||
if(routes[i] === "savedView")
|
if(routes[i] === "savedView")
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
// avoid showing the table name if it's the element before savedView //
|
||||||
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
if(i < routes.length - 1 && routes[i+1] == "savedView")
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if(routes[i] === "")
|
if(routes[i] === "")
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@ -104,7 +104,7 @@ function SavedViews({qController, metaData, tableMetaData, currentSavedView, vie
|
|||||||
{
|
{
|
||||||
setSavedViewsHaveLoaded(true);
|
setSavedViewsHaveLoaded(true);
|
||||||
});
|
});
|
||||||
}, [location, tableMetaData, currentSavedView, view]) // todo#elimGrid does this monitoring work??
|
}, [location, tableMetaData])
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
@ -538,40 +538,22 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
|||||||
}
|
}
|
||||||
}, [dotMenuOpen, keyboardHelpOpen, metaData, activeModalProcess])
|
}, [dotMenuOpen, keyboardHelpOpen, metaData, activeModalProcess])
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// monitor location changes - if our url looks like a process, then open that process. //
|
/*******************************************************************************
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
const urlLooksLikeProcess = (): boolean =>
|
||||||
|
{
|
||||||
|
return (pathParts[pathParts.length - 2] === tableName);
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// monitor location changes - if our url looks like a savedView, then load that view, kinda //
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
useEffect(() =>
|
useEffect(() =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
// the path for a process looks like: .../table/process //
|
|
||||||
// so if our tableName is in the -2 index, try to open process //
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
if (pathParts[pathParts.length - 2] === tableName)
|
|
||||||
{
|
|
||||||
const processName = pathParts[pathParts.length - 1];
|
|
||||||
const processList = allTableProcesses.filter(p => p.name == processName);
|
|
||||||
if (processList.length > 0)
|
|
||||||
{
|
|
||||||
setActiveModalProcess(processList[0]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (metaData?.processes.has(processName))
|
|
||||||
{
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// check for generic processes - should this be a specific attribute on the process? //
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
setActiveModalProcess(metaData?.processes.get(processName));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
console.log(`Couldn't find process named ${processName}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// the path for a savedView looks like: .../table/savedView/32 //
|
// the path for a savedView looks like: .../table/savedView/32 //
|
||||||
// so if path has '/savedView/' get last parsed string //
|
// so if path has '/savedView/' get last parsed string //
|
||||||
@ -609,12 +591,6 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
|||||||
{
|
{
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// if we didn't open a process... not sure what we do in the table/query use-case //
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
setActiveModalProcess(null);
|
|
||||||
|
|
||||||
}, [location]);
|
}, [location]);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
@ -678,6 +654,7 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
|||||||
setTableVariantPromptOpen(true);
|
setTableVariantPromptOpen(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
@ -2079,6 +2056,41 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
|||||||
|
|
||||||
(async () =>
|
(async () =>
|
||||||
{
|
{
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// once we've loaded meta data, let's check the location to see if we should open a process //
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
try
|
||||||
|
{
|
||||||
|
/////////////////////////////////////////////////////////////////
|
||||||
|
// the path for a process looks like: .../table/process //
|
||||||
|
// so if our tableName is in the -2 index, try to open process //
|
||||||
|
/////////////////////////////////////////////////////////////////
|
||||||
|
if (pathParts[pathParts.length - 2] === tableName)
|
||||||
|
{
|
||||||
|
const processName = pathParts[pathParts.length - 1];
|
||||||
|
const processList = allTableProcesses.filter(p => p.name == processName);
|
||||||
|
if (processList.length > 0)
|
||||||
|
{
|
||||||
|
setActiveModalProcess(processList[0]);
|
||||||
|
}
|
||||||
|
else if (metaData?.processes.has(processName))
|
||||||
|
{
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// check for generic processes - should this be a specific attribute on the process? //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
setActiveModalProcess(metaData?.processes.get(processName));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
console.log(`Couldn't find process named ${processName}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e)
|
||||||
|
{
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
|
||||||
if (searchParams && searchParams.has("filter"))
|
if (searchParams && searchParams.has("filter"))
|
||||||
{
|
{
|
||||||
//////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -2161,9 +2173,9 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
|||||||
{
|
{
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// if the last time we were on this table, a currentSavedView was written to local storage - //
|
// if the last time we were on this table, a currentSavedView was written to local storage - //
|
||||||
// then navigate back to that view's URL //
|
// then navigate back to that view's URL - unless - it looks like we're on a process! //
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
if (localStorage.getItem(currentSavedViewLocalStorageKey))
|
if (localStorage.getItem(currentSavedViewLocalStorageKey) && !urlLooksLikeProcess())
|
||||||
{
|
{
|
||||||
const currentSavedViewId = Number.parseInt(localStorage.getItem(currentSavedViewLocalStorageKey));
|
const currentSavedViewId = Number.parseInt(localStorage.getItem(currentSavedViewLocalStorageKey));
|
||||||
console.log(`returning to previously active saved view ${currentSavedViewId}`);
|
console.log(`returning to previously active saved view ${currentSavedViewId}`);
|
||||||
@ -2531,7 +2543,7 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
tableMetaData &&
|
tableMetaData && tableMetaData.usesVariants &&
|
||||||
<TableVariantDialog table={tableMetaData} isOpen={tableVariantPromptOpen} closeHandler={(value: QTableVariant) =>
|
<TableVariantDialog table={tableMetaData} isOpen={tableVariantPromptOpen} closeHandler={(value: QTableVariant) =>
|
||||||
{
|
{
|
||||||
setTableVariantPromptOpen(false);
|
setTableVariantPromptOpen(false);
|
||||||
|
Reference in New Issue
Block a user