first commit
This commit is contained in:
26
ui/app/workspace/config/layout.tsx
Normal file
26
ui/app/workspace/config/layout.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import { createFileRoute, Outlet, useChildMatches } from "@tanstack/react-router";
|
||||
import FullPageLoader from "@/components/fullPageLoader";
|
||||
import { NoPermissionView } from "@/components/noPermissionView";
|
||||
import { useGetCoreConfigQuery } from "@/lib/store";
|
||||
import { RbacOperation, RbacResource, useRbac } from "@enterprise/lib";
|
||||
import ConfigPage from "./page";
|
||||
|
||||
function RouteComponent() {
|
||||
const hasConfigAccess = useRbac(RbacResource.Settings, RbacOperation.View);
|
||||
const { isLoading } = useGetCoreConfigQuery({ fromDB: true }, { skip: !hasConfigAccess });
|
||||
const childMatches = useChildMatches();
|
||||
|
||||
if (!hasConfigAccess) {
|
||||
return <NoPermissionView entity="configuration" />;
|
||||
}
|
||||
|
||||
if (isLoading) {
|
||||
return <FullPageLoader />;
|
||||
}
|
||||
|
||||
return childMatches.length === 0 ? <ConfigPage /> : <Outlet />;
|
||||
}
|
||||
|
||||
export const Route = createFileRoute("/workspace/config")({
|
||||
component: RouteComponent,
|
||||
});
|
||||
Reference in New Issue
Block a user