mirror of
https://github.com/fosrl/pangolin.git
synced 2026-10-20 19:49:05 +02:00
ui improvements
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -290,6 +290,7 @@ export default function RedirectForm({
|
||||
title: t("success"),
|
||||
description: t("redirectUpdated")
|
||||
});
|
||||
router.refresh();
|
||||
} else {
|
||||
const res = await api.put<
|
||||
AxiosResponse<CreateRedirectResponse>
|
||||
@@ -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",
|
||||
|
||||
@@ -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({
|
||||
</Button>
|
||||
);
|
||||
},
|
||||
cell: ({ row }) => (
|
||||
<Link
|
||||
href={`/${orgId}/settings/redirects/${row.original.niceId}`}
|
||||
className="hover:underline"
|
||||
>
|
||||
{row.original.name}
|
||||
</Link>
|
||||
)
|
||||
cell: ({ row }) => <span>{row.original.name}</span>
|
||||
},
|
||||
{
|
||||
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 <span>-</span>;
|
||||
@@ -694,7 +695,8 @@ export default function RedirectsTable({
|
||||
isRefreshing={isRefreshing || isFiltering}
|
||||
rowCount={rowCount}
|
||||
columnVisibility={{
|
||||
niceId: false
|
||||
niceId: false,
|
||||
priority: false
|
||||
}}
|
||||
enableColumnVisibility
|
||||
stickyLeftColumn="name"
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user