mirror of
https://github.com/Kingsrook/qqq-frontend-material-dashboard.git
synced 2025-07-18 05:10:45 +00:00
Merge branch 'feature/sprint-27' into feature/custom-filter-panel
This commit is contained in:
@ -108,6 +108,10 @@ function AuditBody({tableMetaData, recordId, record}: Props): JSX.Element
|
||||
{
|
||||
return (<>{fieldLabel}: Removed value {(oldValue)}</>);
|
||||
}
|
||||
else if(message)
|
||||
{
|
||||
return (<>{message}</>);
|
||||
}
|
||||
|
||||
/*
|
||||
const fieldLabel = <span style={{fontWeight: "700", color: "rgb(52, 71, 103)"}}>{tableMetaData?.fields?.get(fieldName)?.label ?? fieldName}</span>;
|
||||
|
@ -19,15 +19,20 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {colors} from "@mui/material";
|
||||
import {QFieldMetaData} from "@kingsrook/qqq-frontend-core/lib/model/metaData/QFieldMetaData";
|
||||
import {QFieldType} from "@kingsrook/qqq-frontend-core/lib/model/metaData/QFieldType";
|
||||
import {QRecord} from "@kingsrook/qqq-frontend-core/lib/model/QRecord";
|
||||
import {colors, Icon, InputLabel} from "@mui/material";
|
||||
import Box from "@mui/material/Box";
|
||||
import Button from "@mui/material/Button";
|
||||
import Grid from "@mui/material/Grid";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
import {useFormikContext} from "formik";
|
||||
import React, {useState} from "react";
|
||||
import QDynamicFormField from "qqq/components/forms/DynamicFormField";
|
||||
import DynamicSelect from "qqq/components/forms/DynamicSelect";
|
||||
import MDTypography from "qqq/components/legacy/MDTypography";
|
||||
import ValueUtils from "qqq/utils/qqq/ValueUtils";
|
||||
|
||||
interface Props
|
||||
{
|
||||
@ -35,6 +40,7 @@ interface Props
|
||||
formData: any;
|
||||
bulkEditMode?: boolean;
|
||||
bulkEditSwitchChangeHandler?: any;
|
||||
record?: QRecord;
|
||||
}
|
||||
|
||||
function QDynamicForm(props: Props): JSX.Element
|
||||
@ -60,6 +66,14 @@ function QDynamicForm(props: Props): JSX.Element
|
||||
formikProps.setFieldValue(field.name, event.currentTarget.files[0]);
|
||||
};
|
||||
|
||||
const removeFile = (fieldName: string) =>
|
||||
{
|
||||
setFileName(null);
|
||||
formikProps.setFieldValue(fieldName, null);
|
||||
props.record?.values.delete(fieldName)
|
||||
props.record?.displayValues.delete(fieldName)
|
||||
};
|
||||
|
||||
const bulkEditSwitchChanged = (name: string, value: boolean) =>
|
||||
{
|
||||
bulkEditSwitchChangeHandler(name, value);
|
||||
@ -94,10 +108,23 @@ function QDynamicForm(props: Props): JSX.Element
|
||||
|
||||
if (field.type === "file")
|
||||
{
|
||||
const pseudoField = new QFieldMetaData({name: fieldName, type: QFieldType.BLOB});
|
||||
return (
|
||||
<Grid item xs={12} sm={6} key={fieldName}>
|
||||
<Box mb={1.5}>
|
||||
|
||||
<InputLabel shrink={true}>{field.label}</InputLabel>
|
||||
{
|
||||
props.record && props.record.values.get(fieldName) && <Box fontSize="0.875rem" pb={1}>
|
||||
Current File:
|
||||
<Box display="inline-flex" pl={1}>
|
||||
{ValueUtils.getDisplayValue(pseudoField, props.record, "view")}
|
||||
<Tooltip placement="bottom" title="Remove current file">
|
||||
<Icon className="blobIcon" fontSize="small" onClick={(e) => removeFile(fieldName)}>delete</Icon>
|
||||
</Tooltip>
|
||||
</Box>
|
||||
</Box>
|
||||
}
|
||||
<Box display="flex" alignItems="center">
|
||||
<Button variant="outlined" component="label">
|
||||
<span style={{color: colors.lightBlue[500]}}>Choose file to upload</span>
|
||||
|
@ -41,6 +41,7 @@ import QDynamicForm from "qqq/components/forms/DynamicForm";
|
||||
import DynamicFormUtils from "qqq/components/forms/DynamicFormUtils";
|
||||
import MDTypography from "qqq/components/legacy/MDTypography";
|
||||
import QRecordSidebar from "qqq/components/misc/RecordSidebar";
|
||||
import HtmlUtils from "qqq/utils/HtmlUtils";
|
||||
import Client from "qqq/utils/qqq/Client";
|
||||
import TableUtils from "qqq/utils/qqq/TableUtils";
|
||||
import ValueUtils from "qqq/utils/qqq/ValueUtils";
|
||||
@ -82,7 +83,6 @@ function EntityForm(props: Props): JSX.Element
|
||||
const [warningContent, setWarningContent] = useState("");
|
||||
|
||||
const [asyncLoadInited, setAsyncLoadInited] = useState(false);
|
||||
const [formValues, setFormValues] = useState({} as { [key: string]: string });
|
||||
const [tableMetaData, setTableMetaData] = useState(null as QTableMetaData);
|
||||
const [record, setRecord] = useState(null as QRecord);
|
||||
const [tableSections, setTableSections] = useState(null as QTableSection[]);
|
||||
@ -139,7 +139,7 @@ function EntityForm(props: Props): JSX.Element
|
||||
{
|
||||
return <div>Loading...</div>;
|
||||
}
|
||||
return <QDynamicForm formData={formData} />;
|
||||
return <QDynamicForm formData={formData} record={record} />;
|
||||
}
|
||||
|
||||
if (!asyncLoadInited)
|
||||
@ -185,8 +185,6 @@ function EntityForm(props: Props): JSX.Element
|
||||
initialValues[key] = record.values.get(key);
|
||||
});
|
||||
|
||||
//? safe to delete? setFormValues(formValues);
|
||||
|
||||
if (!tableMetaData.capabilities.has(Capability.TABLE_UPDATE))
|
||||
{
|
||||
setNotAllowedError("Records may not be edited in this table");
|
||||
@ -378,17 +376,18 @@ function EntityForm(props: Props): JSX.Element
|
||||
actions.setSubmitting(true);
|
||||
await (async () =>
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// (1) convert date-time fields from user's time-zone into UTC //
|
||||
// (2) if there's an initial value which matches the value (e.g., from the form), then remove that field //
|
||||
// from the set of values that we'll submit to the backend. This is to deal with the fact that our //
|
||||
// date-times in the UI (e.g., the form field) only go to the minute - so they kinda always end up //
|
||||
// changing from, say, 12:15:30 to just 12:15:00... this seems to get around that, for cases when the //
|
||||
// user didn't change the value in the field (but if the user did change the value, then we will submit it) //
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
for(let fieldName of tableMetaData.fields.keys())
|
||||
{
|
||||
const fieldMetaData = tableMetaData.fields.get(fieldName);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// (1) convert date-time fields from user's time-zone into UTC //
|
||||
// (2) if there's an initial value which matches the value (e.g., from the form), then remove that field //
|
||||
// from the set of values that we'll submit to the backend. This is to deal with the fact that our //
|
||||
// date-times in the UI (e.g., the form field) only go to the minute - so they kinda always end up //
|
||||
// changing from, say, 12:15:30 to just 12:15:00... this seems to get around that, for cases when the //
|
||||
// user didn't change the value in the field (but if the user did change the value, then we will submit it) //
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
if(fieldMetaData.type === QFieldType.DATE_TIME && values[fieldName])
|
||||
{
|
||||
console.log(`DateTime ${fieldName}: Initial value: [${initialValues[fieldName]}] -> [${values[fieldName]}]`)
|
||||
@ -402,6 +401,22 @@ function EntityForm(props: Props): JSX.Element
|
||||
values[fieldName] = ValueUtils.frontendLocalZoneDateTimeStringToUTCStringForBackend(values[fieldName]);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// for BLOB fields, there are 3 possible cases: //
|
||||
// 1) they are a File object - in which case, cool, send them through to the backend to have bytes stored. //
|
||||
// 2) they are null - in which case, cool, send them through to the backend to be set to null. //
|
||||
// 3) they are a String, which is their URL path to download them... in that case, don't submit them to //
|
||||
// the backend at all, so they'll stay what they were. do that by deleting them from the values object here. //
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
if(fieldMetaData.type === QFieldType.BLOB)
|
||||
{
|
||||
if(typeof values[fieldName] === "string")
|
||||
{
|
||||
console.log(`${fieldName} value was a string, so, we're deleting it from the values array, to not submit it to the backend, to not change it.`);
|
||||
delete(values[fieldName]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (props.id !== null)
|
||||
@ -416,8 +431,8 @@ function EntityForm(props: Props): JSX.Element
|
||||
}
|
||||
else
|
||||
{
|
||||
const path = `${location.pathname.replace(/\/edit$/, "")}?updateSuccess=true`;
|
||||
navigate(path);
|
||||
const path = location.pathname.replace(/\/edit$/, "");
|
||||
navigate(path, {state: {updateSuccess: true}});
|
||||
}
|
||||
})
|
||||
.catch((error) =>
|
||||
@ -427,12 +442,13 @@ function EntityForm(props: Props): JSX.Element
|
||||
|
||||
if(error.message.toLowerCase().startsWith("warning"))
|
||||
{
|
||||
const path = `${location.pathname.replace(/\/edit$/, "")}?updateSuccess=true&warning=${encodeURIComponent(error.message)}`;
|
||||
navigate(path);
|
||||
const path = location.pathname.replace(/\/edit$/, "");
|
||||
navigate(path, {state: {updateSuccess: true, warning: error.message}});
|
||||
}
|
||||
else
|
||||
{
|
||||
setAlertContent(error.message);
|
||||
HtmlUtils.autoScroll(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -448,20 +464,22 @@ function EntityForm(props: Props): JSX.Element
|
||||
}
|
||||
else
|
||||
{
|
||||
const path = `${location.pathname.replace(/create$/, record.values.get(tableMetaData.primaryKeyField))}?createSuccess=true`;
|
||||
navigate(path);
|
||||
const path = location.pathname.replace(/create$/, record.values.get(tableMetaData.primaryKeyField));
|
||||
navigate(path, {state: {createSuccess: true}});
|
||||
}
|
||||
})
|
||||
.catch((error) =>
|
||||
{
|
||||
if(error.message.toLowerCase().startsWith("warning"))
|
||||
{
|
||||
const path = `${location.pathname.replace(/create$/, record.values.get(tableMetaData.primaryKeyField))}?createSuccess=true&warning=${encodeURIComponent(error.message)}`;
|
||||
const path = location.pathname.replace(/create$/, record.values.get(tableMetaData.primaryKeyField));
|
||||
navigate(path);
|
||||
navigate(path, {state: {createSuccess: true, warning: error.message}});
|
||||
}
|
||||
else
|
||||
{
|
||||
setAlertContent(error.message);
|
||||
HtmlUtils.autoScroll(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -499,12 +517,12 @@ function EntityForm(props: Props): JSX.Element
|
||||
<Grid item xs={12}>
|
||||
{alertContent ? (
|
||||
<Box mb={3}>
|
||||
<Alert severity="error">{alertContent}</Alert>
|
||||
<Alert severity="error" onClose={() => setAlertContent(null)}>{alertContent}</Alert>
|
||||
</Box>
|
||||
) : ("")}
|
||||
{warningContent ? (
|
||||
<Box mb={3}>
|
||||
<Alert severity="warning">{warningContent}</Alert>
|
||||
<Alert severity="warning" onClose={() => setWarningContent(null)}>{warningContent}</Alert>
|
||||
</Box>
|
||||
) : ("")}
|
||||
</Grid>
|
||||
|
@ -707,6 +707,20 @@ const booleanNotEmptyOperator: GridFilterOperator = {
|
||||
|
||||
export const QGridBooleanOperators = [booleanTrueOperator, booleanFalseOperator, booleanEmptyOperator, booleanNotEmptyOperator];
|
||||
|
||||
const blobEmptyOperator: GridFilterOperator = {
|
||||
label: "is empty",
|
||||
value: "isEmpty",
|
||||
getApplyFilterFn: (filterItem: GridFilterItem, column: GridColDef) => null
|
||||
};
|
||||
|
||||
const blobNotEmptyOperator: GridFilterOperator = {
|
||||
label: "is not empty",
|
||||
value: "isNotEmpty",
|
||||
getApplyFilterFn: (filterItem: GridFilterItem, column: GridColDef) => null
|
||||
};
|
||||
|
||||
export const QGridBlobOperators = [blobNotEmptyOperator, blobEmptyOperator];
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
// input element for possible values //
|
||||
|
@ -97,12 +97,31 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
||||
const tableName = table.name;
|
||||
const [searchParams] = useSearchParams();
|
||||
|
||||
const [showSuccessfullyDeletedAlert, setShowSuccessfullyDeletedAlert] = useState(searchParams.has("deleteSuccess"));
|
||||
const [showSuccessfullyDeletedAlert, setShowSuccessfullyDeletedAlert] = useState(false);
|
||||
const [warningAlert, setWarningAlert] = useState(null as string);
|
||||
const [successAlert, setSuccessAlert] = useState(null as string);
|
||||
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
|
||||
if(location.state)
|
||||
{
|
||||
let state: any = location.state;
|
||||
if(state["deleteSuccess"])
|
||||
{
|
||||
setShowSuccessfullyDeletedAlert(true);
|
||||
delete state["deleteSuccess"];
|
||||
}
|
||||
|
||||
if(state["warning"])
|
||||
{
|
||||
setWarningAlert(state["warning"]);
|
||||
delete state["warning"];
|
||||
}
|
||||
|
||||
window.history.replaceState(state, "");
|
||||
}
|
||||
|
||||
const pathParts = location.pathname.replace(/\/+$/, "").split("/");
|
||||
|
||||
////////////////////////////////////////////
|
||||
@ -982,7 +1001,9 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
||||
//////////////////////////////////////
|
||||
const dateString = ValueUtils.formatDateTimeForFileName(new Date());
|
||||
const filename = `${tableMetaData.label} Export ${dateString}.${format}`;
|
||||
const url = `/data/${tableMetaData.name}/export/${filename}?filter=${encodeURIComponent(JSON.stringify(buildQFilter(tableMetaData, filterModel)))}&fields=${visibleFields.join(",")}`;
|
||||
const url = `/data/${tableMetaData.name}/export/${filename}`;
|
||||
|
||||
const encodedFilterJSON = encodeURIComponent(JSON.stringify(buildQFilter(tableMetaData, filterModel)));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
// open a window (tab) with a little page that says the file is being generated. //
|
||||
@ -999,6 +1020,11 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
||||
<script>
|
||||
setTimeout(() =>
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// need to encode and decode this value, so set it in the form here, instead of literally below //
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
document.getElementById("filter").value = decodeURIComponent("${encodedFilterJSON}");
|
||||
|
||||
document.getElementById("exportForm").submit();
|
||||
}, 1);
|
||||
</script>
|
||||
@ -1007,6 +1033,8 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
||||
Generating file <u>${filename}</u>${totalRecords ? " with " + totalRecords.toLocaleString() + " record" + (totalRecords == 1 ? "" : "s") : ""}...
|
||||
<form id="exportForm" method="post" action="${url}" >
|
||||
<input type="hidden" name="Authorization" value="${qController.getAuthorizationHeaderValue()}">
|
||||
<input type="hidden" name="fields" value="${visibleFields.join(",")}">
|
||||
<input type="hidden" name="filter" id="filter">
|
||||
</form>
|
||||
</body>
|
||||
</html>`);
|
||||
@ -1795,23 +1823,20 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
||||
)}
|
||||
{
|
||||
(tableLabel && showSuccessfullyDeletedAlert) ? (
|
||||
<Alert color="success" sx={{mb: 3}} onClose={() =>
|
||||
{
|
||||
setShowSuccessfullyDeletedAlert(false);
|
||||
}}>
|
||||
{`${tableLabel} successfully deleted`}
|
||||
</Alert>
|
||||
<Alert color="success" sx={{mb: 3}} onClose={() => setShowSuccessfullyDeletedAlert(false)}>{`${tableLabel} successfully deleted`}</Alert>
|
||||
) : null
|
||||
}
|
||||
{
|
||||
(successAlert) ? (
|
||||
<Collapse in={Boolean(successAlert)}>
|
||||
<Alert color="success" sx={{mb: 3}} onClose={() =>
|
||||
{
|
||||
setSuccessAlert(null);
|
||||
}}>
|
||||
{successAlert}
|
||||
</Alert>
|
||||
<Alert color="success" sx={{mb: 3}} onClose={() => setSuccessAlert(null)}>{successAlert}</Alert>
|
||||
</Collapse>
|
||||
) : null
|
||||
}
|
||||
{
|
||||
(warningAlert) ? (
|
||||
<Collapse in={Boolean(warningAlert)}>
|
||||
<Alert color="warning" sx={{mb: 3}} onClose={() => setWarningAlert(null)}>{warningAlert}</Alert>
|
||||
</Collapse>
|
||||
) : null
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ import Menu from "@mui/material/Menu";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
import Modal from "@mui/material/Modal";
|
||||
import React, {useContext, useEffect, useState} from "react";
|
||||
import {useLocation, useNavigate, useParams, useSearchParams} from "react-router-dom";
|
||||
import {useLocation, useNavigate, useParams} from "react-router-dom";
|
||||
import QContext from "QContext";
|
||||
import AuditBody from "qqq/components/audits/AuditBody";
|
||||
import {QActionsMenuButton, QCancelButton, QDeleteButton, QEditButton} from "qqq/components/buttons/DefaultButtons";
|
||||
@ -53,6 +53,7 @@ import DashboardWidgets from "qqq/components/widgets/DashboardWidgets";
|
||||
import BaseLayout from "qqq/layouts/BaseLayout";
|
||||
import ProcessRun from "qqq/pages/processes/ProcessRun";
|
||||
import HistoryUtils from "qqq/utils/HistoryUtils";
|
||||
import HtmlUtils from "qqq/utils/HtmlUtils";
|
||||
import Client from "qqq/utils/qqq/Client";
|
||||
import ProcessUtils from "qqq/utils/qqq/ProcessUtils";
|
||||
import TableUtils from "qqq/utils/qqq/TableUtils";
|
||||
@ -97,10 +98,10 @@ function RecordView({table, launchProcess}: Props): JSX.Element
|
||||
const [tableProcesses, setTableProcesses] = useState([] as QProcessMetaData[]);
|
||||
const [allTableProcesses, setAllTableProcesses] = useState([] as QProcessMetaData[]);
|
||||
const [actionsMenu, setActionsMenu] = useState(null);
|
||||
const [notFoundMessage, setNotFoundMessage] = useState(null);
|
||||
const [notFoundMessage, setNotFoundMessage] = useState(null as string);
|
||||
const [errorMessage, setErrorMessage] = useState(null as string)
|
||||
const [successMessage, setSuccessMessage] = useState(null as string);
|
||||
const [warningMessage, setWarningMessage] = useState(null as string);
|
||||
const [searchParams] = useSearchParams();
|
||||
const {setPageHeader} = useContext(QContext);
|
||||
const [activeModalProcess, setActiveModalProcess] = useState(null as QProcessMetaData);
|
||||
const [reloadCounter, setReloadCounter] = useState(0);
|
||||
@ -116,6 +117,7 @@ function RecordView({table, launchProcess}: Props): JSX.Element
|
||||
{
|
||||
setSuccessMessage(null);
|
||||
setNotFoundMessage(null);
|
||||
setErrorMessage(null);
|
||||
setAsyncLoadInited(false);
|
||||
setTableMetaData(null);
|
||||
setRecord(null);
|
||||
@ -316,13 +318,16 @@ function RecordView({table, launchProcess}: Props): JSX.Element
|
||||
|
||||
setPageHeader(record.recordLabel);
|
||||
|
||||
try
|
||||
if(!launchingProcess)
|
||||
{
|
||||
HistoryUtils.push({label: `${tableMetaData?.label}: ${record.recordLabel}`, path: location.pathname, iconName: table.iconName});
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
console.error("Error pushing history: " + e);
|
||||
try
|
||||
{
|
||||
HistoryUtils.push({label: `${tableMetaData?.label}: ${record.recordLabel}`, path: location.pathname, iconName: table.iconName});
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
console.error("Error pushing history: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
@ -423,14 +428,26 @@ function RecordView({table, launchProcess}: Props): JSX.Element
|
||||
setSectionFieldElements(sectionFieldElements);
|
||||
setNonT1TableSections(nonT1TableSections);
|
||||
|
||||
if (searchParams.get("createSuccess") || searchParams.get("updateSuccess"))
|
||||
if(location.state)
|
||||
{
|
||||
setSuccessMessage(`${tableMetaData.label} successfully ${searchParams.get("createSuccess") ? "created" : "updated"}`);
|
||||
}
|
||||
if (searchParams.get("warning"))
|
||||
{
|
||||
setWarningMessage(searchParams.get("warning"));
|
||||
let state: any = location.state;
|
||||
if (state["createSuccess"] || state["updateSuccess"])
|
||||
{
|
||||
setSuccessMessage(`${tableMetaData.label} successfully ${state["createSuccess"] ? "created" : "updated"}`);
|
||||
}
|
||||
|
||||
if (state["warning"])
|
||||
{
|
||||
setWarningMessage(state["warning"]);
|
||||
}
|
||||
|
||||
delete state["createSuccess"]
|
||||
delete state["updateSuccess"]
|
||||
delete state["warning"]
|
||||
|
||||
window.history.replaceState(state, "");
|
||||
}
|
||||
|
||||
})();
|
||||
}
|
||||
|
||||
@ -452,8 +469,25 @@ function RecordView({table, launchProcess}: Props): JSX.Element
|
||||
await qController.delete(tableName, id)
|
||||
.then(() =>
|
||||
{
|
||||
const path = `${pathParts.slice(0, -1).join("/")}?deleteSuccess=true`;
|
||||
navigate(path);
|
||||
const path = pathParts.slice(0, -1).join("/");
|
||||
navigate(path, {state: {deleteSuccess: true}});
|
||||
})
|
||||
.catch((error) =>
|
||||
{
|
||||
setDeleteConfirmationOpen(false);
|
||||
console.log("Caught:");
|
||||
console.log(error);
|
||||
|
||||
if(error.message.toLowerCase().startsWith("warning"))
|
||||
{
|
||||
const path = pathParts.slice(0, -1).join("/");
|
||||
navigate(path, {state: {deleteSuccess: true, warning: error.message}});
|
||||
}
|
||||
else
|
||||
{
|
||||
setErrorMessage(error.message);
|
||||
HtmlUtils.autoScroll(0);
|
||||
}
|
||||
});
|
||||
})();
|
||||
};
|
||||
@ -648,7 +682,7 @@ function RecordView({table, launchProcess}: Props): JSX.Element
|
||||
<Box pb={3}>
|
||||
{
|
||||
successMessage ?
|
||||
<Alert color="success" sx={{mb: 3}} onClose={() =>
|
||||
<Alert color="success" sx={{mb: 3}} onClose={() =>
|
||||
{
|
||||
setSuccessMessage(null);
|
||||
}}>
|
||||
@ -666,6 +700,16 @@ function RecordView({table, launchProcess}: Props): JSX.Element
|
||||
</Alert>
|
||||
: ("")
|
||||
}
|
||||
{
|
||||
errorMessage ?
|
||||
<Alert color="error" sx={{mb: 3}} onClose={() =>
|
||||
{
|
||||
setErrorMessage(null);
|
||||
}}>
|
||||
{errorMessage}
|
||||
</Alert>
|
||||
: ("")
|
||||
}
|
||||
|
||||
<Grid container spacing={3}>
|
||||
<Grid item xs={12} lg={3}>
|
||||
|
@ -500,4 +500,5 @@ input[type="search"]::-webkit-search-results-decoration { display: none; }
|
||||
{
|
||||
padding-left: 0.25rem;
|
||||
padding-right: 0.25rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ import {GridColDef, GridFilterItem, GridRowsProp} from "@mui/x-data-grid-pro";
|
||||
import {GridFilterOperator} from "@mui/x-data-grid/models/gridFilterOperator";
|
||||
import React from "react";
|
||||
import {Link} from "react-router-dom";
|
||||
import {buildQGridPvsOperators, QGridBooleanOperators, QGridNumericOperators, QGridStringOperators} from "qqq/pages/records/query/GridFilterOperators";
|
||||
import {buildQGridPvsOperators, QGridBlobOperators, QGridBooleanOperators, QGridNumericOperators, QGridStringOperators} from "qqq/pages/records/query/GridFilterOperators";
|
||||
import ValueUtils from "qqq/utils/qqq/ValueUtils";
|
||||
|
||||
|
||||
@ -197,6 +197,23 @@ export default class DataGridUtils
|
||||
sortedKeys.forEach((key) =>
|
||||
{
|
||||
const field = tableMetaData.fields.get(key);
|
||||
if(field.isHeavy)
|
||||
{
|
||||
if(field.type == QFieldType.BLOB)
|
||||
{
|
||||
////////////////////////////////////////////////////////
|
||||
// assume we DO want heavy blobs - as download links. //
|
||||
////////////////////////////////////////////////////////
|
||||
}
|
||||
else
|
||||
{
|
||||
///////////////////////////////////////////////////
|
||||
// otherwise, skip heavy fields on query screen. //
|
||||
///////////////////////////////////////////////////
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const column = this.makeColumnFromField(field, tableMetaData, namePrefix, labelPrefix);
|
||||
|
||||
if(key === tableMetaData.primaryKeyField && linkBase && namePrefix == null)
|
||||
@ -262,6 +279,9 @@ export default class DataGridUtils
|
||||
columnWidth = 75;
|
||||
filterOperators = QGridBooleanOperators;
|
||||
break;
|
||||
case QFieldType.BLOB:
|
||||
filterOperators = QGridBlobOperators;
|
||||
break;
|
||||
default:
|
||||
// noop - leave as string
|
||||
}
|
||||
@ -274,6 +294,7 @@ export default class DataGridUtils
|
||||
const widths: Map<string, number> = new Map<string, number>([
|
||||
["small", 100],
|
||||
["medium", 200],
|
||||
["medlarge", 300],
|
||||
["large", 400],
|
||||
["xlarge", 600]
|
||||
]);
|
||||
@ -290,7 +311,7 @@ export default class DataGridUtils
|
||||
let headerName = labelPrefix ? labelPrefix + field.label : field.label;
|
||||
let fieldName = namePrefix ? namePrefix + field.name : field.name;
|
||||
|
||||
const column = {
|
||||
const column: GridColDef = {
|
||||
field: fieldName,
|
||||
type: columnType,
|
||||
headerName: headerName,
|
||||
|
@ -19,6 +19,8 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import Client from "qqq/utils/qqq/Client";
|
||||
|
||||
/*******************************************************************************
|
||||
** Utility functions for basic html/webpage/browser things.
|
||||
*******************************************************************************/
|
||||
@ -59,4 +61,72 @@ export default class HtmlUtils
|
||||
document.body.removeChild(element);
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
** Download a server-side generated file.
|
||||
*******************************************************************************/
|
||||
static downloadUrlViaIFrame = (url: string) =>
|
||||
{
|
||||
if (document.getElementById("downloadIframe"))
|
||||
{
|
||||
document.body.removeChild(document.getElementById("downloadIframe"));
|
||||
}
|
||||
|
||||
const iframe = document.createElement("iframe");
|
||||
iframe.setAttribute("id", "downloadIframe");
|
||||
iframe.setAttribute("name", "downloadIframe");
|
||||
iframe.style.display = "none";
|
||||
// todo - onload event handler to let us know when done?
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
const form = document.createElement("form");
|
||||
form.setAttribute("method", "post");
|
||||
form.setAttribute("action", url);
|
||||
form.setAttribute("target", "downloadIframe");
|
||||
iframe.appendChild(form);
|
||||
|
||||
const authorizationInput = document.createElement("input");
|
||||
authorizationInput.setAttribute("type", "hidden");
|
||||
authorizationInput.setAttribute("id", "authorizationInput");
|
||||
authorizationInput.setAttribute("name", "Authorization");
|
||||
authorizationInput.setAttribute("value", Client.getInstance().getAuthorizationHeaderValue());
|
||||
form.appendChild(authorizationInput);
|
||||
|
||||
const downloadInput = document.createElement("input");
|
||||
downloadInput.setAttribute("type", "hidden");
|
||||
downloadInput.setAttribute("name", "download");
|
||||
downloadInput.setAttribute("value", "1");
|
||||
form.appendChild(downloadInput);
|
||||
|
||||
form.submit();
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
** Open a server-side generated file from a url in a new window.
|
||||
*******************************************************************************/
|
||||
static openInNewWindow = (url: string, filename: string) =>
|
||||
{
|
||||
const openInWindow = window.open("", "_blank");
|
||||
openInWindow.document.write(`<html lang="en">
|
||||
<head>
|
||||
<style>
|
||||
* { font-family: "Roboto","Helvetica","Arial",sans-serif; }
|
||||
</style>
|
||||
<title>${filename}</title>
|
||||
<script>
|
||||
setTimeout(() =>
|
||||
{
|
||||
document.getElementById("exportForm").submit();
|
||||
}, 1);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
Opening ${filename}...
|
||||
<form id="exportForm" method="post" action="${url}" >
|
||||
<input type="hidden" name="Authorization" value="${Client.getInstance().getAuthorizationHeaderValue()}">
|
||||
</form>
|
||||
</body>
|
||||
</html>`);
|
||||
};
|
||||
|
||||
|
||||
}
|
@ -488,6 +488,53 @@ class FilterUtils
|
||||
}
|
||||
}
|
||||
|
||||
if (field && field.type == "DATE" && !values)
|
||||
{
|
||||
try
|
||||
{
|
||||
const criteria = filterJSON.criteria[i];
|
||||
if (criteria && criteria.expression)
|
||||
{
|
||||
let value = new Date();
|
||||
let amount = Number(criteria.expression.amount);
|
||||
switch (criteria.expression.timeUnit)
|
||||
{
|
||||
case "MINUTES":
|
||||
{
|
||||
amount = amount * 60;
|
||||
break;
|
||||
}
|
||||
case "HOURS":
|
||||
{
|
||||
amount = amount * 60 * 60;
|
||||
break;
|
||||
}
|
||||
case "DAYS":
|
||||
{
|
||||
amount = amount * 60 * 60 * 24;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
console.log("Unrecognized time unit: " + criteria.expression.timeUnit);
|
||||
}
|
||||
}
|
||||
|
||||
if (criteria.expression.operator == "MINUS")
|
||||
{
|
||||
amount = -amount;
|
||||
}
|
||||
|
||||
value.setTime(value.getTime() + 1000 * amount);
|
||||
values = [ValueUtils.formatDateISO8601(value)];
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
defaultFilter.items.push({
|
||||
columnField: criteria.fieldName,
|
||||
operatorValue: FilterUtils.qqqCriteriaOperatorToGrid(criteria.operator, field, values),
|
||||
|
@ -28,11 +28,14 @@ import "datejs"; // https://github.com/datejs/Datejs
|
||||
import {Chip, ClickAwayListener, Icon} from "@mui/material";
|
||||
import Box from "@mui/material/Box";
|
||||
import Button from "@mui/material/Button";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
import {makeStyles} from "@mui/styles";
|
||||
import parse from "html-react-parser";
|
||||
import React, {Fragment, useReducer, useState} from "react";
|
||||
import AceEditor from "react-ace";
|
||||
import {Link} from "react-router-dom";
|
||||
import HtmlUtils from "qqq/utils/HtmlUtils";
|
||||
import Client from "qqq/utils/qqq/Client";
|
||||
|
||||
/*******************************************************************************
|
||||
@ -192,6 +195,11 @@ class ValueUtils
|
||||
);
|
||||
}
|
||||
|
||||
if (field.type == QFieldType.BLOB)
|
||||
{
|
||||
return (<BlobComponent field={field} url={rawValue} filename={displayValue} usage={usage} />);
|
||||
}
|
||||
|
||||
return (ValueUtils.getUnadornedValueForDisplay(field, rawValue, displayValue));
|
||||
}
|
||||
|
||||
@ -273,6 +281,16 @@ class ValueUtils
|
||||
return (`${date.toString("yyyy-MM-ddTHH:mm:ssZ")}`);
|
||||
}
|
||||
|
||||
public static formatDateISO8601(date: Date)
|
||||
{
|
||||
if (!(date instanceof Date))
|
||||
{
|
||||
date = new Date(date);
|
||||
}
|
||||
// @ts-ignore
|
||||
return (`${date.toString("yyyy-MM-dd")}`);
|
||||
}
|
||||
|
||||
public static formatDateTimeForFileName(date: Date)
|
||||
{
|
||||
const zp = (value: number): string => (value < 10 ? `0${value}` : `${value}`);
|
||||
@ -500,9 +518,9 @@ function CodeViewer({name, mode, code}: {name: string; mode: string; code: strin
|
||||
</Box>);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// little private component here, for rendering an AceEditor with some buttons/controls/state //
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// little private component here, for rendering "secret-ish" values, that you can click to reveal or copy //
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
function RevealComponent({fieldName, value, usage}: {fieldName: string, value: string, usage: string;}): JSX.Element
|
||||
{
|
||||
const [adornmentFieldsMap, setAdornmentFieldsMap] = useState(new Map<string, boolean>);
|
||||
@ -542,7 +560,7 @@ function RevealComponent({fieldName, value, usage}: {fieldName: string, value: s
|
||||
{
|
||||
displayValue && (
|
||||
adornmentFieldsMap.get(fieldName) === true ? (
|
||||
<Box>
|
||||
<Box component="span">
|
||||
<Icon onClick={(e) => handleRevealIconClick(e, fieldName)} sx={{cursor: "pointer", fontSize: "15px !important", position: "relative", top: "3px", marginRight: "5px"}}>visibility_on</Icon>
|
||||
{displayValue}
|
||||
<ClickAwayListener onClickAway={handleTooltipClose}>
|
||||
@ -561,7 +579,7 @@ function RevealComponent({fieldName, value, usage}: {fieldName: string, value: s
|
||||
</ClickAwayListener>
|
||||
</Box>
|
||||
):(
|
||||
<Box><Icon onClick={(e) => handleRevealIconClick(e, fieldName)} sx={{cursor: "pointer", fontSize: "15px !important", position: "relative", top: "3px", marginRight: "5px"}}>visibility_off</Icon>{displayValue}</Box>
|
||||
<Box display="inline"><Icon onClick={(e) => handleRevealIconClick(e, fieldName)} sx={{cursor: "pointer", fontSize: "15px !important", position: "relative", top: "3px", marginRight: "5px"}}>visibility_off</Icon>{displayValue}</Box>
|
||||
)
|
||||
)
|
||||
}
|
||||
@ -570,5 +588,59 @@ function RevealComponent({fieldName, value, usage}: {fieldName: string, value: s
|
||||
}
|
||||
|
||||
|
||||
interface BlobComponentProps
|
||||
{
|
||||
field: QFieldMetaData;
|
||||
url: string;
|
||||
filename: string;
|
||||
usage: "view" | "query";
|
||||
}
|
||||
|
||||
BlobComponent.defaultProps = {
|
||||
usage: "view",
|
||||
};
|
||||
|
||||
function BlobComponent({field, url, filename, usage}: BlobComponentProps): JSX.Element
|
||||
{
|
||||
const download = (event: React.MouseEvent<HTMLSpanElement>) =>
|
||||
{
|
||||
event.stopPropagation();
|
||||
HtmlUtils.downloadUrlViaIFrame(url);
|
||||
};
|
||||
|
||||
const open = (event: React.MouseEvent<HTMLSpanElement>) =>
|
||||
{
|
||||
event.stopPropagation();
|
||||
HtmlUtils.openInNewWindow(url, filename);
|
||||
};
|
||||
|
||||
if(!filename || !url)
|
||||
{
|
||||
return (<React.Fragment />);
|
||||
}
|
||||
|
||||
const tooltipPlacement = usage == "view" ? "bottom" : "right";
|
||||
|
||||
// todo - thumbnails if adorned?
|
||||
// challenge is - must post (for auth header)...
|
||||
return (
|
||||
<Box display="inline-flex">
|
||||
{
|
||||
usage == "view" && filename
|
||||
}
|
||||
<Tooltip placement={tooltipPlacement} title="Open file">
|
||||
<Icon className={"blobIcon"} fontSize="small" onClick={(e) => open(e)}>open_in_new</Icon>
|
||||
</Tooltip>
|
||||
<Tooltip placement={tooltipPlacement} title="Download file">
|
||||
<Icon className={"blobIcon"} fontSize="small" onClick={(e) => download(e)}>save_alt</Icon>
|
||||
</Tooltip>
|
||||
{
|
||||
usage == "query" && filename
|
||||
}
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
export default ValueUtils;
|
||||
|
@ -74,7 +74,8 @@ public class QBaseSeleniumTest
|
||||
.withRouteToFile("/metaData", "metaData/index.json")
|
||||
.withRouteToFile("/metaData/authentication", "metaData/authentication.json")
|
||||
.withRouteToFile("/metaData/table/person", "metaData/table/person.json")
|
||||
.withRouteToFile("/metaData/table/city", "metaData/table/person.json");
|
||||
.withRouteToFile("/metaData/table/city", "metaData/table/person.json")
|
||||
.withRouteToFile("/processes/querySavedFilter/init", "processes/querySavedFilter/init.json");
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,10 +3,11 @@ package com.kingsrook.qqq.materialdashboard.lib.javalin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.kingsrook.qqq.materialdashboard.lib.QSeleniumLib;
|
||||
import io.javalin.Javalin;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
@ -25,8 +26,8 @@ public class QSeleniumJavalin
|
||||
|
||||
private long WAIT_SECONDS = 10;
|
||||
|
||||
private List<Pair<String, String>> routesToFiles = new ArrayList<>();
|
||||
private List<Pair<String, String>> routesToStrings = new ArrayList<>();
|
||||
private Map<String, String> routesToFiles = new LinkedHashMap<>();
|
||||
private Map<String, String> routesToStrings = new LinkedHashMap<>();
|
||||
|
||||
private Javalin javalin;
|
||||
|
||||
@ -71,9 +72,9 @@ public class QSeleniumJavalin
|
||||
{
|
||||
if(this.routesToFiles == null)
|
||||
{
|
||||
this.routesToFiles = new ArrayList<>();
|
||||
this.routesToFiles = new LinkedHashMap<>();
|
||||
}
|
||||
this.routesToFiles.add(Pair.of(path, fixtureFilePath));
|
||||
this.routesToFiles.put(path, fixtureFilePath);
|
||||
return (this);
|
||||
}
|
||||
|
||||
@ -86,9 +87,9 @@ public class QSeleniumJavalin
|
||||
{
|
||||
if(this.routesToStrings == null)
|
||||
{
|
||||
this.routesToStrings = new ArrayList<>();
|
||||
this.routesToStrings = new LinkedHashMap<>();
|
||||
}
|
||||
this.routesToStrings.add(Pair.of(path, responseString));
|
||||
this.routesToStrings.put(path, responseString);
|
||||
return (this);
|
||||
}
|
||||
|
||||
@ -105,11 +106,11 @@ public class QSeleniumJavalin
|
||||
{
|
||||
javalin.routes(() ->
|
||||
{
|
||||
for(Pair<String, String> routeToFile : routesToFiles)
|
||||
for(Map.Entry<String, String> routeToFile : routesToFiles.entrySet())
|
||||
{
|
||||
LOG.debug("Setting up route for [" + routeToFile.getKey() + "] => [" + routeToFile.getValue() + "]");
|
||||
get(routeToFile.getKey(), new RouteFromFileHandler(this, routeToFile));
|
||||
post(routeToFile.getKey(), new RouteFromFileHandler(this, routeToFile));
|
||||
get(routeToFile.getKey(), new RouteFromFileHandler(this, routeToFile.getKey(), routeToFile.getValue()));
|
||||
post(routeToFile.getKey(), new RouteFromFileHandler(this, routeToFile.getKey(), routeToFile.getValue()));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -118,11 +119,11 @@ public class QSeleniumJavalin
|
||||
{
|
||||
javalin.routes(() ->
|
||||
{
|
||||
for(Pair<String, String> routeToString : routesToStrings)
|
||||
for(Map.Entry<String, String> routeToString : routesToStrings.entrySet())
|
||||
{
|
||||
LOG.debug("Setting up route for [" + routeToString.getKey() + "] => [" + routeToString.getValue() + "]");
|
||||
get(routeToString.getKey(), new RouteFromStringHandler(this, routeToString));
|
||||
post(routeToString.getKey(), new RouteFromStringHandler(this, routeToString));
|
||||
get(routeToString.getKey(), new RouteFromStringHandler(this, routeToString.getKey(), routeToString.getValue()));
|
||||
post(routeToString.getKey(), new RouteFromStringHandler(this, routeToString.getKey(), routeToString.getValue()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import java.util.List;
|
||||
import io.javalin.http.Context;
|
||||
import io.javalin.http.Handler;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@ -28,11 +27,11 @@ public class RouteFromFileHandler implements Handler
|
||||
** Constructor
|
||||
**
|
||||
*******************************************************************************/
|
||||
public RouteFromFileHandler(QSeleniumJavalin qSeleniumJavalin, Pair<String, String> routeToFilePath)
|
||||
public RouteFromFileHandler(QSeleniumJavalin qSeleniumJavalin, String route, String filePath)
|
||||
{
|
||||
this.qSeleniumJavalin = qSeleniumJavalin;
|
||||
this.route = routeToFilePath.getKey();
|
||||
this.filePath = routeToFilePath.getValue();
|
||||
this.route = route;
|
||||
this.filePath = filePath;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,7 +3,6 @@ package com.kingsrook.qqq.materialdashboard.lib.javalin;
|
||||
|
||||
import io.javalin.http.Context;
|
||||
import io.javalin.http.Handler;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@ -25,11 +24,11 @@ public class RouteFromStringHandler implements Handler
|
||||
** Constructor
|
||||
**
|
||||
*******************************************************************************/
|
||||
public RouteFromStringHandler(QSeleniumJavalin qSeleniumJavalin, Pair<String, String> routeToStringPath)
|
||||
public RouteFromStringHandler(QSeleniumJavalin qSeleniumJavalin, String route, String responseString)
|
||||
{
|
||||
this.qSeleniumJavalin = qSeleniumJavalin;
|
||||
this.route = routeToStringPath.getKey();
|
||||
this.responseString = routeToStringPath.getValue();
|
||||
this.route = route;
|
||||
this.responseString = responseString;
|
||||
}
|
||||
|
||||
|
||||
|
115
src/test/java/com/kingsrook/qqq/materialdashboard/tests/BulkEditTest.java
Executable file
115
src/test/java/com/kingsrook/qqq/materialdashboard/tests/BulkEditTest.java
Executable file
@ -0,0 +1,115 @@
|
||||
/*
|
||||
* QQQ - Low-code Application Framework for Engineers.
|
||||
* Copyright (C) 2021-2022. Kingsrook, LLC
|
||||
* 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
|
||||
* contact@kingsrook.com
|
||||
* https://github.com/Kingsrook/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.kingsrook.qqq.materialdashboard.tests;
|
||||
|
||||
|
||||
import com.kingsrook.qqq.materialdashboard.lib.QBaseSeleniumTest;
|
||||
import com.kingsrook.qqq.materialdashboard.lib.javalin.QSeleniumJavalin;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Test for the scripts table
|
||||
*******************************************************************************/
|
||||
public class BulkEditTest extends QBaseSeleniumTest
|
||||
{
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@Override
|
||||
protected void addJavalinRoutes(QSeleniumJavalin qSeleniumJavalin)
|
||||
{
|
||||
addCommonRoutesForThisTest(qSeleniumJavalin);
|
||||
qSeleniumJavalin
|
||||
.withRouteToFile("/metaData/process/person.bulkEdit", "metaData/process/person.bulkEdit.json")
|
||||
.withRouteToFile("/processes/person.bulkEdit/init", "/processes/person.bulkEdit/init.json")
|
||||
.withRouteToFile("/processes/person.bulkEdit/74a03a7d-2f53-4784-9911-3a21f7646c43/step/edit", "/processes/person.bulkEdit/step/edit.json")
|
||||
.withRouteToFile("/processes/person.bulkEdit/74a03a7d-2f53-4784-9911-3a21f7646c43/step/review", "/processes/person.bulkEdit/step/review.json")
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
private void addCommonRoutesForThisTest(QSeleniumJavalin qSeleniumJavalin)
|
||||
{
|
||||
super.addJavalinRoutes(qSeleniumJavalin);
|
||||
qSeleniumJavalin.withRouteToFile("/data/person/count", "data/person/count.json");
|
||||
qSeleniumJavalin.withRouteToFile("/data/person/query", "data/person/index.json");
|
||||
qSeleniumJavalin.withRouteToString("/processes/person.bulkEdit/74a03a7d-2f53-4784-9911-3a21f7646c43/records", "[]");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@Test
|
||||
// @RepeatedTest(100)
|
||||
void test()
|
||||
{
|
||||
qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/peopleApp/greetingsApp/person", "Person");
|
||||
qSeleniumLib.waitForSelectorContaining("button", "selection").click();
|
||||
qSeleniumLib.waitForSelectorContaining("li", "This page").click();
|
||||
qSeleniumLib.waitForSelectorContaining("div", "records on this page are selected");
|
||||
|
||||
qSeleniumLib.waitForSelectorContaining("button", "action").click();
|
||||
qSeleniumLib.waitForSelectorContaining("li", "bulk edit").click();
|
||||
|
||||
/////////////////
|
||||
// edit screen //
|
||||
/////////////////
|
||||
qSeleniumLib.waitForSelector("#bulkEditSwitch-firstName").click();
|
||||
qSeleniumLib.waitForSelector("input[name=firstName]").click();
|
||||
qSeleniumLib.waitForSelector("input[name=firstName]").sendKeys("John");
|
||||
qSeleniumLib.waitForSelectorContaining("button", "next").click();
|
||||
|
||||
///////////////////////
|
||||
// validation screen //
|
||||
///////////////////////
|
||||
qSeleniumLib.waitForSelectorContaining("span", "How would you like to proceed").click();
|
||||
qSeleniumLib.waitForSelectorContaining("button", "next").click();
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// need to change the result of the 'review' step this time //
|
||||
//////////////////////////////////////////////////////////////
|
||||
qSeleniumLib.waitForSelectorContaining("div", "Person Bulk Edit: Review").click();
|
||||
qSeleniumJavalin.clearRoutes();
|
||||
qSeleniumJavalin.stop();
|
||||
addCommonRoutesForThisTest(qSeleniumJavalin);
|
||||
qSeleniumJavalin.withRouteToFile("/processes/person.bulkEdit/74a03a7d-2f53-4784-9911-3a21f7646c43/step/review", "/processes/person.bulkEdit/step/review-result.json");
|
||||
qSeleniumJavalin.restart();
|
||||
qSeleniumLib.waitForSelectorContaining("button", "submit").click();
|
||||
|
||||
///////////////////
|
||||
// result screen //
|
||||
///////////////////
|
||||
qSeleniumLib.waitForSelectorContaining("div", "Person Bulk Edit: Result").click();
|
||||
qSeleniumLib.waitForSelectorContaining("button", "close").click();
|
||||
|
||||
// qSeleniumLib.waitForever();
|
||||
}
|
||||
|
||||
}
|
@ -46,7 +46,6 @@ public class SavedFiltersTest extends QBaseSeleniumTest
|
||||
protected void addJavalinRoutes(QSeleniumJavalin qSeleniumJavalin)
|
||||
{
|
||||
addStandardRoutesForThisTest(qSeleniumJavalin);
|
||||
qSeleniumJavalin.withRouteToFile("/processes/querySavedFilter/init", "processes/querySavedFilter/init.json");
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,12 +1,24 @@
|
||||
{
|
||||
"values": {
|
||||
"firstName": "Kahhhhn",
|
||||
"valuesBeingUpdated": "First Name will be set to: Kahhhhn",
|
||||
"bulkEditEnabledFields": "firstName",
|
||||
"recordsParam": "recordIds",
|
||||
"recordIds": "1,2,3,4,5",
|
||||
"queryFilterJSON": "{\"criteria\":[{\"fieldName\":\"id\",\"operator\":\"IN\",\"values\":[\"1\",\"2\",\"3\",\"4\",\"5\"]}]}"
|
||||
},
|
||||
"processUUID": "74a03a7d-2f53-4784-9911-3a21f7646c43",
|
||||
"nextStep": "review"
|
||||
}
|
||||
"values": {
|
||||
"transactionLevel": "process",
|
||||
"tableName": "person",
|
||||
"recordsParam": "recordIds",
|
||||
"supportsFullValidation": true,
|
||||
"recordIds": "1,2,3,4,5",
|
||||
"sourceTable": "person",
|
||||
"extract": {
|
||||
"name": "com.kingsrook.qqq.backend.core.processes.implementations.etl.streamedwithfrontend.ExtractViaQueryStep",
|
||||
"codeType": "JAVA"
|
||||
},
|
||||
"recordCount": 5,
|
||||
"previewMessage": "This is a preview of the records that will be updated.",
|
||||
"transform": {
|
||||
"name": "com.kingsrook.qqq.backend.core.processes.implementations.bulk.edit.BulkEditTransformStep",
|
||||
"codeType": "JAVA"
|
||||
},
|
||||
"destinationTable": "person",
|
||||
"bulkEditEnabledFields": "firstName"
|
||||
},
|
||||
"processUUID": "74a03a7d-2f53-4784-9911-3a21f7646c43",
|
||||
"nextStep": "review"
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
{
|
||||
"values": {
|
||||
"transactionLevel": "process",
|
||||
"tableName": "person",
|
||||
"recordsParam": "recordIds",
|
||||
"supportsFullValidation": true,
|
||||
"doFullValidation": true,
|
||||
"recordIds": "1,2,3,4,5",
|
||||
"sourceTable": "person",
|
||||
"extract": {
|
||||
"name": "com.kingsrook.qqq.backend.core.processes.implementations.etl.streamedwithfrontend.ExtractViaQueryStep",
|
||||
"codeType": "JAVA"
|
||||
},
|
||||
"validationSummary": [
|
||||
{
|
||||
"status": "OK",
|
||||
"count": 5,
|
||||
"message": "Person records will be edited.",
|
||||
"singularFutureMessage": "Person record will be edited.",
|
||||
"pluralFutureMessage": "Person records will be edited.",
|
||||
"singularPastMessage": "Person record was edited.",
|
||||
"pluralPastMessage": "Person records were edited."
|
||||
},
|
||||
{
|
||||
"status": "INFO",
|
||||
"message": "First name will be set to John"
|
||||
}
|
||||
],
|
||||
"recordCount": 5,
|
||||
"previewMessage": "This is a preview of the records that will be updated.",
|
||||
"transform": {
|
||||
"name": "com.kingsrook.qqq.backend.core.processes.implementations.bulk.edit.BulkEditTransformStep",
|
||||
"codeType": "JAVA"
|
||||
},
|
||||
"destinationTable": "person",
|
||||
"bulkEditEnabledFields": "firstName",
|
||||
"processResults": [
|
||||
{
|
||||
"status": "OK",
|
||||
"count": 5,
|
||||
"message": "Person records were edited.",
|
||||
"singularFutureMessage": "Person record will be edited.",
|
||||
"pluralFutureMessage": "Person records will be edited.",
|
||||
"singularPastMessage": "Person record was edited.",
|
||||
"pluralPastMessage": "Person records were edited."
|
||||
},
|
||||
{
|
||||
"status": "INFO",
|
||||
"message": "Mapping Exception Type was cleared out"
|
||||
}
|
||||
],
|
||||
"load": {
|
||||
"name": "com.kingsrook.qqq.backend.core.processes.implementations.etl.streamedwithfrontend.LoadViaUpdateStep",
|
||||
"codeType": "JAVA"
|
||||
},
|
||||
"basepullReadyToUpdateTimestamp": true
|
||||
},
|
||||
"processUUID": "74a03a7d-2f53-4784-9911-3a21f7646c43",
|
||||
"nextStep": "result"
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
{
|
||||
"values": {
|
||||
"transactionLevel": "process",
|
||||
"tableName": "person",
|
||||
"recordsParam": "recordIds",
|
||||
"supportsFullValidation": true,
|
||||
"doFullValidation": true,
|
||||
"recordIds": "1,2,3,4,5",
|
||||
"sourceTable": "person",
|
||||
"extract": {
|
||||
"name": "com.kingsrook.qqq.backend.core.processes.implementations.etl.streamedwithfrontend.ExtractViaQueryStep",
|
||||
"codeType": "JAVA"
|
||||
},
|
||||
"validationSummary": [
|
||||
{
|
||||
"status": "OK",
|
||||
"count": 5,
|
||||
"message": "Person records will be edited.",
|
||||
"singularFutureMessage": "Person record will be edited.",
|
||||
"pluralFutureMessage": "Person records will be edited.",
|
||||
"singularPastMessage": "Person record was edited.",
|
||||
"pluralPastMessage": "Person records were edited."
|
||||
},
|
||||
{
|
||||
"status": "INFO",
|
||||
"message": "First name will be set to John"
|
||||
}
|
||||
],
|
||||
"recordCount": 5,
|
||||
"previewMessage": "This is a preview of the records that will be updated.",
|
||||
"transform": {
|
||||
"name": "com.kingsrook.qqq.backend.core.processes.implementations.bulk.edit.BulkEditTransformStep",
|
||||
"codeType": "JAVA"
|
||||
},
|
||||
"destinationTable": "person",
|
||||
"bulkEditEnabledFields": "firstName"
|
||||
},
|
||||
"processUUID": "74a03a7d-2f53-4784-9911-3a21f7646c43",
|
||||
"nextStep": "review"
|
||||
}
|
Reference in New Issue
Block a user