2020-10-27 11:25:54 +00:00
|
|
|
import React from "react";
|
|
|
|
import { Meta } from "@storybook/react";
|
|
|
|
import { Page } from "@patternfly/react-core";
|
|
|
|
|
|
|
|
import serverInfo from "../context/server-info/__tests__/mock.json";
|
|
|
|
import roles from "../realm-roles/__tests__/mock-roles.json";
|
|
|
|
import { ServerInfoContext } from "../context/server-info/ServerInfoProvider";
|
|
|
|
|
|
|
|
import { RoleMappingForm } from "../client-scopes/add/RoleMappingForm";
|
2020-11-12 12:55:52 +00:00
|
|
|
import { AdminClient } from "../context/auth/AdminClient";
|
|
|
|
import KeycloakAdminClient from "keycloak-admin";
|
2020-10-27 11:25:54 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
title: "Role Mapping Form",
|
|
|
|
component: RoleMappingForm,
|
|
|
|
} as Meta;
|
|
|
|
|
|
|
|
export const RoleMappingFormExample = () => (
|
|
|
|
<ServerInfoContext.Provider value={serverInfo}>
|
2020-11-12 12:55:52 +00:00
|
|
|
<AdminClient.Provider
|
2020-10-27 11:25:54 +00:00
|
|
|
value={
|
|
|
|
({
|
2020-11-12 12:55:52 +00:00
|
|
|
setConfig: () => {},
|
|
|
|
roles: {
|
|
|
|
find: () => {
|
|
|
|
return roles;
|
|
|
|
},
|
2020-10-27 11:25:54 +00:00
|
|
|
},
|
2020-11-12 12:55:52 +00:00
|
|
|
clients: {
|
|
|
|
find: () => roles,
|
|
|
|
},
|
|
|
|
} as unknown) as KeycloakAdminClient
|
2020-10-27 11:25:54 +00:00
|
|
|
}
|
|
|
|
>
|
|
|
|
<Page>
|
|
|
|
<RoleMappingForm clientScopeId="dummy" />
|
|
|
|
</Page>
|
2020-11-12 12:55:52 +00:00
|
|
|
</AdminClient.Provider>
|
2020-10-27 11:25:54 +00:00
|
|
|
</ServerInfoContext.Provider>
|
|
|
|
);
|