more fixes

This commit is contained in:
Lokowitz
2025-05-17 20:04:56 +00:00
parent eff812eaa8
commit d9ee40c898
48 changed files with 122 additions and 135 deletions

View File

@@ -42,6 +42,7 @@ export function ApiKeysDataTable<TData, TValue>({
}: DataTableProps<TData, TValue>) {
const t = useTranslations();
return (
<DataTable
columns={columns}

View File

@@ -79,18 +79,18 @@ export default function Page() {
)
})
.catch((e) => {
console.error("Error setting permissions", e);
console.error(t('apiKeysErrorSetPermission'), e);
toast({
variant: "destructive",
title: "Error setting permissions",
title: t('apiKeysErrorSetPermission'),
description: formatAxiosError(e)
});
});
if (actionsRes && actionsRes.status === 200) {
toast({
title: "Permissions updated",
description: "The permissions have been updated."
title: t('apiKeysPermissionsUpdated'),
description: t('apiKeysPermissionsUpdatedDescription')
});
}

View File

@@ -89,6 +89,7 @@ export default function Page() {
const { env } = useEnvContext();
const api = createApiClient({ env });
const router = useRouter();
const t = useTranslations();
const [loadingPage, setLoadingPage] = useState(true);
const [createLoading, setCreateLoading] = useState(false);
@@ -111,8 +112,6 @@ export default function Page() {
}
});
const t = useTranslations();
async function onSubmit(data: CreateFormValues) {
setCreateLoading(true);

View File

@@ -4,7 +4,7 @@ import { AxiosResponse } from "axios";
import SettingsSectionTitle from "@app/components/SettingsSectionTitle";
import { ListRootApiKeysResponse } from "@server/routers/apiKeys";
import ApiKeysTable, { ApiKeyRow } from "./ApiKeysTable";
import { useTranslations } from "next-intl";
import { getTranslations } from 'next-intl/server';
type ApiKeyPageProps = {};
@@ -12,7 +12,6 @@ export const dynamic = "force-dynamic";
export default async function ApiKeysPage(props: ApiKeyPageProps) {
let apiKeys: ListRootApiKeysResponse["apiKeys"] = [];
const t = useTranslations();
try {
const res = await internal.get<AxiosResponse<ListRootApiKeysResponse>>(
`/api-keys`,
@@ -30,6 +29,8 @@ export default async function ApiKeysPage(props: ApiKeyPageProps) {
};
});
const t = await getTranslations();
return (
<>
<SettingsSectionTitle

View File

@@ -146,14 +146,14 @@ export default function GeneralPage() {
if (res.status === 200) {
toast({
title: "Success",
description: "Identity provider updated successfully"
title: t('success'),
description: t('idpUpdatedDescription')
});
router.refresh();
}
} catch (e) {
toast({
title: "Error",
title: t('error'),
description: formatAxiosError(e),
variant: "destructive"
});
@@ -372,7 +372,6 @@ export default function GeneralPage() {
{t('idpJmespathAbout')}
</AlertTitle>
<AlertDescription>
{/*TODO(vlalx): Validate replacing */}
{t('idpJmespathAboutDescription')}
<a
href="https://jmespath.org"

View File

@@ -25,6 +25,7 @@ interface SettingsLayoutProps {
export default async function SettingsLayout(props: SettingsLayoutProps) {
const params = await props.params;
const { children } = props;
const t = await getTranslations();
let idp = null;
try {
@@ -37,8 +38,6 @@ export default async function SettingsLayout(props: SettingsLayoutProps) {
redirect("/admin/idp");
}
const t = await getTranslations();
const navItems: HorizontalTabs = [
{
title: t('general'),

View File

@@ -15,7 +15,9 @@ export function PolicyDataTable<TData, TValue>({
data,
onAdd
}: DataTableProps<TData, TValue>) {
const t = useTranslations();
return (
<DataTable
columns={columns}

View File

@@ -89,6 +89,7 @@ export default function PoliciesPage() {
const api = createApiClient({ env });
const router = useRouter();
const { idpId } = useParams();
const t = useTranslations();
const [pageLoading, setPageLoading] = useState(true);
const [addPolicyLoading, setAddPolicyLoading] = useState(false);
@@ -118,8 +119,6 @@ export default function PoliciesPage() {
}
});
const t = useTranslations();
const loadIdp = async () => {
try {
const res = await api.get<AxiosResponse<GetIdpResponse>>(
@@ -450,7 +449,7 @@ export default function PoliciesPage() {
: t('orgPoliciesAdd')}
</CredenzaTitle>
<CredenzaDescription>
Configure access for an organization
{t('orgPolicyConfig')}
</CredenzaDescription>
</CredenzaHeader>
<CredenzaBody>

View File

@@ -77,6 +77,7 @@ export default function Page() {
const router = useRouter();
const [createLoading, setCreateLoading] = useState(false);
const { isUnlocked } = useLicenseStatusContext();
const t = useTranslations();
const form = useForm<CreateIdpFormValues>({
resolver: zodResolver(createIdpFormSchema),
@@ -95,8 +96,6 @@ export default function Page() {
}
});
const t = useTranslations();
async function onSubmit(data: CreateIdpFormValues) {
setCreateLoading(true);
@@ -370,7 +369,6 @@ export default function Page() {
{t('idpJmespathAbout')}
</AlertTitle>
<AlertDescription>
{/*TODO(vlalx): Validate replacing */}
{t('idpJmespathAboutDescription')}{" "}
<a
href="https://jmespath.org"

View File

@@ -10,7 +10,6 @@ import { AxiosResponse } from "axios";
import { authCookieHeader } from "@app/lib/api/cookies";
import { Layout } from "@app/components/Layout";
import { adminNavItems } from "../navigation";
import { useTranslations } from "next-intl";
export const dynamic = "force-dynamic";

View File

@@ -122,7 +122,7 @@ export function SitePriceCalculator({
<Button variant="outline">{t('cancel')}</Button>
</CredenzaClose>
<Button onClick={continueToPayment}>
See Purchase Portal
{t('pricingPortal')}
</Button>
</CredenzaFooter>
</CredenzaContent>

View File

@@ -130,10 +130,10 @@ export default function LicensePage() {
}
} catch (e) {
toast({
title: "Failed to load license keys",
title: t('licenseErrorKeyLoad'),
description: formatAxiosError(
e,
"An error occurred loading license keys."
t('licenseErrorKeyLoadDescription')
)
});
}
@@ -149,16 +149,16 @@ export default function LicensePage() {
}
await loadLicenseKeys();
toast({
title: "License key deleted",
description: "The license key has been deleted."
title: t('licenseKeyDeleted'),
description: t('licenseKeyDeletedDescription')
});
setIsDeleteModalOpen(false);
} catch (e) {
toast({
title: "Failed to delete license key",
title: t('licenseErrorKeyDelete'),
description: formatAxiosError(
e,
"An error occurred deleting license key."
t('licenseErrorKeyDeleteDescription')
)
});
} finally {
@@ -175,15 +175,15 @@ export default function LicensePage() {
}
await loadLicenseKeys();
toast({
title: "License keys rechecked",
description: "All license keys have been rechecked"
title: t('licenseErrorKeyRechecked'),
description: t('licenseErrorKeyRecheckedDescription')
});
} catch (e) {
toast({
title: "Failed to recheck license keys",
title: t('licenseErrorKeyRecheck'),
description: formatAxiosError(
e,
"An error occurred rechecking license keys."
t('licenseErrorKeyRecheckDescription')
)
});
} finally {
@@ -202,8 +202,8 @@ export default function LicensePage() {
}
toast({
title: "License key activated",
description: "The license key has been successfully activated."
title: t('licenseKeyActivated'),
description: t('licenseKeyActivatedDescription')
});
setIsCreateModalOpen(false);
@@ -212,10 +212,10 @@ export default function LicensePage() {
} catch (e) {
toast({
variant: "destructive",
title: "Failed to activate license key",
title: t('licenseErrorKeyActivate'),
description: formatAxiosError(
e,
"An error occurred while activating the license key."
t('licenseErrorKeyActivateDescription')
)
});
} finally {
@@ -360,12 +360,10 @@ export default function LicensePage() {
<Alert variant="neutral" className="mb-6">
<InfoIcon className="h-4 w-4" />
<AlertTitle className="font-semibold">
About Licensing
{t('licenseAbout')}
</AlertTitle>
<AlertDescription>
This is for business and enterprise users who are using
Pangolin in a commercial environment. If you are using
Pangolin for personal use, you can ignore this section.
{t('licenseAboutDescription')}
</AlertDescription>
</Alert>
@@ -397,12 +395,12 @@ export default function LicensePage() {
<div className="space-y-2">
{supporterStatus?.visible ? (
<div className="text-2xl">
Community Edition
{t('communityEdition')}
</div>
) : (
<div className="text-2xl flex items-center gap-2 text-pink-500">
<Heart />
Community Edition
{t('communityEdition')}
</div>
)}
</div>