mirror of
https://github.com/Kingsrook/qqq-frontend-material-dashboard.git
synced 2025-07-18 05:10:45 +00:00
minor adjustments for field formats, possible values, faster feedback on process next/submit
This commit is contained in:
@ -13,7 +13,7 @@
|
|||||||
"@fullcalendar/interaction": "5.10.0",
|
"@fullcalendar/interaction": "5.10.0",
|
||||||
"@fullcalendar/react": "5.10.0",
|
"@fullcalendar/react": "5.10.0",
|
||||||
"@fullcalendar/timegrid": "5.10.0",
|
"@fullcalendar/timegrid": "5.10.0",
|
||||||
"@kingsrook/qqq-frontend-core": "1.0.9",
|
"@kingsrook/qqq-frontend-core": "1.0.10",
|
||||||
"@mui/icons-material": "5.4.1",
|
"@mui/icons-material": "5.4.1",
|
||||||
"@mui/material": "5.4.1",
|
"@mui/material": "5.4.1",
|
||||||
"@mui/styled-engine": "5.4.1",
|
"@mui/styled-engine": "5.4.1",
|
||||||
|
@ -111,6 +111,7 @@ function QDynamicForm(props: Props): JSX.Element
|
|||||||
label={field.label}
|
label={field.label}
|
||||||
isEditable={field.isEditable}
|
isEditable={field.isEditable}
|
||||||
name={fieldName}
|
name={fieldName}
|
||||||
|
displayFormat={field.displayFormat}
|
||||||
value={values[fieldName]}
|
value={values[fieldName]}
|
||||||
error={errors[fieldName] && touched[fieldName]}
|
error={errors[fieldName] && touched[fieldName]}
|
||||||
bulkEditMode={bulkEditMode}
|
bulkEditMode={bulkEditMode}
|
||||||
|
@ -85,6 +85,7 @@ class DynamicFormUtils
|
|||||||
isRequired: field.isRequired,
|
isRequired: field.isRequired,
|
||||||
isEditable: field.isEditable,
|
isEditable: field.isEditable,
|
||||||
type: fieldType,
|
type: fieldType,
|
||||||
|
displayFormat: field.displayFormat,
|
||||||
// todo invalidMsg: "Zipcode is not valid (e.g. 70000).",
|
// todo invalidMsg: "Zipcode is not valid (e.g. 70000).",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -29,12 +29,14 @@ import MDInput from "components/MDInput";
|
|||||||
import React, {useState} from "react";
|
import React, {useState} from "react";
|
||||||
import Grid from "@mui/material/Grid";
|
import Grid from "@mui/material/Grid";
|
||||||
import Switch from "@mui/material/Switch";
|
import Switch from "@mui/material/Switch";
|
||||||
|
import {InputAdornment} from "@mui/material";
|
||||||
|
|
||||||
// Declaring props types for FormField
|
// Declaring props types for FormField
|
||||||
interface Props
|
interface Props
|
||||||
{
|
{
|
||||||
label: string;
|
label: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
displayFormat: string;
|
||||||
type: string;
|
type: string;
|
||||||
isEditable?: boolean;
|
isEditable?: boolean;
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
@ -43,7 +45,7 @@ interface Props
|
|||||||
}
|
}
|
||||||
|
|
||||||
function QDynamicFormField({
|
function QDynamicFormField({
|
||||||
label, name, bulkEditMode, bulkEditSwitchChangeHandler, type, isEditable, ...rest
|
label, name, displayFormat, bulkEditMode, bulkEditSwitchChangeHandler, type, isEditable, ...rest
|
||||||
}: Props): JSX.Element
|
}: Props): JSX.Element
|
||||||
{
|
{
|
||||||
const [switchChecked, setSwitchChecked] = useState(false);
|
const [switchChecked, setSwitchChecked] = useState(false);
|
||||||
@ -56,9 +58,16 @@ function QDynamicFormField({
|
|||||||
inputLabelProps.shrink = true;
|
inputLabelProps.shrink = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const inputProps = {};
|
||||||
|
if (displayFormat && displayFormat.startsWith("$"))
|
||||||
|
{
|
||||||
|
// @ts-ignore
|
||||||
|
inputProps.startAdornment = <InputAdornment position="start">$</InputAdornment>;
|
||||||
|
}
|
||||||
|
|
||||||
const field = () => (
|
const field = () => (
|
||||||
<>
|
<>
|
||||||
<Field {...rest} name={name} type={type} as={MDInput} variant="standard" label={label} InputLabelProps={inputLabelProps} fullWidth disabled={isDisabled} />
|
<Field {...rest} name={name} type={type} as={MDInput} variant="standard" label={label} InputLabelProps={inputLabelProps} InputProps={inputProps} fullWidth disabled={isDisabled} />
|
||||||
<MDBox mt={0.75}>
|
<MDBox mt={0.75}>
|
||||||
<MDTypography component="div" variant="caption" color="error" fontWeight="regular">
|
<MDTypography component="div" variant="caption" color="error" fontWeight="regular">
|
||||||
{!isDisabled && <div className="fieldErrorMessage"><ErrorMessage name={name} /></div>}
|
{!isDisabled && <div className="fieldErrorMessage"><ErrorMessage name={name} /></div>}
|
||||||
|
@ -218,7 +218,7 @@ function EntityList({table}: Props): JSX.Element
|
|||||||
let criteria = new QFilterCriteria(item.columnField, operator, [item.value]);
|
let criteria = new QFilterCriteria(item.columnField, operator, [item.value]);
|
||||||
if (operator === QCriteriaOperator.IS_BLANK || operator === QCriteriaOperator.IS_NOT_BLANK)
|
if (operator === QCriteriaOperator.IS_BLANK || operator === QCriteriaOperator.IS_NOT_BLANK)
|
||||||
{
|
{
|
||||||
criteria = new QFilterCriteria(item.columnField, translateCriteriaOperator(item.operatorValue), null);
|
criteria = new QFilterCriteria(item.columnField, operator, null);
|
||||||
}
|
}
|
||||||
qFilter.addCriteria(criteria);
|
qFilter.addCriteria(criteria);
|
||||||
});
|
});
|
||||||
@ -272,7 +272,6 @@ function EntityList({table}: Props): JSX.Element
|
|||||||
});
|
});
|
||||||
|
|
||||||
const fields = [...tableMetaData.fields.values()];
|
const fields = [...tableMetaData.fields.values()];
|
||||||
|
|
||||||
const rows = [] as any[];
|
const rows = [] as any[];
|
||||||
results.forEach((record) =>
|
results.forEach((record) =>
|
||||||
{
|
{
|
||||||
@ -302,33 +301,37 @@ function EntityList({table}: Props): JSX.Element
|
|||||||
|
|
||||||
let columnType = "string";
|
let columnType = "string";
|
||||||
let columnWidth = 200;
|
let columnWidth = 200;
|
||||||
switch (field.type)
|
|
||||||
|
if (!field.possibleValueSourceName)
|
||||||
{
|
{
|
||||||
case QFieldType.DECIMAL:
|
switch (field.type)
|
||||||
case QFieldType.INTEGER:
|
{
|
||||||
columnType = "number";
|
case QFieldType.DECIMAL:
|
||||||
columnWidth = 100;
|
case QFieldType.INTEGER:
|
||||||
|
columnType = "number";
|
||||||
|
columnWidth = 100;
|
||||||
|
|
||||||
if (key === tableMetaData.primaryKeyField && field.label.length < 3)
|
if (key === tableMetaData.primaryKeyField && field.label.length < 3)
|
||||||
{
|
{
|
||||||
|
columnWidth = 75;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case QFieldType.DATE:
|
||||||
|
columnType = "date";
|
||||||
|
columnWidth = 100;
|
||||||
|
break;
|
||||||
|
case QFieldType.DATE_TIME:
|
||||||
|
columnType = "dateTime";
|
||||||
|
columnWidth = 200;
|
||||||
|
break;
|
||||||
|
case QFieldType.BOOLEAN:
|
||||||
|
columnType = "boolean";
|
||||||
columnWidth = 75;
|
columnWidth = 75;
|
||||||
}
|
break;
|
||||||
|
default:
|
||||||
break;
|
// noop - leave as string
|
||||||
case QFieldType.DATE:
|
}
|
||||||
columnType = "date";
|
|
||||||
columnWidth = 100;
|
|
||||||
break;
|
|
||||||
case QFieldType.DATE_TIME:
|
|
||||||
columnType = "dateTime";
|
|
||||||
columnWidth = 200;
|
|
||||||
break;
|
|
||||||
case QFieldType.BOOLEAN:
|
|
||||||
columnType = "boolean";
|
|
||||||
columnWidth = 75;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// noop - leave as string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const column = {
|
const column = {
|
||||||
@ -336,11 +339,15 @@ function EntityList({table}: Props): JSX.Element
|
|||||||
type: columnType,
|
type: columnType,
|
||||||
headerName: field.label,
|
headerName: field.label,
|
||||||
width: columnWidth,
|
width: columnWidth,
|
||||||
|
renderCell: null as any,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (key === tableMetaData.primaryKeyField)
|
if (key === tableMetaData.primaryKeyField)
|
||||||
{
|
{
|
||||||
columns.splice(0, 0, column);
|
columns.splice(0, 0, column);
|
||||||
|
column.renderCell = (cellValues: any) => (
|
||||||
|
<Link to={cellValues.value}>{cellValues.value}</Link>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -58,6 +58,7 @@ import MDTypography from "../../../components/MDTypography";
|
|||||||
import Footer from "examples/Footer";
|
import Footer from "examples/Footer";
|
||||||
import {QProcessMetaData} from "@kingsrook/qqq-frontend-core/lib/model/metaData/QProcessMetaData";
|
import {QProcessMetaData} from "@kingsrook/qqq-frontend-core/lib/model/metaData/QProcessMetaData";
|
||||||
import Navbar from "qqq/components/Navbar";
|
import Navbar from "qqq/components/Navbar";
|
||||||
|
import BaseLayout from "qqq/components/BaseLayout";
|
||||||
|
|
||||||
interface Props
|
interface Props
|
||||||
{
|
{
|
||||||
@ -530,12 +531,13 @@ function ProcessRun({process}: Props): JSX.Element
|
|||||||
if (lastProcessResponse)
|
if (lastProcessResponse)
|
||||||
{
|
{
|
||||||
setLastProcessResponse(null);
|
setLastProcessResponse(null);
|
||||||
|
|
||||||
setQJobRunning(null);
|
setQJobRunning(null);
|
||||||
|
|
||||||
if (lastProcessResponse instanceof QJobComplete)
|
if (lastProcessResponse instanceof QJobComplete)
|
||||||
{
|
{
|
||||||
const qJobComplete = lastProcessResponse as QJobComplete;
|
const qJobComplete = lastProcessResponse as QJobComplete;
|
||||||
console.log("Setting new step.");
|
console.log("Setting new step.");
|
||||||
|
setJobUUID(null);
|
||||||
setNewStep(qJobComplete.nextStep);
|
setNewStep(qJobComplete.nextStep);
|
||||||
setProcessValues(qJobComplete.values);
|
setProcessValues(qJobComplete.values);
|
||||||
// console.log(`Updated process values: ${JSON.stringify(qJobComplete.values)}`);
|
// console.log(`Updated process values: ${JSON.stringify(qJobComplete.values)}`);
|
||||||
@ -544,6 +546,7 @@ function ProcessRun({process}: Props): JSX.Element
|
|||||||
{
|
{
|
||||||
const qJobStarted = lastProcessResponse as QJobStarted;
|
const qJobStarted = lastProcessResponse as QJobStarted;
|
||||||
setJobUUID(qJobStarted.jobUUID);
|
setJobUUID(qJobStarted.jobUUID);
|
||||||
|
console.log("setting need to check because started");
|
||||||
setNeedToCheckJobStatus(true);
|
setNeedToCheckJobStatus(true);
|
||||||
}
|
}
|
||||||
else if (lastProcessResponse instanceof QJobRunning)
|
else if (lastProcessResponse instanceof QJobRunning)
|
||||||
@ -551,12 +554,14 @@ function ProcessRun({process}: Props): JSX.Element
|
|||||||
const qJobRunning = lastProcessResponse as QJobRunning;
|
const qJobRunning = lastProcessResponse as QJobRunning;
|
||||||
setQJobRunning(qJobRunning);
|
setQJobRunning(qJobRunning);
|
||||||
setQJobRunningDate(new Date());
|
setQJobRunningDate(new Date());
|
||||||
|
console.log("setting need to check because running");
|
||||||
setNeedToCheckJobStatus(true);
|
setNeedToCheckJobStatus(true);
|
||||||
}
|
}
|
||||||
else if (lastProcessResponse instanceof QJobError)
|
else if (lastProcessResponse instanceof QJobError)
|
||||||
{
|
{
|
||||||
const qJobError = lastProcessResponse as QJobError;
|
const qJobError = lastProcessResponse as QJobError;
|
||||||
console.log(`Got an error from the backend... ${qJobError.error}`);
|
console.log(`Got an error from the backend... ${qJobError.error}`);
|
||||||
|
setJobUUID(null);
|
||||||
setProcessError(qJobError.error);
|
setProcessError(qJobError.error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -567,21 +572,26 @@ function ProcessRun({process}: Props): JSX.Element
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
useEffect(() =>
|
useEffect(() =>
|
||||||
{
|
{
|
||||||
|
console.log("In effect for checking status");
|
||||||
if (needToCheckJobStatus)
|
if (needToCheckJobStatus)
|
||||||
{
|
{
|
||||||
|
console.log(" and the bool was true");
|
||||||
setNeedToCheckJobStatus(false);
|
setNeedToCheckJobStatus(false);
|
||||||
(async () =>
|
if (jobUUID)
|
||||||
{
|
{
|
||||||
setTimeout(async () =>
|
(async () =>
|
||||||
{
|
{
|
||||||
const processResponse = await QClient.getInstance().processJobStatus(
|
setTimeout(async () =>
|
||||||
processName,
|
{
|
||||||
processUUID,
|
const processResponse = await QClient.getInstance().processJobStatus(
|
||||||
jobUUID,
|
processName,
|
||||||
);
|
processUUID,
|
||||||
setLastProcessResponse(processResponse);
|
jobUUID,
|
||||||
}, 1500);
|
);
|
||||||
})();
|
setLastProcessResponse(processResponse);
|
||||||
|
}, 1500);
|
||||||
|
})();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [needToCheckJobStatus]);
|
}, [needToCheckJobStatus]);
|
||||||
|
|
||||||
@ -685,20 +695,24 @@ function ProcessRun({process}: Props): JSX.Element
|
|||||||
"content-type": "multipart/form-data; boundary=--------------------------320289315924586491558366",
|
"content-type": "multipart/form-data; boundary=--------------------------320289315924586491558366",
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log("Calling processStep...");
|
setLastProcessResponse(new QJobRunning({message: "Working..."}));
|
||||||
const processResponse = await QClient.getInstance().processStep(
|
|
||||||
processName,
|
setTimeout(async () =>
|
||||||
processUUID,
|
{
|
||||||
activeStep.name,
|
console.log("Calling processStep...");
|
||||||
formData,
|
const processResponse = await QClient.getInstance().processStep(
|
||||||
formDataHeaders,
|
processName,
|
||||||
);
|
processUUID,
|
||||||
setLastProcessResponse(processResponse);
|
activeStep.name,
|
||||||
|
formData,
|
||||||
|
formDataHeaders,
|
||||||
|
);
|
||||||
|
setLastProcessResponse(processResponse);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DashboardLayout>
|
<BaseLayout>
|
||||||
<Navbar />
|
|
||||||
<MDBox py={3} mb={20}>
|
<MDBox py={3} mb={20}>
|
||||||
<Grid
|
<Grid
|
||||||
container
|
container
|
||||||
@ -718,7 +732,7 @@ function ProcessRun({process}: Props): JSX.Element
|
|||||||
values, errors, touched, isSubmitting,
|
values, errors, touched, isSubmitting,
|
||||||
}) => (
|
}) => (
|
||||||
<Form id={formId} autoComplete="off">
|
<Form id={formId} autoComplete="off">
|
||||||
<Card sx={{height: "100%"}}>
|
<Card sx={{minHeight: "calc(100vh - 400px)"}}>
|
||||||
<MDBox mx={2} mt={-3}>
|
<MDBox mx={2} mt={-3}>
|
||||||
<Stepper activeStep={activeStepIndex} alternativeLabel>
|
<Stepper activeStep={activeStepIndex} alternativeLabel>
|
||||||
{steps.map((step) => (
|
{steps.map((step) => (
|
||||||
@ -795,8 +809,7 @@ function ProcessRun({process}: Props): JSX.Element
|
|||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</MDBox>
|
</MDBox>
|
||||||
<Footer />
|
</BaseLayout>
|
||||||
</DashboardLayout>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,4 +98,9 @@
|
|||||||
.MuiFormControl-root
|
.MuiFormControl-root
|
||||||
{
|
{
|
||||||
background-position-y: 1.4rem !important;
|
background-position-y: 1.4rem !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.MuiInputAdornment-sizeMedium *
|
||||||
|
{
|
||||||
|
font-size: .875rem !important;
|
||||||
}
|
}
|
Reference in New Issue
Block a user