mirror of
https://github.com/ansible/awx.git
synced 2026-01-18 13:11:19 -03:30
Adding prevent instance group fallback to inventory and jt defail screens
This commit is contained in:
parent
5ba0bf3a64
commit
420b3c8b84
@ -2,7 +2,14 @@ import React, { useCallback, useEffect } from 'react';
|
||||
import { Link, useHistory } from 'react-router-dom';
|
||||
|
||||
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 { CardBody, CardActionsRow } from 'components/Card';
|
||||
import { DetailList, Detail, UserDateDetail } from 'components/DetailList';
|
||||
@ -50,9 +57,24 @@ function InventoryDetail({ inventory }) {
|
||||
const { organization, user_capabilities: userCapabilities } =
|
||||
inventory.summary_fields;
|
||||
|
||||
const prevent_instance_group_fallback =
|
||||
inventory.prevent_instance_group_fallback;
|
||||
|
||||
const deleteDetailsRequests =
|
||||
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) {
|
||||
return <ContentLoading />;
|
||||
}
|
||||
@ -104,6 +126,22 @@ function InventoryDetail({ inventory }) {
|
||||
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 && (
|
||||
<Detail
|
||||
fullWidth
|
||||
|
||||
@ -193,6 +193,11 @@ const getInventoryHelpTextStrings = () => ({
|
||||
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.
|
||||
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;
|
||||
|
||||
@ -63,6 +63,7 @@ function JobTemplateDetail({ template }) {
|
||||
webhook_service,
|
||||
related: { webhook_receiver },
|
||||
webhook_key,
|
||||
prevent_instance_group_fallback,
|
||||
custom_virtualenv,
|
||||
} = template;
|
||||
const { id: templateId } = useParams();
|
||||
@ -111,7 +112,8 @@ function JobTemplateDetail({ template }) {
|
||||
host_config_key ||
|
||||
allow_simultaneous ||
|
||||
use_fact_cache ||
|
||||
webhook_service;
|
||||
webhook_service ||
|
||||
prevent_instance_group_fallback;
|
||||
|
||||
const renderOptions = (
|
||||
<TextList component={TextListVariants.ul}>
|
||||
@ -140,6 +142,11 @@ function JobTemplateDetail({ template }) {
|
||||
{t`Webhooks`}
|
||||
</TextListItem>
|
||||
)}
|
||||
{prevent_instance_group_fallback && (
|
||||
<TextListItem component={TextListItemVariants.li}>
|
||||
{t`Prevent Instance Group Fallback`}
|
||||
</TextListItem>
|
||||
)}
|
||||
</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
|
||||
label={t`Created`}
|
||||
date={created}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user