mirror of
https://github.com/Kingsrook/qqq-frontend-material-dashboard.git
synced 2025-07-18 05:10:45 +00:00
Checkpoint at end of sprint-7
This commit is contained in:
@ -93,7 +93,7 @@
|
|||||||
"@types/uuid": "8.3.4",
|
"@types/uuid": "8.3.4",
|
||||||
"@typescript-eslint/eslint-plugin": "5.10.2",
|
"@typescript-eslint/eslint-plugin": "5.10.2",
|
||||||
"@typescript-eslint/parser": "5.10.2",
|
"@typescript-eslint/parser": "5.10.2",
|
||||||
"cypress": "^10.3.1",
|
"cypress": "10.3.1",
|
||||||
"eslint": "8.8.0",
|
"eslint": "8.8.0",
|
||||||
"eslint-config-airbnb": "19.0.4",
|
"eslint-config-airbnb": "19.0.4",
|
||||||
"eslint-import-resolver-typescript": "2.5.0",
|
"eslint-import-resolver-typescript": "2.5.0",
|
||||||
|
@ -20,7 +20,7 @@ import Icon from "@mui/material/Icon";
|
|||||||
import Menu from "@mui/material/Menu";
|
import Menu from "@mui/material/Menu";
|
||||||
import MenuItem from "@mui/material/MenuItem";
|
import MenuItem from "@mui/material/MenuItem";
|
||||||
import Link from "@mui/material/Link";
|
import Link from "@mui/material/Link";
|
||||||
import {Alert, tableFooterClasses} from "@mui/material";
|
import {Alert, TablePagination} from "@mui/material";
|
||||||
import {
|
import {
|
||||||
DataGridPro,
|
DataGridPro,
|
||||||
GridCallbackDetails,
|
GridCallbackDetails,
|
||||||
@ -498,6 +498,25 @@ function EntityList({table}: Props): JSX.Element
|
|||||||
document.location.href = `/processes/${tableName}.bulkDelete${getRecordsQueryString()}`;
|
document.location.href = `/processes/${tableName}.bulkDelete${getRecordsQueryString()}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
const defaultLabelDisplayedRows = ({from, to, count}) => `${from.toLocaleString()}–${to.toLocaleString()} of ${count !== -1 ? count.toLocaleString() : `more than ${to.toLocaleString()}`}`;
|
||||||
|
|
||||||
|
function CustomPagination()
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
<TablePagination
|
||||||
|
component="div"
|
||||||
|
count={totalRecords}
|
||||||
|
page={pageNumber}
|
||||||
|
rowsPerPageOptions={[10, 25, 50]}
|
||||||
|
rowsPerPage={rowsPerPage}
|
||||||
|
onPageChange={(event, value) => handlePageChange(value)}
|
||||||
|
onRowsPerPageChange={(event) => handleRowsPerPageChange(Number(event.target.value))}
|
||||||
|
labelDisplayedRows={defaultLabelDisplayedRows}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function CustomToolbar()
|
function CustomToolbar()
|
||||||
{
|
{
|
||||||
const [bulkActionsMenuAnchor, setBulkActionsMenuAnchor] = useState(null as HTMLElement);
|
const [bulkActionsMenuAnchor, setBulkActionsMenuAnchor] = useState(null as HTMLElement);
|
||||||
@ -519,8 +538,8 @@ function EntityList({table}: Props): JSX.Element
|
|||||||
<Button
|
<Button
|
||||||
id="refresh-button"
|
id="refresh-button"
|
||||||
onClick={updateTable}
|
onClick={updateTable}
|
||||||
|
startIcon={<Icon>refresh</Icon>}
|
||||||
>
|
>
|
||||||
<Icon>refresh</Icon>
|
|
||||||
Refresh
|
Refresh
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
@ -538,8 +557,8 @@ function EntityList({table}: Props): JSX.Element
|
|||||||
aria-controls={bulkActionsMenuOpen ? "basic-menu" : undefined}
|
aria-controls={bulkActionsMenuOpen ? "basic-menu" : undefined}
|
||||||
aria-haspopup="true"
|
aria-haspopup="true"
|
||||||
aria-expanded={bulkActionsMenuOpen ? "true" : undefined}
|
aria-expanded={bulkActionsMenuOpen ? "true" : undefined}
|
||||||
|
startIcon={<Icon>table_rows</Icon>}
|
||||||
>
|
>
|
||||||
<Icon>fact_check</Icon>
|
|
||||||
Bulk Actions
|
Bulk Actions
|
||||||
</Button>
|
</Button>
|
||||||
<Menu
|
<Menu
|
||||||
@ -680,7 +699,7 @@ function EntityList({table}: Props): JSX.Element
|
|||||||
<Card>
|
<Card>
|
||||||
<MDBox height="100%">
|
<MDBox height="100%">
|
||||||
<DataGridPro
|
<DataGridPro
|
||||||
components={{Toolbar: CustomToolbar}}
|
components={{Toolbar: CustomToolbar, Pagination: CustomPagination}}
|
||||||
pagination
|
pagination
|
||||||
paginationMode="server"
|
paginationMode="server"
|
||||||
sortingMode="server"
|
sortingMode="server"
|
||||||
@ -693,10 +712,7 @@ function EntityList({table}: Props): JSX.Element
|
|||||||
columns={columns}
|
columns={columns}
|
||||||
rowBuffer={10}
|
rowBuffer={10}
|
||||||
rowCount={totalRecords}
|
rowCount={totalRecords}
|
||||||
pageSize={rowsPerPage}
|
|
||||||
rowsPerPageOptions={[10, 25, 50]}
|
|
||||||
onPageSizeChange={handleRowsPerPageChange}
|
onPageSizeChange={handleRowsPerPageChange}
|
||||||
onPageChange={handlePageChange}
|
|
||||||
onRowClick={handleRowClick}
|
onRowClick={handleRowClick}
|
||||||
density="compact"
|
density="compact"
|
||||||
loading={loading}
|
loading={loading}
|
||||||
|
@ -48,16 +48,11 @@ import {QFrontendComponent} from "@kingsrook/qqq-frontend-core/lib/model/metaDat
|
|||||||
import {QComponentType} from "@kingsrook/qqq-frontend-core/lib/model/metaData/QComponentType";
|
import {QComponentType} from "@kingsrook/qqq-frontend-core/lib/model/metaData/QComponentType";
|
||||||
import FormData from "form-data";
|
import FormData from "form-data";
|
||||||
import QClient from "qqq/utils/QClient";
|
import QClient from "qqq/utils/QClient";
|
||||||
import {CircularProgress} from "@mui/material";
|
import {CircularProgress, TablePagination} from "@mui/material";
|
||||||
import QDynamicForm from "../../components/QDynamicForm";
|
import QDynamicForm from "../../components/QDynamicForm";
|
||||||
import MDTypography from "../../../components/MDTypography";
|
import MDTypography from "../../../components/MDTypography";
|
||||||
import Footer from "examples/Footer";
|
import Footer from "examples/Footer";
|
||||||
|
|
||||||
function logFormValidations(prefix: string, formValidations: any)
|
|
||||||
{
|
|
||||||
console.log(`${prefix}: ${JSON.stringify(formValidations)} `);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ProcessRun(): JSX.Element
|
function ProcessRun(): JSX.Element
|
||||||
{
|
{
|
||||||
const {processName} = useParams();
|
const {processName} = useParams();
|
||||||
@ -122,6 +117,27 @@ function ProcessRun(): JSX.Element
|
|||||||
return (false);
|
return (false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
const defaultLabelDisplayedRows = ({from, to, count}) => `${from.toLocaleString()}–${to.toLocaleString()} of ${count !== -1 ? count.toLocaleString() : `more than ${to.toLocaleString()}`}`;
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
// eslint-disable-next-line react/no-unstable-nested-components
|
||||||
|
function CustomPagination()
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
<TablePagination
|
||||||
|
component="div"
|
||||||
|
count={recordConfig.totalRecords}
|
||||||
|
page={pageNumber}
|
||||||
|
rowsPerPageOptions={[10, 25, 50]}
|
||||||
|
rowsPerPage={rowsPerPage}
|
||||||
|
onPageChange={(event, value) => recordConfig.handlePageChange(value)}
|
||||||
|
onRowsPerPageChange={(event) => recordConfig.handleRowsPerPageChange(Number(event.target.value))}
|
||||||
|
labelDisplayedRows={defaultLabelDisplayedRows}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
// event handler for the bulk-edit field-enabled checkboxes //
|
// event handler for the bulk-edit field-enabled checkboxes //
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
@ -136,7 +152,7 @@ function ProcessRun(): JSX.Element
|
|||||||
{
|
{
|
||||||
if (value === null || value === undefined)
|
if (value === null || value === undefined)
|
||||||
{
|
{
|
||||||
return <span>--</span>;
|
return <span>∅</span>;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof value === "string")
|
if (typeof value === "string")
|
||||||
@ -234,7 +250,7 @@ function ProcessRun(): JSX.Element
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
)))}
|
)))}
|
||||||
{(step.formFields) && (
|
{step.formFields && (
|
||||||
<QDynamicForm
|
<QDynamicForm
|
||||||
formData={formData}
|
formData={formData}
|
||||||
bulkEditMode={doesStepHaveComponent(activeStep, QComponentType.BULK_EDIT_FORM)}
|
bulkEditMode={doesStepHaveComponent(activeStep, QComponentType.BULK_EDIT_FORM)}
|
||||||
@ -263,6 +279,7 @@ function ProcessRun(): JSX.Element
|
|||||||
<br />
|
<br />
|
||||||
<MDBox height="100%">
|
<MDBox height="100%">
|
||||||
<DataGridPro
|
<DataGridPro
|
||||||
|
components={{Pagination: CustomPagination}}
|
||||||
page={recordConfig.pageNo}
|
page={recordConfig.pageNo}
|
||||||
disableSelectionOnClick
|
disableSelectionOnClick
|
||||||
autoHeight
|
autoHeight
|
||||||
@ -389,8 +406,6 @@ function ProcessRun(): JSX.Element
|
|||||||
setInitialValues(initialValues);
|
setInitialValues(initialValues);
|
||||||
setValidationScheme(Yup.object().shape(formValidations));
|
setValidationScheme(Yup.object().shape(formValidations));
|
||||||
setValidationFunction(null);
|
setValidationFunction(null);
|
||||||
|
|
||||||
logFormValidations("Post-disable thingie", formValidations);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -402,7 +417,7 @@ function ProcessRun(): JSX.Element
|
|||||||
setValidationFunction(() => true);
|
setValidationFunction(() => true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [newStep, rowsPerPage, pageNumber]);
|
}, [newStep]);
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// if there are records to load: build a record config, and set the needRecords state flag //
|
// if there are records to load: build a record config, and set the needRecords state flag //
|
||||||
@ -448,12 +463,10 @@ function ProcessRun(): JSX.Element
|
|||||||
newDynamicFormFields[field.name].isRequired = false;
|
newDynamicFormFields[field.name].isRequired = false;
|
||||||
newFormValidations[field.name] = null;
|
newFormValidations[field.name] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
logFormValidations("Upon update", newFormValidations);
|
|
||||||
|
|
||||||
setFormFields(newDynamicFormFields);
|
|
||||||
setValidationScheme(Yup.object().shape(newFormValidations));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setFormFields(newDynamicFormFields);
|
||||||
|
setValidationScheme(Yup.object().shape(newFormValidations));
|
||||||
}
|
}
|
||||||
}, [disabledBulkEditFields]);
|
}, [disabledBulkEditFields]);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user