keycloak-scim/js/apps/admin-ui/src/realm-settings/ProfilesTab.tsx

294 lines
8.5 KiB
TypeScript
Raw Normal View History

import type ClientProfileRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientProfileRepresentation";
import { CodeEditor, Language } from "@patternfly/react-code-editor";
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
import {
ActionGroup,
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
AlertVariant,
Button,
ButtonVariant,
Divider,
Flex,
FlexItem,
FormGroup,
Label,
PageSection,
Radio,
Title,
ToolbarItem,
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
} from "@patternfly/react-core";
import { omit } from "lodash-es";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom";
import { adminClient } from "../admin-client";
import { useAlerts } from "../components/alert/Alerts";
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
import { KeycloakSpinner } from "../components/keycloak-spinner/KeycloakSpinner";
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
import {
Action,
KeycloakDataTable,
} from "../components/table-toolbar/KeycloakDataTable";
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
import { useRealm } from "../context/realm-context/RealmContext";
import { prettyPrintJSON } from "../util";
import { useFetch } from "../utils/useFetch";
Profile view update (#1357) * added routing for viewing client profile * added add executors form template * added add executors form template * add executor: wip * add executor: wip * add executor: wip * add executor: wip * add executor: wip * add executor: wip * add executor: wip * add executor: wip * add executor: wip * added adding excutors to profiles * added displaying executors - wip * added displaying executors - wip * added navigation to client profile edit on executor creation * replaced table with list for listing executors added * added support for editing client profile * added logic making executors with config links only * added read only values for edit/view client temporarily * added helpText for added executors listed in executors list * added helpText for added executors listed in executors list * added deleting executor from client profile * fixed deleting client profile and fixed messages for delete modals * fixed message for delete clinet profile modal * combined delete dialogs for client profile and executor * displaying global executors for global profiles, hiding add executor button * fixed eslint issue * fixed executors list * added back button to global profile view/edit view * fixed test * added global batche and hid actions dropdown for global profiles * fixed switch on/off labels * fixed hide/display items for global and non-global profiles * added isDirty * feedback fixes * feedback fixes * feedback fixes * feedback fixes * feedback fixes * feedback fix * small refactor * added name and removed unused state * fixed executor creation * fixed executor creation * added saving edited client profile * added saving edited client profile * improved trash icon styles * test fix * Some code suggestions * Some more code suggestions * feedback fixes * feedback fixes * use find instead of filter * feedback fixes * added defaultValues for executors * removed defaultValues for executors * final feedback fixes * minor fixes Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Erik Jan de Wit <erikjan.dewit@gmail.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-10-26 20:16:19 +00:00
import { toAddClientProfile } from "./routes/AddClientProfile";
import { toClientProfile } from "./routes/ClientProfile";
2021-09-29 08:51:47 +00:00
import "./realm-settings-section.css";
2021-10-29 16:11:06 +00:00
type ClientProfile = ClientProfileRepresentation & {
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
global: boolean;
};
2021-10-29 16:11:06 +00:00
export default function ProfilesTab() {
const { t } = useTranslation();
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
const { realm } = useRealm();
const { addAlert, addError } = useAlerts();
const [tableProfiles, setTableProfiles] = useState<ClientProfile[]>();
const [globalProfiles, setGlobalProfiles] =
useState<ClientProfileRepresentation[]>();
const [selectedProfile, setSelectedProfile] = useState<ClientProfile>();
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
const [show, setShow] = useState(false);
const [code, setCode] = useState<string>();
const [key, setKey] = useState(0);
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
2021-09-29 08:51:47 +00:00
useFetch(
() =>
adminClient.clientPolicies.listProfiles({
includeGlobalProfiles: true,
}),
(allProfiles) => {
setGlobalProfiles(allProfiles.globalProfiles);
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
2021-09-29 08:51:47 +00:00
const globalProfiles = allProfiles.globalProfiles?.map(
(globalProfiles) => ({
...globalProfiles,
global: true,
}),
2021-09-29 08:51:47 +00:00
);
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
2021-09-29 08:51:47 +00:00
const profiles = allProfiles.profiles?.map((profiles) => ({
...profiles,
global: false,
}));
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
2021-09-29 08:51:47 +00:00
const allClientProfiles = globalProfiles?.concat(profiles ?? []);
setTableProfiles(allClientProfiles || []);
setCode(JSON.stringify(allClientProfiles, null, 2));
2021-09-29 08:51:47 +00:00
},
[key],
2021-09-29 08:51:47 +00:00
);
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
2021-09-29 08:51:47 +00:00
const loader = async () => tableProfiles ?? [];
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
const normalizeProfile = (
profile: ClientProfile,
): ClientProfileRepresentation => omit(profile, "global");
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({
titleKey: t("deleteClientProfileConfirmTitle"),
Profile view update (#1357) * added routing for viewing client profile * added add executors form template * added add executors form template * add executor: wip * add executor: wip * add executor: wip * add executor: wip * add executor: wip * add executor: wip * add executor: wip * add executor: wip * add executor: wip * added adding excutors to profiles * added displaying executors - wip * added displaying executors - wip * added navigation to client profile edit on executor creation * replaced table with list for listing executors added * added support for editing client profile * added logic making executors with config links only * added read only values for edit/view client temporarily * added helpText for added executors listed in executors list * added helpText for added executors listed in executors list * added deleting executor from client profile * fixed deleting client profile and fixed messages for delete modals * fixed message for delete clinet profile modal * combined delete dialogs for client profile and executor * displaying global executors for global profiles, hiding add executor button * fixed eslint issue * fixed executors list * added back button to global profile view/edit view * fixed test * added global batche and hid actions dropdown for global profiles * fixed switch on/off labels * fixed hide/display items for global and non-global profiles * added isDirty * feedback fixes * feedback fixes * feedback fixes * feedback fixes * feedback fixes * feedback fix * small refactor * added name and removed unused state * fixed executor creation * fixed executor creation * added saving edited client profile * added saving edited client profile * improved trash icon styles * test fix * Some code suggestions * Some more code suggestions * feedback fixes * feedback fixes * use find instead of filter * feedback fixes * added defaultValues for executors * removed defaultValues for executors * final feedback fixes * minor fixes Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Erik Jan de Wit <erikjan.dewit@gmail.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-10-26 20:16:19 +00:00
messageKey: t("deleteClientProfileConfirm", {
profileName: selectedProfile?.name,
}),
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
continueButtonLabel: t("delete"),
continueButtonVariant: ButtonVariant.danger,
onConfirm: async () => {
const updatedProfiles = tableProfiles
?.filter(
(profile) =>
profile.name !== selectedProfile?.name && !profile.global,
)
.map<ClientProfileRepresentation>((profile) =>
normalizeProfile(profile),
);
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
try {
await adminClient.clientPolicies.createProfiles({
profiles: updatedProfiles,
globalProfiles,
});
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
addAlert(t("deleteClientSuccess"), AlertVariant.success);
setKey(key + 1);
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
} catch (error) {
addError(t("deleteClientError"), error);
}
},
});
const cellFormatter = (row: ClientProfile) => (
Profile view update (#1357) * added routing for viewing client profile * added add executors form template * added add executors form template * add executor: wip * add executor: wip * add executor: wip * add executor: wip * add executor: wip * add executor: wip * add executor: wip * add executor: wip * add executor: wip * added adding excutors to profiles * added displaying executors - wip * added displaying executors - wip * added navigation to client profile edit on executor creation * replaced table with list for listing executors added * added support for editing client profile * added logic making executors with config links only * added read only values for edit/view client temporarily * added helpText for added executors listed in executors list * added helpText for added executors listed in executors list * added deleting executor from client profile * fixed deleting client profile and fixed messages for delete modals * fixed message for delete clinet profile modal * combined delete dialogs for client profile and executor * displaying global executors for global profiles, hiding add executor button * fixed eslint issue * fixed executors list * added back button to global profile view/edit view * fixed test * added global batche and hid actions dropdown for global profiles * fixed switch on/off labels * fixed hide/display items for global and non-global profiles * added isDirty * feedback fixes * feedback fixes * feedback fixes * feedback fixes * feedback fixes * feedback fix * small refactor * added name and removed unused state * fixed executor creation * fixed executor creation * added saving edited client profile * added saving edited client profile * improved trash icon styles * test fix * Some code suggestions * Some more code suggestions * feedback fixes * feedback fixes * use find instead of filter * feedback fixes * added defaultValues for executors * removed defaultValues for executors * final feedback fixes * minor fixes Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Erik Jan de Wit <erikjan.dewit@gmail.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-10-26 20:16:19 +00:00
<Link
to={toClientProfile({
realm,
profileName: row.name!,
})}
key={row.name}
>
2021-09-29 08:51:47 +00:00
{row.name} {row.global && <Label color="blue">{t("global")}</Label>}
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
</Link>
);
2021-09-29 08:51:47 +00:00
if (!tableProfiles) {
return <KeycloakSpinner />;
2021-09-29 08:51:47 +00:00
}
const save = async () => {
if (!code) {
return;
}
try {
const obj: ClientProfile[] = JSON.parse(code);
const changedProfiles = obj
.filter((profile) => !profile.global)
.map((profile) => normalizeProfile(profile));
const changedGlobalProfiles = obj
.filter((profile) => profile.global)
.map((profile) => normalizeProfile(profile));
try {
await adminClient.clientPolicies.createProfiles({
profiles: changedProfiles,
globalProfiles: changedGlobalProfiles,
});
addAlert(
t("realm-settings:updateClientProfilesSuccess"),
AlertVariant.success,
);
setKey(key + 1);
} catch (error) {
addError("realm-settings:updateClientProfilesError", error);
}
} catch (error) {
console.warn("Invalid json, ignoring value using {}");
}
};
return (
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
<>
<DeleteConfirm />
<PageSection>
<Flex className="kc-profiles-config-section">
<FlexItem>
<Title headingLevel="h1" size="md">
{t("profilesConfigType")}
</Title>
</FlexItem>
<FlexItem>
<Radio
isChecked={!show}
2021-09-29 08:51:47 +00:00
name="profilesView"
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
onChange={() => setShow(false)}
label={t("profilesConfigTypes.formView")}
2021-09-29 08:51:47 +00:00
id="formView-profilesView"
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
className="kc-form-radio-btn pf-u-mr-sm pf-u-ml-sm"
2021-09-29 08:51:47 +00:00
data-testid="formView-profilesView"
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
/>
</FlexItem>
<FlexItem>
<Radio
isChecked={show}
2021-09-29 08:51:47 +00:00
name="profilesView"
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
onChange={() => setShow(true)}
label={t("profilesConfigTypes.jsonEditor")}
2021-09-29 08:51:47 +00:00
id="jsonEditor-profilesView"
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
className="kc-editor-radio-btn"
2021-09-29 08:51:47 +00:00
data-testid="jsonEditor-profilesView"
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
/>
</FlexItem>
</Flex>
</PageSection>
<Divider />
{!show ? (
<KeycloakDataTable
2021-09-29 08:51:47 +00:00
key={tableProfiles.length}
ariaLabelKey="realm-settings:profiles"
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
searchPlaceholderKey="realm-settings:clientProfileSearch"
loader={loader}
toolbarItem={
<ToolbarItem>
<Button
id="createProfile"
component={(props) => (
<Link
{...props}
to={toAddClientProfile({ realm, tab: "profiles" })}
/>
)}
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
data-testid="createProfile"
>
{t("createClientProfile")}
</Button>
</ToolbarItem>
}
isRowDisabled={(value) => value.global}
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
actions={[
{
title: t("common:delete"),
onRowClick: (profile) => {
setSelectedProfile(profile);
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
toggleDeleteDialog();
},
} as Action<ClientProfile>,
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
]}
columns={[
{
name: "name",
displayKey: t("common:name"),
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
cellRenderer: cellFormatter,
},
{
name: "description",
displayKey: t("clientProfileDescription"),
},
]}
emptyState={
<ListEmptyState
message={t("emptyClientProfiles")}
instructions={t("emptyClientProfilesInstructions")}
/>
}
/>
) : (
<FormGroup fieldId={"jsonEditor"}>
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
<div className="pf-u-mt-md pf-u-ml-lg">
<CodeEditor
isLineNumbersVisible
isLanguageLabelVisible
isReadOnly={false}
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
code={code}
language={Language.json}
height="30rem"
onChange={(value) => {
setCode(value ?? "");
}}
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
/>
</div>
<ActionGroup>
<div className="pf-u-mt-md">
<Button
variant={ButtonVariant.primary}
className="pf-u-mr-md pf-u-ml-lg"
onClick={save}
data-testid="jsonEditor-saveBtn"
>
{t("save")}
</Button>
<Button
variant={ButtonVariant.link}
onClick={() => {
setCode(prettyPrintJSON(tableProfiles));
}}
data-testid="jsonEditor-reloadBtn"
>
{t("reload")}
</Button>
</div>
</ActionGroup>
</FormGroup>
Realm setting profiles (#1149) * admin-events-list: added PF code editor * realm-settings: added template for client policies tab * realm-settings: fixed space between text and q icon * admin-events-list: hardcoded representation dialog * realm-settings: css improvement * realm-settings: feedback applied * realm-settings: feedback applied * admin-events-list: fixed representation dialog * admin-events-list: fixed representation dialog * Update src/events/AdminEvents.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * admin-events-list: fixed representation dialog * real-settings-profile: added subtabs * realm-settings-list: added table displaying client profiles and delete dialog * realm-settings-list: updated column name * realm-settings-list: implemented radio button format change * realm-settings-list: added buttons for JSON editor * realm-settings-list: added isPaginated to profiles table * realm-settings-list: impoved css for json editor * realm-settings-list: fix for loader * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: feedback fixes * realm-settings-list: disbaled row when profile is global * realm-settings-new-profile: added template for new profile - wip * realm-settings-list: feedback fixes * Add some @ts-ignore comments for the links * Split routes into multiple files * realm-settings: temporarily hardcoded path for cancelling new profile btn, bumped admin-client dep * realm-settings: reverted back to Link Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
2021-09-20 12:42:07 +00:00
)}
</>
);
2021-10-29 16:11:06 +00:00
}