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,61 @@
|
||||
import { LoaderFunctionArgs, useLoaderData } from "react-router";
|
||||
import { useParams } from "react-router";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import EditPageLayout from "~/components/ui/layouts/EditPageLayout";
|
||||
import { getTranslations } from "~/locale/i18next.server";
|
||||
import ApiSpecs from "~/modules/api/components/ApiSpecs";
|
||||
import ApiSpecsService, { ApiSpecsDto } from "~/modules/api/services/ApiSpecsService";
|
||||
import UrlUtils from "~/utils/app/UrlUtils";
|
||||
import { getAppConfiguration } from "~/utils/db/appConfiguration.db.server";
|
||||
import { verifyUserHasPermission } from "~/utils/helpers/.server/PermissionsService";
|
||||
import { getTenantIdFromUrl } from "~/utils/services/.server/urlService";
|
||||
|
||||
type LoaderData = {
|
||||
apiSpecs: ApiSpecsDto;
|
||||
};
|
||||
export const loader = async ({ request, params }: LoaderFunctionArgs) => {
|
||||
const { t } = await getTranslations(request);
|
||||
const tenantId = await getTenantIdFromUrl(params);
|
||||
await verifyUserHasPermission(request, "app.settings.apiKeys.view", tenantId);
|
||||
const appConfiguration = await getAppConfiguration({ request });
|
||||
if (!appConfiguration.app.features.tenantApiKeys) {
|
||||
throw Response.json({ error: t("settings.api.errors.tenantApiKeysNotEnabled") }, { status: 404 });
|
||||
}
|
||||
const apiSpecs = await ApiSpecsService.generateSpecs({ request });
|
||||
const data: LoaderData = {
|
||||
apiSpecs,
|
||||
};
|
||||
return data;
|
||||
};
|
||||
|
||||
export default function AdminApiDocsRoute() {
|
||||
const { t } = useTranslation();
|
||||
const data = useLoaderData<LoaderData>();
|
||||
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"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<ApiSpecs item={data.apiSpecs} postmanCollectionUrl={null} showPostmanCollection={false} />
|
||||
</EditPageLayout>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user