mirror of
https://github.com/Kingsrook/qqq-frontend-material-dashboard.git
synced 2025-07-19 22:00:45 +00:00
Merge branch 'integration/sprint-28' into feature/CTLE-214-dot-menu
This commit is contained in:
@ -929,12 +929,21 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
||||
}
|
||||
};
|
||||
|
||||
const handleSortChange = (gridSort: GridSortModel) =>
|
||||
const handleSortChangeForDataGrid = (gridSort: GridSortModel) =>
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// this method just wraps handleSortChange, but w/o the optional 2nd param, so we can use it in data grid //
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
handleSortChange(gridSort);
|
||||
}
|
||||
|
||||
const handleSortChange = (gridSort: GridSortModel, overrideFilterModel?: GridFilterModel) =>
|
||||
{
|
||||
if (gridSort && gridSort.length > 0)
|
||||
{
|
||||
setColumnSortModel(gridSort);
|
||||
setQueryFilter(FilterUtils.buildQFilterFromGridFilter(tableMetaData, filterModel, gridSort, rowsPerPage));
|
||||
const gridFilterModelToUse = overrideFilterModel ?? filterModel;
|
||||
setQueryFilter(FilterUtils.buildQFilterFromGridFilter(tableMetaData, gridFilterModelToUse, gridSort, rowsPerPage));
|
||||
localStorage.setItem(sortLocalStorageKey, JSON.stringify(gridSort));
|
||||
}
|
||||
};
|
||||
@ -1286,13 +1295,13 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
||||
|
||||
const models = await FilterUtils.determineFilterAndSortModels(qController, tableMetaData, qRecord.values.get("filterJson"), null, null, null);
|
||||
handleFilterChange(models.filter);
|
||||
handleSortChange(models.sort);
|
||||
handleSortChange(models.sort, models.filter);
|
||||
localStorage.setItem(currentSavedFilterLocalStorageKey, selectedSavedFilterId.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
handleFilterChange({items: []} as GridFilterModel);
|
||||
handleSortChange([{field: tableMetaData.primaryKeyField, sort: "desc"}]);
|
||||
handleSortChange([{field: tableMetaData.primaryKeyField, sort: "desc"}], {items: []} as GridFilterModel);
|
||||
localStorage.removeItem(currentSavedFilterLocalStorageKey);
|
||||
}
|
||||
}
|
||||
@ -1692,7 +1701,7 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
||||
menuItems.push(<MenuItem key={process.name} onClick={() => processClicked(process)}><ListItemIcon><Icon>{process.iconName ?? "arrow_forward"}</Icon></ListItemIcon>{process.label}</MenuItem>);
|
||||
}
|
||||
|
||||
menuItems.push(<MenuItem key="developerMode" onClick={() => navigate("dev")}><ListItemIcon><Icon>code</Icon></ListItemIcon>Developer Mode</MenuItem>);
|
||||
menuItems.push(<MenuItem key="developerMode" onClick={() => navigate(`${metaData.getTablePathByName(tableName)}/dev`)}><ListItemIcon><Icon>code</Icon></ListItemIcon>Developer Mode</MenuItem>);
|
||||
|
||||
if (tableProcesses && tableProcesses.length)
|
||||
{
|
||||
@ -1919,7 +1928,7 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
||||
onColumnVisibilityModelChange={handleColumnVisibilityChange}
|
||||
onColumnOrderChange={handleColumnOrderChange}
|
||||
onSelectionModelChange={selectionChanged}
|
||||
onSortModelChange={handleSortChange}
|
||||
onSortModelChange={handleSortChangeForDataGrid}
|
||||
sortingOrder={["asc", "desc"]}
|
||||
sortModel={columnSortModel}
|
||||
getRowClassName={(params) => (params.indexRelativeToCurrentPage % 2 === 0 ? "even" : "odd")}
|
||||
|
@ -329,10 +329,24 @@ function RecordView({table, launchProcess}: Props): JSX.Element
|
||||
const metaData = await qController.loadMetaData();
|
||||
setMetaData(metaData);
|
||||
ValueUtils.qInstance = metaData;
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
// load the processes to show in the action menu //
|
||||
///////////////////////////////////////////////////
|
||||
const processesForTable = ProcessUtils.getProcessesForTable(metaData, tableName);
|
||||
processesForTable.sort((a, b) => a.label.localeCompare(b.label));
|
||||
setTableProcesses(processesForTable);
|
||||
setAllTableProcesses(ProcessUtils.getProcessesForTable(metaData, tableName, true)); // these include hidden ones (e.g., to find the bulks)
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// load processes that the routing needs to respect //
|
||||
//////////////////////////////////////////////////////
|
||||
const allTableProcesses = ProcessUtils.getProcessesForTable(metaData, tableName, true) // these include hidden ones (e.g., to find the bulks)
|
||||
const runRecordScriptProcess = metaData?.processes.get("runRecordScript");
|
||||
if (runRecordScriptProcess)
|
||||
{
|
||||
allTableProcesses.unshift(runRecordScriptProcess)
|
||||
}
|
||||
setAllTableProcesses(allTableProcesses);
|
||||
|
||||
if (launchingProcess)
|
||||
{
|
||||
@ -570,6 +584,14 @@ function RecordView({table, launchProcess}: Props): JSX.Element
|
||||
|
||||
let hasEditOrDelete = (table.capabilities.has(Capability.TABLE_UPDATE) && table.editPermission) || (table.capabilities.has(Capability.TABLE_DELETE) && table.deletePermission);
|
||||
|
||||
function gotoCreate()
|
||||
{
|
||||
const path = `${pathParts.slice(0, -1).join("/")}/create`;
|
||||
navigate(path);
|
||||
}
|
||||
|
||||
const runRecordScriptProcess = metaData?.processes.get("runRecordScript");
|
||||
|
||||
const renderActionsMenu = (
|
||||
<Menu
|
||||
anchorEl={actionsMenu}
|
||||
@ -626,8 +648,15 @@ function RecordView({table, launchProcess}: Props): JSX.Element
|
||||
</MenuItem>
|
||||
))}
|
||||
{(tableProcesses?.length > 0 || hasEditOrDelete) && <Divider />}
|
||||
{
|
||||
runRecordScriptProcess &&
|
||||
<MenuItem key={runRecordScriptProcess.name} onClick={() => processClicked(runRecordScriptProcess)}>
|
||||
<ListItemIcon><Icon>{runRecordScriptProcess.iconName ?? "arrow_forward"}</Icon></ListItemIcon>
|
||||
{runRecordScriptProcess.label}
|
||||
</MenuItem>
|
||||
}
|
||||
<MenuItem onClick={() => navigate("dev")}>
|
||||
<ListItemIcon><Icon>data_object</Icon></ListItemIcon>
|
||||
<ListItemIcon><Icon>code</Icon></ListItemIcon>
|
||||
Developer Mode
|
||||
</MenuItem>
|
||||
{
|
||||
@ -853,7 +882,7 @@ function RecordView({table, launchProcess}: Props): JSX.Element
|
||||
activeModalProcess &&
|
||||
<Modal open={activeModalProcess !== null} onClose={(event, reason) => closeModalProcess(event, reason)}>
|
||||
<div className="modalProcess">
|
||||
<ProcessRun process={activeModalProcess} isModal={true} recordIds={id} closeModalHandler={closeModalProcess} />
|
||||
<ProcessRun process={activeModalProcess} isModal={true} table={tableMetaData} recordIds={id} closeModalHandler={closeModalProcess} />
|
||||
</div>
|
||||
</Modal>
|
||||
}
|
||||
|
Reference in New Issue
Block a user