Hide clustering section when not publicClient (#2186)
This commit is contained in:
parent
dd35ccb9bf
commit
2cb4fcc29d
1 changed files with 123 additions and 117 deletions
|
@ -50,6 +50,7 @@ export const AdvancedTab = ({
|
|||
save,
|
||||
client: {
|
||||
id,
|
||||
publicClient,
|
||||
registeredNodes,
|
||||
attributes,
|
||||
protocol,
|
||||
|
@ -175,6 +176,9 @@ export const AdvancedTab = ({
|
|||
if (protocol === openIdConnect) {
|
||||
sections.splice(3, 0, t("openIdConnectCompatibilityModes"));
|
||||
}
|
||||
if (!publicClient) {
|
||||
sections.splice(1, 1);
|
||||
}
|
||||
|
||||
return (
|
||||
<PageSection variant="light" className="pf-u-py-0">
|
||||
|
@ -247,128 +251,130 @@ export const AdvancedTab = ({
|
|||
</ActionGroup>
|
||||
</FormAccess>
|
||||
</>
|
||||
<>
|
||||
<FormAccess role="manage-clients" isHorizontal>
|
||||
<FormGroup
|
||||
label={t("nodeReRegistrationTimeout")}
|
||||
fieldId="kc-node-reregistration-timeout"
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText="clients-help:nodeReRegistrationTimeout"
|
||||
fieldLabelId="clients:nodeReRegistrationTimeout"
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Split hasGutter>
|
||||
<SplitItem>
|
||||
<Controller
|
||||
name="nodeReRegistrationTimeout"
|
||||
defaultValue=""
|
||||
control={control}
|
||||
render={({ onChange, value }) => (
|
||||
<TimeSelector value={value} onChange={onChange} />
|
||||
)}
|
||||
/>
|
||||
</SplitItem>
|
||||
<SplitItem>
|
||||
<Button
|
||||
variant={ButtonVariant.secondary}
|
||||
onClick={() => save()}
|
||||
>
|
||||
{t("common:save")}
|
||||
</Button>
|
||||
</SplitItem>
|
||||
</Split>
|
||||
</FormGroup>
|
||||
</FormAccess>
|
||||
{publicClient && (
|
||||
<>
|
||||
<DeleteNodeConfirm />
|
||||
<AddHostDialog
|
||||
clientId={id!}
|
||||
isOpen={addNodeOpen}
|
||||
onAdded={(node) => {
|
||||
nodes[node] = moment.now() / 1000;
|
||||
refresh();
|
||||
}}
|
||||
onClose={() => setAddNodeOpen(false)}
|
||||
/>
|
||||
<ExpandableSection
|
||||
toggleText={t("registeredClusterNodes")}
|
||||
onToggle={setExpanded}
|
||||
isExpanded={expanded}
|
||||
>
|
||||
<KeycloakDataTable
|
||||
key={key}
|
||||
ariaLabelKey="registeredClusterNodes"
|
||||
loader={() =>
|
||||
Promise.resolve(
|
||||
Object.entries(nodes || {}).map((entry) => {
|
||||
return { host: entry[0], registration: entry[1] };
|
||||
})
|
||||
)
|
||||
}
|
||||
toolbarItem={
|
||||
<>
|
||||
<ToolbarItem>
|
||||
<Button
|
||||
id="testClusterAvailability"
|
||||
onClick={testCluster}
|
||||
variant={ButtonVariant.secondary}
|
||||
isDisabled={Object.keys(nodes).length === 0}
|
||||
>
|
||||
{t("testClusterAvailability")}
|
||||
</Button>
|
||||
</ToolbarItem>
|
||||
<ToolbarItem>
|
||||
<Button
|
||||
id="registerNodeManually"
|
||||
onClick={() => setAddNodeOpen(true)}
|
||||
variant={ButtonVariant.tertiary}
|
||||
>
|
||||
{t("registerNodeManually")}
|
||||
</Button>
|
||||
</ToolbarItem>
|
||||
</>
|
||||
}
|
||||
actions={[
|
||||
{
|
||||
title: t("common:delete"),
|
||||
onRowClick: (node) => {
|
||||
setSelectedNode(node.host);
|
||||
toggleDeleteNodeConfirm();
|
||||
},
|
||||
},
|
||||
]}
|
||||
columns={[
|
||||
{
|
||||
name: "host",
|
||||
displayKey: "clients:nodeHost",
|
||||
},
|
||||
{
|
||||
name: "registration",
|
||||
displayKey: "clients:lastRegistration",
|
||||
cellFormatters: [
|
||||
(value) =>
|
||||
value
|
||||
? moment(parseInt(value.toString()) * 1000).format(
|
||||
"LLL"
|
||||
)
|
||||
: "",
|
||||
],
|
||||
},
|
||||
]}
|
||||
emptyState={
|
||||
<ListEmptyState
|
||||
message={t("noNodes")}
|
||||
instructions={t("noNodesInstructions")}
|
||||
primaryActionText={t("registerNodeManually")}
|
||||
onPrimaryAction={() => setAddNodeOpen(true)}
|
||||
<FormAccess role="manage-clients" isHorizontal>
|
||||
<FormGroup
|
||||
label={t("nodeReRegistrationTimeout")}
|
||||
fieldId="kc-node-reregistration-timeout"
|
||||
labelIcon={
|
||||
<HelpItem
|
||||
helpText="clients-help:nodeReRegistrationTimeout"
|
||||
fieldLabelId="clients:nodeReRegistrationTimeout"
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Split hasGutter>
|
||||
<SplitItem>
|
||||
<Controller
|
||||
name="nodeReRegistrationTimeout"
|
||||
defaultValue=""
|
||||
control={control}
|
||||
render={({ onChange, value }) => (
|
||||
<TimeSelector value={value} onChange={onChange} />
|
||||
)}
|
||||
/>
|
||||
</SplitItem>
|
||||
<SplitItem>
|
||||
<Button
|
||||
variant={ButtonVariant.secondary}
|
||||
onClick={() => save()}
|
||||
>
|
||||
{t("common:save")}
|
||||
</Button>
|
||||
</SplitItem>
|
||||
</Split>
|
||||
</FormGroup>
|
||||
</FormAccess>
|
||||
<>
|
||||
<DeleteNodeConfirm />
|
||||
<AddHostDialog
|
||||
clientId={id!}
|
||||
isOpen={addNodeOpen}
|
||||
onAdded={(node) => {
|
||||
nodes[node] = moment.now() / 1000;
|
||||
refresh();
|
||||
}}
|
||||
onClose={() => setAddNodeOpen(false)}
|
||||
/>
|
||||
</ExpandableSection>
|
||||
<ExpandableSection
|
||||
toggleText={t("registeredClusterNodes")}
|
||||
onToggle={setExpanded}
|
||||
isExpanded={expanded}
|
||||
>
|
||||
<KeycloakDataTable
|
||||
key={key}
|
||||
ariaLabelKey="registeredClusterNodes"
|
||||
loader={() =>
|
||||
Promise.resolve(
|
||||
Object.entries(nodes || {}).map((entry) => {
|
||||
return { host: entry[0], registration: entry[1] };
|
||||
})
|
||||
)
|
||||
}
|
||||
toolbarItem={
|
||||
<>
|
||||
<ToolbarItem>
|
||||
<Button
|
||||
id="testClusterAvailability"
|
||||
onClick={testCluster}
|
||||
variant={ButtonVariant.secondary}
|
||||
isDisabled={Object.keys(nodes).length === 0}
|
||||
>
|
||||
{t("testClusterAvailability")}
|
||||
</Button>
|
||||
</ToolbarItem>
|
||||
<ToolbarItem>
|
||||
<Button
|
||||
id="registerNodeManually"
|
||||
onClick={() => setAddNodeOpen(true)}
|
||||
variant={ButtonVariant.tertiary}
|
||||
>
|
||||
{t("registerNodeManually")}
|
||||
</Button>
|
||||
</ToolbarItem>
|
||||
</>
|
||||
}
|
||||
actions={[
|
||||
{
|
||||
title: t("common:delete"),
|
||||
onRowClick: (node) => {
|
||||
setSelectedNode(node.host);
|
||||
toggleDeleteNodeConfirm();
|
||||
},
|
||||
},
|
||||
]}
|
||||
columns={[
|
||||
{
|
||||
name: "host",
|
||||
displayKey: "clients:nodeHost",
|
||||
},
|
||||
{
|
||||
name: "registration",
|
||||
displayKey: "clients:lastRegistration",
|
||||
cellFormatters: [
|
||||
(value) =>
|
||||
value
|
||||
? moment(parseInt(value.toString()) * 1000).format(
|
||||
"LLL"
|
||||
)
|
||||
: "",
|
||||
],
|
||||
},
|
||||
]}
|
||||
emptyState={
|
||||
<ListEmptyState
|
||||
message={t("noNodes")}
|
||||
instructions={t("noNodesInstructions")}
|
||||
primaryActionText={t("registerNodeManually")}
|
||||
onPrimaryAction={() => setAddNodeOpen(true)}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</ExpandableSection>
|
||||
</>
|
||||
</>
|
||||
</>
|
||||
)}
|
||||
<>
|
||||
{protocol === openIdConnect && (
|
||||
<>
|
||||
|
|
Loading…
Reference in a new issue