mirror of
https://github.com/ansible/awx.git
synced 2026-05-09 18:37:36 -02:30
Change Options to Enabled Options in various details views
This commit is contained in:
committed by
Shane McDonald
parent
2c5bcf268d
commit
7a455d08d7
@@ -1,9 +1,13 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
import {
|
||||||
import { Chip, List, ListItem } from '@patternfly/react-core';
|
Chip,
|
||||||
|
TextList,
|
||||||
|
TextListItem,
|
||||||
|
TextListVariants,
|
||||||
|
TextListItemVariants,
|
||||||
|
} from '@patternfly/react-core';
|
||||||
import { Detail, DeletedDetail } from '../DetailList';
|
import { Detail, DeletedDetail } from '../DetailList';
|
||||||
import { VariablesDetail } from '../CodeEditor';
|
import { VariablesDetail } from '../CodeEditor';
|
||||||
import CredentialChip from '../CredentialChip';
|
import CredentialChip from '../CredentialChip';
|
||||||
@@ -44,14 +48,28 @@ function PromptInventorySourceDetail({ resource }) {
|
|||||||
update_on_project_update
|
update_on_project_update
|
||||||
) {
|
) {
|
||||||
optionsList = (
|
optionsList = (
|
||||||
<List>
|
<TextList component={TextListVariants.ul}>
|
||||||
{overwrite && <ListItem>{t`Overwrite`}</ListItem>}
|
{overwrite && (
|
||||||
{overwrite_vars && <ListItem>{t`Overwrite Variables`}</ListItem>}
|
<TextListItem component={TextListItemVariants.li}>
|
||||||
{update_on_launch && <ListItem>{t`Update on Launch`}</ListItem>}
|
{t`Overwrite local groups and hosts from remote inventory source`}
|
||||||
{update_on_project_update && (
|
</TextListItem>
|
||||||
<ListItem>{t`Update on Project Update`}</ListItem>
|
|
||||||
)}
|
)}
|
||||||
</List>
|
{overwrite_vars && (
|
||||||
|
<TextListItem component={TextListItemVariants.li}>
|
||||||
|
{t`Overwrite local variables from remote inventory source`}
|
||||||
|
</TextListItem>
|
||||||
|
)}
|
||||||
|
{update_on_launch && (
|
||||||
|
<TextListItem component={TextListItemVariants.li}>
|
||||||
|
{t`Update on launch`}
|
||||||
|
</TextListItem>
|
||||||
|
)}
|
||||||
|
{update_on_project_update && (
|
||||||
|
<TextListItem component={TextListItemVariants.li}>
|
||||||
|
{t`Update on project update`}
|
||||||
|
</TextListItem>
|
||||||
|
)}
|
||||||
|
</TextList>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,7 +180,9 @@ function PromptInventorySourceDetail({ resource }) {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{optionsList && <Detail label={t`Options`} value={optionsList} />}
|
{optionsList && (
|
||||||
|
<Detail fullWidth label={t`Enabled Options`} value={optionsList} />
|
||||||
|
)}
|
||||||
{source_vars && (
|
{source_vars && (
|
||||||
<VariablesDetail
|
<VariablesDetail
|
||||||
label={t`Source Variables`}
|
label={t`Source Variables`}
|
||||||
|
|||||||
@@ -60,12 +60,14 @@ describe('PromptInventorySourceDetail', () => {
|
|||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
wrapper
|
wrapper
|
||||||
.find('Detail[label="Options"]')
|
.find('Detail[label="Enabled Options"]')
|
||||||
.containsAllMatchingElements([
|
.containsAllMatchingElements([
|
||||||
<li>Overwrite</li>,
|
<li>
|
||||||
<li>Overwrite Variables</li>,
|
Overwrite local groups and hosts from remote inventory source
|
||||||
<li>Update on Launch</li>,
|
</li>,
|
||||||
<li>Update on Project Update</li>,
|
<li>Overwrite local variables from remote inventory source</li>,
|
||||||
|
<li>Update on launch</li>,
|
||||||
|
<li>Update on project update</li>,
|
||||||
])
|
])
|
||||||
).toEqual(true);
|
).toEqual(true);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
import {
|
||||||
import { Chip, List, ListItem } from '@patternfly/react-core';
|
Chip,
|
||||||
|
TextList,
|
||||||
|
TextListItem,
|
||||||
|
TextListVariants,
|
||||||
|
TextListItemVariants,
|
||||||
|
} from '@patternfly/react-core';
|
||||||
import CredentialChip from '../CredentialChip';
|
import CredentialChip from '../CredentialChip';
|
||||||
import ChipGroup from '../ChipGroup';
|
import ChipGroup from '../ChipGroup';
|
||||||
import Sparkline from '../Sparkline';
|
import Sparkline from '../Sparkline';
|
||||||
@@ -51,19 +55,37 @@ function PromptJobTemplateDetail({ resource }) {
|
|||||||
become_enabled ||
|
become_enabled ||
|
||||||
host_config_key ||
|
host_config_key ||
|
||||||
allow_simultaneous ||
|
allow_simultaneous ||
|
||||||
use_fact_cache
|
use_fact_cache ||
|
||||||
|
webhook_service
|
||||||
) {
|
) {
|
||||||
optionsList = (
|
optionsList = (
|
||||||
<List>
|
<TextList component={TextListVariants.ul}>
|
||||||
{become_enabled && (
|
{become_enabled && (
|
||||||
<ListItem>{t`Enable Privilege Escalation`}</ListItem>
|
<TextListItem component={TextListItemVariants.li}>
|
||||||
|
{t`Privilege Escalation`}
|
||||||
|
</TextListItem>
|
||||||
)}
|
)}
|
||||||
{host_config_key && (
|
{host_config_key && (
|
||||||
<ListItem>{t`Allow Provisioning Callbacks`}</ListItem>
|
<TextListItem component={TextListItemVariants.li}>
|
||||||
|
{t`Provisioning Callbacks`}
|
||||||
|
</TextListItem>
|
||||||
)}
|
)}
|
||||||
{allow_simultaneous && <ListItem>{t`Enable Concurrent Jobs`}</ListItem>}
|
{allow_simultaneous && (
|
||||||
{use_fact_cache && <ListItem>{t`Use Fact Storage`}</ListItem>}
|
<TextListItem component={TextListItemVariants.li}>
|
||||||
</List>
|
{t`Concurrent Jobs`}
|
||||||
|
</TextListItem>
|
||||||
|
)}
|
||||||
|
{use_fact_cache && (
|
||||||
|
<TextListItem component={TextListItemVariants.li}>
|
||||||
|
{t`Fact Storage`}
|
||||||
|
</TextListItem>
|
||||||
|
)}
|
||||||
|
{webhook_service && (
|
||||||
|
<TextListItem component={TextListItemVariants.li}>
|
||||||
|
{t`Webhooks`}
|
||||||
|
</TextListItem>
|
||||||
|
)}
|
||||||
|
</TextList>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +186,7 @@ function PromptJobTemplateDetail({ resource }) {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{optionsList && <Detail label={t`Options`} value={optionsList} />}
|
{optionsList && <Detail label={t`Enabled Options`} value={optionsList} />}
|
||||||
{summary_fields?.credentials?.length > 0 && (
|
{summary_fields?.credentials?.length > 0 && (
|
||||||
<Detail
|
<Detail
|
||||||
fullWidth
|
fullWidth
|
||||||
|
|||||||
@@ -96,12 +96,13 @@ describe('PromptJobTemplateDetail', () => {
|
|||||||
).toEqual(true);
|
).toEqual(true);
|
||||||
expect(
|
expect(
|
||||||
wrapper
|
wrapper
|
||||||
.find('Detail[label="Options"]')
|
.find('Detail[label="Enabled Options"]')
|
||||||
.containsAllMatchingElements([
|
.containsAllMatchingElements([
|
||||||
<li>Enable Privilege Escalation</li>,
|
<li>Privilege Escalation</li>,
|
||||||
<li>Allow Provisioning Callbacks</li>,
|
<li>Provisioning Callbacks</li>,
|
||||||
<li>Enable Concurrent Jobs</li>,
|
<li>Concurrent Jobs</li>,
|
||||||
<li>Use Fact Storage</li>,
|
<li>Fact Storage</li>,
|
||||||
|
<li>Webhooks</li>,
|
||||||
])
|
])
|
||||||
).toEqual(true);
|
).toEqual(true);
|
||||||
expect(wrapper.find('VariablesDetail').prop('value')).toEqual(
|
expect(wrapper.find('VariablesDetail').prop('value')).toEqual(
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
import { List, ListItem } from '@patternfly/react-core';
|
import {
|
||||||
|
TextList,
|
||||||
|
TextListItem,
|
||||||
|
TextListVariants,
|
||||||
|
TextListItemVariants,
|
||||||
|
} from '@patternfly/react-core';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { Config } from '../../contexts/Config';
|
import { Config } from '../../contexts/Config';
|
||||||
|
|
||||||
import { Detail, DeletedDetail } from '../DetailList';
|
import { Detail, DeletedDetail } from '../DetailList';
|
||||||
import CredentialChip from '../CredentialChip';
|
import CredentialChip from '../CredentialChip';
|
||||||
import { toTitleCase } from '../../util/strings';
|
import { toTitleCase } from '../../util/strings';
|
||||||
@@ -36,17 +39,33 @@ function PromptProjectDetail({ resource }) {
|
|||||||
allow_override
|
allow_override
|
||||||
) {
|
) {
|
||||||
optionsList = (
|
optionsList = (
|
||||||
<List>
|
<TextList component={TextListVariants.ul}>
|
||||||
{scm_clean && <ListItem>{t`Clean`}</ListItem>}
|
{scm_clean && (
|
||||||
{scm_delete_on_update && <ListItem>{t`Delete on Update`}</ListItem>}
|
<TextListItem
|
||||||
|
component={TextListItemVariants.li}
|
||||||
|
>{t`Discard local changes before syncing`}</TextListItem>
|
||||||
|
)}
|
||||||
|
{scm_delete_on_update && (
|
||||||
|
<TextListItem
|
||||||
|
component={TextListItemVariants.li}
|
||||||
|
>{t`Delete the project before syncing`}</TextListItem>
|
||||||
|
)}
|
||||||
{scm_track_submodules && (
|
{scm_track_submodules && (
|
||||||
<ListItem>{t`Track submodules latest commit on branch`}</ListItem>
|
<TextListItem
|
||||||
|
component={TextListItemVariants.li}
|
||||||
|
>{t`Track submodules latest commit on branch`}</TextListItem>
|
||||||
)}
|
)}
|
||||||
{scm_update_on_launch && (
|
{scm_update_on_launch && (
|
||||||
<ListItem>{t`Update Revision on Launch`}</ListItem>
|
<TextListItem
|
||||||
|
component={TextListItemVariants.li}
|
||||||
|
>{t`Update revision on job launch`}</TextListItem>
|
||||||
)}
|
)}
|
||||||
{allow_override && <ListItem>{t`Allow Branch Override`}</ListItem>}
|
{allow_override && (
|
||||||
</List>
|
<TextListItem
|
||||||
|
component={TextListItemVariants.li}
|
||||||
|
>{t`Allow branch override`}</TextListItem>
|
||||||
|
)}
|
||||||
|
</TextList>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +109,7 @@ function PromptProjectDetail({ resource }) {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{optionsList && <Detail label={t`Options`} value={optionsList} />}
|
{optionsList && <Detail label={t`Enabled Options`} value={optionsList} />}
|
||||||
<Detail
|
<Detail
|
||||||
label={t`Cache Timeout`}
|
label={t`Cache Timeout`}
|
||||||
value={`${scm_update_cache_timeout} ${t`Seconds`}`}
|
value={`${scm_update_cache_timeout} ${t`Seconds`}`}
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ describe('PromptProjectDetail', () => {
|
|||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
wrapper = mountWithContexts(
|
wrapper = mountWithContexts(
|
||||||
<PromptProjectDetail resource={mockProject} />,
|
<PromptProjectDetail
|
||||||
|
resource={{ ...mockProject, scm_track_submodules: true }}
|
||||||
|
/>,
|
||||||
{
|
{
|
||||||
context: { config },
|
context: { config },
|
||||||
}
|
}
|
||||||
@@ -54,12 +56,13 @@ describe('PromptProjectDetail', () => {
|
|||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
wrapper
|
wrapper
|
||||||
.find('Detail[label="Options"]')
|
.find('Detail[label="Enabled Options"]')
|
||||||
.containsAllMatchingElements([
|
.containsAllMatchingElements([
|
||||||
<li>Clean</li>,
|
<li>Discard local changes before syncing</li>,
|
||||||
<li>Delete on Update</li>,
|
<li>Delete the project before syncing</li>,
|
||||||
<li>Update Revision on Launch</li>,
|
<li>Track submodules latest commit on branch</li>,
|
||||||
<li>Allow Branch Override</li>,
|
<li>Update revision on job launch</li>,
|
||||||
|
<li>Allow branch override</li>,
|
||||||
])
|
])
|
||||||
).toEqual(true);
|
).toEqual(true);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
import {
|
||||||
import { Chip, List, ListItem } from '@patternfly/react-core';
|
Chip,
|
||||||
|
TextList,
|
||||||
|
TextListItem,
|
||||||
|
TextListVariants,
|
||||||
|
TextListItemVariants,
|
||||||
|
} from '@patternfly/react-core';
|
||||||
import CredentialChip from '../CredentialChip';
|
import CredentialChip from '../CredentialChip';
|
||||||
import ChipGroup from '../ChipGroup';
|
import ChipGroup from '../ChipGroup';
|
||||||
import { Detail } from '../DetailList';
|
import { Detail } from '../DetailList';
|
||||||
@@ -26,10 +30,18 @@ function PromptWFJobTemplateDetail({ resource }) {
|
|||||||
let optionsList = '';
|
let optionsList = '';
|
||||||
if (allow_simultaneous || webhook_service) {
|
if (allow_simultaneous || webhook_service) {
|
||||||
optionsList = (
|
optionsList = (
|
||||||
<List>
|
<TextList component={TextListVariants.ul}>
|
||||||
{allow_simultaneous && <ListItem>{t`Enable Concurrent Jobs`}</ListItem>}
|
{allow_simultaneous && (
|
||||||
{webhook_service && <ListItem>{t`Enable Webhooks`}</ListItem>}
|
<TextListItem component={TextListItemVariants.li}>
|
||||||
</List>
|
{t`Concurrent Jobs`}
|
||||||
|
</TextListItem>
|
||||||
|
)}
|
||||||
|
{webhook_service && (
|
||||||
|
<TextListItem component={TextListItemVariants.li}>
|
||||||
|
{t`Webhooks`}
|
||||||
|
</TextListItem>
|
||||||
|
)}
|
||||||
|
</TextList>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,7 +94,7 @@ function PromptWFJobTemplateDetail({ resource }) {
|
|||||||
value={`${window.location.origin}${related.webhook_receiver}`}
|
value={`${window.location.origin}${related.webhook_receiver}`}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{optionsList && <Detail label={t`Options`} value={optionsList} />}
|
{optionsList && <Detail label={t`Enabled Options`} value={optionsList} />}
|
||||||
{summary_fields?.webhook_credential && (
|
{summary_fields?.webhook_credential && (
|
||||||
<Detail
|
<Detail
|
||||||
fullWidth
|
fullWidth
|
||||||
|
|||||||
@@ -38,10 +38,10 @@ describe('PromptWFJobTemplateDetail', () => {
|
|||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
wrapper
|
wrapper
|
||||||
.find('Detail[label="Options"]')
|
.find('Detail[label="Enabled Options"]')
|
||||||
.containsAllMatchingElements([
|
.containsAllMatchingElements([
|
||||||
<li>Enable Concurrent Jobs</li>,
|
<li>Concurrent Jobs</li>,
|
||||||
<li>Enable Webhooks</li>,
|
<li>Webhooks</li>,
|
||||||
])
|
])
|
||||||
).toEqual(true);
|
).toEqual(true);
|
||||||
expect(
|
expect(
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
import React, { Fragment, useEffect, useCallback } from 'react';
|
import React, { Fragment, useEffect, useCallback } 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 styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { Button, List, ListItem } from '@patternfly/react-core';
|
import {
|
||||||
|
Button,
|
||||||
|
TextList,
|
||||||
|
TextListItem,
|
||||||
|
TextListVariants,
|
||||||
|
TextListItemVariants,
|
||||||
|
} 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 ContentError from '../../../components/ContentError';
|
import ContentError from '../../../components/ContentError';
|
||||||
@@ -134,15 +139,7 @@ function CredentialDetail({ credential }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (type === 'boolean') {
|
if (type === 'boolean') {
|
||||||
return (
|
return null;
|
||||||
<Detail
|
|
||||||
dataCy={`credential-${id}-detail`}
|
|
||||||
id={`credential-${id}-detail`}
|
|
||||||
key={id}
|
|
||||||
label={t`Options`}
|
|
||||||
value={<List>{inputs[id] && <ListItem>{label}</ListItem>}</List>}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inputs[id] === '$encrypted$') {
|
if (inputs[id] === '$encrypted$') {
|
||||||
@@ -189,6 +186,10 @@ function CredentialDetail({ credential }) {
|
|||||||
credential
|
credential
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const enabledBooleanFields = fields.filter(
|
||||||
|
({ id, type }) => type === 'boolean' && inputs[id]
|
||||||
|
);
|
||||||
|
|
||||||
if (hasContentLoading) {
|
if (hasContentLoading) {
|
||||||
return <ContentLoading />;
|
return <ContentLoading />;
|
||||||
}
|
}
|
||||||
@@ -255,6 +256,20 @@ function CredentialDetail({ credential }) {
|
|||||||
date={modified}
|
date={modified}
|
||||||
user={modified_by}
|
user={modified_by}
|
||||||
/>
|
/>
|
||||||
|
{enabledBooleanFields.length > 0 && (
|
||||||
|
<Detail
|
||||||
|
label={t`Enabled Options`}
|
||||||
|
value={
|
||||||
|
<TextList component={TextListVariants.ul}>
|
||||||
|
{enabledBooleanFields.map(({ id, label }) => (
|
||||||
|
<TextListItem key={id} component={TextListItemVariants.li}>
|
||||||
|
{label}
|
||||||
|
</TextListItem>
|
||||||
|
))}
|
||||||
|
</TextList>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</DetailList>
|
</DetailList>
|
||||||
{Object.keys(inputSources).length > 0 && (
|
{Object.keys(inputSources).length > 0 && (
|
||||||
<PluginFieldText>
|
<PluginFieldText>
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ describe('<CredentialDetail />', () => {
|
|||||||
'Privilege Escalation Password',
|
'Privilege Escalation Password',
|
||||||
'Prompt on launch'
|
'Prompt on launch'
|
||||||
);
|
);
|
||||||
expect(wrapper.find(`Detail[label="Options"] ListItem`).text()).toEqual(
|
expect(wrapper.find(`Detail[label="Enabled Options"] li`).text()).toEqual(
|
||||||
'Authorize'
|
'Authorize'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
import React, { useCallback, useEffect, useState } from 'react';
|
import React, { useCallback, useEffect, useState } 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 {
|
||||||
import { Button, List, ListItem } from '@patternfly/react-core';
|
Button,
|
||||||
|
TextList,
|
||||||
|
TextListItem,
|
||||||
|
TextListVariants,
|
||||||
|
TextListItemVariants,
|
||||||
|
} 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 { VariablesDetail } from '../../../components/CodeEditor';
|
import { VariablesDetail } from '../../../components/CodeEditor';
|
||||||
@@ -19,7 +23,6 @@ import {
|
|||||||
UserDateDetail,
|
UserDateDetail,
|
||||||
} from '../../../components/DetailList';
|
} from '../../../components/DetailList';
|
||||||
import ErrorDetail from '../../../components/ErrorDetail';
|
import ErrorDetail from '../../../components/ErrorDetail';
|
||||||
import Popover from '../../../components/Popover';
|
|
||||||
import useRequest from '../../../util/useRequest';
|
import useRequest from '../../../util/useRequest';
|
||||||
import { InventorySourcesAPI } from '../../../api';
|
import { InventorySourcesAPI } from '../../../api';
|
||||||
import { relatedResourceDeleteRequests } from '../../../util/getRelatedResourceDeleteDetails';
|
import { relatedResourceDeleteRequests } from '../../../util/getRelatedResourceDeleteDetails';
|
||||||
@@ -112,71 +115,28 @@ function InventorySourceDetail({ inventorySource }) {
|
|||||||
update_on_project_update
|
update_on_project_update
|
||||||
) {
|
) {
|
||||||
optionsList = (
|
optionsList = (
|
||||||
<List>
|
<TextList component={TextListVariants.ul}>
|
||||||
{overwrite && (
|
{overwrite && (
|
||||||
<ListItem>
|
<TextListItem component={TextListItemVariants.li}>
|
||||||
{t`Overwrite`}
|
{t`Overwrite local groups and hosts from remote inventory source`}
|
||||||
<Popover
|
</TextListItem>
|
||||||
content={
|
|
||||||
<>
|
|
||||||
{t`If checked, any hosts and groups that were
|
|
||||||
previously present on the external source but are now removed
|
|
||||||
will be removed from the inventory. Hosts and groups
|
|
||||||
that were not managed by the inventory source will be promoted
|
|
||||||
to the next manually created group or if there is no manually
|
|
||||||
created group to promote them into, they will be left in the "all"
|
|
||||||
default group for the inventory.`}
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
{t`When not checked, local child
|
|
||||||
hosts and groups not found on the external source will remain
|
|
||||||
untouched by the inventory update process.`}
|
|
||||||
</>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</ListItem>
|
|
||||||
)}
|
)}
|
||||||
{overwrite_vars && (
|
{overwrite_vars && (
|
||||||
<ListItem>
|
<TextListItem component={TextListItemVariants.li}>
|
||||||
{t`Overwrite variables`}
|
{t`Overwrite local variables from remote inventory source`}
|
||||||
<Popover
|
</TextListItem>
|
||||||
content={
|
|
||||||
<>
|
|
||||||
{t`If checked, all variables for child groups
|
|
||||||
and hosts will be removed and replaced by those found
|
|
||||||
on the external source.`}
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
{t`When not checked, a merge will be performed,
|
|
||||||
combining local variables with those found on the
|
|
||||||
external source.`}
|
|
||||||
</>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</ListItem>
|
|
||||||
)}
|
)}
|
||||||
{update_on_launch && (
|
{update_on_launch && (
|
||||||
<ListItem>
|
<TextListItem component={TextListItemVariants.li}>
|
||||||
{t`Update on launch`}
|
{t`Update on launch`}
|
||||||
<Popover
|
</TextListItem>
|
||||||
content={t`Each time a job runs using this inventory,
|
|
||||||
refresh the inventory from the selected source before
|
|
||||||
executing job tasks.`}
|
|
||||||
/>
|
|
||||||
</ListItem>
|
|
||||||
)}
|
)}
|
||||||
{update_on_project_update && (
|
{update_on_project_update && (
|
||||||
<ListItem>
|
<TextListItem component={TextListItemVariants.li}>
|
||||||
{t`Update on project update`}
|
{t`Update on project update`}
|
||||||
<Popover
|
</TextListItem>
|
||||||
content={t`After every project update where the SCM revision
|
|
||||||
changes, refresh the inventory from the selected source
|
|
||||||
before executing job tasks. This is intended for static content,
|
|
||||||
like the Ansible inventory .ini file format.`}
|
|
||||||
/>
|
|
||||||
</ListItem>
|
|
||||||
)}
|
)}
|
||||||
</List>
|
</TextList>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,7 +202,7 @@ function InventorySourceDetail({ inventorySource }) {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{optionsList && (
|
{optionsList && (
|
||||||
<Detail fullWidth label={t`Options`} value={optionsList} />
|
<Detail fullWidth label={t`Enabled Options`} value={optionsList} />
|
||||||
)}
|
)}
|
||||||
{source_vars && (
|
{source_vars && (
|
||||||
<VariablesDetail
|
<VariablesDetail
|
||||||
|
|||||||
@@ -85,10 +85,10 @@ describe('InventorySourceDetail', () => {
|
|||||||
expect(wrapper.find('VariablesDetail').prop('value')).toEqual(
|
expect(wrapper.find('VariablesDetail').prop('value')).toEqual(
|
||||||
'---\nfoo: bar'
|
'---\nfoo: bar'
|
||||||
);
|
);
|
||||||
wrapper.find('Detail[label="Options"] li').forEach(option => {
|
wrapper.find('Detail[label="Enabled Options"] li').forEach(option => {
|
||||||
expect([
|
expect([
|
||||||
'Overwrite',
|
'Overwrite local groups and hosts from remote inventory source',
|
||||||
'Overwrite variables',
|
'Overwrite local variables from remote inventory source',
|
||||||
'Update on launch',
|
'Update on launch',
|
||||||
'Update on project update',
|
'Update on project update',
|
||||||
]).toContain(option.text());
|
]).toContain(option.text());
|
||||||
|
|||||||
@@ -5,8 +5,10 @@ import styled from 'styled-components';
|
|||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
ClipboardCopy,
|
ClipboardCopy,
|
||||||
List,
|
TextList,
|
||||||
ListItem,
|
TextListItem,
|
||||||
|
TextListVariants,
|
||||||
|
TextListItemVariants,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
} from '@patternfly/react-core';
|
} from '@patternfly/react-core';
|
||||||
import { Project } from '../../../types';
|
import { Project } from '../../../types';
|
||||||
@@ -78,17 +80,33 @@ function ProjectDetail({ project }) {
|
|||||||
allow_override
|
allow_override
|
||||||
) {
|
) {
|
||||||
optionsList = (
|
optionsList = (
|
||||||
<List>
|
<TextList component={TextListVariants.ul}>
|
||||||
{scm_clean && <ListItem>{t`Clean`}</ListItem>}
|
{scm_clean && (
|
||||||
{scm_delete_on_update && <ListItem>{t`Delete on Update`}</ListItem>}
|
<TextListItem
|
||||||
|
component={TextListItemVariants.li}
|
||||||
|
>{t`Discard local changes before syncing`}</TextListItem>
|
||||||
|
)}
|
||||||
|
{scm_delete_on_update && (
|
||||||
|
<TextListItem
|
||||||
|
component={TextListItemVariants.li}
|
||||||
|
>{t`Delete the project before syncing`}</TextListItem>
|
||||||
|
)}
|
||||||
{scm_track_submodules && (
|
{scm_track_submodules && (
|
||||||
<ListItem>{t`Track submodules latest commit on branch`}</ListItem>
|
<TextListItem
|
||||||
|
component={TextListItemVariants.li}
|
||||||
|
>{t`Track submodules latest commit on branch`}</TextListItem>
|
||||||
)}
|
)}
|
||||||
{scm_update_on_launch && (
|
{scm_update_on_launch && (
|
||||||
<ListItem>{t`Update Revision on Launch`}</ListItem>
|
<TextListItem
|
||||||
|
component={TextListItemVariants.li}
|
||||||
|
>{t`Update revision on job launch`}</TextListItem>
|
||||||
)}
|
)}
|
||||||
{allow_override && <ListItem>{t`Allow Branch Override`}</ListItem>}
|
{allow_override && (
|
||||||
</List>
|
<TextListItem
|
||||||
|
component={TextListItemVariants.li}
|
||||||
|
>{t`Allow branch override`}</TextListItem>
|
||||||
|
)}
|
||||||
|
</TextList>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,7 +214,6 @@ function ProjectDetail({ project }) {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{optionsList && <Detail label={t`Options`} value={optionsList} />}
|
|
||||||
<Detail
|
<Detail
|
||||||
label={t`Cache Timeout`}
|
label={t`Cache Timeout`}
|
||||||
value={`${scm_update_cache_timeout} ${t`Seconds`}`}
|
value={`${scm_update_cache_timeout} ${t`Seconds`}`}
|
||||||
@@ -212,7 +229,6 @@ function ProjectDetail({ project }) {
|
|||||||
)}
|
)}
|
||||||
</Config>
|
</Config>
|
||||||
<Detail label={t`Playbook Directory`} value={local_path} />
|
<Detail label={t`Playbook Directory`} value={local_path} />
|
||||||
|
|
||||||
<UserDateDetail
|
<UserDateDetail
|
||||||
label={t`Created`}
|
label={t`Created`}
|
||||||
date={created}
|
date={created}
|
||||||
@@ -223,6 +239,9 @@ function ProjectDetail({ project }) {
|
|||||||
date={modified}
|
date={modified}
|
||||||
user={summary_fields.modified_by}
|
user={summary_fields.modified_by}
|
||||||
/>
|
/>
|
||||||
|
{optionsList && (
|
||||||
|
<Detail fullWidth label={t`Enabled Options`} value={optionsList} />
|
||||||
|
)}
|
||||||
</DetailList>
|
</DetailList>
|
||||||
<CardActionsRow>
|
<CardActionsRow>
|
||||||
{summary_fields.user_capabilities?.edit && (
|
{summary_fields.user_capabilities?.edit && (
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ describe('<ProjectDetail />', () => {
|
|||||||
scm_refspec: 'refs/remotes/*',
|
scm_refspec: 'refs/remotes/*',
|
||||||
scm_clean: true,
|
scm_clean: true,
|
||||||
scm_delete_on_update: true,
|
scm_delete_on_update: true,
|
||||||
scm_track_submodules: false,
|
scm_track_submodules: true,
|
||||||
credential: 100,
|
credential: 100,
|
||||||
status: 'successful',
|
status: 'successful',
|
||||||
organization: 10,
|
organization: 10,
|
||||||
@@ -127,12 +127,13 @@ describe('<ProjectDetail />', () => {
|
|||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
wrapper
|
wrapper
|
||||||
.find('Detail[label="Options"]')
|
.find('Detail[label="Enabled Options"]')
|
||||||
.containsAllMatchingElements([
|
.containsAllMatchingElements([
|
||||||
<li>Clean</li>,
|
<li>Discard local changes before syncing</li>,
|
||||||
<li>Delete on Update</li>,
|
<li>Delete the project before syncing</li>,
|
||||||
<li>Update Revision on Launch</li>,
|
<li>Track submodules latest commit on branch</li>,
|
||||||
<li>Allow Branch Override</li>,
|
<li>Update revision on job launch</li>,
|
||||||
|
<li>Allow branch override</li>,
|
||||||
])
|
])
|
||||||
).toEqual(true);
|
).toEqual(true);
|
||||||
});
|
});
|
||||||
@@ -151,7 +152,7 @@ describe('<ProjectDetail />', () => {
|
|||||||
const wrapper = mountWithContexts(
|
const wrapper = mountWithContexts(
|
||||||
<ProjectDetail project={{ ...mockProject, ...mockOptions }} />
|
<ProjectDetail project={{ ...mockProject, ...mockOptions }} />
|
||||||
);
|
);
|
||||||
expect(wrapper.find('Detail[label="Options"]').length).toBe(0);
|
expect(wrapper.find('Detail[label="Enabled Options"]').length).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should have proper number of delete detail requests', () => {
|
test('should have proper number of delete detail requests', () => {
|
||||||
|
|||||||
@@ -115,28 +115,37 @@ function JobTemplateDetail({ template }) {
|
|||||||
);
|
);
|
||||||
const generateCallBackUrl = `${window.location.origin + url}callback/`;
|
const generateCallBackUrl = `${window.location.origin + url}callback/`;
|
||||||
const renderOptionsField =
|
const renderOptionsField =
|
||||||
become_enabled || host_config_key || allow_simultaneous || use_fact_cache;
|
become_enabled ||
|
||||||
|
host_config_key ||
|
||||||
|
allow_simultaneous ||
|
||||||
|
use_fact_cache ||
|
||||||
|
webhook_service;
|
||||||
|
|
||||||
const renderOptions = (
|
const renderOptions = (
|
||||||
<TextList component={TextListVariants.ul}>
|
<TextList component={TextListVariants.ul}>
|
||||||
{become_enabled && (
|
{become_enabled && (
|
||||||
<TextListItem component={TextListItemVariants.li}>
|
<TextListItem component={TextListItemVariants.li}>
|
||||||
{t`Enable Privilege Escalation`}
|
{t`Privilege Escalation`}
|
||||||
</TextListItem>
|
</TextListItem>
|
||||||
)}
|
)}
|
||||||
{host_config_key && (
|
{host_config_key && (
|
||||||
<TextListItem component={TextListItemVariants.li}>
|
<TextListItem component={TextListItemVariants.li}>
|
||||||
{t`Allow Provisioning Callbacks`}
|
{t`Provisioning Callbacks`}
|
||||||
</TextListItem>
|
</TextListItem>
|
||||||
)}
|
)}
|
||||||
{allow_simultaneous && (
|
{allow_simultaneous && (
|
||||||
<TextListItem component={TextListItemVariants.li}>
|
<TextListItem component={TextListItemVariants.li}>
|
||||||
{t`Enable Concurrent Jobs`}
|
{t`Concurrent Jobs`}
|
||||||
</TextListItem>
|
</TextListItem>
|
||||||
)}
|
)}
|
||||||
{use_fact_cache && (
|
{use_fact_cache && (
|
||||||
<TextListItem component={TextListItemVariants.li}>
|
<TextListItem component={TextListItemVariants.li}>
|
||||||
{t`Use Fact Storage`}
|
{t`Fact Storage`}
|
||||||
|
</TextListItem>
|
||||||
|
)}
|
||||||
|
{webhook_service && (
|
||||||
|
<TextListItem component={TextListItemVariants.li}>
|
||||||
|
{t`Webhooks`}
|
||||||
</TextListItem>
|
</TextListItem>
|
||||||
)}
|
)}
|
||||||
</TextList>
|
</TextList>
|
||||||
@@ -258,9 +267,6 @@ function JobTemplateDetail({ template }) {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{renderOptionsField && (
|
|
||||||
<Detail label={t`Options`} value={renderOptions} />
|
|
||||||
)}
|
|
||||||
<UserDateDetail
|
<UserDateDetail
|
||||||
label={t`Created`}
|
label={t`Created`}
|
||||||
date={created}
|
date={created}
|
||||||
@@ -271,6 +277,9 @@ function JobTemplateDetail({ template }) {
|
|||||||
date={modified}
|
date={modified}
|
||||||
user={summary_fields.modified_by}
|
user={summary_fields.modified_by}
|
||||||
/>
|
/>
|
||||||
|
{renderOptionsField && (
|
||||||
|
<Detail fullWidth label={t`Enabled Options`} value={renderOptions} />
|
||||||
|
)}
|
||||||
{summary_fields.credentials && summary_fields.credentials.length > 0 && (
|
{summary_fields.credentials && summary_fields.credentials.length > 0 && (
|
||||||
<Detail
|
<Detail
|
||||||
fullWidth
|
fullWidth
|
||||||
|
|||||||
@@ -58,12 +58,12 @@ function WorkflowJobTemplateDetail({ template }) {
|
|||||||
<TextList component={TextListVariants.ul}>
|
<TextList component={TextListVariants.ul}>
|
||||||
{template.allow_simultaneous && (
|
{template.allow_simultaneous && (
|
||||||
<TextListItem component={TextListItemVariants.li}>
|
<TextListItem component={TextListItemVariants.li}>
|
||||||
{t`- Enable Concurrent Jobs`}
|
{t`Concurrent Jobs`}
|
||||||
</TextListItem>
|
</TextListItem>
|
||||||
)}
|
)}
|
||||||
{template.webhook_service && (
|
{template.webhook_service && (
|
||||||
<TextListItem component={TextListItemVariants.li}>
|
<TextListItem component={TextListItemVariants.li}>
|
||||||
{t`- Enable Webhooks`}
|
{t`Webhooks`}
|
||||||
</TextListItem>
|
</TextListItem>
|
||||||
)}
|
)}
|
||||||
</TextList>
|
</TextList>
|
||||||
@@ -186,9 +186,6 @@ function WorkflowJobTemplateDetail({ template }) {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{renderOptionsField && (
|
|
||||||
<Detail label={t`Options`} value={renderOptions} />
|
|
||||||
)}
|
|
||||||
<UserDateDetail
|
<UserDateDetail
|
||||||
label={t`Created`}
|
label={t`Created`}
|
||||||
date={created}
|
date={created}
|
||||||
@@ -199,6 +196,9 @@ function WorkflowJobTemplateDetail({ template }) {
|
|||||||
date={modified}
|
date={modified}
|
||||||
user={summary_fields.modified_by}
|
user={summary_fields.modified_by}
|
||||||
/>
|
/>
|
||||||
|
{renderOptionsField && (
|
||||||
|
<Detail fullWidth label={t`Enabled Options`} value={renderOptions} />
|
||||||
|
)}
|
||||||
{summary_fields.labels?.results?.length > 0 && (
|
{summary_fields.labels?.results?.length > 0 && (
|
||||||
<Detail
|
<Detail
|
||||||
fullWidth
|
fullWidth
|
||||||
|
|||||||
Reference in New Issue
Block a user