Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,48 @@
|
||||
import { LoaderFunctionArgs, Outlet, useLoaderData, useParams } from "react-router";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import ApiKeysTable from "~/components/core/apiKeys/ApiKeysTable";
|
||||
import EditPageLayout from "~/components/ui/layouts/EditPageLayout";
|
||||
import UrlUtils from "~/utils/app/UrlUtils";
|
||||
import { useAppData } from "~/utils/data/useAppData";
|
||||
import { RedactedApiKeyWithDetails, getApiKeys } from "~/utils/db/apiKeys.db.server";
|
||||
import { verifyUserHasPermission } from "~/utils/helpers/.server/PermissionsService";
|
||||
import { getUserHasPermission } from "~/utils/helpers/PermissionsHelper";
|
||||
import { getTenantIdFromUrl } from "~/utils/services/.server/urlService";
|
||||
|
||||
type LoaderData = {
|
||||
apiKeys: RedactedApiKeyWithDetails[];
|
||||
};
|
||||
|
||||
export const loader = async ({ request, params }: LoaderFunctionArgs) => {
|
||||
const tenantId = await getTenantIdFromUrl(params);
|
||||
await verifyUserHasPermission(request, "app.settings.apiKeys.view", tenantId);
|
||||
const data: LoaderData = {
|
||||
apiKeys: await getApiKeys(tenantId),
|
||||
};
|
||||
return data;
|
||||
};
|
||||
|
||||
export default function ApiKeysRoute() {
|
||||
const { t } = useTranslation();
|
||||
const data = useLoaderData<LoaderData>();
|
||||
const appData = useAppData();
|
||||
const params = useParams();
|
||||
|
||||
return (
|
||||
<EditPageLayout
|
||||
tabs={[
|
||||
{ name: t("shared.overview"), routePath: UrlUtils.getModulePath(params, "api") },
|
||||
{ name: t("models.apiCall.plural"), routePath: UrlUtils.getModulePath(params, "api/logs") },
|
||||
{ name: t("models.apiKey.plural"), routePath: UrlUtils.getModulePath(params, "api/keys") },
|
||||
{ name: t("docs.title"), routePath: UrlUtils.getModulePath(params, "api/docs") },
|
||||
]}
|
||||
>
|
||||
<ApiKeysTable
|
||||
canCreate={getUserHasPermission(appData, "app.settings.apiKeys.create")}
|
||||
entities={appData.entities}
|
||||
items={data.apiKeys}
|
||||
/>
|
||||
<Outlet />
|
||||
</EditPageLayout>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user