From dbec039046f6c47660673a602cc15a47385aa7d4 Mon Sep 17 00:00:00 2001 From: Darin Kelkhoff Date: Mon, 22 Aug 2022 19:48:27 -0500 Subject: [PATCH 1/6] Removing many console.logs --- src/qqq/pages/process-run/index.tsx | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/qqq/pages/process-run/index.tsx b/src/qqq/pages/process-run/index.tsx index 8d3137f..7164d9b 100644 --- a/src/qqq/pages/process-run/index.tsx +++ b/src/qqq/pages/process-run/index.tsx @@ -355,8 +355,6 @@ function ProcessRun({process}: Props): JSX.Element return; } - // console.log(`Steps are: ${steps}`); - // console.log(`Setting step to ${newStep}`); let newIndex = null; if (typeof newStep === "number") { @@ -458,9 +456,6 @@ function ProcessRun({process}: Props): JSX.Element { if (activeStep && activeStep.formFields) { - console.log("In useEffect for disabledBulkEditFields"); - console.log(disabledBulkEditFields); - const newDynamicFormFields: any = {}; const newFormValidations: any = {}; activeStep.formFields.forEach((field) => @@ -536,17 +531,14 @@ function ProcessRun({process}: Props): JSX.Element if (lastProcessResponse instanceof QJobComplete) { const qJobComplete = lastProcessResponse as QJobComplete; - console.log("Setting new step."); setJobUUID(null); setNewStep(qJobComplete.nextStep); setProcessValues(qJobComplete.values); - // console.log(`Updated process values: ${JSON.stringify(qJobComplete.values)}`); } else if (lastProcessResponse instanceof QJobStarted) { const qJobStarted = lastProcessResponse as QJobStarted; setJobUUID(qJobStarted.jobUUID); - console.log("setting need to check because started"); setNeedToCheckJobStatus(true); } else if (lastProcessResponse instanceof QJobRunning) @@ -554,7 +546,6 @@ function ProcessRun({process}: Props): JSX.Element const qJobRunning = lastProcessResponse as QJobRunning; setQJobRunning(qJobRunning); setQJobRunningDate(new Date()); - console.log("setting need to check because running"); setNeedToCheckJobStatus(true); } else if (lastProcessResponse instanceof QJobError) @@ -572,10 +563,8 @@ function ProcessRun({process}: Props): JSX.Element ///////////////////////////////////////////////////////////////////////// useEffect(() => { - console.log("In effect for checking status"); if (needToCheckJobStatus) { - console.log(" and the bool was true"); setNeedToCheckJobStatus(false); if (jobUUID) { @@ -623,8 +612,6 @@ function ProcessRun({process}: Props): JSX.Element // queryStringForInit = `recordsParam=filterId&filterId=${urlSearchParams.get("filterId")}` // } - console.log(`@dk: Query String for init: ${queryStringForInit}`); - try { const processMetaData = await QClient.getInstance().loadProcessMetaData(processName); @@ -699,7 +686,6 @@ function ProcessRun({process}: Props): JSX.Element setTimeout(async () => { - console.log("Calling processStep..."); const processResponse = await QClient.getInstance().processStep( processName, processUUID, From ec8d5645be5021b66aa6f4a9965e0ea8cdd0c557 Mon Sep 17 00:00:00 2001 From: Darin Kelkhoff Date: Tue, 23 Aug 2022 08:03:22 -0500 Subject: [PATCH 2/6] Updated to pass app instead of appTreeNode to AppHome --- src/App.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/App.tsx b/src/App.tsx index 0540bec..9508ad8 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -226,7 +226,7 @@ export default function App() name: `${app.label}`, key: app.name, route: path, - component: , + component: , }); } else if (app.type === QAppNodeType.TABLE) From 2b47031f641b762d2e463f4284b3d77b898a99d2 Mon Sep 17 00:00:00 2001 From: Darin Kelkhoff Date: Tue, 23 Aug 2022 08:10:19 -0500 Subject: [PATCH 3/6] Moving selectionTool style to override-styles.css --- src/qqq/pages/entity-list/index.tsx | 1 - src/qqq/pages/entity-list/styles.css | 26 -------------------------- src/qqq/styles/qqq-override-styles.css | 8 +++++++- 3 files changed, 7 insertions(+), 28 deletions(-) delete mode 100644 src/qqq/pages/entity-list/styles.css diff --git a/src/qqq/pages/entity-list/index.tsx b/src/qqq/pages/entity-list/index.tsx index d184814..33184bb 100644 --- a/src/qqq/pages/entity-list/index.tsx +++ b/src/qqq/pages/entity-list/index.tsx @@ -77,7 +77,6 @@ import Button from "@mui/material/Button"; import Footer from "../../components/Footer"; import QProcessUtils from "../../utils/QProcessUtils"; -import "./styles.css"; import {QActionsMenuButton, QCreateNewButton} from "qqq/components/QButtons"; import QValueUtils from "qqq/utils/QValueUtils"; import LinearProgress from "@mui/material/LinearProgress"; diff --git a/src/qqq/pages/entity-list/styles.css b/src/qqq/pages/entity-list/styles.css deleted file mode 100644 index 5f4975c..0000000 --- a/src/qqq/pages/entity-list/styles.css +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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 . - */ - -.selectionTool -{ - margin-left: 40px; - font-size: 14px; -} diff --git a/src/qqq/styles/qqq-override-styles.css b/src/qqq/styles/qqq-override-styles.css index e6c5891..4f865a0 100644 --- a/src/qqq/styles/qqq-override-styles.css +++ b/src/qqq/styles/qqq-override-styles.css @@ -103,4 +103,10 @@ .MuiInputAdornment-sizeMedium * { font-size: .875rem !important; -} \ No newline at end of file +} + +.MuiDataGrid-toolbarContainer .selectionTool +{ + margin-left: 40px; + font-size: 14px; +} From 84b1c6f610900554f19b32879bada1d4c4e13778 Mon Sep 17 00:00:00 2001 From: Darin Kelkhoff Date: Tue, 23 Aug 2022 09:01:12 -0500 Subject: [PATCH 4/6] Fixed button style by changing to proper MUI Button --- src/qqq/pages/entity-list/index.tsx | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/qqq/pages/entity-list/index.tsx b/src/qqq/pages/entity-list/index.tsx index 33184bb..3ac6cc4 100644 --- a/src/qqq/pages/entity-list/index.tsx +++ b/src/qqq/pages/entity-list/index.tsx @@ -691,15 +691,11 @@ function EntityList({table}: Props): JSX.Element The {` ${selectedIds.length.toLocaleString()} `} records on this page are selected. - + ) } @@ -709,15 +705,11 @@ function EntityList({table}: Props): JSX.Element All {` ${totalRecords.toLocaleString()} `} records matching this query are selected. - + ) } From ce3c9e9deb584e698aaae67152316e4098574683 Mon Sep 17 00:00:00 2001 From: Tim Chamberlain Date: Tue, 23 Aug 2022 10:23:15 -0500 Subject: [PATCH 5/6] updated to try again when 5XX errors occur --- src/qqq/pages/process-run/index.tsx | 48 ++++++++++++++++++++++++----- src/qqq/utils/QClient.ts | 6 +--- 2 files changed, 41 insertions(+), 13 deletions(-) diff --git a/src/qqq/pages/process-run/index.tsx b/src/qqq/pages/process-run/index.tsx index 7164d9b..ccc034b 100644 --- a/src/qqq/pages/process-run/index.tsx +++ b/src/qqq/pages/process-run/index.tsx @@ -22,7 +22,7 @@ import React, {useEffect, useState, Fragment} from "react"; // formik components -import {Form, Formik, useFormikContext} from "formik"; +import {Form, Formik} from "formik"; // @mui material components import Grid from "@mui/material/Grid"; @@ -59,12 +59,17 @@ import Footer from "examples/Footer"; import {QProcessMetaData} from "@kingsrook/qqq-frontend-core/lib/model/metaData/QProcessMetaData"; import Navbar from "qqq/components/Navbar"; import BaseLayout from "qqq/components/BaseLayout"; +import {QException} from "@kingsrook/qqq-frontend-core/lib/exceptions/QException"; interface Props { process?: QProcessMetaData; } +const INITIAL_RETRY_MILLIS = 1_500; +const RETRY_MAX_MILLIS = 12_000; +const BACKOFF_AMOUNT = 1.5; + function ProcessRun({process}: Props): JSX.Element { const processNameParam = useParams().processName; @@ -74,6 +79,7 @@ function ProcessRun({process}: Props): JSX.Element // process state // /////////////////// const [processUUID, setProcessUUID] = useState(null as string); + const [retryMillis, setRetryMillis] = useState(INITIAL_RETRY_MILLIS); const [jobUUID, setJobUUID] = useState(null as string); const [qJobRunning, setQJobRunning] = useState(null as QJobRunning); const [qJobRunningDate, setQJobRunningDate] = useState(null as Date); @@ -526,6 +532,8 @@ function ProcessRun({process}: Props): JSX.Element if (lastProcessResponse) { setLastProcessResponse(null); + setRetryMillis(INITIAL_RETRY_MILLIS); + setQJobRunning(null); if (lastProcessResponse instanceof QJobComplete) @@ -566,23 +574,47 @@ function ProcessRun({process}: Props): JSX.Element if (needToCheckJobStatus) { setNeedToCheckJobStatus(false); - if (jobUUID) + (async () => { - (async () => + setTimeout(async () => { - setTimeout(async () => + try { + console.log("OK"); const processResponse = await QClient.getInstance().processJobStatus( processName, processUUID, jobUUID, ); setLastProcessResponse(processResponse); - }, 1500); - })(); - } + } + catch (e) + { + if (e instanceof QException) + { + const qException = e as QException; + const status = Number(qException.status); + if (status !== undefined && !Number.isNaN(status) && status >= 500 && status <= 600) + { + if (retryMillis < RETRY_MAX_MILLIS) + { + console.log(`500 error, attempting to retry in ${retryMillis + retryMillis} millis`); + setRetryMillis(retryMillis * BACKOFF_AMOUNT); + setNeedToCheckJobStatus(true); + return; + } + + console.log(`Retry millis [${retryMillis}] is greater or equal to the max retry limit [${RETRY_MAX_MILLIS}], giving up...`); + setProcessError("Could not connect to server"); + } + } + + throw (e); + } + }, retryMillis); + })(); } - }, [needToCheckJobStatus]); + }, [needToCheckJobStatus, retryMillis]); ////////////////////////////////////////////////////////////////////////////////////////// // do the initial load of data for the process - that is, meta data, plus the init step // diff --git a/src/qqq/utils/QClient.ts b/src/qqq/utils/QClient.ts index 960595d..8a48c01 100644 --- a/src/qqq/utils/QClient.ts +++ b/src/qqq/utils/QClient.ts @@ -34,11 +34,7 @@ class QClient private static handleException(exception: QException) { console.log(`Caught Exception: ${JSON.stringify(exception)}`); - const {logout} = useAuth0(); - if (exception.status === "401") - { - logout(); - } + throw (exception); } public static getInstance() From f829179f57ba19bcc98dd577678243ce485d47df Mon Sep 17 00:00:00 2001 From: Darin Kelkhoff Date: Thu, 25 Aug 2022 11:03:07 -0500 Subject: [PATCH 6/6] Update to kingsrook/qqq-frontend-core 1.0.12 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 31d6da4..b332395 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "@fullcalendar/interaction": "5.10.0", "@fullcalendar/react": "5.10.0", "@fullcalendar/timegrid": "5.10.0", - "@kingsrook/qqq-frontend-core": "1.0.10", + "@kingsrook/qqq-frontend-core": "1.0.12", "@mui/icons-material": "5.4.1", "@mui/material": "5.4.1", "@mui/styled-engine": "5.4.1",