From feb0df76ab20ec5f4ec42f887381584864e9a2cc Mon Sep 17 00:00:00 2001 From: Edward Viaene Date: Mon, 19 Aug 2024 22:34:14 +0200 Subject: [PATCH] Feature/v1.0.41 (#6) UI improvements --- docs/release-notes.md | 7 ++++++- latest | 2 +- webapp/src/Routes/Setup/Setup.tsx | 6 +++--- webapp/src/Routes/Upgrade/Upgrade.tsx | 1 + webapp/src/Routes/Users/ListUsers.tsx | 26 ++++++++++++++++++-------- 5 files changed, 29 insertions(+), 13 deletions(-) diff --git a/docs/release-notes.md b/docs/release-notes.md index bd86340..cded076 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -1,5 +1,10 @@ # Release Notes +## Version v1.0.41 +* UI: axios version bump +* UI: disable https forwarding when request is served over http +* UI: general improvements + ## Version v1.0.40 * GCP marketplace release @@ -42,4 +47,4 @@ Once upgraded to this release, new upgrades can be done through the UI. * Local Users Support * OIDC Support -* Wireguard® for VPN Connections \ No newline at end of file +* Wireguard® for VPN Connections diff --git a/latest b/latest index 8cfaa35..4f45e65 100644 --- a/latest +++ b/latest @@ -1 +1 @@ -v1.0.40 +v1.0.41 diff --git a/webapp/src/Routes/Setup/Setup.tsx b/webapp/src/Routes/Setup/Setup.tsx index 488e0c9..2057366 100644 --- a/webapp/src/Routes/Setup/Setup.tsx +++ b/webapp/src/Routes/Setup/Setup.tsx @@ -8,7 +8,6 @@ import { useAuthContext } from "../../Auth/Auth"; import { useForm } from '@mantine/form'; import axios, { AxiosError } from "axios"; - type SetupRequest = { hostname: string; enableTLS: boolean; @@ -130,13 +129,14 @@ export function Setup() { - form.setFieldValue("redirectToHttps", !form.getValues().redirectToHttps )}> + window.location.protocol === "https:" ? form.setFieldValue("redirectToHttps", !form.getValues().redirectToHttps) : null }> @@ -147,7 +147,7 @@ export function Setup() { Redirect http requests to https. Not needed when terminating TLS on an external LoadBalancer. - Recommended once TLS is activated and working. + Can only be enabled once this page is requested through https. diff --git a/webapp/src/Routes/Upgrade/Upgrade.tsx b/webapp/src/Routes/Upgrade/Upgrade.tsx index 5a53ea2..7cbf1a1 100644 --- a/webapp/src/Routes/Upgrade/Upgrade.tsx +++ b/webapp/src/Routes/Upgrade/Upgrade.tsx @@ -27,6 +27,7 @@ export function Upgrade() { if(upgradeStatus === "upgrading") { setUpgradeStatus("completed") setMessage("") + queryClient.invalidateQueries({ queryKey: ['version'] }) } return res.json() } diff --git a/webapp/src/Routes/Users/ListUsers.tsx b/webapp/src/Routes/Users/ListUsers.tsx index 86c9eed..bef27d0 100644 --- a/webapp/src/Routes/Users/ListUsers.tsx +++ b/webapp/src/Routes/Users/ListUsers.tsx @@ -17,6 +17,11 @@ type UserIDAndPassword = { password: string; } +type Status = { + status: string; + color: string; +} + export function ListUsers({localAuthDisabled}:Props) { const [opened, { open, close }] = useDisclosure(false); const [newPassword, setNewPassword] = useState(); @@ -89,12 +94,7 @@ export function ListUsers({localAuthDisabled}:Props) { saml: 'teal', provisioned: 'grape', }; - const userStatus: Record = { - active: 'green', - suspended: 'red', - tokenExpired: 'amber', - localAuthDisabled: 'yellow' - }; + const rolesData = ["user", "admin"]; const openPasswordModal = (id:string) => { @@ -106,6 +106,16 @@ export function ListUsers({localAuthDisabled}:Props) { const date = new Date(dateInput) return date.getFullYear() + "-" + (date.getMonth()+1).toString().padStart(2, '0') + "-" + date.getDate().toString().padStart(2, '0') + " " + date.getHours().toString().padStart(2, '0') + ":" + date.getMinutes().toString().padStart(2, '0') + ":" + date.getSeconds().toString().padStart(2, '0') } + + const getStatus = (item:User) : Status => { + if(item.suspended) { + return {status: "Suspended", color: "red"} + } + if (localAuthDisabled && item.oidcID == "" && !item.provisioned) { + return {status: "Local Auth Disabled", color: "yellow"} + } + return {status: "Active", color: "green"} + } const rows = data.map((item:User) => ( @@ -148,8 +158,8 @@ export function ListUsers({localAuthDisabled}:Props) { : null} - - {item.suspended ? "Suspended" : localAuthDisabled && item.oidcID == "" ? "Local Auth Disabled" : "Active"} + + {getStatus(item).status}