keycloak-scim/src/realm-settings/ProfilesTab.tsx

212 lines
6.4 KiB
TypeScript
Raw Normal View History

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 React, { useMemo, useState } from "react";
import { omit } from "lodash";
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 {
AlertVariant,
Button,
ButtonVariant,
Label,
PageSection,
ToolbarItem,
} from "@patternfly/react-core";
import { Divider, Flex, FlexItem, Radio, Title } from "@patternfly/react-core";
import { CodeEditor, Language } from "@patternfly/react-code-editor";
import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable";
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
import { useTranslation } from "react-i18next";
import { useAdminClient } from "../context/auth/AdminClient";
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
import { useRealm } from "../context/realm-context/RealmContext";
import { useAlerts } from "../components/alert/Alerts";
import { Link } from "react-router-dom";
import "./RealmSettingsSection.css";
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 { toNewClientProfile } from "./routes/NewClientProfile";
import type ClientProfileRepresentation from "@keycloak/keycloak-admin-client/lib/defs/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
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;
};
export const ProfilesTab = () => {
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 { t } = useTranslation("realm-settings");
const adminClient = useAdminClient();
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 [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
const loader = async () => {
const allProfiles = await adminClient.clientPolicies.listProfiles({
realm,
includeGlobalProfiles: true,
});
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
const globalProfiles = allProfiles.globalProfiles?.map(
(globalProfiles) => ({
...globalProfiles,
global: true,
})
);
const profiles = allProfiles.profiles?.map((profiles) => ({
...profiles,
global: false,
}));
const allClientProfiles = globalProfiles?.concat(profiles ?? []);
setTableProfiles(allClientProfiles);
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
return allClientProfiles ?? [];
};
const code = useMemo(
() => JSON.stringify(tableProfiles, null, 2),
[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 [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({
titleKey: t("deleteClientProfileConfirmTitle"),
messageKey: t("deleteClientProfileConfirm"),
continueButtonLabel: t("delete"),
continueButtonVariant: ButtonVariant.danger,
onConfirm: async () => {
const updatedProfiles = tableProfiles
?.filter(
(profile) => profile.name !== selectedProfile?.name && !profile.global
)
.map<ClientProfileRepresentation>((profile) => 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
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) => (
<Link to={""} key={row.name}>
{row.name} {""}
{row.global && <Label color="blue">{t("global")}</Label>}
</Link>
);
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}
name="formView"
onChange={() => setShow(false)}
label={t("profilesConfigTypes.formView")}
id="formView-radioBtn"
className="kc-form-radio-btn pf-u-mr-sm pf-u-ml-sm"
data-testid="formView-radioBtn"
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}
name="jsonEditor"
onChange={() => setShow(true)}
label={t("profilesConfigTypes.jsonEditor")}
id="jsonEditor-radioBtn"
className="kc-editor-radio-btn"
data-testid="jsonEditor-radioBtn"
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
key={key}
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
ariaLabelKey="userEventsRegistered"
searchPlaceholderKey="realm-settings:clientProfileSearch"
isPaginated
loader={loader}
toolbarItem={
<ToolbarItem>
<Button
id="createProfile"
component={Link}
// @ts-ignore
to={toNewClientProfile({ realm })}
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();
},
},
]}
columns={[
{
name: "name",
displayKey: t("clientProfileName"),
cellRenderer: cellFormatter,
},
{
name: "description",
displayKey: t("clientProfileDescription"),
},
]}
emptyState={
<ListEmptyState
message={t("emptyClientProfiles")}
instructions={t("emptyClientProfilesInstructions")}
/>
}
/>
) : (
<>
<div className="pf-u-mt-md pf-u-ml-lg">
<CodeEditor
isLineNumbersVisible
isLanguageLabelVisible
code={code}
language={Language.json}
height="30rem"
/>
</div>
<div className="pf-u-mt-md">
<Button
variant={ButtonVariant.primary}
className="pf-u-mr-md pf-u-ml-lg"
>
{t("save")}
</Button>
<Button variant={ButtonVariant.link}> {t("reload")}</Button>
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>
</>
)}
</>
);
};