From abec27a33440c43fbe7d20e12f72d42c6b9018e2 Mon Sep 17 00:00:00 2001 From: jenny-s51 Date: Wed, 28 Apr 2021 16:42:59 -0400 Subject: [PATCH 01/16] wip keys --- src/realm-roles/AssociatedRolesTab.tsx | 10 +++++++ src/realm-settings/GeneralTab.tsx | 29 +++++++++++++++++++++ src/realm-settings/LoginTab.tsx | 22 ++++++++++++++++ src/realm-settings/RealmSettingsSection.css | 1 + 4 files changed, 62 insertions(+) diff --git a/src/realm-roles/AssociatedRolesTab.tsx b/src/realm-roles/AssociatedRolesTab.tsx index 944ecdf648..14dafa8c4f 100644 --- a/src/realm-roles/AssociatedRolesTab.tsx +++ b/src/realm-roles/AssociatedRolesTab.tsx @@ -21,6 +21,7 @@ import { useAdminClient } from "../context/auth/AdminClient"; import type { RoleFormType } from "./RealmRoleTabs"; import type ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation"; import _ from "lodash"; +import { filter } from "cypress/types/bluebird"; type AssociatedRolesTabProps = { additionalRoles: Role[]; @@ -126,6 +127,15 @@ export const AssociatedRolesTab = ({ )!.clientId!) ); + console.log(filterDupes + .filter((role) => role.clientRole) + .map( + (role) => + (role.clientId = clients.find( + (client) => client.id === role.containerId + )!.clientId!) + )) + return alphabetize(additionalRoles); }); }; diff --git a/src/realm-settings/GeneralTab.tsx b/src/realm-settings/GeneralTab.tsx index 784487a053..8d0b924427 100644 --- a/src/realm-settings/GeneralTab.tsx +++ b/src/realm-settings/GeneralTab.tsx @@ -43,6 +43,35 @@ export const RealmSettingsGeneralTab = ({ const requireSslTypes = ["all", "external", "none"]; +<<<<<<< HEAD +======= + useEffect(() => { + return asyncStateFetch( + () => adminClient.realms.findOne({ realm: realmName }), + (realm) => { + console.log(realm) + setRealm(realm); + setupForm(realm); + }, + handleError + ); + }, []); + + const setupForm = (realm: RealmRepresentation) => { + Object.entries(realm).map((entry) => setValue(entry[0], entry[1])); + }; + + const save = async (realm: RealmRepresentation) => { + try { + await adminClient.realms.update({ realm: realmName }, realm); + setRealm(realm); + addAlert(t("saveSuccess"), AlertVariant.success); + } catch (error) { + addAlert(t("saveError", { error }), AlertVariant.danger); + } + }; + +>>>>>>> wip keys return ( <> diff --git a/src/realm-settings/LoginTab.tsx b/src/realm-settings/LoginTab.tsx index 45b9c721f7..dbdb5fe946 100644 --- a/src/realm-settings/LoginTab.tsx +++ b/src/realm-settings/LoginTab.tsx @@ -6,10 +6,32 @@ import { HelpItem } from "../components/help-enabler/HelpItem"; import { FormPanel } from "../components/scroll-form/FormPanel"; import type RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation"; +<<<<<<< HEAD type RealmSettingsLoginTabProps = { save: (realm: RealmRepresentation) => void; realm: RealmRepresentation; }; +======= +export const RealmSettingsLoginTab = () => { + const { t } = useTranslation("realm-settings"); + const [realm, setRealm] = useState(); + const handleError = useErrorHandler(); + const adminClient = useAdminClient(); + const { realm: realmName } = useRealm(); + const { addAlert } = useAlerts(); + + useEffect(() => { + + console.log("kjsdlja") + return asyncStateFetch( + () => adminClient.realms.findOne({ realm: realmName }), + (realm) => { + setRealm(realm); + }, + handleError + ); + }, []); +>>>>>>> wip keys export const RealmSettingsLoginTab = ({ save, diff --git a/src/realm-settings/RealmSettingsSection.css b/src/realm-settings/RealmSettingsSection.css index b14a033e39..329b85ac1b 100644 --- a/src/realm-settings/RealmSettingsSection.css +++ b/src/realm-settings/RealmSettingsSection.css @@ -16,6 +16,7 @@ div.pf-c-card__body.kc-form-panel__body { padding-left: 0px; padding-bottom: var(--pf-global--spacer--2xl); } + button#kc-certificate.pf-c-button.pf-m-secondary { margin-left: var(--pf-global--spacer--md); } From d5c5e3c01b36a6678ba9c50b015fd394a86dba80 Mon Sep 17 00:00:00 2001 From: jenny-s51 Date: Wed, 28 Apr 2021 16:45:01 -0400 Subject: [PATCH 02/16] keys --- src/realm-settings/KeysTab.tsx | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/realm-settings/KeysTab.tsx b/src/realm-settings/KeysTab.tsx index 54e16c30f2..2d6b4e6f53 100644 --- a/src/realm-settings/KeysTab.tsx +++ b/src/realm-settings/KeysTab.tsx @@ -31,6 +31,7 @@ export const KeysTabInner = ({ keys }: KeysTabInnerProps) => { const [certificate, setCertificate] = useState(""); const loader = async () => { +<<<<<<< HEAD return keys; }; @@ -55,6 +56,37 @@ export const KeysTabInner = ({ keys }: KeysTabInnerProps) => { noCancelButton: true, onConfirm: async () => {}, }); +======= + + const keysMetaData = allKeys; + + console.log("keyz", allKeys); + + return keysMetaData.map((key) => { + key.provider = realmComponents.find( + (component) => component.id === key.providerId + )?.name!; + }); + }; + + // let f = + // keys.map((key) => { + // key.provider = realmComponents.find( + // (component) => component.id === key.providerId + // )?.name!; + // }); + + // console.log(typeof f) + + // keys.forEach((item) => { + // if (item.name === "ecdsa-generated" ) + // console.log(item.config!.ecdsaEllipticCurveKey[0].slice(-3)) + // } + // ) + // keys.config!.ecdsaEllipticCurveKey.slice(-2) + + const toggleModal = () => setOpen(!open); +>>>>>>> keys const goToCreate = () => history.push(`${url}/add-role`); @@ -62,8 +94,15 @@ export const KeysTabInner = ({ keys }: KeysTabInnerProps) => { return <>{provider}; }; +<<<<<<< HEAD const ButtonRenderer = ({ provider, publicKey, certificate }: KeyData) => { if (provider === "ecdsa-generated") { +======= +}; + + const ButtonRenderer = ({ name }: ComponentRepresentation) => { + if (name === "ecdsa-generated") { +>>>>>>> keys return ( <> ); +<<<<<<< HEAD } if (provider === "rsa-generated" || provider === "fallback-RS256") { +======= + } else if (provider === "rsa-generated" || provider === "fallback-RS256") { +>>>>>>> adds keys table to realm settings return ( <> - ); - }; - const ButtonRenderer = ({ provider, publicKey, certificate }: KeyData) => { if (provider === "ecdsa-generated") { - return <>{renderPublicKeyButton(publicKey!)}; - } - if (provider === "rsa-generated" || provider === "fallback-RS256") { + return ( + <> + + + ); + } else if (provider === "rsa-generated" || provider === "fallback-RS256") { return ( <>
- {renderPublicKeyButton(publicKey!)} + + + , + + <>{component.name} + , + + <>{component.providerDescription} + , + ]} + /> + + + ))} + ); @@ -159,32 +235,34 @@ type KeysProps = { components: ComponentRepresentation[]; realmComponents: ComponentRepresentation[]; keyProviderComponentTypes: ComponentTypeRepresentation[]; - }; - -export const KeysProviderTab = ({ components, keyProviderComponentTypes, ...props }: KeysProps) => { - console.log("components", components) - // console.log("keyz", keys) - // console.log("keyz", keyProviderComponentTypes) +export const KeysProviderTab = ({ + components, + keyProviderComponentTypes, + ...props +}: KeysProps) => { + // console.log("components", components) + // console.log("keyz", keys) + // console.log("keyz", keyProviderComponentTypes) return ( { + components={components?.map((component) => { const provider = keyProviderComponentTypes.find( - (component: ComponentTypeRepresentation) => - component.id === key.providerId + (componentType: ComponentTypeRepresentation) => + component.providerId === componentType.id ); - return { ...key, providerDescription: provider?.helpText }; + return { ...component, providerDescription: provider?.helpText }; })} keyProviderComponentTypes={keyProviderComponentTypes} - // keyProviderComponentTypes={keyProviderComponentTypes?.map((key) => { - // const provider = keyProviderComponentTypes.find( - // (key: key) => - // component.id === key.providerId - // ); - // return { ...key, provider: provider?.providerId }; - // })} + // keyProviderComponentTypes={keyProviderComponentTypes?.map((key) => { + // const provider = keyProviderComponentTypes.find( + // (key: key) => + // component.id === key.providerId + // ); + // return { ...key, provider: provider?.providerId }; + // })} {...props} /> ); diff --git a/src/realm-settings/LoginTab.tsx b/src/realm-settings/LoginTab.tsx index 3aa8fa09d2..45b9c721f7 100644 --- a/src/realm-settings/LoginTab.tsx +++ b/src/realm-settings/LoginTab.tsx @@ -6,30 +6,10 @@ import { HelpItem } from "../components/help-enabler/HelpItem"; import { FormPanel } from "../components/scroll-form/FormPanel"; import type RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation"; -<<<<<<< HEAD type RealmSettingsLoginTabProps = { save: (realm: RealmRepresentation) => void; realm: RealmRepresentation; }; -======= -export const RealmSettingsLoginTab = () => { - const { t } = useTranslation("realm-settings"); - const [realm, setRealm] = useState(); - const handleError = useErrorHandler(); - const adminClient = useAdminClient(); - const { realm: realmName } = useRealm(); - const { addAlert } = useAlerts(); - - useEffect(() => { - return asyncStateFetch( - () => adminClient.realms.findOne({ realm: realmName }), - (realm) => { - setRealm(realm); - }, - handleError - ); - }, []); ->>>>>>> wip keys export const RealmSettingsLoginTab = ({ save, diff --git a/src/realm-settings/RealmSettingsSection.css b/src/realm-settings/RealmSettingsSection.css index 329b85ac1b..a6bd54b633 100644 --- a/src/realm-settings/RealmSettingsSection.css +++ b/src/realm-settings/RealmSettingsSection.css @@ -20,3 +20,7 @@ div.pf-c-card__body.kc-form-panel__body { button#kc-certificate.pf-c-button.pf-m-secondary { margin-left: var(--pf-global--spacer--md); } + +.pf-c-data-list__item-row.test { + font-weight: bold; +} \ No newline at end of file diff --git a/src/realm-settings/RealmSettingsSection.tsx b/src/realm-settings/RealmSettingsSection.tsx index e3a40b95b0..ca81241f7f 100644 --- a/src/realm-settings/RealmSettingsSection.tsx +++ b/src/realm-settings/RealmSettingsSection.tsx @@ -30,6 +30,7 @@ import { KeysListTab } from "./KeysListTab"; import { KeyMetadataRepresentation } from "keycloak-admin/lib/defs/keyMetadataRepresentation"; import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation"; import { KeysProviderTab } from "./KeysProvidersTab"; +import { useServerInfo } from "../context/server-info/ServerInfoProvider"; type RealmSettingsHeaderProps = { onChange: (value: boolean) => void; @@ -135,6 +136,10 @@ export const RealmSettingsSection = () => { ComponentRepresentation[] >([]); + const kpComponentTypes = useServerInfo().componentTypes![ + "org.keycloak.keys.KeyProvider" + ]; + useFetch( () => adminClient.realms.findOne({ realm: realmName }), (realm) => { @@ -249,7 +254,11 @@ export const RealmSettingsSection = () => { eventKey={1} title={{t("providers")}} > - {/* */} + diff --git a/src/realm-settings/messages.json b/src/realm-settings/messages.json index 0c8132169e..c36888fc59 100644 --- a/src/realm-settings/messages.json +++ b/src/realm-settings/messages.json @@ -36,8 +36,10 @@ "providers": "Providers", "algorithm": "Algorithm", "type": "Type", + "name": "Name", "kid": "Kid", "provider": "Provider", + "providerDescription": "Provider description", "publicKeys": "Public keys", "certificate": "Certificate", "userRegistration": "User registration", From 345c924e0f48ac19e37eb8765a8d6fd2a0630360 Mon Sep 17 00:00:00 2001 From: jenny-s51 Date: Tue, 4 May 2021 15:25:36 -0400 Subject: [PATCH 07/16] add providers and search functionality --- .../table-toolbar/KeycloakDataTable.tsx | 56 +--- src/realm-settings/KeysProvidersTab.tsx | 256 ++++++++---------- src/realm-settings/RealmSettingsSection.css | 27 +- src/realm-settings/messages.json | 7 +- 4 files changed, 157 insertions(+), 189 deletions(-) diff --git a/src/components/table-toolbar/KeycloakDataTable.tsx b/src/components/table-toolbar/KeycloakDataTable.tsx index d7cc3b4e68..991ba01636 100644 --- a/src/components/table-toolbar/KeycloakDataTable.tsx +++ b/src/components/table-toolbar/KeycloakDataTable.tsx @@ -11,15 +11,7 @@ import { TableHeader, TableVariant, } from "@patternfly/react-table"; -import { - DataList, - DataListAction, - DataListCell, - DataListItem, - DataListItemCells, - DataListItemRow, - Spinner, -} from "@patternfly/react-core"; +import { Spinner } from "@patternfly/react-core"; import _ from "lodash"; import { PaginatingTableToolbar } from "./PaginatingTableToolbar"; @@ -55,6 +47,7 @@ type DataTableProps = { onSelect?: (isSelected: boolean, rowIndex: number) => void; onCollapse?: (isOpen: boolean, rowIndex: number) => void; canSelectAll: boolean; + isNotCompact?: boolean; }; function DataTable({ @@ -66,13 +59,14 @@ function DataTable({ onSelect, onCollapse, canSelectAll, + isNotCompact, ...props }: DataTableProps) { const { t } = useTranslation(); return ( onSelect(isSelected, rowIndex) @@ -132,6 +126,7 @@ export type DataListProps = { toolbarItem?: ReactNode; emptyState?: ReactNode; icon?: React.ComponentClass; + isNotCompact?: boolean; }; /** @@ -163,6 +158,7 @@ export function KeycloakDataTable({ isPaginated = false, onSelect, canSelectAll = false, + isNotCompact, detailColumns, isRowDisabled, loader, @@ -391,47 +387,9 @@ export function KeycloakDataTable({ actionResolver={actionResolver} rows={filteredData || rows} columns={columns} + isNotCompact={isNotCompact} ariaLabelKey={ariaLabelKey} /> - // { - // // setGroupId(value); - // // }} - // aria-label={t("groups")} - // isCompact - // itemOrder={itemOrder} - // > - // {(rows!).map((component) => ( - // { - // // if ((e.target as HTMLInputElement).type !== "checkbox") { - // // setGroupId(group.id); - // // } - // // }} - // > - // - - // - // <>{Math.random()} - // , - // ]} - // /> - // - // - // - // - // ))} - // )} {!loading && rows.length === 0 && diff --git a/src/realm-settings/KeysProvidersTab.tsx b/src/realm-settings/KeysProvidersTab.tsx index 6ea9a4727e..1bc63dd242 100644 --- a/src/realm-settings/KeysProvidersTab.tsx +++ b/src/realm-settings/KeysProvidersTab.tsx @@ -1,37 +1,30 @@ -import React, { Component, useState, useEffect } from "react"; -import { useHistory, useRouteMatch } from "react-router-dom"; +import React, { useState, useEffect } from "react"; import { useTranslation } from "react-i18next"; import { Button, ButtonVariant, DataList, - DataListAction, DataListCell, DataListControl, DataListDragButton, DataListItem, DataListItemCells, DataListItemRow, + Dropdown, + DropdownToggle, + InputGroup, PageSection, + TextInput, + Toolbar, + ToolbarGroup, + ToolbarItem, } from "@patternfly/react-core"; import { 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 "./RealmSettingsSection.css"; -import { - cellWidth, - Table, - TableBody, - TableHeader, - TableVariant, -} from "@patternfly/react-table"; import ComponentTypeRepresentation from "keycloak-admin/lib/defs/componentTypeRepresentation"; -import { asyncStateFetch } from "../context/auth/AdminClient"; -import { useErrorHandler } from "react-error-boundary"; +import { SearchIcon } from "@patternfly/react-icons"; type ComponentData = KeyMetadataRepresentation & { providerDescription?: string; @@ -44,163 +37,158 @@ type KeysTabInnerProps = { keyProviderComponentTypes: ComponentTypeRepresentation[]; }; -export const KeysTabInner = ({ - components, - keyProviderComponentTypes, -}: KeysTabInnerProps) => { +export const KeysTabInner = ({ components }: KeysTabInnerProps) => { const { t } = useTranslation("roles"); - const history = useHistory(); - const { url } = useRouteMatch(); - const [key, setKey] = useState(0); - const refresh = () => setKey(new Date().getTime()); - const errorHandler = useErrorHandler(); - const [itemOrder, setItemOrder] = useState(["data1", "data2", "data3"]); const [id, setId] = useState(""); + const [searchVal, setSearchVal] = useState(""); + const [filteredComponents, setFilteredComponents] = useState( + [] + ); - const loader = async () => { - return components; - }; + const itemIds = components.map((item, idx) => "data" + idx); - // useEffect( - // () => - // asyncStateFetch( - // async () => { - // return components; - // }, - // async () => { + const [itemOrder, setItemOrder] = useState([]); - // setFetchedComponents(components) - // }, - // errorHandler - // ), - // [] - // ); + console.log("itemord", itemOrder); - React.useEffect(() => { - refresh(); - }, [components]); + const [liveText, setLiveText] = useState(""); - const goToCreate = () => history.push(`${url}/add-role`); - - console.log("componentsss", components); + useEffect(() => { + setItemOrder(["data", ...itemIds]); + }, [components, searchVal]); const onDragStart = (id: string) => { - console.log(itemOrder); + setLiveText(t("onDragStart", { id })); setId(id); }; - const onDragMove = (oldIndex, newIndex) => { - console.log(`Dragging item ${id}.`); + const onDragMove = () => { + setLiveText(t("onDragMove", { id })); }; - const columns = [ - t("realm-settings:name"), - t("realm-settings:provider"), - t("realm-settings:providerDescription"), - ]; + const onDragCancel = () => { + setLiveText(t("onDragCancel")); + }; - // const onDragCancel = () => { - // this.setState({ - // liveText: `Dragging cancelled. List is unchanged.` - // }); - // }; + const onDragFinish = (itemOrder: string[]) => { + setItemOrder(["data", ...itemOrder.filter((i) => i !== "data")]); + setLiveText(t("onDragCancel")); + }; - const onDragFinish = (itemOrder) => { - setItemOrder(itemOrder); + const onSearch = () => { + if (searchVal !== "") { + setSearchVal(searchVal); + const x = components.filter((v) => { + return v.name?.includes(searchVal) || v.providerId?.includes(searchVal); + }); + setFilteredComponents(x); + } else { + setSearchVal(""); + setFilteredComponents(components); + } + }; + + const handleKeyDown = (e: any) => { + if (e.key === "Enter") { + onSearch(); + } + }; + + const handleInputChange = (value: string) => { + setSearchVal(value); }; return ( <> - {/* - */} - {/* - } - /> */} -
- - -
+ + <> + + + + + + + + + {}} + toggle={ + + {t("realm-settings:addProvider")} + + } + /> + + + + + { - // setGroupId(value); - // }} aria-label={t("groups")} onDragFinish={onDragFinish} onDragStart={onDragStart} onDragMove={onDragMove} - // onDragCancel={this.onDragCancel} + onDragCancel={onDragCancel} itemOrder={itemOrder} isCompact > - {/* - - + + + + <>{t("realm-settings:name")} , - + <>{t("realm-settings:provider")} , - + <>{t("realm-settings:providerDescription")} - + , ]} /> - */} - {components.map((component, idx) => ( + + {(filteredComponents.length === 0 + ? components + : filteredComponents + ).map((component, idx) => ( ))} +
+ {liveText} +
); @@ -242,10 +233,6 @@ export const KeysProviderTab = ({ keyProviderComponentTypes, ...props }: KeysProps) => { - // console.log("components", components) - // console.log("keyz", keys) - // console.log("keyz", keyProviderComponentTypes) - return ( { @@ -256,13 +243,6 @@ export const KeysProviderTab = ({ return { ...component, providerDescription: provider?.helpText }; })} keyProviderComponentTypes={keyProviderComponentTypes} - // keyProviderComponentTypes={keyProviderComponentTypes?.map((key) => { - // const provider = keyProviderComponentTypes.find( - // (key: key) => - // component.id === key.providerId - // ); - // return { ...key, provider: provider?.providerId }; - // })} {...props} /> ); diff --git a/src/realm-settings/RealmSettingsSection.css b/src/realm-settings/RealmSettingsSection.css index a6bd54b633..939a08979f 100644 --- a/src/realm-settings/RealmSettingsSection.css +++ b/src/realm-settings/RealmSettingsSection.css @@ -23,4 +23,29 @@ button#kc-certificate.pf-c-button.pf-m-secondary { .pf-c-data-list__item-row.test { font-weight: bold; -} \ No newline at end of file +} + +.pf-c-data-list__item-content.test2 { + margin-left: var(--pf-global--spacer--xl); +} + +button.pf-c-data-list__item-draggable-button.pf-m-disabled.header-drag-button { + /* --pf-c-data-list__item-draggable-button-icon--Color: white; */ + display: none; +} + +button.pf-c-data-list__item-draggable-button.row-drag-button { + padding-top: var(--pf-global--spacer--md); +} + +.pf-c-data-list__item-control { + margin-right: 0px; +} + +button.pf-c-button.pf-m-link.add-provider { + padding: 0px; +} + +.pf-c-toolbar__group.providers-toolbar { + padding-left: var(--pf-c-toolbar__content--PaddingLeft); +} diff --git a/src/realm-settings/messages.json b/src/realm-settings/messages.json index c36888fc59..dd791355f3 100644 --- a/src/realm-settings/messages.json +++ b/src/realm-settings/messages.json @@ -40,6 +40,7 @@ "kid": "Kid", "provider": "Provider", "providerDescription": "Provider description", + "addProvider": "Add provider", "publicKeys": "Public keys", "certificate": "Certificate", "userRegistration": "User registration", @@ -104,5 +105,9 @@ "partial-import": { "partialImportHeaderText": "Partial import allows you to import users, clients, and resources from a previously exported json file.", "import": "Import" - } + }, + "onDragStart": "Dragging started for item {{id}}", + "onDragMove": "Dragging item {{id}}", + "onDragCancel": "Dragging cancelled. List is unchanged.", + "onDragFinish": "Dragging finished {{list}}" } From 5dca0bcba9c3350c2c73bbdd46e84a3a0cdc5249 Mon Sep 17 00:00:00 2001 From: jenny-s51 Date: Tue, 4 May 2021 15:25:54 -0400 Subject: [PATCH 08/16] clean up stylesheet --- src/realm-settings/RealmSettingsSection.css | 1 - 1 file changed, 1 deletion(-) diff --git a/src/realm-settings/RealmSettingsSection.css b/src/realm-settings/RealmSettingsSection.css index 939a08979f..636616a18e 100644 --- a/src/realm-settings/RealmSettingsSection.css +++ b/src/realm-settings/RealmSettingsSection.css @@ -30,7 +30,6 @@ button#kc-certificate.pf-c-button.pf-m-secondary { } button.pf-c-data-list__item-draggable-button.pf-m-disabled.header-drag-button { - /* --pf-c-data-list__item-draggable-button-icon--Color: white; */ display: none; } From ae18cee673010ba04bc37ccd95bd00c0b514682f Mon Sep 17 00:00:00 2001 From: jenny-s51 Date: Mon, 17 May 2021 10:12:51 -0400 Subject: [PATCH 09/16] fix format --- src/realm-settings/KeysListTab.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/realm-settings/KeysListTab.tsx b/src/realm-settings/KeysListTab.tsx index b926fa5c49..d84163309e 100644 --- a/src/realm-settings/KeysListTab.tsx +++ b/src/realm-settings/KeysListTab.tsx @@ -189,4 +189,4 @@ export const KeysListTab = ({ keys, realmComponents, ...props }: KeysProps) => { {...props} /> ); -}; \ No newline at end of file +}; From 7c20226022694691f1b53f495d8f13271c0baee0 Mon Sep 17 00:00:00 2001 From: Jenny <32821331+jenny-s51@users.noreply.github.com> Date: Tue, 18 May 2021 08:26:25 -0400 Subject: [PATCH 10/16] Update src/realm-settings/KeysListTab.tsx Co-authored-by: Erik Jan de Wit --- src/realm-settings/KeysListTab.tsx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/realm-settings/KeysListTab.tsx b/src/realm-settings/KeysListTab.tsx index d84163309e..0c4d9dea55 100644 --- a/src/realm-settings/KeysListTab.tsx +++ b/src/realm-settings/KeysListTab.tsx @@ -172,11 +172,6 @@ type KeysProps = { }; export const KeysListTab = ({ keys, realmComponents, ...props }: KeysProps) => { - console.log("components", realmComponents); - console.log( - realmComponents.forEach((component) => console.log(component.name)) - ); - return ( { From e82be4ccf8d86bb6ce10f798f69d6d5abe2416c6 Mon Sep 17 00:00:00 2001 From: jenny-s51 Date: Tue, 18 May 2021 10:31:38 -0400 Subject: [PATCH 11/16] remove log stmt --- src/realm-settings/KeysProvidersTab.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/realm-settings/KeysProvidersTab.tsx b/src/realm-settings/KeysProvidersTab.tsx index 1bc63dd242..7df71f32c8 100644 --- a/src/realm-settings/KeysProvidersTab.tsx +++ b/src/realm-settings/KeysProvidersTab.tsx @@ -50,8 +50,6 @@ export const KeysTabInner = ({ components }: KeysTabInnerProps) => { const [itemOrder, setItemOrder] = useState([]); - console.log("itemord", itemOrder); - const [liveText, setLiveText] = useState(""); useEffect(() => { From dd41d93f38308631622291be0a403596d433d0e2 Mon Sep 17 00:00:00 2001 From: jenny-s51 Date: Tue, 18 May 2021 11:17:52 -0400 Subject: [PATCH 12/16] show public key and certificate correctly --- src/realm-settings/KeysListTab.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/realm-settings/KeysListTab.tsx b/src/realm-settings/KeysListTab.tsx index 0c4d9dea55..1cc8e2f3a8 100644 --- a/src/realm-settings/KeysListTab.tsx +++ b/src/realm-settings/KeysListTab.tsx @@ -14,6 +14,7 @@ import { cellWidth } from "@patternfly/react-table"; type KeyData = KeyMetadataRepresentation & { provider?: string; + type?: string; }; type KeysTabInnerProps = { @@ -34,6 +35,8 @@ export const KeysTabInner = ({ keys }: KeysTabInnerProps) => { return keys; }; + console.log("Keys", keys) + React.useEffect(() => { refresh(); }, [keys]); @@ -62,8 +65,8 @@ export const KeysTabInner = ({ keys }: KeysTabInnerProps) => { return <>{provider}; }; - const ButtonRenderer = ({ provider, publicKey, certificate }: KeyData) => { - if (provider === "ecdsa-generated") { + const ButtonRenderer = ({ type, publicKey, certificate }: KeyData) => { + if (type === "EC") { return ( <> ); - } else if (provider === "rsa-generated" || provider === "fallback-RS256") { + } else if (type === "RSA") { return ( <>
From 096378e75e417d4cb9af268ac96c4de199714335 Mon Sep 17 00:00:00 2001 From: jenny-s51 Date: Tue, 18 May 2021 11:19:06 -0400 Subject: [PATCH 13/16] remove log --- src/realm-settings/KeysListTab.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/realm-settings/KeysListTab.tsx b/src/realm-settings/KeysListTab.tsx index 1cc8e2f3a8..9154c4e957 100644 --- a/src/realm-settings/KeysListTab.tsx +++ b/src/realm-settings/KeysListTab.tsx @@ -35,8 +35,6 @@ export const KeysTabInner = ({ keys }: KeysTabInnerProps) => { return keys; }; - console.log("Keys", keys) - React.useEffect(() => { refresh(); }, [keys]); From cdc46ef72fb274048511445586d0f616e8f7c4c2 Mon Sep 17 00:00:00 2001 From: jenny-s51 Date: Tue, 18 May 2021 11:41:38 -0400 Subject: [PATCH 14/16] align buttons --- src/realm-settings/KeysListTab.tsx | 2 +- src/realm-settings/RealmSettingsSection.css | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/realm-settings/KeysListTab.tsx b/src/realm-settings/KeysListTab.tsx index 9154c4e957..06bcfca113 100644 --- a/src/realm-settings/KeysListTab.tsx +++ b/src/realm-settings/KeysListTab.tsx @@ -82,7 +82,7 @@ export const KeysTabInner = ({ keys }: KeysTabInnerProps) => { } else if (type === "RSA") { return ( <> -
+
- - ); -<<<<<<< HEAD - } - if (provider === "rsa-generated" || provider === "fallback-RS256") { -======= - } else if (provider === "rsa-generated" || provider === "fallback-RS256") { ->>>>>>> adds keys table to realm settings - return ( - <> - - - - ); - } - }; - - return ( - <> - - - - - } - /> - - - ); -}; - -type KeysProps = { - keys: KeyMetadataRepresentation[]; - realmComponents: ComponentRepresentation[]; -}; - -export const KeysTab = ({ keys, realmComponents, ...props }: KeysProps) => { - return ( - { - const provider = realmComponents.find( - (component: ComponentRepresentation) => - component.id === key.providerId - ); - return { ...key, provider: provider?.providerId }; - })} - {...props} - /> - ); -};