mirror of
https://github.com/Kingsrook/qqq-frontend-material-dashboard.git
synced 2025-07-18 05:10:45 +00:00
CE-793 - Cleanup from initial pre-qa qa
This commit is contained in:
@ -282,6 +282,12 @@ function SavedViews({qController, metaData, tableMetaData, currentSavedView, vie
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if(!savedView.queryColumns || !savedView.queryColumns.columns || savedView.queryColumns.columns.length == 0)
|
||||||
|
{
|
||||||
|
viewDiffs.push("This view did not previously have columns saved with it, so the next time you save it they will be initialized.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// nested function to help diff visible status of columns //
|
// nested function to help diff visible status of columns //
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@ -390,7 +396,7 @@ function SavedViews({qController, metaData, tableMetaData, currentSavedView, vie
|
|||||||
|
|
||||||
if(savedView.queryColumns.columns.map(c => c.name).join(",") != activeView.queryColumns.columns.map(c => c.name).join(","))
|
if(savedView.queryColumns.columns.map(c => c.name).join(",") != activeView.queryColumns.columns.map(c => c.name).join(","))
|
||||||
{
|
{
|
||||||
viewDiffs.push("Changed the order of 1 or more columns.");
|
viewDiffs.push("Changed the order columns.");
|
||||||
}
|
}
|
||||||
|
|
||||||
diffWidthsFunction(savedView.queryColumns, activeView.queryColumns, "Changed width for ");
|
diffWidthsFunction(savedView.queryColumns, activeView.queryColumns, "Changed width for ");
|
||||||
@ -452,12 +458,26 @@ function SavedViews({qController, metaData, tableMetaData, currentSavedView, vie
|
|||||||
|
|
||||||
if(savedView.mode != activeView.mode)
|
if(savedView.mode != activeView.mode)
|
||||||
{
|
{
|
||||||
viewDiffs.push(`Mode changed from ${savedView.mode} to ${activeView.mode}`)
|
if(savedView.mode)
|
||||||
|
{
|
||||||
|
viewDiffs.push(`Mode changed from ${savedView.mode} to ${activeView.mode}`)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
viewDiffs.push(`Mode set to ${activeView.mode}`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(savedView.rowsPerPage != activeView.rowsPerPage)
|
if(savedView.rowsPerPage != activeView.rowsPerPage)
|
||||||
{
|
{
|
||||||
viewDiffs.push(`Rows per page changed from ${savedView.rowsPerPage} to ${activeView.rowsPerPage}`)
|
if(savedView.rowsPerPage)
|
||||||
|
{
|
||||||
|
viewDiffs.push(`Rows per page changed from ${savedView.rowsPerPage} to ${activeView.rowsPerPage}`)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
viewDiffs.push(`Rows per page set to ${activeView.rowsPerPage}`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(viewDiffs.length > 0)
|
if(viewDiffs.length > 0)
|
||||||
|
@ -350,7 +350,6 @@ const BasicAndAdvancedQueryControls = forwardRef((props: BasicAndAdvancedQueryCo
|
|||||||
if(criteria && criteria.fieldName && criteria.operator)
|
if(criteria && criteria.fieldName && criteria.operator)
|
||||||
{
|
{
|
||||||
const [field, fieldTable] = TableUtils.getFieldAndTable(tableMetaData, criteria.fieldName);
|
const [field, fieldTable] = TableUtils.getFieldAndTable(tableMetaData, criteria.fieldName);
|
||||||
const valuesString = FilterUtils.getValuesString(field, criteria);
|
|
||||||
counter++;
|
counter++;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -383,8 +383,17 @@ export default function QuickFilter({tableMetaData, fullFieldName, fieldMetaData
|
|||||||
buttonAdditionalStyles.color = "white !important";
|
buttonAdditionalStyles.color = "white !important";
|
||||||
buttonClassName = "filterActive";
|
buttonClassName = "filterActive";
|
||||||
|
|
||||||
|
let valuesString = FilterUtils.getValuesString(fieldMetaData, criteria);
|
||||||
|
if(fieldMetaData.type == QFieldType.BOOLEAN)
|
||||||
|
{
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// for booleans, in here, the operator-label is "equals yes" or "equals no", so we don't want the values string //
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
valuesString = "";
|
||||||
|
}
|
||||||
|
|
||||||
buttonContent = (
|
buttonContent = (
|
||||||
<Tooltip title={`${operatorSelectedValue.label} ${FilterUtils.getValuesString(fieldMetaData, criteria)}`} enterDelay={tooltipEnterDelay}>
|
<Tooltip title={`${operatorSelectedValue.label} ${valuesString}`} enterDelay={tooltipEnterDelay}>
|
||||||
{buttonContent}
|
{buttonContent}
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
);
|
);
|
||||||
|
@ -600,39 +600,6 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
|||||||
doSetCurrentSavedView(null);
|
doSetCurrentSavedView(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//... if (currentSavedViewId != null)
|
|
||||||
//... {
|
|
||||||
//... /* hmm...
|
|
||||||
//... if(currentSavedView && currentSavedView.values.get("id") == currentSavedViewId)
|
|
||||||
//... {
|
|
||||||
//... console.log("@dk - mmm, current saved filter is already the one we're trying to go to, so, avoid double-dipping...");
|
|
||||||
//... }
|
|
||||||
//... else
|
|
||||||
//... */
|
|
||||||
//... {
|
|
||||||
//... console.log("@dk - have saved filter in url, going to query it now.");
|
|
||||||
//... (async () =>
|
|
||||||
//... {
|
|
||||||
//... const formData = new FormData();
|
|
||||||
//... formData.append("id", currentSavedViewId);
|
|
||||||
//... formData.append(QController.STEP_TIMEOUT_MILLIS_PARAM_NAME, 60 * 1000);
|
|
||||||
//... const processResult = await qController.processInit("querySavedView", formData, qController.defaultMultipartFormDataHeaders());
|
|
||||||
//... if (processResult instanceof QJobError)
|
|
||||||
//... {
|
|
||||||
//... const jobError = processResult as QJobError;
|
|
||||||
//... console.error("Could not retrieve saved filter: " + jobError.userFacingError);
|
|
||||||
//... }
|
|
||||||
//... else
|
|
||||||
//... {
|
|
||||||
//... const result = processResult as QJobComplete;
|
|
||||||
//... const qRecord = new QRecord(result.values.savedViewList[0]);
|
|
||||||
//... console.log("@dk - got saved filter from backend, going to set it now");
|
|
||||||
//... doSetCurrentSavedView(qRecord);
|
|
||||||
//... }
|
|
||||||
//... })();
|
|
||||||
//... }
|
|
||||||
//... }
|
|
||||||
}
|
}
|
||||||
catch (e)
|
catch (e)
|
||||||
{
|
{
|
||||||
@ -755,7 +722,7 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`@dk In updateTable for ${reason} ${JSON.stringify(queryFilter)}`);
|
console.log(`In updateTable for ${reason} ${JSON.stringify(queryFilter)}`);
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
setRows([]);
|
setRows([]);
|
||||||
(async () =>
|
(async () =>
|
||||||
@ -1155,7 +1122,7 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
const doSetQueryFilter = (queryFilter: QQueryFilter, isFromActivateView = false): void =>
|
const doSetQueryFilter = (queryFilter: QQueryFilter, isFromActivateView = false): void =>
|
||||||
{
|
{
|
||||||
console.log(`@dk Setting a new query filter: ${JSON.stringify(queryFilter)}`);
|
console.log(`Setting a new query filter: ${JSON.stringify(queryFilter)}`);
|
||||||
|
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
// in case there's no orderBys, set default here //
|
// in case there's no orderBys, set default here //
|
||||||
@ -1449,6 +1416,12 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
|||||||
const viewJson = savedView.values.get("viewJson")
|
const viewJson = savedView.values.get("viewJson")
|
||||||
const newView = RecordQueryView.buildFromJSON(viewJson);
|
const newView = RecordQueryView.buildFromJSON(viewJson);
|
||||||
newView.viewIdentity = "savedView:" + savedView.values.get("id");
|
newView.viewIdentity = "savedView:" + savedView.values.get("id");
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////
|
||||||
|
// e.g., translate possible values from ids to objects w/ labels //
|
||||||
|
///////////////////////////////////////////////////////////////////
|
||||||
|
await FilterUtils.cleanupValuesInFilerFromQueryString(qController, tableMetaData, newView.queryFilter);
|
||||||
|
|
||||||
activateView(newView);
|
activateView(newView);
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -2006,7 +1979,7 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
if (pageState == "initial")
|
if (pageState == "initial")
|
||||||
{
|
{
|
||||||
console.log("@dk - page state is initial - going to loadingMetaData...");
|
console.log("page state is initial - going to loadingMetaData...");
|
||||||
setPageState("loadingMetaData");
|
setPageState("loadingMetaData");
|
||||||
pageLoadingState.setLoading();
|
pageLoadingState.setLoading();
|
||||||
|
|
||||||
@ -2037,7 +2010,7 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
|||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
if (pageState == "loadedMetaData")
|
if (pageState == "loadedMetaData")
|
||||||
{
|
{
|
||||||
console.log("@dk - page state is loadedMetaData - going to loadingView...");
|
console.log("page state is loadedMetaData - going to loadingView...");
|
||||||
setPageState("loadingView");
|
setPageState("loadingView");
|
||||||
|
|
||||||
(async () =>
|
(async () =>
|
||||||
@ -2137,7 +2110,7 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
|||||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
if (pageState == "loadedView")
|
if (pageState == "loadedView")
|
||||||
{
|
{
|
||||||
console.log("@dk - page state is loadedView - going to preparingGrid...");
|
console.log("page state is loadedView - going to preparingGrid...");
|
||||||
setPageState("preparingGrid");
|
setPageState("preparingGrid");
|
||||||
|
|
||||||
(async () =>
|
(async () =>
|
||||||
@ -2191,10 +2164,12 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
console.log("@dk - finished preparing grid, going to page state ready");
|
console.log("finished preparing grid, going to page state ready");
|
||||||
setPageState("ready");
|
setPageState("ready");
|
||||||
|
|
||||||
// todo - is this sufficient?
|
////////////////////////////////////////////
|
||||||
|
// if we need a variant, show that prompt //
|
||||||
|
////////////////////////////////////////////
|
||||||
if (tableMetaData?.usesVariants && !tableVariant)
|
if (tableMetaData?.usesVariants && !tableVariant)
|
||||||
{
|
{
|
||||||
promptForTableVariantSelection();
|
promptForTableVariantSelection();
|
||||||
@ -2277,7 +2252,7 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
|||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
if(pageState != "ready")
|
if(pageState != "ready")
|
||||||
{
|
{
|
||||||
console.log(`@dk - page state is ${pageState}... no-op while those complete async's run...`);
|
console.log(`page state is ${pageState}... no-op while those complete async's run...`);
|
||||||
return (getLoadingScreen());
|
return (getLoadingScreen());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ class FilterUtils
|
|||||||
public static getValuesString(fieldMetaData: QFieldMetaData, criteria: QFilterCriteria, maxValuesToShow: number = 3): string
|
public static getValuesString(fieldMetaData: QFieldMetaData, criteria: QFilterCriteria, maxValuesToShow: number = 3): string
|
||||||
{
|
{
|
||||||
let valuesString = "";
|
let valuesString = "";
|
||||||
if (criteria.values && criteria.values.length && fieldMetaData.type !== QFieldType.BOOLEAN)
|
if (criteria.values && criteria.values.length)
|
||||||
{
|
{
|
||||||
let labels = [] as string[];
|
let labels = [] as string[];
|
||||||
|
|
||||||
@ -323,7 +323,11 @@ class FilterUtils
|
|||||||
|
|
||||||
for (let i = 0; i < maxLoops; i++)
|
for (let i = 0; i < maxLoops; i++)
|
||||||
{
|
{
|
||||||
if (criteria.values[i] && criteria.values[i].label)
|
if(fieldMetaData.type == QFieldType.BOOLEAN)
|
||||||
|
{
|
||||||
|
labels.push(criteria.values[i] == true ? "yes" : "no")
|
||||||
|
}
|
||||||
|
else if (criteria.values[i] && criteria.values[i].label)
|
||||||
{
|
{
|
||||||
labels.push(criteria.values[i].label);
|
labels.push(criteria.values[i].label);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user