-
- */}
-
+
+
);
}
+
+QGoogleDriveFolderPicker.defaultProps = {
+ showDefaultFoldersView: true,
+ showSharedDrivesView: true
+};
diff --git a/src/qqq/pages/process-run/components/QGoogleDriveFolderPickerWrapper.tsx b/src/qqq/pages/process-run/components/QGoogleDriveFolderPickerWrapper.tsx
new file mode 100644
index 0000000..7f793be
--- /dev/null
+++ b/src/qqq/pages/process-run/components/QGoogleDriveFolderPickerWrapper.tsx
@@ -0,0 +1,46 @@
+/*
+ * 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 .
+ */
+
+import {GoogleOAuthProvider} from "@react-oauth/google";
+import React from "react";
+import {QGoogleDriveFolderPicker} from "qqq/pages/process-run/components/QGoogleDriveFolderPicker";
+
+interface Props
+{
+ showDefaultFoldersView: boolean;
+ showSharedDrivesView: boolean;
+}
+
+export function QGoogleDriveFolderPickerWrapper({showDefaultFoldersView, showSharedDrivesView}: Props): JSX.Element
+{
+ const clientId = process.env.REACT_APP_GOOGLE_APP_CLIENT_ID;
+
+ return (
+
+
+
+ );
+}
+
+QGoogleDriveFolderPickerWrapper.defaultProps = {
+ showDefaultFoldersView: true,
+ showSharedDrivesView: true
+};
diff --git a/src/qqq/pages/process-run/index.tsx b/src/qqq/pages/process-run/index.tsx
index 16ed041..2843ca0 100644
--- a/src/qqq/pages/process-run/index.tsx
+++ b/src/qqq/pages/process-run/index.tsx
@@ -41,6 +41,7 @@ import StepLabel from "@mui/material/StepLabel";
import Stepper from "@mui/material/Stepper";
import Typography from "@mui/material/Typography";
import {DataGridPro, GridColDef} from "@mui/x-data-grid-pro";
+import {GoogleOAuthProvider} from "@react-oauth/google";
import FormData from "form-data";
import {Form, Formik} from "formik";
import React, {useEffect, useState} from "react";
@@ -54,7 +55,7 @@ import MDBox from "qqq/components/Temporary/MDBox";
import MDButton from "qqq/components/Temporary/MDButton";
import MDProgress from "qqq/components/Temporary/MDProgress";
import MDTypography from "qqq/components/Temporary/MDTypography";
-import {QGoogleDriveFolderPicker} from "qqq/pages/process-run/components/QGoogleDriveFolderPicker";
+import {QGoogleDriveFolderPickerWrapper} from "qqq/pages/process-run/components/QGoogleDriveFolderPickerWrapper";
import QValidationReview from "qqq/pages/process-run/components/QValidationReview";
import QClient from "qqq/utils/QClient";
import QValueUtils from "qqq/utils/QValueUtils";
@@ -181,21 +182,6 @@ function ProcessRun({process, defaultProcessValues}: Props): JSX.Element
setDisabledBulkEditFields(newDisabledBulkEditFields);
};
- const formatViewValue = (value: any): JSX.Element =>
- {
- if (value === null || value === undefined)
- {
- return ;
- }
-
- if (typeof value === "string")
- {
- return QValueUtils.breakTextIntoLines(value);
- }
-
- return ({value});
- };
-
const toggleShowErrorDetail = () =>
{
setShowErrorDetail(!showErrorDetail);
@@ -335,7 +321,7 @@ function ProcessRun({process, defaultProcessValues}: Props): JSX.Element
:
- {formatViewValue(processValues[field.name])}
+ {QValueUtils.getValueForDisplay(field, processValues[field.name])}
))}
@@ -396,7 +382,8 @@ function ProcessRun({process, defaultProcessValues}: Props): JSX.Element
}
{
component.type === QComponentType.GOOGLE_DRIVE_SELECT_FOLDER && (
-
+ // todo - make these booleans configurable (values on the component)
+
)
}
{
diff --git a/src/qqq/utils/QValueUtils.tsx b/src/qqq/utils/QValueUtils.tsx
index f69ad53..e6a5432 100644
--- a/src/qqq/utils/QValueUtils.tsx
+++ b/src/qqq/utils/QValueUtils.tsx
@@ -26,7 +26,6 @@ import {QRecord} from "@kingsrook/qqq-frontend-core/lib/model/QRecord";
import "datejs";
import {Chip, Icon} from "@mui/material";
import React, {Fragment} from "react";
-import {Link} from "react-router-dom";
/*******************************************************************************
** Utility class for working with QQQ Values
@@ -34,15 +33,29 @@ import {Link} from "react-router-dom";
*******************************************************************************/
class QValueUtils
{
+
+ /*******************************************************************************
+ ** When you have a field, and a record - call this method to get a string or
+ ** element back to display the field's value.
+ *******************************************************************************/
public static getDisplayValue(field: QFieldMetaData, record: QRecord): string | JSX.Element
{
const displayValue = record.displayValues ? record.displayValues.get(field.name) : undefined;
const rawValue = record.values ? record.values.get(field.name) : undefined;
+ return QValueUtils.getValueForDisplay(field, rawValue, displayValue);
+ }
+
+ /*******************************************************************************
+ ** When you have a field and a value (either just a raw value, or a raw and
+ ** display value), call this method to get a string Element to display.
+ *******************************************************************************/
+ public static getValueForDisplay(field: QFieldMetaData, rawValue: any, displayValue: any = rawValue): string | JSX.Element
+ {
if (field.hasAdornment(AdornmentType.LINK))
{
const adornment = field.getAdornment(AdornmentType.LINK);
- return (
+ return (
{
e.stopPropagation();
}}>{rawValue})
@@ -62,14 +75,15 @@ class QValueUtils
return ();
}
- return (QValueUtils._getDisplayValueString(field, record));
+ return (QValueUtils.getUnadornedValueForDisplay(field, rawValue, displayValue));
}
- private static _getDisplayValueString(field: QFieldMetaData, record: QRecord): string
+ /*******************************************************************************
+ ** After we know there's no element to be returned (e.g., because no adornment),
+ ** this method does the string formatting.
+ *******************************************************************************/
+ private static getUnadornedValueForDisplay(field: QFieldMetaData, rawValue: any, displayValue: any): string | JSX.Element
{
- const displayValue = record.displayValues ? record.displayValues.get(field.name) : undefined;
- const rawValue = record.values ? record.values.get(field.name) : undefined;
-
if (field.type === QFieldType.DATE_TIME)
{
if (!rawValue)
@@ -90,12 +104,18 @@ class QValueUtils
return (displayValue);
}
+ let returnValue = displayValue;
if (displayValue === undefined && rawValue !== undefined)
{
- return (rawValue);
+ returnValue = rawValue;
}
- return (displayValue);
+ if (typeof returnValue === "string" && returnValue.indexOf("\n") > -1)
+ {
+ return QValueUtils.breakTextIntoLines(returnValue);
+ }
+
+ return (returnValue);
}
public static getFormattedNumber(n: number): string
@@ -117,7 +137,6 @@ class QValueUtils
}
}
-
public static breakTextIntoLines(value: string): JSX.Element
{
return (