mirror of
https://github.com/ansible/awx.git
synced 2026-05-10 19:07:36 -02:30
Fix UI peers_from_control_nodes (#14858)
* Fix UI peers_from_control_nodes Fixes bug where peers_from_control_node was greyed out in UI. Additional changes: - Make edit instance button only show for instances with managed = False - Make remove instance button only show for instances with managed = False - InstanceList selectable only for instances with managed = False --------- Signed-off-by: Seth Foster <fosterbseth@gmail.com>
This commit is contained in:
@@ -209,33 +209,31 @@ function InstanceDetail({ setBreadcrumb, isK8s }) {
|
|||||||
<Detail label={t`Node Type`} value={instance.node_type} />
|
<Detail label={t`Node Type`} value={instance.node_type} />
|
||||||
<Detail label={t`Host`} value={instance.ip_address} />
|
<Detail label={t`Host`} value={instance.ip_address} />
|
||||||
<Detail label={t`Listener Port`} value={instance.listener_port} />
|
<Detail label={t`Listener Port`} value={instance.listener_port} />
|
||||||
{(isExecutionNode || isHopNode || !isManaged) && (
|
{!isManaged && instance.related?.install_bundle && (
|
||||||
<>
|
<Detail
|
||||||
{instance.related?.install_bundle && (
|
label={t`Install Bundle`}
|
||||||
<Detail
|
value={
|
||||||
label={t`Install Bundle`}
|
<Tooltip content={t`Click to download bundle`}>
|
||||||
value={
|
<Button
|
||||||
<Tooltip content={t`Click to download bundle`}>
|
component="a"
|
||||||
<Button
|
isSmall
|
||||||
component="a"
|
href={`${instance.related?.install_bundle}`}
|
||||||
isSmall
|
target="_blank"
|
||||||
href={`${instance.related?.install_bundle}`}
|
variant="secondary"
|
||||||
target="_blank"
|
dataCy="install-bundle-download-button"
|
||||||
variant="secondary"
|
rel="noopener noreferrer"
|
||||||
dataCy="install-bundle-download-button"
|
>
|
||||||
rel="noopener noreferrer"
|
<DownloadIcon />
|
||||||
>
|
</Button>
|
||||||
<DownloadIcon />
|
</Tooltip>
|
||||||
</Button>
|
}
|
||||||
</Tooltip>
|
/>
|
||||||
}
|
)}
|
||||||
/>
|
{(isExecutionNode || isHopNode) && (
|
||||||
)}
|
<Detail
|
||||||
<Detail
|
label={t`Peers from control nodes`}
|
||||||
label={t`Peers from control nodes`}
|
value={instance.peers_from_control_nodes ? t`On` : t`Off`}
|
||||||
value={instance.peers_from_control_nodes ? t`On` : t`Off`}
|
/>
|
||||||
/>
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
{!isHopNode && (
|
{!isHopNode && (
|
||||||
<>
|
<>
|
||||||
@@ -341,9 +339,8 @@ function InstanceDetail({ setBreadcrumb, isK8s }) {
|
|||||||
)}
|
)}
|
||||||
</DetailList>
|
</DetailList>
|
||||||
<CardActionsRow>
|
<CardActionsRow>
|
||||||
{config?.me?.is_superuser &&
|
{config?.me?.is_superuser && isK8s && !isManaged && (
|
||||||
isK8s &&
|
<>
|
||||||
(isExecutionNode || isHopNode || !isManaged) && (
|
|
||||||
<Button
|
<Button
|
||||||
ouiaId="instance-detail-edit-button"
|
ouiaId="instance-detail-edit-button"
|
||||||
aria-label={t`edit`}
|
aria-label={t`edit`}
|
||||||
@@ -352,17 +349,14 @@ function InstanceDetail({ setBreadcrumb, isK8s }) {
|
|||||||
>
|
>
|
||||||
{t`Edit`}
|
{t`Edit`}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
|
||||||
{config?.me?.is_superuser &&
|
|
||||||
isK8s &&
|
|
||||||
(isExecutionNode || isHopNode || !isManaged) && (
|
|
||||||
<RemoveInstanceButton
|
<RemoveInstanceButton
|
||||||
dataCy="remove-instance-button"
|
dataCy="remove-instance-button"
|
||||||
itemsToRemove={[instance]}
|
itemsToRemove={[instance]}
|
||||||
isK8s={isK8s}
|
isK8s={isK8s}
|
||||||
onRemove={removeInstances}
|
onRemove={removeInstances}
|
||||||
/>
|
/>
|
||||||
)}
|
</>
|
||||||
|
)}
|
||||||
{isExecutionNode && (
|
{isExecutionNode && (
|
||||||
<Tooltip content={t`Run a health check on the instance`}>
|
<Tooltip content={t`Run a health check on the instance`}>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -114,7 +114,6 @@ function InstanceListItem({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const isHopNode = instance.node_type === 'hop';
|
const isHopNode = instance.node_type === 'hop';
|
||||||
const isExecutionNode = instance.node_type === 'execution';
|
|
||||||
const isManaged = instance.managed;
|
const isManaged = instance.managed;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -140,7 +139,7 @@ function InstanceListItem({
|
|||||||
rowIndex,
|
rowIndex,
|
||||||
isSelected,
|
isSelected,
|
||||||
onSelect,
|
onSelect,
|
||||||
disable: !(isExecutionNode || isHopNode || isManaged),
|
disable: isManaged,
|
||||||
}}
|
}}
|
||||||
dataLabel={t`Selected`}
|
dataLabel={t`Selected`}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const INSTANCE_TYPES = [
|
|||||||
{ id: 'hop', name: t`Hop` },
|
{ id: 'hop', name: t`Hop` },
|
||||||
];
|
];
|
||||||
|
|
||||||
function InstanceFormFields({ isEdit, instance }) {
|
function InstanceFormFields({ isEdit }) {
|
||||||
const [instanceTypeField, instanceTypeMeta, instanceTypeHelpers] = useField({
|
const [instanceTypeField, instanceTypeMeta, instanceTypeHelpers] = useField({
|
||||||
name: 'node_type',
|
name: 'node_type',
|
||||||
validate: required(t`Set a value for this field`),
|
validate: required(t`Set a value for this field`),
|
||||||
@@ -98,7 +98,6 @@ function InstanceFormFields({ isEdit, instance }) {
|
|||||||
name="peers_from_control_nodes"
|
name="peers_from_control_nodes"
|
||||||
label={t`Peers from control nodes`}
|
label={t`Peers from control nodes`}
|
||||||
tooltip={t`If enabled, control nodes will peer to this instance automatically. If disabled, instance will be connected only to associated peers.`}
|
tooltip={t`If enabled, control nodes will peer to this instance automatically. If disabled, instance will be connected only to associated peers.`}
|
||||||
isDisabled={parseInt(instance.listener_port, 10) < 1024 || true}
|
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
</>
|
</>
|
||||||
@@ -139,7 +138,7 @@ function InstanceForm({
|
|||||||
{(formik) => (
|
{(formik) => (
|
||||||
<Form autoComplete="off" onSubmit={formik.handleSubmit}>
|
<Form autoComplete="off" onSubmit={formik.handleSubmit}>
|
||||||
<FormColumnLayout>
|
<FormColumnLayout>
|
||||||
<InstanceFormFields isEdit={isEdit} instance={instance} />
|
<InstanceFormFields isEdit={isEdit} />
|
||||||
<FormSubmitError error={submitError} />
|
<FormSubmitError error={submitError} />
|
||||||
<FormActionGroup
|
<FormActionGroup
|
||||||
onCancel={handleCancel}
|
onCancel={handleCancel}
|
||||||
|
|||||||
Reference in New Issue
Block a user