Extend tsconfig from Snowpack and fix type errors

This commit is contained in:
Jon Koops 2021-05-04 19:58:18 +02:00
parent c0c3fd6692
commit f671cbed84
128 changed files with 202 additions and 250 deletions

View file

@ -1,6 +1,6 @@
import KeycloakAdminClient from "keycloak-admin";
import UserRepresentation from "keycloak-admin/lib/defs/userRepresentation";
import ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation";
import type UserRepresentation from "keycloak-admin/lib/defs/userRepresentation";
import type ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation";
export default class AdminClient {
private client: KeycloakAdminClient;

View file

@ -1,7 +1,7 @@
// See: https://github.com/snowpackjs/snowpack/issues/3242
// @ts-ignore
import snowpackConfig from "@snowpack/app-scripts-react/jest.config.js";
import { Config } from "@jest/types";
import type { Config } from "@jest/types";
const config: Config.InitialOptions = {
...snowpackConfig(),

View file

@ -1,5 +1,5 @@
import React from "react";
import KeycloakAdminClient from "keycloak-admin";
import type KeycloakAdminClient from "keycloak-admin";
import { AdminClient } from "./context/auth/AdminClient";
import { WhoAmIContextProvider } from "./context/whoami/WhoAmI";

View file

@ -13,7 +13,7 @@ import {
} from "@patternfly/react-core";
import { CheckCircleIcon } from "@patternfly/react-icons";
import AuthenticationFlowRepresentation from "keycloak-admin/lib/defs/authenticationFlowRepresentation";
import type AuthenticationFlowRepresentation from "keycloak-admin/lib/defs/authenticationFlowRepresentation";
import { useAdminClient } from "../context/auth/AdminClient";
import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable";
import { KeycloakTabs } from "../components/keycloak-tabs/KeycloakTabs";

View file

@ -12,7 +12,7 @@ import {
ToolbarItem,
} from "@patternfly/react-core";
import { cellWidth } from "@patternfly/react-table";
import ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation";
import type ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation";
import { useAdminClient } from "../context/auth/AdminClient";
import { ViewHeader } from "../components/view-header/ViewHeader";
@ -26,7 +26,7 @@ import {
AllClientScopes,
AllClientScopeType,
} from "../components/client-scope/ClientScopeTypes";
import KeycloakAdminClient from "keycloak-admin";
import type KeycloakAdminClient from "keycloak-admin";
import { ChangeTypeDialog } from "./ChangeTypeDialog";
import "./client-scope.css";

View file

@ -19,8 +19,8 @@ import {
TableVariant,
} from "@patternfly/react-table";
import { useTranslation } from "react-i18next";
import ProtocolMapperRepresentation from "keycloak-admin/lib/defs/protocolMapperRepresentation";
import { ProtocolMapperTypeRepresentation } from "keycloak-admin/lib/defs/serverInfoRepesentation";
import type ProtocolMapperRepresentation from "keycloak-admin/lib/defs/protocolMapperRepresentation";
import type { ProtocolMapperTypeRepresentation } from "keycloak-admin/lib/defs/serverInfoRepesentation";
import { useServerInfo } from "../../context/server-info/ServerInfoProvider";
import { ListEmptyState } from "../../components/list-empty-state/ListEmptyState";

View file

@ -18,9 +18,9 @@ import {
ValidatedOptions,
} from "@patternfly/react-core";
import RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation";
import ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation";
import ProtocolMapperRepresentation from "keycloak-admin/lib/defs/protocolMapperRepresentation";
import type RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation";
import type ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation";
import type ProtocolMapperRepresentation from "keycloak-admin/lib/defs/protocolMapperRepresentation";
import { useAlerts } from "../../components/alert/Alerts";
import { RealmContext } from "../../context/realm-context/RealmContext";
import { useAdminClient, useFetch } from "../../context/auth/AdminClient";

View file

@ -1,6 +1,7 @@
import React, { useState } from "react";
import { mount } from "enzyme";
import { Button } from "@patternfly/react-core";
import type { ServerInfoRepresentation } from "keycloak-admin/lib/defs/serverInfoRepesentation";
import serverInfo from "../../../context/server-info/__tests__/mock.json";
import { ServerInfoContext } from "../../../context/server-info/ServerInfoProvider";
@ -10,7 +11,9 @@ describe("<MapperDialog/>", () => {
const Test = (args: AddMapperDialogModalProps) => {
const [open, setOpen] = useState(false);
return (
<ServerInfoContext.Provider value={serverInfo}>
<ServerInfoContext.Provider
value={(serverInfo as unknown) as ServerInfoRepresentation}
>
<AddMapperDialog
{...args}
open={open}

View file

@ -1,6 +1,6 @@
import React, { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { Link, useHistory, useRouteMatch } from "react-router-dom";
import { Link, useHistory } from "react-router-dom";
import {
AlertVariant,
ButtonVariant,
@ -10,9 +10,9 @@ import {
} from "@patternfly/react-core";
import { CaretDownIcon } from "@patternfly/react-icons";
import ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation";
import ProtocolMapperRepresentation from "keycloak-admin/lib/defs/protocolMapperRepresentation";
import { ProtocolMapperTypeRepresentation } from "keycloak-admin/lib/defs/serverInfoRepesentation";
import type ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation";
import type ProtocolMapperRepresentation from "keycloak-admin/lib/defs/protocolMapperRepresentation";
import type { ProtocolMapperTypeRepresentation } from "keycloak-admin/lib/defs/serverInfoRepesentation";
import { useServerInfo } from "../../context/server-info/ServerInfoProvider";
import { ListEmptyState } from "../../components/list-empty-state/ListEmptyState";

View file

@ -19,8 +19,8 @@ import {
TextInput,
ValidatedOptions,
} from "@patternfly/react-core";
import { ConfigPropertyRepresentation } from "keycloak-admin/lib/defs/configPropertyRepresentation";
import ProtocolMapperRepresentation from "keycloak-admin/lib/defs/protocolMapperRepresentation";
import type { ConfigPropertyRepresentation } from "keycloak-admin/lib/defs/configPropertyRepresentation";
import type ProtocolMapperRepresentation from "keycloak-admin/lib/defs/protocolMapperRepresentation";
import { ViewHeader } from "../../components/view-header/ViewHeader";
import { useAdminClient, useFetch } from "../../context/auth/AdminClient";

View file

@ -15,7 +15,7 @@ import {
Button,
} from "@patternfly/react-core";
import ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation";
import type ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation";
import { HelpItem } from "../../components/help-enabler/HelpItem";
import { useLoginProviders } from "../../context/server-info/ServerInfoProvider";
import { convertToFormValues } from "../../util";

View file

@ -9,7 +9,7 @@ import {
TabTitleText,
} from "@patternfly/react-core";
import ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation";
import type ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation";
import { useAdminClient, useFetch } from "../../context/auth/AdminClient";
import { KeycloakTabs } from "../../components/keycloak-tabs/KeycloakTabs";
import { useAlerts } from "../../components/alert/Alerts";
@ -18,7 +18,7 @@ import { convertFormValuesToObject } from "../../util";
import { MapperList } from "../details/MapperList";
import { ScopeForm } from "../details/ScopeForm";
import { RoleMapping, Row } from "../../components/role-mapping/RoleMapping";
import { RoleMappingPayload } from "keycloak-admin/lib/defs/roleRepresentation";
import type { RoleMappingPayload } from "keycloak-admin/lib/defs/roleRepresentation";
export const ClientScopeForm = () => {
const { t } = useTranslation("client-scopes");

View file

@ -18,8 +18,8 @@ import {
ToolbarItem,
} from "@patternfly/react-core";
import GlobalRequestResult from "keycloak-admin/lib/defs/globalRequestResult";
import ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation";
import type GlobalRequestResult from "keycloak-admin/lib/defs/globalRequestResult";
import type ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation";
import { convertToFormValues, toUpperCase } from "../util";
import { FormAccess } from "../components/form-access/FormAccess";
import { ScrollForm } from "../components/scroll-form/ScrollForm";
@ -36,7 +36,7 @@ import { AddHostDialog } from "./advanced/AddHostDialog";
import { FineGrainSamlEndpointConfig } from "./advanced/FineGrainSamlEndpointConfig";
import { AuthenticationOverrides } from "./advanced/AuthenticationOverrides";
import { useRealm } from "../context/realm-context/RealmContext";
import { SaveOptions } from "./ClientDetails";
import type { SaveOptions } from "./ClientDetails";
type AdvancedProps = {
save: (options?: SaveOptions) => void;

View file

@ -11,7 +11,7 @@ import {
import { HelpItem } from "../components/help-enabler/HelpItem";
import { FormAccess } from "../components/form-access/FormAccess";
import { ClientForm } from "./ClientDetails";
import type { ClientForm } from "./ClientDetails";
export const ClientDescription = () => {
const { t } = useTranslation("clients");

View file

@ -14,7 +14,7 @@ import {
import { useHistory, useParams } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { Controller, FormProvider, useForm, useWatch } from "react-hook-form";
import ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation";
import type ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation";
import _ from "lodash";
import { ClientSettings } from "./ClientSettings";

View file

@ -17,7 +17,7 @@ import { useAdminClient } from "../context/auth/AdminClient";
import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable";
import { emptyFormatter, exportClient, getBaseUrl } from "../util";
import { useAlerts } from "../components/alert/Alerts";
import ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation";
import type ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation";
import { formattedLinkTableCell } from "../components/external-link/FormattedLink";
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
import { KeycloakTabs } from "../components/keycloak-tabs/KeycloakTabs";

View file

@ -11,7 +11,7 @@ import {
} from "@patternfly/react-core";
import { FormAccess } from "../../components/form-access/FormAccess";
import { ClientForm } from "../ClientDetails";
import type { ClientForm } from "../ClientDetails";
import { HelpItem } from "../../components/help-enabler/HelpItem";
import "./capability-config.css";

View file

@ -15,7 +15,7 @@ import { GeneralSettings } from "./GeneralSettings";
import { CapabilityConfig } from "./CapabilityConfig";
import { useAlerts } from "../../components/alert/Alerts";
import { ViewHeader } from "../../components/view-header/ViewHeader";
import ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation";
import type ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation";
import { useAdminClient } from "../../context/auth/AdminClient";
import { useRealm } from "../../context/realm-context/RealmContext";

View file

@ -1,6 +1,6 @@
import React from "react";
import { useTranslation } from "react-i18next";
import { Control } from "react-hook-form";
import type { Control } from "react-hook-form";
import {
ActionGroup,
Button,

View file

@ -8,7 +8,7 @@ import {
SplitItem,
} from "@patternfly/react-core";
import { useFormContext } from "react-hook-form";
import { ClientForm } from "../ClientDetails";
import type { ClientForm } from "../ClientDetails";
export type ClientSecretProps = {
secret: string;

View file

@ -18,7 +18,7 @@ import {
Split,
SplitItem,
} from "@patternfly/react-core";
import CredentialRepresentation from "keycloak-admin/lib/defs/credentialRepresentation";
import type CredentialRepresentation from "keycloak-admin/lib/defs/credentialRepresentation";
import { useAlerts } from "../../components/alert/Alerts";
import { useConfirmDialog } from "../../components/confirm-dialog/ConfirmDialog";

View file

@ -15,7 +15,7 @@ import { ClientDescription } from "../ClientDescription";
import { JsonFileUpload } from "../../components/json-file-upload/JsonFileUpload";
import { useAlerts } from "../../components/alert/Alerts";
import { ViewHeader } from "../../components/view-header/ViewHeader";
import ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation";
import type ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation";
import { useAdminClient } from "../../context/auth/AdminClient";
import { FormAccess } from "../../components/form-access/FormAccess";
import { useRealm } from "../../context/realm-context/RealmContext";

View file

@ -10,7 +10,7 @@ import {
PageSection,
} from "@patternfly/react-core";
import ClientInitialAccessPresentation from "keycloak-admin/lib/defs/clientInitialAccessPresentation";
import type ClientInitialAccessPresentation from "keycloak-admin/lib/defs/clientInitialAccessPresentation";
import { FormAccess } from "../../components/form-access/FormAccess";
import { ViewHeader } from "../../components/view-header/ViewHeader";
import { HelpItem } from "../../components/help-enabler/HelpItem";

View file

@ -5,7 +5,7 @@ import { useTranslation } from "react-i18next";
import { AlertVariant, Button, ButtonVariant } from "@patternfly/react-core";
import { wrappable } from "@patternfly/react-table";
import ClientInitialAccessPresentation from "keycloak-admin/lib/defs/clientInitialAccessPresentation";
import type ClientInitialAccessPresentation from "keycloak-admin/lib/defs/clientInitialAccessPresentation";
import { KeycloakDataTable } from "../../components/table-toolbar/KeycloakDataTable";
import { useAdminClient } from "../../context/auth/AdminClient";
import { useRealm } from "../../context/realm-context/RealmContext";

View file

@ -16,7 +16,7 @@ import {
TextInput,
} from "@patternfly/react-core";
import KeyStoreConfig from "keycloak-admin/lib/defs/keystoreConfig";
import type KeyStoreConfig from "keycloak-admin/lib/defs/keystoreConfig";
import { HelpItem } from "../../components/help-enabler/HelpItem";
import { PasswordInput } from "../../components/password-input/PasswordInput";
import { StoreSettings } from "./StoreSettings";

View file

@ -18,12 +18,12 @@ import {
TextInput,
} from "@patternfly/react-core";
import CertificateRepresentation from "keycloak-admin/lib/defs/certificateRepresentation";
import KeyStoreConfig from "keycloak-admin/lib/defs/keystoreConfig";
import type CertificateRepresentation from "keycloak-admin/lib/defs/certificateRepresentation";
import type KeyStoreConfig from "keycloak-admin/lib/defs/keystoreConfig";
import { HelpItem } from "../../components/help-enabler/HelpItem";
import { FormAccess } from "../../components/form-access/FormAccess";
import { Controller, useFormContext, useWatch } from "react-hook-form";
import { ClientForm } from "../ClientDetails";
import type { ClientForm } from "../ClientDetails";
import { GenerateKeyDialog } from "./GenerateKeyDialog";
import { useFetch, useAdminClient } from "../../context/auth/AdminClient";
import { useAlerts } from "../../components/alert/Alerts";

View file

@ -10,7 +10,7 @@ import {
DropdownDirection,
} from "@patternfly/react-core";
import { CaretUpIcon } from "@patternfly/react-icons";
import ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation";
import type ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation";
import {
ClientScopeType,

View file

@ -11,8 +11,8 @@ import {
ToolbarItem,
} from "@patternfly/react-core";
import { FilterIcon } from "@patternfly/react-icons";
import ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation";
import KeycloakAdminClient from "keycloak-admin";
import type ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation";
import type KeycloakAdminClient from "keycloak-admin";
import { useAdminClient } from "../../context/auth/AdminClient";
import { toUpperCase } from "../../util";

View file

@ -24,11 +24,11 @@ import {
Title,
} from "@patternfly/react-core";
import { QuestionCircleIcon } from "@patternfly/react-icons";
import ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation";
import UserRepresentation from "keycloak-admin/lib/defs/userRepresentation";
import RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation";
import ProtocolMapperRepresentation from "keycloak-admin/lib/defs/protocolMapperRepresentation";
import { ProtocolMapperTypeRepresentation } from "keycloak-admin/lib/defs/serverInfoRepesentation";
import type ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation";
import type UserRepresentation from "keycloak-admin/lib/defs/userRepresentation";
import type RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation";
import type ProtocolMapperRepresentation from "keycloak-admin/lib/defs/protocolMapperRepresentation";
import type { ProtocolMapperTypeRepresentation } from "keycloak-admin/lib/defs/serverInfoRepesentation";
import { useAdminClient, useFetch } from "../../context/auth/AdminClient";
import { useServerInfo } from "../../context/server-info/ServerInfoProvider";

View file

@ -2,9 +2,8 @@ import React, { useContext, useState } from "react";
import { useTranslation } from "react-i18next";
import { AlertVariant } from "@patternfly/react-core";
import RoleRepresentation, {
RoleMappingPayload,
} from "keycloak-admin/lib/defs/roleRepresentation";
import type RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation";
import type { RoleMappingPayload } from "keycloak-admin/lib/defs/roleRepresentation";
import { useAdminClient } from "../../context/auth/AdminClient";
import { RealmContext } from "../../context/realm-context/RealmContext";
import { useAlerts } from "../../components/alert/Alerts";

View file

@ -1,6 +1,6 @@
import React, { useEffect } from "react";
import { useTranslation } from "react-i18next";
import { ArrayField, UseFormMethods } from "react-hook-form";
import type { ArrayField, UseFormMethods } from "react-hook-form";
import { ActionGroup, Button, TextInput } from "@patternfly/react-core";
import {
TableComposable,

View file

@ -1,10 +1,10 @@
import React, { useState } from "react";
import { TFunction } from "i18next";
import type { TFunction } from "i18next";
import { useTranslation } from "react-i18next";
import { DropdownItem, Select, SelectOption } from "@patternfly/react-core";
import ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation";
import type ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation";
export enum ClientScope {
default = "default",

View file

@ -6,7 +6,7 @@ import {
PageSection,
} from "@patternfly/react-core";
import React from "react";
import { FallbackProps } from "react-error-boundary";
import type { FallbackProps } from "react-error-boundary";
import { useTranslation } from "react-i18next";
export const ErrorRenderer = ({ error, resetErrorBoundary }: FallbackProps) => {

View file

@ -1,6 +1,6 @@
import React, { AnchorHTMLAttributes } from "react";
import { ExternalLinkAltIcon } from "@patternfly/react-icons";
import { IFormatter, IFormatterValueType } from "@patternfly/react-table";
import type { IFormatter, IFormatterValueType } from "@patternfly/react-table";
export type FormattedLinkProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
isInline?: boolean;

View file

@ -18,7 +18,7 @@ import {
StackItem,
TextArea,
} from "@patternfly/react-core";
import { AccessType } from "keycloak-admin/lib/defs/whoAmIRepresentation";
import type { AccessType } from "keycloak-admin/lib/defs/whoAmIRepresentation";
import { useAccess } from "../../context/access/Access";

View file

@ -2,6 +2,7 @@ import React from "react";
import { mount } from "enzyme";
import { Controller, useForm } from "react-hook-form";
import { FormGroup, Switch, TextInput } from "@patternfly/react-core";
import type WhoAmIRepresentation from "keycloak-admin/lib/defs/whoAmIRepresentation";
import { WhoAmI, WhoAmIContext } from "../../../context/whoami/WhoAmI";
import whoami from "../../../context/whoami/__tests__/mock-whoami.json";
@ -15,7 +16,10 @@ describe("<FormAccess />", () => {
const { register, control } = useForm();
return (
<WhoAmIContext.Provider
value={{ refresh: () => {}, whoAmI: new WhoAmI("master", whoami) }}
value={{
refresh: () => {},
whoAmI: new WhoAmI("master", whoami as WhoAmIRepresentation),
}}
>
<RealmContext.Provider
value={{

View file

@ -8,7 +8,7 @@ import {
ButtonVariant,
EmptyStateSecondaryActions,
} from "@patternfly/react-core";
import { SVGIconProps } from "@patternfly/react-icons/dist/js/createIcon";
import type { SVGIconProps } from "@patternfly/react-icons/dist/js/createIcon";
import { PlusCircleIcon } from "@patternfly/react-icons";
import { SearchIcon } from "@patternfly/react-icons";

View file

@ -16,7 +16,7 @@ import {
} from "@patternfly/react-core";
import { CheckIcon } from "@patternfly/react-icons";
import RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation";
import type RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation";
import { toUpperCase } from "../../util";
import { useRealm } from "../../context/realm-context/RealmContext";
import { WhoAmIContext } from "../../context/whoami/WhoAmI";

View file

@ -18,10 +18,10 @@ import {
import { KeycloakDataTable } from "../table-toolbar/KeycloakDataTable";
import { useFetch, useAdminClient } from "../../context/auth/AdminClient";
import ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation";
import type ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation";
import { FilterIcon } from "@patternfly/react-icons";
import { Row, ServiceRole } from "./RoleMapping";
import RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation";
import type RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation";
export type MappingType = "service-account" | "client-scope";

View file

@ -9,8 +9,8 @@ import {
ToolbarItem,
} from "@patternfly/react-core";
import ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation";
import RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation";
import type ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation";
import type RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation";
import { AddRoleMappingModal, MappingType } from "./AddRoleMappingModal";
import { KeycloakDataTable } from "../table-toolbar/KeycloakDataTable";
import { emptyFormatter } from "../../util";

View file

@ -17,7 +17,7 @@ import _ from "lodash";
import { PaginatingTableToolbar } from "./PaginatingTableToolbar";
import { useFetch } from "../../context/auth/AdminClient";
import { ListEmptyState } from "../list-empty-state/ListEmptyState";
import { SVGIconProps } from "@patternfly/react-icons/dist/js/createIcon";
import type { SVGIconProps } from "@patternfly/react-icons/dist/js/createIcon";
type TitleCell = { title: JSX.Element };
type Cell<T> = keyof T | JSX.Element | TitleCell;

View file

@ -1,5 +1,5 @@
import React, { createContext, useContext, useEffect, useState } from "react";
import { AccessType } from "keycloak-admin/lib/defs/whoAmIRepresentation";
import type { AccessType } from "keycloak-admin/lib/defs/whoAmIRepresentation";
import { RealmContext } from "../../context/realm-context/RealmContext";
import { WhoAmIContext } from "../../context/whoami/WhoAmI";

View file

@ -1,7 +1,7 @@
import { createContext, DependencyList, useContext, useEffect } from "react";
import axios from "axios";
import KeycloakAdminClient from "keycloak-admin";
import type KeycloakAdminClient from "keycloak-admin";
import { useErrorHandler } from "react-error-boundary";
export const AdminClient = createContext<KeycloakAdminClient | undefined>(

View file

@ -1,7 +1,7 @@
import React, { useContext, useState } from "react";
import _ from "lodash";
import RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation";
import type RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation";
import { RecentUsed } from "../../components/realm-selector/recent-used";
import { useAdminClient, useFetch } from "../auth/AdminClient";
import { WhoAmIContext } from "../whoami/WhoAmI";

View file

@ -1,5 +1,5 @@
import React, { createContext, ReactNode, useContext } from "react";
import { ServerInfoRepresentation } from "keycloak-admin/lib/defs/serverInfoRepesentation";
import type { ServerInfoRepresentation } from "keycloak-admin/lib/defs/serverInfoRepesentation";
import { sortProviders } from "../../util";
import { DataLoader } from "../../components/data-loader/DataLoader";

View file

@ -1,9 +1,8 @@
import React, { useState } from "react";
import i18n from "../../i18n";
import WhoAmIRepresentation, {
AccessType,
} from "keycloak-admin/lib/defs/whoAmIRepresentation";
import type WhoAmIRepresentation from "keycloak-admin/lib/defs/whoAmIRepresentation";
import type { AccessType } from "keycloak-admin/lib/defs/whoAmIRepresentation";
import { useAdminClient, useFetch } from "../auth/AdminClient";
export class WhoAmI {

View file

@ -1,25 +1,26 @@
import whoamiMock from "./mock-whoami.json";
import { WhoAmI } from "../WhoAmI";
import type WhoAmIRepresentation from "keycloak-admin/lib/defs/whoAmIRepresentation";
test("returns display name", () => {
const whoami = new WhoAmI("master", whoamiMock);
const whoami = new WhoAmI("master", whoamiMock as WhoAmIRepresentation);
expect(whoami.getDisplayName()).toEqual("Stan Silvert");
});
test("returns correct home realm", () => {
let whoami = new WhoAmI("myrealm", whoamiMock);
let whoami = new WhoAmI("myrealm", whoamiMock as WhoAmIRepresentation);
expect(whoami.getHomeRealm()).toEqual("myrealm");
whoami = new WhoAmI(undefined, whoamiMock);
whoami = new WhoAmI(undefined, whoamiMock as WhoAmIRepresentation);
expect(whoami.getHomeRealm()).toEqual("master");
});
test("can not create realm", () => {
const whoami = new WhoAmI("master", whoamiMock);
const whoami = new WhoAmI("master", whoamiMock as WhoAmIRepresentation);
expect(whoami.canCreateRealm()).toEqual(false);
});
test("getRealmAccess", () => {
const whoami = new WhoAmI("master", whoamiMock);
const whoami = new WhoAmI("master", whoamiMock as WhoAmIRepresentation);
expect(Object.keys(whoami.getRealmAccess()).length).toEqual(3);
expect(whoami.getRealmAccess()["master"].length).toEqual(18);
});

View file

@ -20,7 +20,7 @@ import {
TableHeader,
TableVariant,
} from "@patternfly/react-table";
import AdminEventRepresentation from "keycloak-admin/lib/defs/adminEventRepresentation";
import type AdminEventRepresentation from "keycloak-admin/lib/defs/adminEventRepresentation";
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
type DisplayDialogProps = {

View file

@ -16,7 +16,7 @@ import {
} from "@patternfly/react-core";
import { cellWidth, expandable } from "@patternfly/react-table";
import { CheckCircleIcon, WarningTriangleIcon } from "@patternfly/react-icons";
import EventRepresentation from "keycloak-admin/lib/defs/eventRepresentation";
import type EventRepresentation from "keycloak-admin/lib/defs/eventRepresentation";
import { useAdminClient } from "../context/auth/AdminClient";
import { ViewHeader } from "../components/view-header/ViewHeader";

View file

@ -12,7 +12,7 @@ import {
} from "@patternfly/react-core";
import { UsersIcon } from "@patternfly/react-icons";
import GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation";
import type GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation";
import { useAdminClient } from "../context/auth/AdminClient";
import { useAlerts } from "../components/alert/Alerts";
import { useRealm } from "../context/realm-context/RealmContext";

View file

@ -13,7 +13,7 @@ import {
import { useTranslation } from "react-i18next";
import { useForm } from "react-hook-form";
import GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation";
import type GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation";
import { useAdminClient } from "../context/auth/AdminClient";
import { useAlerts } from "../components/alert/Alerts";

View file

@ -10,7 +10,7 @@ import {
TabTitleText,
Tabs,
} from "@patternfly/react-core";
import GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation";
import type GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation";
import { ViewHeader } from "../components/view-header/ViewHeader";
import { useFetch, useAdminClient } from "../context/auth/AdminClient";

View file

@ -12,8 +12,8 @@ import {
ToolbarItem,
} from "@patternfly/react-core";
import GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation";
import UserRepresentation from "keycloak-admin/lib/defs/userRepresentation";
import type GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation";
import type UserRepresentation from "keycloak-admin/lib/defs/userRepresentation";
import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable";
import { useAdminClient } from "../context/auth/AdminClient";
import { useAlerts } from "../components/alert/Alerts";

View file

@ -8,7 +8,7 @@ import {
ModalVariant,
} from "@patternfly/react-core";
import UserRepresentation from "keycloak-admin/lib/defs/userRepresentation";
import type UserRepresentation from "keycloak-admin/lib/defs/userRepresentation";
import { useAdminClient } from "../context/auth/AdminClient";
import { useRealm } from "../context/realm-context/RealmContext";
import { useAlerts } from "../components/alert/Alerts";

View file

@ -21,7 +21,7 @@ import {
} from "@patternfly/react-core";
import { AngleRightIcon, SearchIcon } from "@patternfly/react-icons";
import GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation";
import type GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation";
import { useFetch, useAdminClient } from "../context/auth/AdminClient";
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";

View file

@ -16,7 +16,7 @@ import {
} from "@patternfly/react-core";
import { SearchIcon } from "@patternfly/react-icons";
import GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation";
import type GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation";
import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable";
import { useAdminClient } from "../context/auth/AdminClient";
import { useRealm } from "../context/realm-context/RealmContext";

View file

@ -1,5 +1,5 @@
import React, { createContext, ReactNode, useContext, useState } from "react";
import GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation";
import type GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation";
type SubGroupsProps = {
subGroups: GroupRepresentation[];

View file

@ -23,7 +23,7 @@ import {
ToolbarItem,
} from "@patternfly/react-core";
import IdentityProviderRepresentation from "keycloak-admin/lib/defs/identityProviderRepresentation";
import type IdentityProviderRepresentation from "keycloak-admin/lib/defs/identityProviderRepresentation";
import { ViewHeader } from "../components/view-header/ViewHeader";
import { useFetch, useAdminClient } from "../context/auth/AdminClient";
import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable";

View file

@ -17,7 +17,7 @@ import {
TextContent,
Text,
} from "@patternfly/react-core";
import IdentityProviderRepresentation from "keycloak-admin/lib/defs/identityProviderRepresentation";
import type IdentityProviderRepresentation from "keycloak-admin/lib/defs/identityProviderRepresentation";
import { useAdminClient } from "../context/auth/AdminClient";
import { useAlerts } from "../components/alert/Alerts";

View file

@ -10,7 +10,7 @@ import {
StackOverflowIcon,
TwitterIcon,
} from "@patternfly/react-icons";
import { SVGIconProps } from "@patternfly/react-icons/dist/js/createIcon";
import type { SVGIconProps } from "@patternfly/react-icons/dist/js/createIcon";
import { FontAwesomeIcon } from "./icons/FontAwesomeIcon";

View file

@ -9,7 +9,7 @@ import {
PageSection,
} from "@patternfly/react-core";
import IdentityProviderRepresentation from "keycloak-admin/lib/defs/identityProviderRepresentation";
import type IdentityProviderRepresentation from "keycloak-admin/lib/defs/identityProviderRepresentation";
import { ViewHeader } from "../../components/view-header/ViewHeader";
import { toUpperCase } from "../../util";
import { FormAccess } from "../../components/form-access/FormAccess";

View file

@ -9,7 +9,7 @@ import {
PageSection,
} from "@patternfly/react-core";
import IdentityProviderRepresentation from "keycloak-admin/lib/defs/identityProviderRepresentation";
import type IdentityProviderRepresentation from "keycloak-admin/lib/defs/identityProviderRepresentation";
import { FormAccess } from "../../components/form-access/FormAccess";
import { ViewHeader } from "../../components/view-header/ViewHeader";
import { useAdminClient } from "../../context/auth/AdminClient";

View file

@ -10,12 +10,12 @@ import {
SelectVariant,
} from "@patternfly/react-core";
import AuthenticationFlowRepresentation from "keycloak-admin/lib/defs/authenticationFlowRepresentation";
import type AuthenticationFlowRepresentation from "keycloak-admin/lib/defs/authenticationFlowRepresentation";
import { useFetch, useAdminClient } from "../../context/auth/AdminClient";
import { SwitchField } from "../component/SwitchField";
import { TextField } from "../component/TextField";
import { HelpItem } from "../../components/help-enabler/HelpItem";
import { FieldProps } from "../component/FormGroupField";
import type { FieldProps } from "../component/FormGroupField";
const LoginFlow = ({
field,

View file

@ -13,7 +13,7 @@ import {
TabTitleText,
} from "@patternfly/react-core";
import IdentityProviderRepresentation from "keycloak-admin/lib/defs/identityProviderRepresentation";
import type IdentityProviderRepresentation from "keycloak-admin/lib/defs/identityProviderRepresentation";
import { FormAccess } from "../../components/form-access/FormAccess";
import { ScrollForm } from "../../components/scroll-form/ScrollForm";
import { ViewHeader } from "../../components/view-header/ViewHeader";

View file

@ -5,7 +5,7 @@ import { FormGroup, Switch, TextInput, Title } from "@patternfly/react-core";
import { HelpItem } from "../../components/help-enabler/HelpItem";
import { useTranslation } from "react-i18next";
import { useAdminClient } from "../../context/auth/AdminClient";
import { OIDCConfigurationRepresentation } from "../OIDCConfigurationRepresentation";
import type { OIDCConfigurationRepresentation } from "../OIDCConfigurationRepresentation";
import { JsonFileUpload } from "../../components/json-file-upload/JsonFileUpload";
import { useRealm } from "../../context/realm-context/RealmContext";
import { DiscoverySettings } from "./DiscoverySettings";

View file

@ -1,5 +1,5 @@
import React, { useEffect, useState } from "react";
import KeycloakAdminClient from "keycloak-admin";
import type KeycloakAdminClient from "keycloak-admin";
import { Label } from "@patternfly/react-core";
export type AliasRendererComponentProps = {

View file

@ -11,7 +11,7 @@ import {
} from "@patternfly/react-core";
import { useTranslation } from "react-i18next";
import { useFetch, useAdminClient } from "../context/auth/AdminClient";
import RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation";
import type RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation";
import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable";
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
import { CaretDownIcon, FilterIcon } from "@patternfly/react-icons";

View file

@ -10,7 +10,7 @@ import {
PageSection,
ToolbarItem,
} from "@patternfly/react-core";
import RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation";
import type RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation";
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable";
import { useAlerts } from "../components/alert/Alerts";
@ -18,8 +18,8 @@ import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
import { emptyFormatter } from "../util";
import { AssociatedRolesModal } from "./AssociatedRolesModal";
import { useAdminClient } from "../context/auth/AdminClient";
import { RoleFormType } from "./RealmRoleTabs";
import ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation";
import type { RoleFormType } from "./RealmRoleTabs";
import type ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation";
import _ from "lodash";
type AssociatedRolesTabProps = {

View file

@ -8,8 +8,8 @@ import {
ValidatedOptions,
} from "@patternfly/react-core";
import { useTranslation } from "react-i18next";
import { UseFormMethods } from "react-hook-form";
import { RoleFormType } from "./RealmRoleTabs";
import type { UseFormMethods } from "react-hook-form";
import type { RoleFormType } from "./RealmRoleTabs";
import { FormAccess } from "../components/form-access/FormAccess";
export type RealmRoleFormProps = {

View file

@ -13,8 +13,8 @@ import { useFieldArray, useForm } from "react-hook-form";
import { useAlerts } from "../components/alert/Alerts";
import { useAdminClient } from "../context/auth/AdminClient";
import RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation";
import Composites from "keycloak-admin/lib/defs/roleRepresentation";
import type RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation";
import type Composites from "keycloak-admin/lib/defs/roleRepresentation";
import {
KeyValueType,
AttributesForm,

View file

@ -1,6 +1,6 @@
import React from "react";
import { useTranslation } from "react-i18next";
import { ArrayField, UseFormMethods } from "react-hook-form";
import type { ArrayField, UseFormMethods } from "react-hook-form";
import { ActionGroup, Button, TextInput } from "@patternfly/react-core";
import {
TableComposable,
@ -13,7 +13,7 @@ import {
import { MinusCircleIcon, PlusCircleIcon } from "@patternfly/react-icons";
import { FormAccess } from "../components/form-access/FormAccess";
import { RoleFormType } from "./RealmRoleTabs";
import type { RoleFormType } from "./RealmRoleTabs";
import "./RealmRolesSection.css";

View file

@ -4,7 +4,7 @@ import { useTranslation } from "react-i18next";
import { AlertVariant, Button, ButtonVariant } from "@patternfly/react-core";
import { useAdminClient } from "../context/auth/AdminClient";
import RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation";
import type RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation";
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable";
import { useAlerts } from "../components/alert/Alerts";

View file

@ -11,7 +11,7 @@ import {
TextInput,
} from "@patternfly/react-core";
import RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation";
import type RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation";
import { FormAccess } from "../components/form-access/FormAccess";
import { HelpItem } from "../components/help-enabler/HelpItem";
import { FormPanel } from "../components/scroll-form/FormPanel";

View file

@ -16,7 +16,7 @@ import {
TextInput,
} from "@patternfly/react-core";
import RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation";
import type RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation";
import { getBaseUrl } from "../util";
import { useAdminClient } from "../context/auth/AdminClient";
import { useRealm } from "../context/realm-context/RealmContext";

View file

@ -2,12 +2,12 @@ import React, { useState } from "react";
import { useHistory, useRouteMatch } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { Button, ButtonVariant, PageSection } from "@patternfly/react-core";
import { KeyMetadataRepresentation } from "keycloak-admin/lib/defs/keyMetadataRepresentation";
import type { KeyMetadataRepresentation } from "keycloak-admin/lib/defs/keyMetadataRepresentation";
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable";
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
import { emptyFormatter } from "../util";
import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation";
import type ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation";
import "./RealmSettingsSection.css";
import { cellWidth } from "@patternfly/react-table";

View file

@ -2,12 +2,12 @@ import React, { useState } from "react";
import { useHistory, useRouteMatch } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { Button, ButtonVariant, PageSection } from "@patternfly/react-core";
import { KeyMetadataRepresentation } from "keycloak-admin/lib/defs/keyMetadataRepresentation";
import type { KeyMetadataRepresentation } from "keycloak-admin/lib/defs/keyMetadataRepresentation";
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable";
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
import { emptyFormatter } from "../util";
import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation";
import type ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation";
import "./RealmSettingsSection.css";
import { cellWidth } from "@patternfly/react-table";

View file

@ -4,7 +4,7 @@ import { FormGroup, PageSection, Switch } from "@patternfly/react-core";
import { FormAccess } from "../components/form-access/FormAccess";
import { HelpItem } from "../components/help-enabler/HelpItem";
import { FormPanel } from "../components/scroll-form/FormPanel";
import RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation";
import type RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation";
type RealmSettingsLoginTabProps = {
save: (realm: RealmRepresentation) => void;

View file

@ -13,7 +13,7 @@ import {
TabTitleText,
} from "@patternfly/react-core";
import RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation";
import type RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation";
import { toUpperCase } from "../util";
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
import { useAdminClient, useFetch } from "../context/auth/AdminClient";
@ -27,8 +27,8 @@ import { PartialImportDialog } from "./PartialImport";
import { RealmSettingsThemesTab } from "./ThemesTab";
import { RealmSettingsEmailTab } from "./EmailTab";
import { KeysListTab } from "./KeysListTab";
import { KeyMetadataRepresentation } from "keycloak-admin/lib/defs/keyMetadataRepresentation";
import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation";
import type { KeyMetadataRepresentation } from "keycloak-admin/lib/defs/keyMetadataRepresentation";
import type ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation";
type RealmSettingsHeaderProps = {
onChange: (value: boolean) => void;

View file

@ -12,7 +12,7 @@ import {
Switch,
} from "@patternfly/react-core";
import RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation";
import type RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation";
import { FormAccess } from "../components/form-access/FormAccess";
import { HelpItem } from "../components/help-enabler/HelpItem";
import { useServerInfo } from "../context/server-info/ServerInfoProvider";

View file

@ -15,7 +15,7 @@ import { JsonFileUpload } from "../../components/json-file-upload/JsonFileUpload
import { useAlerts } from "../../components/alert/Alerts";
import { useForm, Controller } from "react-hook-form";
import { ViewHeader } from "../../components/view-header/ViewHeader";
import RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation";
import type RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation";
import { useAdminClient } from "../../context/auth/AdminClient";
import { WhoAmIContext } from "../../context/whoami/WhoAmI";
import { FormAccess } from "../../components/form-access/FormAccess";

View file

@ -1,6 +1,6 @@
import { TFunction } from "i18next";
import { BreadcrumbsRoute } from "use-react-router-breadcrumbs";
import { AccessType } from "keycloak-admin/lib/defs/whoAmIRepresentation";
import type { TFunction } from "i18next";
import type { BreadcrumbsRoute } from "use-react-router-breadcrumbs";
import type { AccessType } from "keycloak-admin/lib/defs/whoAmIRepresentation";
import { AuthenticationSection } from "./authentication/AuthenticationSection";
import { ClientScopeForm } from "./client-scopes/form/ClientScopeForm";

View file

@ -2,7 +2,7 @@ import React from "react";
import { Link } from "react-router-dom";
import { PageSection } from "@patternfly/react-core";
import moment from "moment";
import UserSessionRepresentation from "keycloak-admin/lib/defs/userSessionRepresentation";
import type UserSessionRepresentation from "keycloak-admin/lib/defs/userSessionRepresentation";
import { ViewHeader } from "../components/view-header/ViewHeader";
import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable";

View file

@ -1,6 +1,7 @@
import React, { useState } from "react";
import { Button } from "@patternfly/react-core";
import { Meta, Story } from "@storybook/react";
import type { Meta, Story } from "@storybook/react";
import type { ServerInfoRepresentation } from "keycloak-admin/lib/defs/serverInfoRepesentation";
import serverInfo from "../context/server-info/__tests__/mock.json";
import { ServerInfoContext } from "../context/server-info/ServerInfoProvider";
@ -17,7 +18,9 @@ export default {
const Template: Story<AddMapperDialogProps> = (args) => {
const [open, setOpen] = useState(false);
return (
<ServerInfoContext.Provider value={serverInfo}>
<ServerInfoContext.Provider
value={(serverInfo as unknown) as ServerInfoRepresentation}
>
<AddMapperDialog
{...args}
open={open}

View file

@ -1,6 +1,6 @@
import React from "react";
import { AlertVariant, Button } from "@patternfly/react-core";
import { Meta } from "@storybook/react";
import type { Meta } from "@storybook/react";
import { AlertPanel } from "../components/alert/AlertPanel";
import { AlertProvider, useAlerts } from "../components/alert/Alerts";

View file

@ -5,7 +5,7 @@ import {
TextVariants,
ButtonVariant,
} from "@patternfly/react-core";
import { Meta, Story } from "@storybook/react";
import type { Meta, Story } from "@storybook/react";
import { action } from "@storybook/addon-actions";
import {

View file

@ -1,5 +1,5 @@
import React, { ReactNode } from "react";
import { Meta } from "@storybook/react";
import type { Meta } from "@storybook/react";
import { DataLoader } from "../components/data-loader/DataLoader";

View file

@ -1,5 +1,5 @@
import React, { useState } from "react";
import { Meta } from "@storybook/react";
import type { Meta } from "@storybook/react";
import { DownloadDialog } from "../components/download-dialog/DownloadDialog";
import { MockAdminClient } from "./MockAdminClient";

View file

@ -1,5 +1,5 @@
import React from "react";
import { Meta, Story } from "@storybook/react";
import type { Meta, Story } from "@storybook/react";
import {
FormattedLink,
FormattedLinkProps,

View file

@ -9,7 +9,7 @@ import {
Form,
TextInput,
} from "@patternfly/react-core";
import { Meta } from "@storybook/react";
import type { Meta } from "@storybook/react";
import { HelpItem } from "../components/help-enabler/HelpItem";
import {

View file

@ -1,5 +1,5 @@
import React from "react";
import { Meta, Story } from "@storybook/react";
import type { Meta, Story } from "@storybook/react";
import {
JsonFileUpload,

View file

@ -1,6 +1,6 @@
import React from "react";
import { IFormatterValueType } from "@patternfly/react-table";
import { Meta, Story } from "@storybook/react";
import type { IFormatterValueType } from "@patternfly/react-table";
import type { Meta, Story } from "@storybook/react";
import clients from "../clients/__tests__/mock-clients.json";
@ -39,7 +39,7 @@ SimpleList.args = {
},
{ name: "baseUrl", displayKey: "clients:homeURL" },
],
loader: () => clients,
loader: async () => clients,
};
export const LoadingList = Template.bind({});

View file

@ -1,5 +1,5 @@
import React from "react";
import { Meta, Story } from "@storybook/react";
import type { Meta, Story } from "@storybook/react";
import {
ListEmptyState,
ListEmptyStateProps,

View file

@ -1,5 +1,6 @@
import React from "react";
import { Meta } from "@storybook/react";
import type { Meta } from "@storybook/react";
import type { ServerInfoRepresentation } from "keycloak-admin/lib/defs/serverInfoRepesentation";
import serverInfo from "../context/server-info/__tests__/mock.json";
import clientScopeMock from "../client-scopes/__tests__/mock-client-scope.json";
@ -13,7 +14,9 @@ export default {
} as Meta;
export const MapperListExample = () => (
<ServerInfoContext.Provider value={serverInfo}>
<ServerInfoContext.Provider
value={(serverInfo as unknown) as ServerInfoRepresentation}
>
<MockAdminClient>
<MapperList clientScope={clientScopeMock} refresh={() => {}} />
</MockAdminClient>

View file

@ -1,6 +1,7 @@
import React, { ReactNode } from "react";
import { HashRouter } from "react-router-dom";
import KeycloakAdminClient from "keycloak-admin";
import type KeycloakAdminClient from "keycloak-admin";
import type { ServerInfoRepresentation } from "keycloak-admin/lib/defs/serverInfoRepesentation";
import { AccessContextProvider } from "../context/access/Access";
import { WhoAmIContextProvider } from "../context/whoami/WhoAmI";
@ -30,7 +31,9 @@ export const MockAdminClient = (props: {
}) => {
return (
<HashRouter>
<ServerInfoContext.Provider value={serverInfo}>
<ServerInfoContext.Provider
value={(serverInfo as unknown) as ServerInfoRepresentation}
>
<AdminClient.Provider
value={
({

View file

@ -1,5 +1,5 @@
import React from "react";
import { Meta, Story } from "@storybook/react";
import type { Meta, Story } from "@storybook/react";
import { action } from "@storybook/addon-actions";
import { FormProvider, useForm } from "react-hook-form";
import { Button } from "@patternfly/react-core";

View file

@ -1,5 +1,5 @@
import React from "react";
import { Meta } from "@storybook/react";
import type { Meta } from "@storybook/react";
import { Page } from "@patternfly/react-core";
import { NewRealmForm } from "../realm/add/NewRealmForm";
import { MockAdminClient } from "./MockAdminClient";

View file

@ -1,5 +1,5 @@
import React from "react";
import { Meta } from "@storybook/react";
import type { Meta } from "@storybook/react";
import { MockAdminClient } from "./MockAdminClient";
import rolesMock from "../realm-roles/__tests__/mock-roles.json";
import { RealmRoleTabs } from "../realm-roles/RealmRoleTabs";

View file

@ -1,6 +1,6 @@
import React from "react";
import { Page } from "@patternfly/react-core";
import { Meta } from "@storybook/react";
import type { Meta } from "@storybook/react";
import { MockAdminClient } from "./MockAdminClient";
import { RealmRoleTabs } from "../realm-roles/RealmRoleTabs";

View file

@ -1,6 +1,7 @@
import React from "react";
import { Meta } from "@storybook/react";
import type { Meta } from "@storybook/react";
import { Page } from "@patternfly/react-core";
import type { ServerInfoRepresentation } from "keycloak-admin/lib/defs/serverInfoRepesentation";
import serverInfo from "../context/server-info/__tests__/mock.json";
import roles from "../realm-roles/__tests__/mock-roles.json";
@ -16,7 +17,9 @@ export default {
} as Meta;
export const RoleMappingFormExample = () => (
<ServerInfoContext.Provider value={serverInfo}>
<ServerInfoContext.Provider
value={(serverInfo as unknown) as ServerInfoRepresentation}
>
<MockAdminClient
mock={{
roles: {

View file

@ -1,5 +1,5 @@
import React from "react";
import { Meta } from "@storybook/react";
import type { Meta } from "@storybook/react";
import { ScrollForm } from "../components/scroll-form/ScrollForm";
export default {

Some files were not shown because too many files have changed in this diff Show more