mirror of
https://github.com/keycloak/keycloak.git
synced 2026-05-26 13:50:48 +00:00
moved AdminEnvironment to seperate file (#48039)
* moved AdminEnvironment to seperate file fixes: #48038 Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * code review Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> --------- Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
@@ -22,7 +22,7 @@ import { AccessContextProvider } from "./context/access/Access";
|
||||
import { RealmContextProvider } from "./context/realm-context/RealmContext";
|
||||
import { ServerInfoProvider } from "./context/server-info/ServerInfoProvider";
|
||||
import { WhoAmIContextProvider } from "./context/whoami/WhoAmI";
|
||||
import type { Environment } from "./environment";
|
||||
import type { Environment } from "./environment-types";
|
||||
import { SubGroups } from "./groups/SubGroupsContext";
|
||||
import { AuthWall } from "./root/AuthWall";
|
||||
import { Banners } from "./Banners";
|
||||
|
||||
@@ -12,7 +12,7 @@ import { NavLink, useNavigate } from "react-router-dom";
|
||||
import { useAccess } from "./context/access/Access";
|
||||
import { useRealm } from "./context/realm-context/RealmContext";
|
||||
import { useServerInfo } from "./context/server-info/ServerInfoProvider";
|
||||
import { Environment } from "./environment";
|
||||
import type { Environment } from "./environment-types";
|
||||
import { toPage } from "./page/routes";
|
||||
import { routes } from "./routes";
|
||||
import { resolveDisplayName } from "./util";
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
useRequiredContext,
|
||||
} from "@keycloak/keycloak-ui-shared";
|
||||
import type Keycloak from "keycloak-js";
|
||||
import type { Environment } from "./environment";
|
||||
import type { Environment } from "./environment-types";
|
||||
|
||||
export type AdminClientProps = {
|
||||
keycloak: Keycloak;
|
||||
|
||||
@@ -28,7 +28,7 @@ import { Action, KeycloakDataTable } from "@keycloak/keycloak-ui-shared";
|
||||
import { ViewHeader } from "../components/view-header/ViewHeader";
|
||||
import { useAccess } from "../context/access/Access";
|
||||
import { useRealm } from "../context/realm-context/RealmContext";
|
||||
import { Environment } from "../environment";
|
||||
import { Environment } from "../environment-types";
|
||||
import helpUrls from "../help-urls";
|
||||
import { emptyFormatter, exportClient } from "../util";
|
||||
import { convertClientToUrl } from "../utils/client-url";
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import type { BaseEnvironment } from "@keycloak/keycloak-ui-shared";
|
||||
|
||||
export type Environment = BaseEnvironment & {
|
||||
/**
|
||||
* The URL to the root of the Administration Console, including the path if present, this takes into account the configured hostname of the Administration Console.
|
||||
* For example, the Keycloak server could be hosted on `auth.example.com` and Admin Console may be hosted on `admin.example.com/some/path`.
|
||||
*
|
||||
* Note that this URL is normalized not to include a trailing slash, so take this into account when constructing URLs.
|
||||
*
|
||||
* @see {@link https://www.keycloak.org/server/hostname#_administration_console}
|
||||
*/
|
||||
adminBaseUrl: string;
|
||||
/** The URL to the base of the Admin Console. */
|
||||
consoleBaseUrl: string;
|
||||
/** The name of the master realm. */
|
||||
masterRealm: string;
|
||||
/** The version hash of the auth server. */
|
||||
resourceVersion: string;
|
||||
};
|
||||
@@ -1,24 +1,4 @@
|
||||
import {
|
||||
getInjectedEnvironment,
|
||||
type BaseEnvironment,
|
||||
} from "@keycloak/keycloak-ui-shared";
|
||||
|
||||
export type Environment = BaseEnvironment & {
|
||||
/**
|
||||
* The URL to the root of the Administration Console, including the path if present, this takes into account the configured hostname of the Administration Console.
|
||||
* For example, the Keycloak server could be hosted on `auth.example.com` and Admin Console may be hosted on `admin.example.com/some/path`.
|
||||
*
|
||||
* Note that this URL is normalized not to include a trailing slash, so take this into account when constructing URLs.
|
||||
*
|
||||
* @see {@link https://www.keycloak.org/server/hostname#_administration_console}
|
||||
*/
|
||||
adminBaseUrl: string;
|
||||
/** The URL to the base of the Admin Console. */
|
||||
consoleBaseUrl: string;
|
||||
/** The name of the master realm. */
|
||||
masterRealm: string;
|
||||
/** The version hash of the auth server. */
|
||||
resourceVersion: string;
|
||||
};
|
||||
import { getInjectedEnvironment } from "@keycloak/keycloak-ui-shared";
|
||||
import type { Environment } from "./environment-types";
|
||||
|
||||
export const environment = getInjectedEnvironment<Environment>();
|
||||
|
||||
@@ -13,7 +13,7 @@ import { useTranslation } from "react-i18next";
|
||||
import { useAdminClient } from "../../admin-client";
|
||||
import { FileUploadForm } from "../../components/json-file-upload/FileUploadForm";
|
||||
import { useRealm } from "../../context/realm-context/RealmContext";
|
||||
import type { Environment } from "../../environment";
|
||||
import type { Environment } from "../../environment-types";
|
||||
import { addTrailingSlash } from "../../util";
|
||||
import { getAuthorizationHeaders } from "../../utils/getAuthorizationHeaders";
|
||||
import { DiscoveryEndpointField } from "../component/DiscoveryEndpointField";
|
||||
|
||||
@@ -9,7 +9,7 @@ import { useTranslation } from "react-i18next";
|
||||
|
||||
import { FormattedLink } from "../../components/external-link/FormattedLink";
|
||||
import { useRealm } from "../../context/realm-context/RealmContext";
|
||||
import type { Environment } from "../../environment";
|
||||
import type { Environment } from "../../environment-types";
|
||||
import { DisplayOrder } from "../component/DisplayOrder";
|
||||
import { RedirectUrl } from "../component/RedirectUrl";
|
||||
|
||||
|
||||
@@ -322,7 +322,7 @@ export { Header } from "./PageHeader";
|
||||
export { PageNav } from "./PageNav";
|
||||
export { PageNotFoundSection } from "./PageNotFoundSection";
|
||||
export { App as AdminUi } from "./App";
|
||||
export type { Environment as AdminEnvironment } from "./environment";
|
||||
export type { Environment as AdminEnvironment } from "./environment-types";
|
||||
export { KeycloakProvider, useEnvironment } from "@keycloak/keycloak-ui-shared";
|
||||
export { AdminClientContext, initAdminClient } from "./admin-client";
|
||||
export { AppContexts } from "./App";
|
||||
|
||||
@@ -5,14 +5,21 @@ import { StrictMode } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { createHashRouter, RouterProvider } from "react-router-dom";
|
||||
import { i18n } from "./i18n/i18n";
|
||||
import { RootRoute } from "./routes";
|
||||
import { Root } from "./Root";
|
||||
import { routes } from "./routes";
|
||||
|
||||
import "./index.css";
|
||||
|
||||
// Initialize required components before rendering app.
|
||||
await i18n.init();
|
||||
|
||||
const router = createHashRouter([RootRoute]);
|
||||
const router = createHashRouter([
|
||||
{
|
||||
path: "/",
|
||||
element: <Root />,
|
||||
children: routes,
|
||||
},
|
||||
]);
|
||||
const container = document.getElementById("app");
|
||||
const root = createRoot(container!);
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import { ViewHeader } from "../components/view-header/ViewHeader";
|
||||
import { useAccess } from "../context/access/Access";
|
||||
import { useRealm } from "../context/realm-context/RealmContext";
|
||||
import { toDashboard } from "../dashboard/routes/Dashboard";
|
||||
import type { Environment } from "../environment";
|
||||
import type { Environment } from "../environment-types";
|
||||
import helpUrls from "../help-urls";
|
||||
import {
|
||||
convertFormValuesToObject,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { loginThemeProperties as properties } from "./LoginThemeProperties";
|
||||
import { usePreviewLogo } from "./LogoContext";
|
||||
import { useEnvironment } from "@keycloak/keycloak-ui-shared";
|
||||
import { Environment } from "../../environment";
|
||||
import { Environment } from "../../environment-types";
|
||||
import { usePreviewBackground } from "./BackgroundContext";
|
||||
|
||||
type LoginPreviewWindowProps = {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import type { AccessType } from "@keycloak/keycloak-admin-client/lib/defs/whoAmIRepresentation";
|
||||
import type { TFunction } from "i18next";
|
||||
import type { ComponentType } from "react";
|
||||
import type { NonIndexRouteObject, RouteObject } from "react-router-dom";
|
||||
import type { NonIndexRouteObject } from "react-router-dom";
|
||||
import { PageNotFoundSection } from "./PageNotFoundSection";
|
||||
import { Root } from "./Root";
|
||||
import authenticationRoutes from "./authentication/routes";
|
||||
import clientScopesRoutes from "./client-scopes/routes";
|
||||
import clientRoutes from "./clients/routes";
|
||||
@@ -60,9 +59,3 @@ export const routes: AppRouteObject[] = [
|
||||
...pageRoutes,
|
||||
NotFoundRoute,
|
||||
];
|
||||
|
||||
export const RootRoute: RouteObject = {
|
||||
path: "/",
|
||||
element: <Root />,
|
||||
children: routes,
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientRepresentation";
|
||||
import type { Environment } from "../environment";
|
||||
import type { Environment } from "../environment-types";
|
||||
import { joinPath } from "./joinPath";
|
||||
|
||||
export const convertClientToUrl = (
|
||||
|
||||
Reference in New Issue
Block a user