This commit is contained in:
vlalx 2025-05-06 06:33:43 +03:00
parent 87b95986c3
commit b9c7c8c966
No known key found for this signature in database
GPG key ID: B7D6023D527B4F97
13 changed files with 347 additions and 70 deletions

View file

@ -245,5 +245,43 @@
"days": "Tage", "days": "Tage",
"weeks": "Wochen", "weeks": "Wochen",
"months": "Monate", "months": "Monate",
"years": "Jahre" "years": "Jahre",
} "apiKeysTitle": "API-Schlüssel Information",
"apiKeysNameMin": "Name muss mindestens 2 Zeichen lang sein.",
"apiKeysNameMax": "Name darf nicht länger als 255 Zeichen sein.",
"apiKeysConfirmCopy2": "Sie müssen bestätigen, dass Sie den API-Schlüssel kopiert haben.",
"apiKeysErrorCreate": "Fehler beim Erstellen des API-Schlüssels",
"apiKeysErrorSetPermission": "Fehler beim Setzen der Berechtigungen",
"apiKeysCreate": "API-Schlüssel generieren",
"apiKeysCreateDescription": "Generieren Sie einen neuen API-Schlüssel für Ihre Organisation",
"apiKeysGeneralSettings": "Berechtigungen",
"apiKeysGeneralSettingsDescription": "Legen Sie fest, was dieser API-Schlüssel tun kann",
"apiKeysList": "Ihr API-Schlüssel",
"apiKeysSave": "Speichern Sie Ihren API-Schlüssel",
"apiKeysSaveDescription": "Sie können dies nur einmal sehen. Kopieren Sie es an einen sicheren Ort.",
"apiKeysInfo": "Ihr API-Schlüssel ist:",
"apiKeysConfirmCopy": "Ich habe den API-Schlüssel kopiert",
"generate": "Generieren",
"done": "Fertig",
"apiKeysSeeAll": "Alle API-Schlüssel anzeigen",
"apiKeysPermissionsErrorLoadingActions": "Fehler beim Laden der API-Schlüsselaktionen",
"apiKeysPermissionsErrorUpdate": "Fehler beim Setzen der Berechtigungen",
"apiKeysPermissionsUpdated": "Berechtigungen aktualisiert",
"apiKeysPermissionsUpdatedDescription": "Die Berechtigungen wurden aktualisiert.",
"apiKeysPermissionsGeneralSettings": "Berechtigungen",
"apiKeysPermissionsGeneralSettingsDescription": "Legen Sie fest, was dieser API-Schlüssel tun kann",
"apiKeysPermissionsSave": "Berechtigungen speichern",
"apiKeysPermissionsTitle": "Berechtigungen",
"apiKeys": "API-Schlüssel",
"searchApiKeys": "API-Schlüssel suchen...",
"apiKeysAdd": "API-Schlüssel generieren",
"apiKeysErrorDelete": "Fehler beim Löschen des API-Schlüssels",
"apiKeysErrorDeleteMessage": "Fehler beim Löschen des API-Schlüssels",
"apiKeysQuestionRemove": "Sind Sie sicher, dass Sie den API-Schlüssel {selectedApiKey} aus der Organisation entfernen möchten?",
"apiKeysMessageRemove": "Einmal entfernt, kann der API-Schlüssel nicht mehr verwendet werden.",
"apiKeysMessageConfirm": "Zur Bestätigung geben Sie bitte den Namen des API-Schlüssels unten ein.",
"apiKeysDeleteConfirm": "Löschen des API-Schlüssels bestätigen",
"apiKeysDelete": "API-Schlüssel löschen",
"apiKeysManage": "API-Schlüssel verwalten",
"apiKeysDescription": "API-Schlüssel werden zur Authentifizierung mit der Integrations-API verwendet"
}

View file

@ -247,5 +247,43 @@
"days": "Days", "days": "Days",
"weeks": "Weeks", "weeks": "Weeks",
"months": "Months", "months": "Months",
"years": "Years" "years": "Years",
} "apiKeysTitle": "API Key Information",
"apiKeysNameMin": "Name must be at least 2 characters.",
"apiKeysNameMax": "Name must not be longer than 255 characters.",
"apiKeysConfirmCopy2": "You must confirm that you have copied the API key.",
"apiKeysErrorCreate": "Error creating API key",
"apiKeysErrorSetPermission": "Error setting permissions",
"apiKeysCreate": "Generate API Key",
"apiKeysCreateDescription": "Generate a new API key for your organization",
"apiKeysGeneralSettings": "Permissions",
"apiKeysGeneralSettingsDescription": "Determine what this API key can do",
"apiKeysList": "Your API Key",
"apiKeysSave": "Save Your API Key",
"apiKeysSaveDescription": "You will only be able to see this once. Make sure to copy it to a secure place.",
"apiKeysInfo": "Your API key is:",
"apiKeysConfirmCopy": "I have copied the API key",
"generate": "Generate",
"done": "Done",
"apiKeysSeeAll": "See All API Keys",
"apiKeysPermissionsErrorLoadingActions": "Error loading API key actions",
"apiKeysPermissionsErrorUpdate": "Error setting permissions",
"apiKeysPermissionsUpdated": "Permissions updated",
"apiKeysPermissionsUpdatedDescription": "The permissions have been updated.",
"apiKeysPermissionsGeneralSettings": "Permissions",
"apiKeysPermissionsGeneralSettingsDescription": "Determine what this API key can do",
"apiKeysPermissionsSave": "Save Permissions",
"apiKeysPermissionsTitle": "Permissions",
"apiKeys": "API Keys",
"searchApiKeys": "Search API keys...",
"apiKeysAdd": "Generate API Key",
"apiKeysErrorDelete": "Error deleting API key",
"apiKeysErrorDeleteMessage": "Error deleting API key",
"apiKeysQuestionRemove": "Are you sure you want to remove the API key {selectedApiKey} from the organization?",
"apiKeysMessageRemove": "Once removed, the API key will no longer be able to be used.",
"apiKeysMessageConfirm": "To confirm, please type the name of the API key below.",
"apiKeysDeleteConfirm": "Confirm Delete API Key",
"apiKeysDelete": "Delete API Key",
"apiKeysManage": "Manage API Keys",
"apiKeysDescription": "API keys are used to authenticate with the integration API"
}

View file

@ -245,5 +245,43 @@
"days": "Jours", "days": "Jours",
"weeks": "Semaines", "weeks": "Semaines",
"months": "Mois", "months": "Mois",
"years": "Années" "years": "Années",
} "apiKeysTitle": "Informations sur la clé API",
"apiKeysNameMin": "Le nom doit comporter au moins 2 caractères.",
"apiKeysNameMax": "Le nom ne doit pas dépasser 255 caractères.",
"apiKeysConfirmCopy2": "Vous devez confirmer que vous avez copié la clé API.",
"apiKeysErrorCreate": "Erreur lors de la création de la clé API",
"apiKeysErrorSetPermission": "Erreur lors de la définition des permissions",
"apiKeysCreate": "Générer une clé API",
"apiKeysCreateDescription": "Générer une nouvelle clé API pour votre organisation",
"apiKeysGeneralSettings": "Permissions",
"apiKeysGeneralSettingsDescription": "Déterminez ce que cette clé API peut faire",
"apiKeysList": "Votre clé API",
"apiKeysSave": "Enregistrer votre clé API",
"apiKeysSaveDescription": "Vous ne pourrez voir cela qu'une seule fois. Assurez-vous de la copier dans un endroit sécurisé.",
"apiKeysInfo": "Votre clé API est :",
"apiKeysConfirmCopy": "J'ai copié la clé API",
"generate": "Générer",
"done": "Terminé",
"apiKeysSeeAll": "Voir toutes les clés API",
"apiKeysPermissionsErrorLoadingActions": "Erreur lors du chargement des actions de la clé API",
"apiKeysPermissionsErrorUpdate": "Erreur lors de la définition des permissions",
"apiKeysPermissionsUpdated": "Permissions mises à jour",
"apiKeysPermissionsUpdatedDescription": "Les permissions ont été mises à jour.",
"apiKeysPermissionsGeneralSettings": "Permissions",
"apiKeysPermissionsGeneralSettingsDescription": "Déterminez ce que cette clé API peut faire",
"apiKeysPermissionsSave": "Enregistrer les permissions",
"apiKeysPermissionsTitle": "Permissions",
"apiKeys": "Clés API",
"searchApiKeys": "Rechercher des clés API...",
"apiKeysAdd": "Générer une clé API",
"apiKeysErrorDelete": "Erreur lors de la suppression de la clé API",
"apiKeysErrorDeleteMessage": "Erreur lors de la suppression de la clé API",
"apiKeysQuestionRemove": "Êtes-vous sûr de vouloir supprimer la clé API {selectedApiKey} de l'organisation ?",
"apiKeysMessageRemove": "Une fois supprimée, la clé API ne pourra plus être utilisée.",
"apiKeysMessageConfirm": "Pour confirmer, veuillez saisir le nom de la clé API ci-dessous.",
"apiKeysDeleteConfirm": "Confirmer la suppression de la clé API",
"apiKeysDelete": "Supprimer la clé API",
"apiKeysManage": "Gérer les clés API",
"apiKeysDescription": "Les clés API sont utilisées pour s'authentifier avec l'API d'intégration"
}

View file

@ -245,5 +245,43 @@
"days": "Giorni", "days": "Giorni",
"weeks": "Settimane", "weeks": "Settimane",
"months": "Mesi", "months": "Mesi",
"years": "Anni" "years": "Anni",
} "apiKeysTitle": "Informazioni Chiave API",
"apiKeysNameMin": "Il nome deve contenere almeno 2 caratteri.",
"apiKeysNameMax": "Il nome non deve essere più lungo di 255 caratteri.",
"apiKeysConfirmCopy2": "Devi confermare di aver copiato la chiave API.",
"apiKeysErrorCreate": "Errore nella creazione della chiave API",
"apiKeysErrorSetPermission": "Errore nell'impostazione dei permessi",
"apiKeysCreate": "Genera Chiave API",
"apiKeysCreateDescription": "Genera una nuova chiave API per la tua organizzazione",
"apiKeysGeneralSettings": "Permessi",
"apiKeysGeneralSettingsDescription": "Determina cosa può fare questa chiave API",
"apiKeysList": "La Tua Chiave API",
"apiKeysSave": "Salva La Tua Chiave API",
"apiKeysSaveDescription": "Potrai vederla solo una volta. Assicurati di copiarla in un luogo sicuro.",
"apiKeysInfo": "La tua chiave API è:",
"apiKeysConfirmCopy": "Ho copiato la chiave API",
"generate": "Genera",
"done": "Fatto",
"apiKeysSeeAll": "Vedi Tutte Le Chiavi API",
"apiKeysPermissionsErrorLoadingActions": "Errore nel caricamento delle azioni della chiave API",
"apiKeysPermissionsErrorUpdate": "Errore nell'impostazione dei permessi",
"apiKeysPermissionsUpdated": "Permessi aggiornati",
"apiKeysPermissionsUpdatedDescription": "I permessi sono stati aggiornati.",
"apiKeysPermissionsGeneralSettings": "Permessi",
"apiKeysPermissionsGeneralSettingsDescription": "Determina cosa può fare questa chiave API",
"apiKeysPermissionsSave": "Salva Permessi",
"apiKeysPermissionsTitle": "Permessi",
"apiKeys": "Chiavi API",
"searchApiKeys": "Cerca chiavi API...",
"apiKeysAdd": "Genera Chiave API",
"apiKeysErrorDelete": "Errore nell'eliminazione della chiave API",
"apiKeysErrorDeleteMessage": "Errore nell'eliminazione della chiave API",
"apiKeysQuestionRemove": "Sei sicuro di voler rimuovere la chiave API {selectedApiKey} dall'organizzazione?",
"apiKeysMessageRemove": "Una volta rimossa, la chiave API non potrà più essere utilizzata.",
"apiKeysMessageConfirm": "Per confermare, digita il nome della chiave API qui sotto.",
"apiKeysDeleteConfirm": "Conferma Eliminazione Chiave API",
"apiKeysDelete": "Elimina Chiave API",
"apiKeysManage": "Gestisci Chiavi API",
"apiKeysDescription": "Le chiavi API sono utilizzate per autenticarsi con l'API di integrazione"
}

View file

@ -245,5 +245,43 @@
"days": "Dni", "days": "Dni",
"weeks": "Tygodnie", "weeks": "Tygodnie",
"months": "Miesiące", "months": "Miesiące",
"years": "Lata" "years": "Lata",
} "apiKeysTitle": "Informacje o kluczu API",
"apiKeysNameMin": "Nazwa musi mieć co najmniej 2 znaki.",
"apiKeysNameMax": "Nazwa nie może być dłuższa niż 255 znaków.",
"apiKeysConfirmCopy2": "Musisz potwierdzić, że skopiowałeś klucz API.",
"apiKeysErrorCreate": "Błąd podczas tworzenia klucza API",
"apiKeysErrorSetPermission": "Błąd podczas ustawiania uprawnień",
"apiKeysCreate": "Generuj klucz API",
"apiKeysCreateDescription": "Wygeneruj nowy klucz API dla swojej organizacji",
"apiKeysGeneralSettings": "Uprawnienia",
"apiKeysGeneralSettingsDescription": "Określ, co ten klucz API może zrobić",
"apiKeysList": "Twój klucz API",
"apiKeysSave": "Zapisz swój klucz API",
"apiKeysSaveDescription": "Będziesz mógł zobaczyć to tylko raz. Upewnij się, że skopiujesz go w bezpieczne miejsce.",
"apiKeysInfo": "Twój klucz API to:",
"apiKeysConfirmCopy": "Skopiowałem klucz API",
"generate": "Generuj",
"done": "Gotowe",
"apiKeysSeeAll": "Zobacz wszystkie klucze API",
"apiKeysPermissionsErrorLoadingActions": "Błąd podczas ładowania akcji klucza API",
"apiKeysPermissionsErrorUpdate": "Błąd podczas ustawiania uprawnień",
"apiKeysPermissionsUpdated": "Uprawnienia zaktualizowane",
"apiKeysPermissionsUpdatedDescription": "Uprawnienia zostały zaktualizowane.",
"apiKeysPermissionsGeneralSettings": "Uprawnienia",
"apiKeysPermissionsGeneralSettingsDescription": "Określ, co ten klucz API może zrobić",
"apiKeysPermissionsSave": "Zapisz uprawnienia",
"apiKeysPermissionsTitle": "Uprawnienia",
"apiKeys": "Klucze API",
"searchApiKeys": "Szukaj kluczy API...",
"apiKeysAdd": "Generuj klucz API",
"apiKeysErrorDelete": "Błąd podczas usuwania klucza API",
"apiKeysErrorDeleteMessage": "Błąd podczas usuwania klucza API",
"apiKeysQuestionRemove": "Czy na pewno chcesz usunąć klucz API {selectedApiKey} z organizacji?",
"apiKeysMessageRemove": "Po usunięciu klucz API nie będzie już mógł być używany.",
"apiKeysMessageConfirm": "Aby potwierdzić, wpisz nazwę klucza API poniżej.",
"apiKeysDeleteConfirm": "Potwierdź usunięcie klucza API",
"apiKeysDelete": "Usuń klucz API",
"apiKeysManage": "Zarządzaj kluczami API",
"apiKeysDescription": "Klucze API służą do uwierzytelniania z API integracji"
}

View file

@ -245,5 +245,43 @@
"days": "dias", "days": "dias",
"weeks": "semanas", "weeks": "semanas",
"months": "Meses", "months": "Meses",
"years": "anos" "years": "anos",
} "apiKeysTitle": "Informações da Chave API",
"apiKeysNameMin": "O nome deve ter pelo menos 2 caracteres.",
"apiKeysNameMax": "O nome não deve ter mais de 255 caracteres.",
"apiKeysConfirmCopy2": "Você deve confirmar que copiou a chave API.",
"apiKeysErrorCreate": "Erro ao criar chave API",
"apiKeysErrorSetPermission": "Erro ao definir permissões",
"apiKeysCreate": "Gerar Chave API",
"apiKeysCreateDescription": "Gerar uma nova chave API para sua organização",
"apiKeysGeneralSettings": "Permissões",
"apiKeysGeneralSettingsDescription": "Determine o que esta chave API pode fazer",
"apiKeysList": "Sua Chave API",
"apiKeysSave": "Salvar Sua Chave API",
"apiKeysSaveDescription": "Você só poderá ver isto uma vez. Certifique-se de copiá-la para um local seguro.",
"apiKeysInfo": "Sua chave API é:",
"apiKeysConfirmCopy": "Eu copiei a chave API",
"generate": "Gerar",
"done": "Concluído",
"apiKeysSeeAll": "Ver Todas as Chaves API",
"apiKeysPermissionsErrorLoadingActions": "Erro ao carregar ações da chave API",
"apiKeysPermissionsErrorUpdate": "Erro ao definir permissões",
"apiKeysPermissionsUpdated": "Permissões atualizadas",
"apiKeysPermissionsUpdatedDescription": "As permissões foram atualizadas.",
"apiKeysPermissionsGeneralSettings": "Permissões",
"apiKeysPermissionsGeneralSettingsDescription": "Determine o que esta chave API pode fazer",
"apiKeysPermissionsSave": "Salvar Permissões",
"apiKeysPermissionsTitle": "Permissões",
"apiKeys": "Chaves API",
"searchApiKeys": "Pesquisar chaves API...",
"apiKeysAdd": "Gerar Chave API",
"apiKeysErrorDelete": "Erro ao excluir chave API",
"apiKeysErrorDeleteMessage": "Erro ao excluir chave API",
"apiKeysQuestionRemove": "Tem certeza que deseja remover a chave API {selectedApiKey} da organização?",
"apiKeysMessageRemove": "Uma vez removida, a chave API não poderá mais ser utilizada.",
"apiKeysMessageConfirm": "Para confirmar, por favor digite o nome da chave API abaixo.",
"apiKeysDeleteConfirm": "Confirmar Exclusão da Chave API",
"apiKeysDelete": "Excluir Chave API",
"apiKeysManage": "Gerenciar Chaves API",
"apiKeysDescription": "As chaves API são usadas para autenticar com a API de integração"
}

View file

@ -245,5 +245,43 @@
"days": "Days", "days": "Days",
"weeks": "Weeks", "weeks": "Weeks",
"months": "Months", "months": "Months",
"years": "Years" "years": "Years",
} "apiKeysTitle": "API Key Information",
"apiKeysNameMin": "Name must be at least 2 characters.",
"apiKeysNameMax": "Name must not be longer than 255 characters.",
"apiKeysConfirmCopy2": "You must confirm that you have copied the API key.",
"apiKeysErrorCreate": "Error creating API key",
"apiKeysErrorSetPermission": "Error setting permissions",
"apiKeysCreate": "Generate API Key",
"apiKeysCreateDescription": "Generate a new API key for your organization",
"apiKeysGeneralSettings": "Permissions",
"apiKeysGeneralSettingsDescription": "Determine what this API key can do",
"apiKeysList": "Your API Key",
"apiKeysSave": "Save Your API Key",
"apiKeysSaveDescription": "You will only be able to see this once. Make sure to copy it to a secure place.",
"apiKeysInfo": "Your API key is:",
"apiKeysConfirmCopy": "I have copied the API key",
"generate": "Generate",
"done": "Done",
"apiKeysSeeAll": "See All API Keys",
"apiKeysPermissionsErrorLoadingActions": "Error loading API key actions",
"apiKeysPermissionsErrorUpdate": "Error setting permissions",
"apiKeysPermissionsUpdated": "Permissions updated",
"apiKeysPermissionsUpdatedDescription": "The permissions have been updated.",
"apiKeysPermissionsGeneralSettings": "Permissions",
"apiKeysPermissionsGeneralSettingsDescription": "Determine what this API key can do",
"apiKeysPermissionsSave": "Save Permissions",
"apiKeysPermissionsTitle": "Permissions",
"apiKeys": "API Keys",
"searchApiKeys": "Search API keys...",
"apiKeysAdd": "Generate API Key",
"apiKeysErrorDelete": "Error deleting API key",
"apiKeysErrorDeleteMessage": "Error deleting API key",
"apiKeysQuestionRemove": "Are you sure you want to remove the API key {selectedApiKey} from the organization?",
"apiKeysMessageRemove": "Once removed, the API key will no longer be able to be used.",
"apiKeysMessageConfirm": "To confirm, please type the name of the API key below.",
"apiKeysDeleteConfirm": "Confirm Delete API Key",
"apiKeysDelete": "Delete API Key",
"apiKeysManage": "Manage API Keys",
"apiKeysDescription": "API keys are used to authenticate with the integration API"
}

View file

@ -7,6 +7,7 @@
import { DataTable } from "@app/components/ui/data-table"; import { DataTable } from "@app/components/ui/data-table";
import { ColumnDef } from "@tanstack/react-table"; import { ColumnDef } from "@tanstack/react-table";
import { useTranslations } from "next-intl";
interface DataTableProps<TData, TValue> { interface DataTableProps<TData, TValue> {
columns: ColumnDef<TData, TValue>[]; columns: ColumnDef<TData, TValue>[];
@ -19,15 +20,18 @@ export function OrgApiKeysDataTable<TData, TValue>({
columns, columns,
data data
}: DataTableProps<TData, TValue>) { }: DataTableProps<TData, TValue>) {
const t = useTranslations();
return ( return (
<DataTable <DataTable
columns={columns} columns={columns}
data={data} data={data}
title="API Keys" title={t('apiKeys')}
searchPlaceholder="Search API keys..." searchPlaceholder={t('searchApiKeys')}
searchColumn="name" searchColumn="name"
onAdd={addApiKey} onAdd={addApiKey}
addButtonText="Generate API Key" addButtonText={t('apiKeysAdd')}
/> />
); );
} }

View file

@ -24,6 +24,7 @@ import { formatAxiosError } from "@app/lib/api";
import { createApiClient } from "@app/lib/api"; import { createApiClient } from "@app/lib/api";
import { useEnvContext } from "@app/hooks/useEnvContext"; import { useEnvContext } from "@app/hooks/useEnvContext";
import moment from "moment"; import moment from "moment";
import { useTranslations } from "next-intl";
export type OrgApiKeyRow = { export type OrgApiKeyRow = {
id: string; id: string;
@ -49,14 +50,16 @@ export default function OrgApiKeysTable({
const api = createApiClient(useEnvContext()); const api = createApiClient(useEnvContext());
const t = useTranslations();
const deleteSite = (apiKeyId: string) => { const deleteSite = (apiKeyId: string) => {
api.delete(`/org/${orgId}/api-key/${apiKeyId}`) api.delete(`/org/${orgId}/api-key/${apiKeyId}`)
.catch((e) => { .catch((e) => {
console.error("Error deleting API key", e); console.error(t('apiKeysErrorDelete'), e);
toast({ toast({
variant: "destructive", variant: "destructive",
title: "Error deleting API key", title: t('apiKeysErrorDelete'),
description: formatAxiosError(e, "Error deleting API key") description: formatAxiosError(e, t('apiKeysErrorDeleteMessage'))
}); });
}) })
.then(() => { .then(() => {
@ -90,7 +93,7 @@ export default function OrgApiKeysTable({
setSelected(apiKeyROw); setSelected(apiKeyROw);
}} }}
> >
<span>View settings</span> <span>{t('viewSettings')}</span>
</DropdownMenuItem> </DropdownMenuItem>
<DropdownMenuItem <DropdownMenuItem
onClick={() => { onClick={() => {
@ -115,7 +118,7 @@ export default function OrgApiKeysTable({
column.toggleSorting(column.getIsSorted() === "asc") column.toggleSorting(column.getIsSorted() === "asc")
} }
> >
Name {t('name')}
<ArrowUpDown className="ml-2 h-4 w-4" /> <ArrowUpDown className="ml-2 h-4 w-4" />
</Button> </Button>
); );
@ -145,7 +148,7 @@ export default function OrgApiKeysTable({
<div className="flex items-center justify-end"> <div className="flex items-center justify-end">
<Link href={`/${orgId}/settings/api-keys/${r.id}`}> <Link href={`/${orgId}/settings/api-keys/${r.id}`}>
<Button variant={"outlinePrimary"} className="ml-2"> <Button variant={"outlinePrimary"} className="ml-2">
Edit {t('edit')}
<ArrowRight className="ml-2 w-4 h-4" /> <ArrowRight className="ml-2 w-4 h-4" />
</Button> </Button>
</Link> </Link>
@ -167,28 +170,24 @@ export default function OrgApiKeysTable({
dialog={ dialog={
<div className="space-y-4"> <div className="space-y-4">
<p> <p>
Are you sure you want to remove the API key{" "} {t('apiKeysQuestionRemove', {selectedApiKey: selected?.name || selected?.id})}
<b>{selected?.name || selected?.id}</b> from the
organization?
</p> </p>
<p> <p>
<b> <b>
Once removed, the API key will no longer be {t('apiKeysMessageRemove')}
able to be used.
</b> </b>
</p> </p>
<p> <p>
To confirm, please type the name of the API key {t('apiKeysMessageConfirm')}
below.
</p> </p>
</div> </div>
} }
buttonText="Confirm Delete API Key" buttonText={t('apiKeysDeleteConfirm')}
onConfirm={async () => deleteSite(selected!.id)} onConfirm={async () => deleteSite(selected!.id)}
string={selected.name} string={selected.name}
title="Delete API Key" title={t('apiKeysDelete')}
/> />
)} )}

View file

@ -20,6 +20,7 @@ import {
import { GetApiKeyResponse } from "@server/routers/apiKeys"; import { GetApiKeyResponse } from "@server/routers/apiKeys";
import ApiKeyProvider from "@app/providers/ApiKeyProvider"; import ApiKeyProvider from "@app/providers/ApiKeyProvider";
import { HorizontalTabs } from "@app/components/HorizontalTabs"; import { HorizontalTabs } from "@app/components/HorizontalTabs";
import { useTranslations } from "next-intl";
interface SettingsLayoutProps { interface SettingsLayoutProps {
children: React.ReactNode; children: React.ReactNode;
@ -29,6 +30,8 @@ interface SettingsLayoutProps {
export default async function SettingsLayout(props: SettingsLayoutProps) { export default async function SettingsLayout(props: SettingsLayoutProps) {
const params = await props.params; const params = await props.params;
const t = useTranslations();
const { children } = props; const { children } = props;
let apiKey = null; let apiKey = null;
@ -45,7 +48,7 @@ export default async function SettingsLayout(props: SettingsLayoutProps) {
const navItems = [ const navItems = [
{ {
title: "Permissions", title: t('apiKeysPermissionsTitle'),
href: "/{orgId}/settings/api-keys/{apiKeyId}/permissions" href: "/{orgId}/settings/api-keys/{apiKeyId}/permissions"
} }
]; ];

View file

@ -23,12 +23,15 @@ import { ListApiKeyActionsResponse } from "@server/routers/apiKeys";
import { AxiosResponse } from "axios"; import { AxiosResponse } from "axios";
import { useParams } from "next/navigation"; import { useParams } from "next/navigation";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useTranslations } from "next-intl";
export default function Page() { export default function Page() {
const { env } = useEnvContext(); const { env } = useEnvContext();
const api = createApiClient({ env }); const api = createApiClient({ env });
const { orgId, apiKeyId } = useParams(); const { orgId, apiKeyId } = useParams();
const t = useTranslations();
const [loadingPage, setLoadingPage] = useState<boolean>(true); const [loadingPage, setLoadingPage] = useState<boolean>(true);
const [selectedPermissions, setSelectedPermissions] = useState< const [selectedPermissions, setSelectedPermissions] = useState<
Record<string, boolean> Record<string, boolean>
@ -47,10 +50,10 @@ export default function Page() {
.catch((e) => { .catch((e) => {
toast({ toast({
variant: "destructive", variant: "destructive",
title: "Error loading API key actions", title: t('apiKeysPermissionsErrorLoadingActions'),
description: formatAxiosError( description: formatAxiosError(
e, e,
"Error loading API key actions" t('apiKeysPermissionsErrorLoadingActions')
) )
}); });
}); });
@ -81,18 +84,18 @@ export default function Page() {
) )
}) })
.catch((e) => { .catch((e) => {
console.error("Error setting permissions", e); console.error(t('apiKeysPermissionsErrorUpdate'), e);
toast({ toast({
variant: "destructive", variant: "destructive",
title: "Error setting permissions", title: t('apiKeysPermissionsErrorUpdate'),
description: formatAxiosError(e) description: formatAxiosError(e)
}); });
}); });
if (actionsRes && actionsRes.status === 200) { if (actionsRes && actionsRes.status === 200) {
toast({ toast({
title: "Permissions updated", title: t('apiKeysPermissionsUpdated'),
description: "The permissions have been updated." description: t('apiKeysPermissionsUpdatedDescription')
}); });
} }
@ -106,10 +109,10 @@ export default function Page() {
<SettingsSection> <SettingsSection>
<SettingsSectionHeader> <SettingsSectionHeader>
<SettingsSectionTitle> <SettingsSectionTitle>
Permissions {t('apiKeysPermissionsGeneralSettings')}
</SettingsSectionTitle> </SettingsSectionTitle>
<SettingsSectionDescription> <SettingsSectionDescription>
Determine what this API key can do {t('apiKeysPermissionsGeneralSettingsDescription')}
</SettingsSectionDescription> </SettingsSectionDescription>
</SettingsSectionHeader> </SettingsSectionHeader>
<SettingsSectionBody> <SettingsSectionBody>
@ -126,7 +129,7 @@ export default function Page() {
loading={loadingSavePermissions} loading={loadingSavePermissions}
disabled={loadingSavePermissions} disabled={loadingSavePermissions}
> >
Save Permissions {t('apiKeysPermissionsSave')}
</Button> </Button>
</SettingsSectionFooter> </SettingsSectionFooter>
</SettingsSectionBody> </SettingsSectionBody>

View file

@ -61,15 +61,18 @@ import moment from "moment";
import CopyCodeBox from "@server/emails/templates/components/CopyCodeBox"; import CopyCodeBox from "@server/emails/templates/components/CopyCodeBox";
import CopyTextBox from "@app/components/CopyTextBox"; import CopyTextBox from "@app/components/CopyTextBox";
import PermissionsSelectBox from "@app/components/PermissionsSelectBox"; import PermissionsSelectBox from "@app/components/PermissionsSelectBox";
import { useTranslations } from "next-intl";
const t = useTranslations();
const createFormSchema = z.object({ const createFormSchema = z.object({
name: z name: z
.string() .string()
.min(2, { .min(2, {
message: "Name must be at least 2 characters." message: t('apiKeysNameMin')
}) })
.max(255, { .max(255, {
message: "Name must not be longer than 255 characters." message: t('apiKeysNameMax')
}) })
}); });
@ -84,7 +87,7 @@ const copiedFormSchema = z
return data.copied; return data.copied;
}, },
{ {
message: "You must confirm that you have copied the API key.", message: t('apiKeysConfirmCopy2'),
path: ["copied"] path: ["copied"]
} }
); );
@ -132,7 +135,7 @@ export default function Page() {
.catch((e) => { .catch((e) => {
toast({ toast({
variant: "destructive", variant: "destructive",
title: "Error creating API key", title: t('apiKeysErrorCreate'),
description: formatAxiosError(e) description: formatAxiosError(e)
}); });
}); });
@ -153,10 +156,10 @@ export default function Page() {
) )
}) })
.catch((e) => { .catch((e) => {
console.error("Error setting permissions", e); console.error(t('apiKeysErrorSetPermission'), e);
toast({ toast({
variant: "destructive", variant: "destructive",
title: "Error setting permissions", title: t('apiKeysErrorSetPermission'),
description: formatAxiosError(e) description: formatAxiosError(e)
}); });
}); });
@ -195,8 +198,8 @@ export default function Page() {
<> <>
<div className="flex justify-between"> <div className="flex justify-between">
<HeaderTitle <HeaderTitle
title="Generate API Key" title={t('apiKeysCreate')}
description="Generate a new API key for your organization" description={t('apiKeysCreateDescription')}
/> />
<Button <Button
variant="outline" variant="outline"
@ -204,7 +207,7 @@ export default function Page() {
router.push(`/${orgId}/settings/api-keys`); router.push(`/${orgId}/settings/api-keys`);
}} }}
> >
See All API Keys {t('apiKeysSeeAll')}
</Button> </Button>
</div> </div>
@ -216,7 +219,7 @@ export default function Page() {
<SettingsSection> <SettingsSection>
<SettingsSectionHeader> <SettingsSectionHeader>
<SettingsSectionTitle> <SettingsSectionTitle>
API Key Information {t('apiKeysTitle')}
</SettingsSectionTitle> </SettingsSectionTitle>
</SettingsSectionHeader> </SettingsSectionHeader>
<SettingsSectionBody> <SettingsSectionBody>
@ -232,7 +235,7 @@ export default function Page() {
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel> <FormLabel>
Name {t('name')}
</FormLabel> </FormLabel>
<FormControl> <FormControl>
<Input <Input
@ -253,10 +256,10 @@ export default function Page() {
<SettingsSection> <SettingsSection>
<SettingsSectionHeader> <SettingsSectionHeader>
<SettingsSectionTitle> <SettingsSectionTitle>
Permissions {t('apiKeysGeneralSettings')}
</SettingsSectionTitle> </SettingsSectionTitle>
<SettingsSectionDescription> <SettingsSectionDescription>
Determine what this API key can do {t('apiKeysGeneralSettingsDescription')}
</SettingsSectionDescription> </SettingsSectionDescription>
</SettingsSectionHeader> </SettingsSectionHeader>
<SettingsSectionBody> <SettingsSectionBody>
@ -275,14 +278,14 @@ export default function Page() {
<SettingsSection> <SettingsSection>
<SettingsSectionHeader> <SettingsSectionHeader>
<SettingsSectionTitle> <SettingsSectionTitle>
Your API Key {t('apiKeysList')}
</SettingsSectionTitle> </SettingsSectionTitle>
</SettingsSectionHeader> </SettingsSectionHeader>
<SettingsSectionBody> <SettingsSectionBody>
<InfoSections cols={2}> <InfoSections cols={2}>
<InfoSection> <InfoSection>
<InfoSectionTitle> <InfoSectionTitle>
Name {t('name')}
</InfoSectionTitle> </InfoSectionTitle>
<InfoSectionContent> <InfoSectionContent>
<CopyToClipboard <CopyToClipboard
@ -292,7 +295,7 @@ export default function Page() {
</InfoSection> </InfoSection>
<InfoSection> <InfoSection>
<InfoSectionTitle> <InfoSectionTitle>
Created {t('created')}
</InfoSectionTitle> </InfoSectionTitle>
<InfoSectionContent> <InfoSectionContent>
{moment( {moment(
@ -305,17 +308,15 @@ export default function Page() {
<Alert variant="neutral"> <Alert variant="neutral">
<InfoIcon className="h-4 w-4" /> <InfoIcon className="h-4 w-4" />
<AlertTitle className="font-semibold"> <AlertTitle className="font-semibold">
Save Your API Key {t('apiKeysSave')}
</AlertTitle> </AlertTitle>
<AlertDescription> <AlertDescription>
You will only be able to see this {t('apiKeysSaveDescription')}
once. Make sure to copy it to a
secure place.
</AlertDescription> </AlertDescription>
</Alert> </Alert>
<h4 className="font-semibold"> <h4 className="font-semibold">
Your API key is: {t('apiKeysInfo')}
</h4> </h4>
<CopyTextBox <CopyTextBox
@ -353,8 +354,7 @@ export default function Page() {
htmlFor="terms" htmlFor="terms"
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
> >
I have copied {t('apiKeysConfirmCopy')}
the API key
</label> </label>
</div> </div>
<FormMessage /> <FormMessage />
@ -378,7 +378,7 @@ export default function Page() {
router.push(`/${orgId}/settings/api-keys`); router.push(`/${orgId}/settings/api-keys`);
}} }}
> >
Cancel {t('cancel')}
</Button> </Button>
)} )}
{!apiKey && ( {!apiKey && (
@ -390,7 +390,7 @@ export default function Page() {
form.handleSubmit(onSubmit)(); form.handleSubmit(onSubmit)();
}} }}
> >
Generate {t('generate')}
</Button> </Button>
)} )}
@ -401,7 +401,7 @@ export default function Page() {
copiedForm.handleSubmit(onCopiedSubmit)(); copiedForm.handleSubmit(onCopiedSubmit)();
}} }}
> >
Done {t('done')}
</Button> </Button>
)} )}
</div> </div>

View file

@ -9,6 +9,7 @@ import { AxiosResponse } from "axios";
import SettingsSectionTitle from "@app/components/SettingsSectionTitle"; import SettingsSectionTitle from "@app/components/SettingsSectionTitle";
import OrgApiKeysTable, { OrgApiKeyRow } from "./OrgApiKeysTable"; import OrgApiKeysTable, { OrgApiKeyRow } from "./OrgApiKeysTable";
import { ListOrgApiKeysResponse } from "@server/routers/apiKeys"; import { ListOrgApiKeysResponse } from "@server/routers/apiKeys";
import { useTranslations } from "next-intl";
type ApiKeyPageProps = { type ApiKeyPageProps = {
params: Promise<{ orgId: string }>; params: Promise<{ orgId: string }>;
@ -18,6 +19,7 @@ export const dynamic = "force-dynamic";
export default async function ApiKeysPage(props: ApiKeyPageProps) { export default async function ApiKeysPage(props: ApiKeyPageProps) {
const params = await props.params; const params = await props.params;
const t = useTranslations();
let apiKeys: ListOrgApiKeysResponse["apiKeys"] = []; let apiKeys: ListOrgApiKeysResponse["apiKeys"] = [];
try { try {
const res = await internal.get<AxiosResponse<ListOrgApiKeysResponse>>( const res = await internal.get<AxiosResponse<ListOrgApiKeysResponse>>(
@ -39,8 +41,8 @@ export default async function ApiKeysPage(props: ApiKeyPageProps) {
return ( return (
<> <>
<SettingsSectionTitle <SettingsSectionTitle
title="Manage API Keys" title={t('apiKeysManage')}
description="API keys are used to authenticate with the integration API" description={t('apiKeysDescription')}
/> />
<OrgApiKeysTable apiKeys={rows} orgId={params.orgId} /> <OrgApiKeysTable apiKeys={rows} orgId={params.orgId} />