mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-19 11:26:37 +00:00
🐛 fix paths
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useState } from "react";
|
import RegenerateCredentialsModal from "@app/components/RegenerateCredentialsModal";
|
||||||
import {
|
import {
|
||||||
SettingsContainer,
|
SettingsContainer,
|
||||||
SettingsSection,
|
SettingsSection,
|
||||||
@@ -10,18 +10,23 @@ import {
|
|||||||
SettingsSectionTitle
|
SettingsSectionTitle
|
||||||
} from "@app/components/Settings";
|
} from "@app/components/Settings";
|
||||||
import { Button } from "@app/components/ui/button";
|
import { Button } from "@app/components/ui/button";
|
||||||
import { createApiClient, formatAxiosError } from "@app/lib/api";
|
import {
|
||||||
import { useEnvContext } from "@app/hooks/useEnvContext";
|
Tooltip,
|
||||||
import { toast } from "@app/hooks/useToast";
|
TooltipContent,
|
||||||
import { useParams, useRouter } from "next/navigation";
|
TooltipProvider,
|
||||||
import { useTranslations } from "next-intl";
|
TooltipTrigger
|
||||||
import { PickClientDefaultsResponse } from "@server/routers/client";
|
} from "@app/components/ui/tooltip";
|
||||||
import { useClientContext } from "@app/hooks/useClientContext";
|
import { useClientContext } from "@app/hooks/useClientContext";
|
||||||
import RegenerateCredentialsModal from "@app/components/RegenerateCredentialsModal";
|
import { useEnvContext } from "@app/hooks/useEnvContext";
|
||||||
import { build } from "@server/build";
|
|
||||||
import { useLicenseStatusContext } from "@app/hooks/useLicenseStatusContext";
|
import { useLicenseStatusContext } from "@app/hooks/useLicenseStatusContext";
|
||||||
import { useSubscriptionStatusContext } from "@app/hooks/useSubscriptionStatusContext";
|
import { useSubscriptionStatusContext } from "@app/hooks/useSubscriptionStatusContext";
|
||||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@app/components/ui/tooltip";
|
import { toast } from "@app/hooks/useToast";
|
||||||
|
import { createApiClient } from "@app/lib/api";
|
||||||
|
import { build } from "@server/build";
|
||||||
|
import { PickClientDefaultsResponse } from "@server/routers/client";
|
||||||
|
import { useTranslations } from "next-intl";
|
||||||
|
import { useParams, useRouter } from "next/navigation";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
export default function CredentialsPage() {
|
export default function CredentialsPage() {
|
||||||
const { env } = useEnvContext();
|
const { env } = useEnvContext();
|
||||||
@@ -32,7 +37,8 @@ export default function CredentialsPage() {
|
|||||||
const { client } = useClientContext();
|
const { client } = useClientContext();
|
||||||
|
|
||||||
const [modalOpen, setModalOpen] = useState(false);
|
const [modalOpen, setModalOpen] = useState(false);
|
||||||
const [clientDefaults, setClientDefaults] = useState<PickClientDefaultsResponse | null>(null);
|
const [clientDefaults, setClientDefaults] =
|
||||||
|
useState<PickClientDefaultsResponse | null>(null);
|
||||||
|
|
||||||
const { licenseStatus, isUnlocked } = useLicenseStatusContext();
|
const { licenseStatus, isUnlocked } = useLicenseStatusContext();
|
||||||
const subscription = useSubscriptionStatusContext();
|
const subscription = useSubscriptionStatusContext();
|
||||||
@@ -44,18 +50,19 @@ export default function CredentialsPage() {
|
|||||||
return isEnterpriseNotLicensed || isSaasNotSubscribed;
|
return isEnterpriseNotLicensed || isSaasNotSubscribed;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const handleConfirmRegenerate = async () => {
|
const handleConfirmRegenerate = async () => {
|
||||||
|
|
||||||
const res = await api.get(`/org/${orgId}/pick-client-defaults`);
|
const res = await api.get(`/org/${orgId}/pick-client-defaults`);
|
||||||
if (res && res.status === 200) {
|
if (res && res.status === 200) {
|
||||||
const data = res.data.data;
|
const data = res.data.data;
|
||||||
setClientDefaults(data);
|
setClientDefaults(data);
|
||||||
|
|
||||||
await api.post(`/re-key/${client?.clientId}/regenerate-client-secret`, {
|
await api.post(
|
||||||
olmId: data.olmId,
|
`/re-key/${client?.clientId}/regenerate-client-secret`,
|
||||||
secret: data.olmSecret,
|
{
|
||||||
});
|
olmId: data.olmId,
|
||||||
|
secret: data.olmSecret
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
toast({
|
toast({
|
||||||
title: t("credentialsSaved"),
|
title: t("credentialsSaved"),
|
||||||
@@ -95,7 +102,8 @@ export default function CredentialsPage() {
|
|||||||
<div className="inline-block">
|
<div className="inline-block">
|
||||||
<Button
|
<Button
|
||||||
onClick={() => setModalOpen(true)}
|
onClick={() => setModalOpen(true)}
|
||||||
disabled={isSecurityFeatureDisabled()}>
|
disabled={isSecurityFeatureDisabled()}
|
||||||
|
>
|
||||||
{t("regeneratecredentials")}
|
{t("regeneratecredentials")}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
@@ -121,4 +129,4 @@ export default function CredentialsPage() {
|
|||||||
/>
|
/>
|
||||||
</SettingsContainer>
|
</SettingsContainer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,40 +1,37 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
|
||||||
import { z } from "zod";
|
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import {
|
import {
|
||||||
Form,
|
Form,
|
||||||
FormControl,
|
FormControl,
|
||||||
FormDescription,
|
|
||||||
FormField,
|
FormField,
|
||||||
FormItem,
|
FormItem,
|
||||||
FormLabel,
|
FormLabel,
|
||||||
FormMessage
|
FormMessage
|
||||||
} from "@/components/ui/form";
|
} from "@/components/ui/form";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { useClientContext } from "@app/hooks/useClientContext";
|
|
||||||
import { useForm } from "react-hook-form";
|
|
||||||
import { toast } from "@app/hooks/useToast";
|
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import {
|
import {
|
||||||
SettingsContainer,
|
SettingsContainer,
|
||||||
SettingsSection,
|
SettingsSection,
|
||||||
SettingsSectionHeader,
|
|
||||||
SettingsSectionTitle,
|
|
||||||
SettingsSectionDescription,
|
|
||||||
SettingsSectionBody,
|
SettingsSectionBody,
|
||||||
|
SettingsSectionDescription,
|
||||||
|
SettingsSectionFooter,
|
||||||
SettingsSectionForm,
|
SettingsSectionForm,
|
||||||
SettingsSectionFooter
|
SettingsSectionHeader,
|
||||||
|
SettingsSectionTitle
|
||||||
} from "@app/components/Settings";
|
} from "@app/components/Settings";
|
||||||
import { formatAxiosError } from "@app/lib/api";
|
import { useClientContext } from "@app/hooks/useClientContext";
|
||||||
import { createApiClient } from "@app/lib/api";
|
|
||||||
import { useEnvContext } from "@app/hooks/useEnvContext";
|
import { useEnvContext } from "@app/hooks/useEnvContext";
|
||||||
import { useEffect, useState } from "react";
|
import { toast } from "@app/hooks/useToast";
|
||||||
import { Tag, TagInput } from "@app/components/tags/tag-input";
|
import { createApiClient, formatAxiosError } from "@app/lib/api";
|
||||||
import { AxiosResponse } from "axios";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import { ListSitesResponse } from "@server/routers/site";
|
import { ListSitesResponse } from "@server/routers/site";
|
||||||
|
import { AxiosResponse } from "axios";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { useForm } from "react-hook-form";
|
||||||
|
import { z } from "zod";
|
||||||
|
|
||||||
const GeneralFormSchema = z.object({
|
const GeneralFormSchema = z.object({
|
||||||
name: z.string().nonempty("Name is required")
|
name: z.string().nonempty("Name is required")
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
import { internal } from "@app/lib/api";
|
import ClientInfoCard from "@app/components/ClientInfoCard";
|
||||||
import { AxiosResponse } from "axios";
|
|
||||||
import { authCookieHeader } from "@app/lib/api/cookies";
|
|
||||||
import SettingsSectionTitle from "@app/components/SettingsSectionTitle";
|
|
||||||
import { GetClientResponse } from "@server/routers/client";
|
|
||||||
import ClientInfoCard from "../../../../../components/ClientInfoCard";
|
|
||||||
import ClientProvider from "@app/providers/ClientProvider";
|
|
||||||
import { redirect } from "next/navigation";
|
|
||||||
import { HorizontalTabs } from "@app/components/HorizontalTabs";
|
import { HorizontalTabs } from "@app/components/HorizontalTabs";
|
||||||
import { getTranslations } from "next-intl/server";
|
import SettingsSectionTitle from "@app/components/SettingsSectionTitle";
|
||||||
|
import { internal } from "@app/lib/api";
|
||||||
|
import { authCookieHeader } from "@app/lib/api/cookies";
|
||||||
|
import ClientProvider from "@app/providers/ClientProvider";
|
||||||
import { build } from "@server/build";
|
import { build } from "@server/build";
|
||||||
|
import { GetClientResponse } from "@server/routers/client";
|
||||||
|
import { AxiosResponse } from "axios";
|
||||||
|
import { getTranslations } from "next-intl/server";
|
||||||
|
import { redirect } from "next/navigation";
|
||||||
|
|
||||||
type SettingsLayoutProps = {
|
type SettingsLayoutProps = {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
params: Promise<{ clientId: number | string; orgId: string }>;
|
params: Promise<{ clientId: number | string; orgId: string }>;
|
||||||
}
|
};
|
||||||
|
|
||||||
export default async function SettingsLayout(props: SettingsLayoutProps) {
|
export default async function SettingsLayout(props: SettingsLayoutProps) {
|
||||||
const params = await props.params;
|
const params = await props.params;
|
||||||
@@ -36,16 +36,17 @@ export default async function SettingsLayout(props: SettingsLayoutProps) {
|
|||||||
|
|
||||||
const navItems = [
|
const navItems = [
|
||||||
{
|
{
|
||||||
title: t('general'),
|
title: t("general"),
|
||||||
href: `/{orgId}/settings/clients/{clientId}/general`
|
href: `/{orgId}/settings/clients/machine/{clientId}/general`
|
||||||
},
|
},
|
||||||
...(build === 'enterprise'
|
...(build === "enterprise"
|
||||||
? [{
|
? [
|
||||||
title: t('credentials'),
|
{
|
||||||
href: `/{orgId}/settings/clients/{clientId}/credentials`
|
title: t("credentials"),
|
||||||
},
|
href: `/{orgId}/settings/clients/machine/{clientId}/credentials`
|
||||||
]
|
}
|
||||||
: []),
|
]
|
||||||
|
: [])
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -58,9 +59,7 @@ export default async function SettingsLayout(props: SettingsLayoutProps) {
|
|||||||
<ClientProvider client={client}>
|
<ClientProvider client={client}>
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
<ClientInfoCard />
|
<ClientInfoCard />
|
||||||
<HorizontalTabs items={navItems}>
|
<HorizontalTabs items={navItems}>{children}</HorizontalTabs>
|
||||||
{children}
|
|
||||||
</HorizontalTabs>
|
|
||||||
</div>
|
</div>
|
||||||
</ClientProvider>
|
</ClientProvider>
|
||||||
</>
|
</>
|
||||||
@@ -4,5 +4,7 @@ export default async function ClientPage(props: {
|
|||||||
params: Promise<{ orgId: string; clientId: number | string }>;
|
params: Promise<{ orgId: string; clientId: number | string }>;
|
||||||
}) {
|
}) {
|
||||||
const params = await props.params;
|
const params = await props.params;
|
||||||
redirect(`/${params.orgId}/settings/clients/${params.clientId}/general`);
|
redirect(
|
||||||
|
`/${params.orgId}/settings/clients/machine/${params.clientId}/general`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
@@ -369,10 +369,10 @@ export default function MachineClientsTable({
|
|||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
<Link
|
<Link
|
||||||
href={`/${clientRow.orgId}/settings/clients/${clientRow.id}`}
|
href={`/${clientRow.orgId}/settings/clients/machine/${clientRow.id}`}
|
||||||
>
|
>
|
||||||
<Button variant={"outline"}>
|
<Button variant={"outline"}>
|
||||||
Edit
|
{t("edit")}
|
||||||
<ArrowRight className="ml-2 w-4 h-4" />
|
<ArrowRight className="ml-2 w-4 h-4" />
|
||||||
</Button>
|
</Button>
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
Reference in New Issue
Block a user