mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 17:37:37 -02:30
Adding prevent instance group fallback to inventory and jt defail screens
This commit is contained in:
@@ -2,7 +2,14 @@ import React, { useCallback, useEffect } from 'react';
|
|||||||
import { Link, useHistory } from 'react-router-dom';
|
import { Link, useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
import { Button, Chip } from '@patternfly/react-core';
|
import {
|
||||||
|
Button,
|
||||||
|
Chip,
|
||||||
|
TextList,
|
||||||
|
TextListItem,
|
||||||
|
TextListItemVariants,
|
||||||
|
TextListVariants,
|
||||||
|
} from '@patternfly/react-core';
|
||||||
import AlertModal from 'components/AlertModal';
|
import AlertModal from 'components/AlertModal';
|
||||||
import { CardBody, CardActionsRow } from 'components/Card';
|
import { CardBody, CardActionsRow } from 'components/Card';
|
||||||
import { DetailList, Detail, UserDateDetail } from 'components/DetailList';
|
import { DetailList, Detail, UserDateDetail } from 'components/DetailList';
|
||||||
@@ -50,9 +57,24 @@ function InventoryDetail({ inventory }) {
|
|||||||
const { organization, user_capabilities: userCapabilities } =
|
const { organization, user_capabilities: userCapabilities } =
|
||||||
inventory.summary_fields;
|
inventory.summary_fields;
|
||||||
|
|
||||||
|
const prevent_instance_group_fallback =
|
||||||
|
inventory.prevent_instance_group_fallback;
|
||||||
|
|
||||||
const deleteDetailsRequests =
|
const deleteDetailsRequests =
|
||||||
relatedResourceDeleteRequests.inventory(inventory);
|
relatedResourceDeleteRequests.inventory(inventory);
|
||||||
|
|
||||||
|
const renderOptionsField = prevent_instance_group_fallback;
|
||||||
|
|
||||||
|
const renderOptions = (
|
||||||
|
<TextList component={TextListVariants.ul}>
|
||||||
|
{prevent_instance_group_fallback && (
|
||||||
|
<TextListItem component={TextListItemVariants.li}>
|
||||||
|
{t`Prevent Instance Group Fallback`}
|
||||||
|
</TextListItem>
|
||||||
|
)}
|
||||||
|
</TextList>
|
||||||
|
);
|
||||||
|
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
return <ContentLoading />;
|
return <ContentLoading />;
|
||||||
}
|
}
|
||||||
@@ -104,6 +126,22 @@ function InventoryDetail({ inventory }) {
|
|||||||
isEmpty={instanceGroups.length === 0}
|
isEmpty={instanceGroups.length === 0}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{prevent_instance_group_fallback && (
|
||||||
|
<Detail
|
||||||
|
label={t`Prevent Instance Group Fallback`}
|
||||||
|
dataCy="inv-detail-prevent-instnace-group-fallback"
|
||||||
|
helpText={helpText.preventInstanceGroupFallback}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{renderOptionsField && (
|
||||||
|
<Detail
|
||||||
|
fullWidth
|
||||||
|
label={t`Enabled Options`}
|
||||||
|
value={renderOptions}
|
||||||
|
dataCy="jt-detail-enabled-options"
|
||||||
|
helpText={helpText.enabledOptions}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
{inventory.summary_fields.labels && (
|
{inventory.summary_fields.labels && (
|
||||||
<Detail
|
<Detail
|
||||||
fullWidth
|
fullWidth
|
||||||
|
|||||||
@@ -193,6 +193,11 @@ const getInventoryHelpTextStrings = () => ({
|
|||||||
the dropdown or enter a file within the input.`,
|
the dropdown or enter a file within the input.`,
|
||||||
preventInstanceGroupFallback: t`If enabled, the inventory will prevent adding any organization instance groups to the list of preferred instances groups to run associated job templates on.
|
preventInstanceGroupFallback: t`If enabled, the inventory will prevent adding any organization instance groups to the list of preferred instances groups to run associated job templates on.
|
||||||
Note: If this setting is enabled and you provided an empty list, the global instance groups will be applied.`,
|
Note: If this setting is enabled and you provided an empty list, the global instance groups will be applied.`,
|
||||||
|
enabledOptions: (
|
||||||
|
<>
|
||||||
|
<p>{t`Prevent Instance Group Fallback: If enabled, the inventory will prevent adding any organization instance groups to the list of preferred instances groups to run associated job templates on.`}</p>
|
||||||
|
</>
|
||||||
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default getInventoryHelpTextStrings;
|
export default getInventoryHelpTextStrings;
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ function JobTemplateDetail({ template }) {
|
|||||||
webhook_service,
|
webhook_service,
|
||||||
related: { webhook_receiver },
|
related: { webhook_receiver },
|
||||||
webhook_key,
|
webhook_key,
|
||||||
|
prevent_instance_group_fallback,
|
||||||
custom_virtualenv,
|
custom_virtualenv,
|
||||||
} = template;
|
} = template;
|
||||||
const { id: templateId } = useParams();
|
const { id: templateId } = useParams();
|
||||||
@@ -111,7 +112,8 @@ function JobTemplateDetail({ template }) {
|
|||||||
host_config_key ||
|
host_config_key ||
|
||||||
allow_simultaneous ||
|
allow_simultaneous ||
|
||||||
use_fact_cache ||
|
use_fact_cache ||
|
||||||
webhook_service;
|
webhook_service ||
|
||||||
|
prevent_instance_group_fallback;
|
||||||
|
|
||||||
const renderOptions = (
|
const renderOptions = (
|
||||||
<TextList component={TextListVariants.ul}>
|
<TextList component={TextListVariants.ul}>
|
||||||
@@ -140,6 +142,11 @@ function JobTemplateDetail({ template }) {
|
|||||||
{t`Webhooks`}
|
{t`Webhooks`}
|
||||||
</TextListItem>
|
</TextListItem>
|
||||||
)}
|
)}
|
||||||
|
{prevent_instance_group_fallback && (
|
||||||
|
<TextListItem component={TextListItemVariants.li}>
|
||||||
|
{t`Prevent Instance Group Fallback`}
|
||||||
|
</TextListItem>
|
||||||
|
)}
|
||||||
</TextList>
|
</TextList>
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -335,6 +342,13 @@ function JobTemplateDetail({ template }) {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{prevent_instance_group_fallback && (
|
||||||
|
<Detail
|
||||||
|
label={t`Prevent Instance Group Fallback`}
|
||||||
|
dataCy="jt-detail-prevent-instnace-group-fallback"
|
||||||
|
helpText={helpText.preventInstanceGroupFallback}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<UserDateDetail
|
<UserDateDetail
|
||||||
label={t`Created`}
|
label={t`Created`}
|
||||||
date={created}
|
date={created}
|
||||||
|
|||||||
Reference in New Issue
Block a user