From 7386fa523448bbacc64223d3c23331536812b3fb Mon Sep 17 00:00:00 2001 From: miloschwartz Date: Thu, 15 Oct 2026 11:25:07 -0400 Subject: [PATCH] ui improvements --- server/routers/redirect/listRedirects.ts | 2 ++ src/app/[orgId]/settings/redirects/page.tsx | 2 ++ src/components/RedirectForm.tsx | 4 +++- src/components/RedirectsTable.tsx | 22 +++++++++++---------- src/hooks/useStoredColumnVisibility.ts | 7 ++++--- 5 files changed, 23 insertions(+), 14 deletions(-) diff --git a/server/routers/redirect/listRedirects.ts b/server/routers/redirect/listRedirects.ts index 518d27298..1f33af71a 100644 --- a/server/routers/redirect/listRedirects.ts +++ b/server/routers/redirect/listRedirects.ts @@ -30,6 +30,7 @@ export type ListRedirectsResponse = PaginatedResponse<{ resourceName: string | null; resourceNiceId: string | null; resourceFullDomain: string | null; + resourceSsl: boolean | null; resourceDomainId: string | null; domainId: string | null; baseDomain: string | null; @@ -236,6 +237,7 @@ export async function listRedirects( resourceName: resources.name, resourceNiceId: resources.niceId, resourceFullDomain: resources.fullDomain, + resourceSsl: resources.ssl, resourceDomainId: resources.domainId, domainId: redirects.domainId, baseDomain: domains.baseDomain diff --git a/src/app/[orgId]/settings/redirects/page.tsx b/src/app/[orgId]/settings/redirects/page.tsx index 7cc04837b..b4bb18f25 100644 --- a/src/app/[orgId]/settings/redirects/page.tsx +++ b/src/app/[orgId]/settings/redirects/page.tsx @@ -115,11 +115,13 @@ export default async function RedirectIndexPage(props: RedirectIndexPageProps) { rewritePathType: redirect.rewritePathType, priority: redirect.priority, permanent: redirect.permanent, + ssl: redirect.ssl, enabled: redirect.enabled, resourceId: redirect.resourceId, resourceName: redirect.resourceName, resourceNiceId: redirect.resourceNiceId, resourceFullDomain: redirect.resourceFullDomain, + resourceSsl: redirect.resourceSsl, resourceDomainId: redirect.resourceDomainId, domainId: redirect.domainId, baseDomain: redirect.baseDomain diff --git a/src/components/RedirectForm.tsx b/src/components/RedirectForm.tsx index e8c703e23..c29f86ec2 100644 --- a/src/components/RedirectForm.tsx +++ b/src/components/RedirectForm.tsx @@ -290,6 +290,7 @@ export default function RedirectForm({ title: t("success"), description: t("redirectUpdated") }); + router.refresh(); } else { const res = await api.put< AxiosResponse @@ -298,8 +299,9 @@ export default function RedirectForm({ title: t("success"), description: t("redirectCreated") }); + const niceId = res.data.data.redirect.niceId; + router.push(`/${orgId}/settings/redirects/${niceId}`); } - router.push(`/${orgId}/settings/redirects/`); } catch (e) { toast({ variant: "destructive", diff --git a/src/components/RedirectsTable.tsx b/src/components/RedirectsTable.tsx index 2918c1e09..9519cd150 100644 --- a/src/components/RedirectsTable.tsx +++ b/src/components/RedirectsTable.tsx @@ -89,11 +89,13 @@ export type RedirectRow = { rewritePathType: "exact" | "prefix" | "regex" | "stripPrefix" | null; priority: number | null; permanent: boolean; + ssl: boolean; enabled: boolean; resourceId: number | null; resourceName: string | null; resourceNiceId: string | null; resourceFullDomain: string | null; + resourceSsl: boolean | null; resourceDomainId: string | null; domainId: string | null; baseDomain: string | null; @@ -315,14 +317,7 @@ export default function RedirectsTable({ ); }, - cell: ({ row }) => ( - - {row.original.name} - - ) + cell: ({ row }) => {row.original.name} }, { id: "niceId", @@ -453,7 +448,13 @@ export default function RedirectsTable({ ? withPrefixGlob(redirect.matchPath) : redirect.matchPath : ""; - const source = `${host ?? ""}${matchPath}`; + // Resource-attached redirects inherit the resource's ssl. + const sourceSsl = redirect.resourceId + ? (redirect.resourceSsl ?? true) + : redirect.ssl; + const source = host + ? `${sourceSsl ? "https" : "http"}://${host}${matchPath}` + : matchPath; if (!source) { return -; @@ -694,7 +695,8 @@ export default function RedirectsTable({ isRefreshing={isRefreshing || isFiltering} rowCount={rowCount} columnVisibility={{ - niceId: false + niceId: false, + priority: false }} enableColumnVisibility stickyLeftColumn="name" diff --git a/src/hooks/useStoredColumnVisibility.ts b/src/hooks/useStoredColumnVisibility.ts index 1d5d66628..e2a1802f4 100644 --- a/src/hooks/useStoredColumnVisibility.ts +++ b/src/hooks/useStoredColumnVisibility.ts @@ -20,7 +20,9 @@ const getStoredColumnVisibility = ( const parsed = JSON.parse(stored); // Validate that it's an object if (typeof parsed === "object" && parsed !== null) { - return parsed; + // Stored choices win. Keys only present in the defaults + // (for example a newly hidden column) still apply. + return { ...(defaultVisibility || {}), ...parsed }; } } } catch (error) { @@ -60,8 +62,7 @@ export function useStoredColumnVisibility( const setColumnVisibility = useCallback( ( updaterOrValue: - | VisibilityState - | ((old: VisibilityState) => VisibilityState) + VisibilityState | ((old: VisibilityState) => VisibilityState) ) => { if (typeof updaterOrValue === "function") { setVisibility((oldValue) => {