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";
|
2022-02-21 12:14:20 +00:00
|
|
|
import type { RouteDef } from "../../route-config";
|
|
|
|
|
|
|
|
export type DedicatedScopeTab = "mappers" | "scope";
|
|
|
|
|
|
|
|
export type DedicatedScopeDetailsParams = {
|
|
|
|
realm: string;
|
|
|
|
clientId: string;
|
|
|
|
tab?: DedicatedScopeTab;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const DedicatedScopeDetailsRoute: RouteDef = {
|
2022-08-22 14:29:35 +00:00
|
|
|
path: "/:realm/clients/:clientId/clientScopes/dedicated",
|
2022-02-21 12:14:20 +00:00
|
|
|
component: lazy(() => import("../scopes/DedicatedScopes")),
|
|
|
|
breadcrumb: (t) => t("clients:dedicatedScopes"),
|
2022-05-30 09:23:24 +00:00
|
|
|
access: "view-clients",
|
2022-08-22 14:29:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export const DedicatedScopeDetailsWithTabRoute: RouteDef = {
|
|
|
|
...DedicatedScopeDetailsRoute,
|
|
|
|
path: "/:realm/clients/:clientId/clientScopes/dedicated/:tab",
|
2022-02-21 12:14:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export const toDedicatedScope = (
|
|
|
|
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),
|
|
|
|
};
|
|
|
|
};
|