From 3ca417bd4399c4f9ae68fc348ddf53239d6562d1 Mon Sep 17 00:00:00 2001 From: Courtney Myers Date: Mon, 9 Oct 2023 16:26:46 -0400 Subject: [PATCH 1/3] Remove no longer used PUBLIC_URL env variables from GitHub Workflow actions --- .github/workflows/dev.yml | 3 +-- .github/workflows/staging.yml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index d8665d70..71f695a1 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -97,8 +97,7 @@ jobs: - name: Build front-end files and move to server run: | - PUBLIC_URL="$SERVER_URL" \ - VITE_SERVER_BASE_PATH="$SERVER_BASE_PATH" \ + VITE_SERVER_BASE_PATH="$SERVER_BASE_PATH" \ VITE_CLOUD_SPACE="$CLOUD_SPACE" \ VITE_FORMIO_BASE_URL="$FORMIO_BASE_URL" \ VITE_FORMIO_PROJECT_NAME="$FORMIO_PROJECT_NAME" \ diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 1e022efb..69fe9edb 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -97,8 +97,7 @@ jobs: - name: Build front-end files and move to server run: | - PUBLIC_URL="$SERVER_URL" \ - VITE_SERVER_BASE_PATH="$SERVER_BASE_PATH" \ + VITE_SERVER_BASE_PATH="$SERVER_BASE_PATH" \ VITE_CLOUD_SPACE="$CLOUD_SPACE" \ VITE_FORMIO_BASE_URL="$FORMIO_BASE_URL" \ VITE_FORMIO_PROJECT_NAME="$FORMIO_PROJECT_NAME" \ From 4bceceb5e5bb1a2b7444ecc092281425ea7bdeb6 Mon Sep 17 00:00:00 2001 From: Courtney Myers Date: Mon, 9 Oct 2023 16:28:07 -0400 Subject: [PATCH 2/3] Remove social media meta tags and use of PUBLIC_URL from 404.html --- app/client/public/404.html | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/app/client/public/404.html b/app/client/public/404.html index d9ec8547..cb1457c5 100644 --- a/app/client/public/404.html +++ b/app/client/public/404.html @@ -19,34 +19,10 @@ /> - - - - - - - - - - - - - - - - + Date: Mon, 9 Oct 2023 16:53:02 -0400 Subject: [PATCH 3/3] Move useHelpdeskAccess() custom hook out of app component and into utilities file --- app/client/src/components/app.tsx | 12 ------------ app/client/src/components/userDashboard.tsx | 8 ++++++-- app/client/src/routes/helpdesk.tsx | 2 +- app/client/src/utilities.ts | 12 ++++++++++++ 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/app/client/src/components/app.tsx b/app/client/src/components/app.tsx index cc8872dc..98945305 100644 --- a/app/client/src/components/app.tsx +++ b/app/client/src/components/app.tsx @@ -183,18 +183,6 @@ function useInactivityDialog(callback: () => void) { }, [dialogShown, heading, countdownSeconds, updateDialogDescription]); } -/** Custom hook to check if user should have access to the helpdesk page */ -export function useHelpdeskAccess() { - const user = useUserData(); - const userRoles = user?.memberof.split(",") || []; - - return !user - ? "pending" - : userRoles.includes("csb_admin") || userRoles.includes("csb_helpdesk") - ? "success" - : "failure"; -} - function ProtectedRoute() { const { pathname } = useLocation(); diff --git a/app/client/src/components/userDashboard.tsx b/app/client/src/components/userDashboard.tsx index 7b8132e8..ea6fc4aa 100644 --- a/app/client/src/components/userDashboard.tsx +++ b/app/client/src/components/userDashboard.tsx @@ -5,8 +5,12 @@ import uswds from "@formio/uswds"; import icons from "uswds/img/sprite.svg"; // --- import { serverUrl, formioBaseUrl, formioProjectUrl } from "@/config"; -import { useConfigQuery, useBapSamQuery, useBapSamData } from "@/utilities"; -import { useHelpdeskAccess } from "@/components/app"; +import { + useHelpdeskAccess, + useConfigQuery, + useBapSamQuery, + useBapSamData, +} from "@/utilities"; import { Loading } from "@/components/loading"; import { useDialogActions } from "@/contexts/dialog"; diff --git a/app/client/src/routes/helpdesk.tsx b/app/client/src/routes/helpdesk.tsx index 1cc1cd20..431ae2d7 100644 --- a/app/client/src/routes/helpdesk.tsx +++ b/app/client/src/routes/helpdesk.tsx @@ -22,9 +22,9 @@ import { getData, postData, useContentData, + useHelpdeskAccess, submissionNeedsEdits, } from "@/utilities"; -import { useHelpdeskAccess } from "@/components/app"; import { Loading } from "@/components/loading"; import { Message } from "@/components/message"; import { MarkdownContent } from "@/components/markdownContent"; diff --git a/app/client/src/utilities.ts b/app/client/src/utilities.ts index 966c4aef..c90058d9 100644 --- a/app/client/src/utilities.ts +++ b/app/client/src/utilities.ts @@ -304,6 +304,18 @@ export function useUserData() { return queryClient.getQueryData(["user"]); } +/** Custom hook to check if user should have access to the helpdesk page */ +export function useHelpdeskAccess() { + const user = useUserData(); + const userRoles = user?.memberof.split(",") || []; + + return !user + ? "pending" + : userRoles.includes("csb_admin") || userRoles.includes("csb_helpdesk") + ? "success" + : "failure"; +} + /** Custom hook to fetch CSB config */ export function useConfigQuery() { return useQuery({