From e4dd6c0aa6b13b94f2afa113aebfdc9af446fbf9 Mon Sep 17 00:00:00 2001 From: shamsmosowi Date: Fri, 22 Oct 2021 08:27:34 +1100 Subject: [PATCH 1/4] added a temp skip button for rules setting step --- src/components/Setup/Step4Rules.tsx | 42 +++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/src/components/Setup/Step4Rules.tsx b/src/components/Setup/Step4Rules.tsx index 4ceecd06..52eaef83 100644 --- a/src/components/Setup/Step4Rules.tsx +++ b/src/components/Setup/Step4Rules.tsx @@ -21,6 +21,7 @@ import { CONFIG } from "config/dbPaths"; import { requiredRules, adminRules, utilFns } from "config/firestoreRules"; import { rowyRun } from "utils/rowyRun"; import { runRoutes } from "constants/runRoutes"; +import { useConfirmation } from "components/ConfirmationDialog"; export default function Step4Rules({ rowyRunUrl, @@ -28,6 +29,7 @@ export default function Step4Rules({ setCompletion, }: ISetupStepBodyProps) { const { projectId, getAuthToken } = useAppContext(); + const { requestConfirmation } = useConfirmation(); const [hasRules, setHasRules] = useState(completion.rules); const [adminRule, setAdminRule] = useState(true); @@ -83,13 +85,11 @@ export default function Step4Rules({ body: { ruleset: newRules }, }); if (!res.success) throw new Error(res.message); - const isSuccessful = await checkRules(rowyRunUrl, authToken); if (isSuccessful) { setCompletion((c) => ({ ...c, rules: true })); setHasRules(true); } - setRulesStatus("IDLE"); } catch (e: any) { console.error(e); @@ -97,6 +97,19 @@ export default function Step4Rules({ } }; + const handleSkip = () => { + requestConfirmation({ + title: "Skip rules", + body: "This might prevent you or other users in your project from accessing firestore data on Rowy", + confirm: "Skip", + cancel: "cancel", + handleConfirm: async () => { + setCompletion((c) => ({ ...c, rules: true })); + setHasRules(true); + }, + }); + }; + return ( <> @@ -201,15 +214,23 @@ export default function Step4Rules({ Please check the generated rules first. - - Set Firestore Rules - - + {" "} + + Set Firestore Rules + + + {rulesStatus !== "LOADING" && typeof rulesStatus === "string" && ( {rulesStatus} @@ -246,7 +267,6 @@ export const checkRules = async ( sanitizedRules.includes( utilFns.replace(/\s{2,}/g, " ").replace(/\n/g, " ") ); - return hasRules; } catch (e: any) { console.error(e); From 82628d460a459f541e141901d39f49f9ea16323a Mon Sep 17 00:00:00 2001 From: Tyler La Fronz Date: Wed, 27 Oct 2021 09:20:54 -0400 Subject: [PATCH 2/4] Fixes issue where the title field name is shown rather than the value --- src/components/fields/ConnectService/InlineCell.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/fields/ConnectService/InlineCell.tsx b/src/components/fields/ConnectService/InlineCell.tsx index 3f4d2453..c6db7bba 100644 --- a/src/components/fields/ConnectService/InlineCell.tsx +++ b/src/components/fields/ConnectService/InlineCell.tsx @@ -1,5 +1,6 @@ import { forwardRef } from "react"; import { IPopoverInlineCellProps } from "../types"; +import { get } from "lodash"; import { ButtonBase, Grid, Chip } from "@mui/material"; import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown"; @@ -29,9 +30,9 @@ export const ConnectService = forwardRef(function ConnectService( > {Array.isArray(value) && - value.map((doc: any) => ( - - + value.map((snapshot) => ( + + ))} From a64c5315832c05acced99820709acf62a19a0fc6 Mon Sep 17 00:00:00 2001 From: shamsmosowi Date: Thu, 28 Oct 2021 01:34:43 +1100 Subject: [PATCH 3/4] fix inline cell of connect-service --- .../fields/ConnectService/InlineCell.tsx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/components/fields/ConnectService/InlineCell.tsx b/src/components/fields/ConnectService/InlineCell.tsx index 3f4d2453..bfa01791 100644 --- a/src/components/fields/ConnectService/InlineCell.tsx +++ b/src/components/fields/ConnectService/InlineCell.tsx @@ -5,13 +5,14 @@ import { ButtonBase, Grid, Chip } from "@mui/material"; import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown"; import ChipList from "components/Table/formatters/ChipList"; +import { get } from "lodash"; export const ConnectService = forwardRef(function ConnectService( { value, showPopoverCell, disabled, column }: IPopoverInlineCellProps, ref: React.Ref ) { const config = column.config ?? {}; - + const displayKey = config.titleKey ?? config.primaryKey; return ( showPopoverCell(true)} @@ -28,12 +29,15 @@ export const ConnectService = forwardRef(function ConnectService( }} > - {Array.isArray(value) && - value.map((doc: any) => ( - - - - ))} + {Array.isArray(value) && ( + + {value.map((snapshot) => ( + + + + ))} + + )} {!disabled && ( From cfaded7864d3b7178bf673126ffa8692289ff549 Mon Sep 17 00:00:00 2001 From: shamsmosowi Date: Thu, 28 Oct 2021 01:40:16 +1100 Subject: [PATCH 4/4] fix merge --- src/components/fields/ConnectService/InlineCell.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/fields/ConnectService/InlineCell.tsx b/src/components/fields/ConnectService/InlineCell.tsx index c226af33..955b9f5c 100644 --- a/src/components/fields/ConnectService/InlineCell.tsx +++ b/src/components/fields/ConnectService/InlineCell.tsx @@ -1,6 +1,5 @@ import { forwardRef } from "react"; import { IPopoverInlineCellProps } from "../types"; -import { get } from "lodash"; import { ButtonBase, Grid, Chip } from "@mui/material"; import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";