Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/post vite transition updates #373

Merged
merged 3 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand Down
26 changes: 1 addition & 25 deletions app/client/public/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,10 @@
/>
<meta property="DC.title" content="CSB Rebate Forms Application" />
<meta property="DC.type" content="Data and Tools" />
<meta property="og:site_name" content="US EPA" />
<meta property="og:type" content="website" />
<meta property="og:url" content="%PUBLIC_URL%/" />
<meta property="og:title" content="CSB Rebate Forms Application | US EPA" />
<meta
property="og:description"
content="U.S. EPA CSB Rebate Forms Application"
/>
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property="og:updated_time" content="2022-03-01" />
<meta property="og:country_name" content="United States of America" />
<meta name="twitter:card" content="summary_large_image" />
<meta
name="twitter:description"
content="U.S. EPA CSB Rebate Forms Application"
/>
<meta
name="twitter:title"
content="CSB Rebate Forms Application | US EPA"
/>
<meta name="twitter:url" content="%PUBLIC_URL%/" />
<meta name="twitter:image:height" content="600" />
<meta name="twitter:image:width" content="1200" />
<meta name="msapplication-TileColor" content="#005ea2" />
<meta name="theme-color" content="#005ea2" />
<link rel="manifest" href="./manifest.json" />
<link rel="canonical" href="%PUBLIC_URL%/" />
<link rel="canonical" href="./" />
<link
rel="apple-touch-icon-precomposed"
sizes="196x196"
Expand Down
12 changes: 0 additions & 12 deletions app/client/src/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
8 changes: 6 additions & 2 deletions app/client/src/components/userDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
2 changes: 1 addition & 1 deletion app/client/src/routes/helpdesk.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
12 changes: 12 additions & 0 deletions app/client/src/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,18 @@ export function useUserData() {
return queryClient.getQueryData<UserData>(["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({
Expand Down
Loading