2022-02-21 12:14:20 +00:00
|
|
|
import { lazy } from "react";
|
2023-01-18 12:09:49 +00:00
|
|
|
import type { Path } from "react-router-dom";
|
|
|
|
import { generatePath } from "react-router-dom";
|
2023-03-27 14:10:48 +00:00
|
|
|
import type { AppRouteObject } from "../../routes";
|
2022-02-21 12:14:20 +00:00
|
|
|
|
|
|
|
export type DedicatedScopeTab = "mappers" | "scope";
|
|
|
|
|
|
|
|
export type DedicatedScopeDetailsParams = {
|
|
|
|
realm: string;
|
|
|
|
clientId: string;
|
|
|
|
tab?: DedicatedScopeTab;
|
|
|
|
};
|
|
|
|
|
2023-03-24 14:37:24 +00:00
|
|
|
const DedicatedScopes = lazy(() => import("../scopes/DedicatedScopes"));
|
|
|
|
|
2023-03-27 14:10:48 +00:00
|
|
|
export const DedicatedScopeDetailsRoute: AppRouteObject = {
|
2022-08-22 14:29:35 +00:00
|
|
|
path: "/:realm/clients/:clientId/clientScopes/dedicated",
|
2023-03-24 14:37:24 +00:00
|
|
|
element: <DedicatedScopes />,
|
2022-02-21 12:14:20 +00:00
|
|
|
breadcrumb: (t) => t("clients:dedicatedScopes"),
|
2023-03-27 00:31:23 +00:00
|
|
|
handle: {
|
|
|
|
access: "view-clients",
|
|
|
|
},
|
2022-08-22 14:29:35 +00:00
|
|
|
};
|
|
|
|
|
2023-03-27 14:10:48 +00:00
|
|
|
export const DedicatedScopeDetailsWithTabRoute: AppRouteObject = {
|
2022-08-22 14:29:35 +00:00
|
|
|
...DedicatedScopeDetailsRoute,
|
|
|
|
path: "/:realm/clients/:clientId/clientScopes/dedicated/:tab",
|
2022-02-21 12:14:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export const toDedicatedScope = (
|
2023-07-11 14:03:21 +00:00
|
|
|
params: DedicatedScopeDetailsParams,
|
2022-08-22 14:29:35 +00:00
|
|
|
): Partial<Path> => {
|
|
|
|
const path = params.tab
|
|
|
|
? DedicatedScopeDetailsWithTabRoute.path
|
|
|
|
: DedicatedScopeDetailsRoute.path;
|
|
|
|
|
|
|
|
return {
|
|
|
|
pathname: generatePath(path, params),
|
|
|
|
};
|
|
|
|
};
|