mirror of
https://github.com/ansible/awx.git
synced 2026-01-20 06:01:25 -03:30
Merge pull request #12378 from john-westcott-iv/winrm_debug_5925
Making verbosity list and options a constant and adding WinRM debug
This commit is contained in:
commit
c2715d7c29
@ -26,13 +26,6 @@ function AdHocCommands({
|
||||
const [isWizardOpen, setIsWizardOpen] = useState(false);
|
||||
const { isKebabified, onKebabModalChange } = useContext(KebabifiedContext);
|
||||
|
||||
const verbosityOptions = [
|
||||
{ value: '0', key: '0', label: t`0 (Normal)` },
|
||||
{ value: '1', key: '1', label: t`1 (Verbose)` },
|
||||
{ value: '2', key: '2', label: t`2 (More Verbose)` },
|
||||
{ value: '3', key: '3', label: t`3 (Debug)` },
|
||||
{ value: '4', key: '4', label: t`4 (Connection Debug)` },
|
||||
];
|
||||
useEffect(() => {
|
||||
if (isKebabified) {
|
||||
onKebabModalChange(isWizardOpen);
|
||||
@ -159,7 +152,6 @@ function AdHocCommands({
|
||||
adHocItems={adHocItems}
|
||||
organizationId={organizationId}
|
||||
moduleOptions={moduleOptions}
|
||||
verbosityOptions={verbosityOptions}
|
||||
credentialTypeId={credentialTypeId}
|
||||
onCloseWizard={() => setIsWizardOpen(false)}
|
||||
onLaunch={handleSubmit}
|
||||
|
||||
@ -3,13 +3,13 @@ import { t } from '@lingui/macro';
|
||||
import { withFormik, useFormikContext } from 'formik';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import { VERBOSITY } from 'components/VerbositySelectField';
|
||||
import Wizard from '../Wizard';
|
||||
import useAdHocLaunchSteps from './useAdHocLaunchSteps';
|
||||
|
||||
function AdHocCommandsWizard({
|
||||
onLaunch,
|
||||
moduleOptions,
|
||||
verbosityOptions,
|
||||
onCloseWizard,
|
||||
credentialTypeId,
|
||||
organizationId,
|
||||
@ -18,7 +18,6 @@ function AdHocCommandsWizard({
|
||||
|
||||
const { steps, validateStep, visitStep, visitAllSteps } = useAdHocLaunchSteps(
|
||||
moduleOptions,
|
||||
verbosityOptions,
|
||||
organizationId,
|
||||
credentialTypeId
|
||||
);
|
||||
@ -57,13 +56,13 @@ function AdHocCommandsWizard({
|
||||
}
|
||||
|
||||
const FormikApp = withFormik({
|
||||
mapPropsToValues({ adHocItems, verbosityOptions }) {
|
||||
mapPropsToValues({ adHocItems }) {
|
||||
const adHocItemStrings = adHocItems.map((item) => item.name).join(', ');
|
||||
return {
|
||||
limit: adHocItemStrings || 'all',
|
||||
credentials: [],
|
||||
module_args: '',
|
||||
verbosity: verbosityOptions[0].value,
|
||||
verbosity: VERBOSITY()[0],
|
||||
forks: 0,
|
||||
diff_mode: false,
|
||||
become_enabled: '',
|
||||
@ -79,7 +78,6 @@ const FormikApp = withFormik({
|
||||
FormikApp.propTypes = {
|
||||
onLaunch: PropTypes.func.isRequired,
|
||||
moduleOptions: PropTypes.arrayOf(PropTypes.array).isRequired,
|
||||
verbosityOptions: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
onCloseWizard: PropTypes.func.isRequired,
|
||||
credentialTypeId: PropTypes.number.isRequired,
|
||||
};
|
||||
|
||||
@ -13,13 +13,6 @@ jest.mock('../../api/models/Credentials');
|
||||
jest.mock('../../api/models/ExecutionEnvironments');
|
||||
jest.mock('../../api/models/Root');
|
||||
|
||||
const verbosityOptions = [
|
||||
{ value: '0', key: '0', label: '0 (Normal)' },
|
||||
{ value: '1', key: '1', label: '1 (Verbose)' },
|
||||
{ value: '2', key: '2', label: '2 (More Verbose)' },
|
||||
{ value: '3', key: '3', label: '3 (Debug)' },
|
||||
{ value: '4', key: '4', label: '4 (Connection Debug)' },
|
||||
];
|
||||
const moduleOptions = [
|
||||
['command', 'command'],
|
||||
['shell', 'shell'],
|
||||
@ -44,7 +37,6 @@ describe('<AdHocCommandsWizard/>', () => {
|
||||
adHocItems={adHocItems}
|
||||
onLaunch={onLaunch}
|
||||
moduleOptions={moduleOptions}
|
||||
verbosityOptions={verbosityOptions}
|
||||
onCloseWizard={() => {}}
|
||||
credentialTypeId={1}
|
||||
organizationId={1}
|
||||
|
||||
@ -7,6 +7,7 @@ import { Form, FormGroup, Switch, Checkbox } from '@patternfly/react-core';
|
||||
import styled from 'styled-components';
|
||||
import { required } from 'util/validators';
|
||||
import useBrandName from 'hooks/useBrandName';
|
||||
import { VerbositySelectField } from 'components/VerbositySelectField';
|
||||
import AnsibleSelect from '../AnsibleSelect';
|
||||
import FormField from '../FormField';
|
||||
import { VariablesField } from '../CodeEditor';
|
||||
@ -21,7 +22,7 @@ const TooltipWrapper = styled.div`
|
||||
text-align: left;
|
||||
`;
|
||||
|
||||
function AdHocDetailsStep({ verbosityOptions, moduleOptions }) {
|
||||
function AdHocDetailsStep({ moduleOptions }) {
|
||||
const brandName = useBrandName();
|
||||
const [moduleNameField, moduleNameMeta, moduleNameHelpers] = useField({
|
||||
name: 'module_name',
|
||||
@ -32,7 +33,7 @@ function AdHocDetailsStep({ verbosityOptions, moduleOptions }) {
|
||||
const [diffModeField, , diffModeHelpers] = useField('diff_mode');
|
||||
const [becomeEnabledField, , becomeEnabledHelpers] =
|
||||
useField('become_enabled');
|
||||
const [verbosityField, verbosityMeta, verbosityHelpers] = useField({
|
||||
const [, verbosityMeta] = useField({
|
||||
name: 'verbosity',
|
||||
validate: required(null),
|
||||
});
|
||||
@ -122,33 +123,16 @@ function AdHocDetailsStep({ verbosityOptions, moduleOptions }) {
|
||||
)
|
||||
}
|
||||
/>
|
||||
<FormGroup
|
||||
|
||||
<VerbositySelectField
|
||||
fieldId="verbosity"
|
||||
aria-label={t`select verbosity`}
|
||||
label={t`Verbosity`}
|
||||
isRequired
|
||||
validated={
|
||||
tooltip={t`These are the verbosity levels for standard out of the command run that are supported.`}
|
||||
isValid={
|
||||
!verbosityMeta.touched || !verbosityMeta.error
|
||||
? 'default'
|
||||
: 'error'
|
||||
}
|
||||
helperTextInvalid={verbosityMeta.error}
|
||||
labelIcon={
|
||||
<Popover
|
||||
content={t`These are the verbosity levels for standard out of the command run that are supported.`}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<AnsibleSelect
|
||||
{...verbosityField}
|
||||
isValid={!verbosityMeta.touched || !verbosityMeta.error}
|
||||
id="verbosity"
|
||||
data={verbosityOptions || []}
|
||||
onChange={(event, value) => {
|
||||
verbosityHelpers.setValue(parseInt(value, 10));
|
||||
}}
|
||||
/>
|
||||
</FormGroup>
|
||||
/>
|
||||
<FormField
|
||||
id="limit"
|
||||
name="limit"
|
||||
@ -296,7 +280,6 @@ function AdHocDetailsStep({ verbosityOptions, moduleOptions }) {
|
||||
|
||||
AdHocDetailsStep.propTypes = {
|
||||
moduleOptions: PropTypes.arrayOf(PropTypes.array).isRequired,
|
||||
verbosityOptions: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
};
|
||||
|
||||
export default AdHocDetailsStep;
|
||||
|
||||
@ -3,6 +3,7 @@ import { t } from '@lingui/macro';
|
||||
import { Tooltip } from '@patternfly/react-core';
|
||||
import { ExclamationCircleIcon as PFExclamationCircleIcon } from '@patternfly/react-icons';
|
||||
import styled from 'styled-components';
|
||||
import { VERBOSITY } from '../VerbositySelectField';
|
||||
import { toTitleCase } from '../../util/strings';
|
||||
import { VariablesDetail } from '../CodeEditor';
|
||||
import { jsonToYaml } from '../../util/yaml';
|
||||
@ -21,7 +22,7 @@ const ErrorMessageWrapper = styled.div`
|
||||
margin-bottom: 10px;
|
||||
`;
|
||||
function AdHocPreviewStep({ hasErrors, values }) {
|
||||
const { credential, execution_environment, extra_vars } = values;
|
||||
const { credential, execution_environment, extra_vars, verbosity } = values;
|
||||
|
||||
const items = Object.entries(values);
|
||||
return (
|
||||
@ -44,6 +45,7 @@ function AdHocPreviewStep({ hasErrors, values }) {
|
||||
key !== 'extra_vars' &&
|
||||
key !== 'execution_environment' &&
|
||||
key !== 'credentials' &&
|
||||
key !== 'verbosity' &&
|
||||
!key.startsWith('credential_passwords') && (
|
||||
<Detail key={key} label={toTitleCase(key)} value={value} />
|
||||
)
|
||||
@ -57,6 +59,9 @@ function AdHocPreviewStep({ hasErrors, values }) {
|
||||
value={execution_environment[0]?.name}
|
||||
/>
|
||||
)}
|
||||
{verbosity && (
|
||||
<Detail label={t`Verbosity`} value={VERBOSITY()[values.verbosity]} />
|
||||
)}
|
||||
{extra_vars && (
|
||||
<VariablesDetail
|
||||
value={jsonToYaml(JSON.stringify(extra_vars))}
|
||||
|
||||
@ -5,11 +5,7 @@ import StepName from '../LaunchPrompt/steps/StepName';
|
||||
import AdHocDetailsStep from './AdHocDetailsStep';
|
||||
|
||||
const STEP_ID = 'details';
|
||||
export default function useAdHocDetailsStep(
|
||||
visited,
|
||||
moduleOptions,
|
||||
verbosityOptions
|
||||
) {
|
||||
export default function useAdHocDetailsStep(visited, moduleOptions) {
|
||||
const { values, touched, setFieldError } = useFormikContext();
|
||||
|
||||
const hasError = () => {
|
||||
@ -39,12 +35,7 @@ export default function useAdHocDetailsStep(
|
||||
{t`Details`}
|
||||
</StepName>
|
||||
),
|
||||
component: (
|
||||
<AdHocDetailsStep
|
||||
moduleOptions={moduleOptions}
|
||||
verbosityOptions={verbosityOptions}
|
||||
/>
|
||||
),
|
||||
component: <AdHocDetailsStep moduleOptions={moduleOptions} />,
|
||||
enableNext: true,
|
||||
nextButtonText: t`Next`,
|
||||
},
|
||||
|
||||
@ -24,7 +24,6 @@ function showCredentialPasswordsStep(credential) {
|
||||
|
||||
export default function useAdHocLaunchSteps(
|
||||
moduleOptions,
|
||||
verbosityOptions,
|
||||
organizationId,
|
||||
credentialTypeId
|
||||
) {
|
||||
@ -32,7 +31,7 @@ export default function useAdHocLaunchSteps(
|
||||
|
||||
const [visited, setVisited] = useState({});
|
||||
const steps = [
|
||||
useAdHocDetailsStep(visited, moduleOptions, verbosityOptions),
|
||||
useAdHocDetailsStep(visited, moduleOptions),
|
||||
useAdHocExecutionEnvironmentStep(organizationId),
|
||||
useAdHocCredentialStep(visited, credentialTypeId),
|
||||
useCredentialPasswordsStep(
|
||||
|
||||
@ -46,7 +46,9 @@ function AnsibleSelect({
|
||||
value={option.value}
|
||||
label={option.label}
|
||||
isDisabled={option.isDisabled}
|
||||
/>
|
||||
>
|
||||
{option.label}
|
||||
</FormSelectOption>
|
||||
))}
|
||||
</FormSelect>
|
||||
);
|
||||
|
||||
@ -9,6 +9,7 @@ import { TagMultiSelect } from '../../MultiSelect';
|
||||
import AnsibleSelect from '../../AnsibleSelect';
|
||||
import { VariablesField } from '../../CodeEditor';
|
||||
import Popover from '../../Popover';
|
||||
import { VerbositySelectField } from '../../VerbositySelectField';
|
||||
|
||||
const FieldHeader = styled.div`
|
||||
display: flex;
|
||||
@ -129,36 +130,16 @@ function JobTypeField() {
|
||||
}
|
||||
|
||||
function VerbosityField() {
|
||||
const [field, meta, helpers] = useField('verbosity');
|
||||
const options = [
|
||||
{ value: '0', key: '0', label: t`0 (Normal)` },
|
||||
{ value: '1', key: '1', label: t`1 (Verbose)` },
|
||||
{ value: '2', key: '2', label: t`2 (More Verbose)` },
|
||||
{ value: '3', key: '3', label: t`3 (Debug)` },
|
||||
{ value: '4', key: '4', label: t`4 (Connection Debug)` },
|
||||
];
|
||||
|
||||
const [, meta] = useField('verbosity');
|
||||
const isValid = !(meta.touched && meta.error);
|
||||
|
||||
return (
|
||||
<FormGroup
|
||||
<VerbositySelectField
|
||||
fieldId="prompt-verbosity"
|
||||
validated={isValid ? 'default' : 'error'}
|
||||
label={t`Verbosity`}
|
||||
labelIcon={
|
||||
<Popover
|
||||
content={t`Control the level of output ansible
|
||||
tooltip={t`Control the level of output ansible
|
||||
will produce as the playbook executes.`}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<AnsibleSelect
|
||||
id="prompt-verbosity"
|
||||
data={options}
|
||||
{...field}
|
||||
onChange={(event, value) => helpers.setValue(value)}
|
||||
/>
|
||||
</FormGroup>
|
||||
isValid={isValid ? 'default' : 'error'}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ describe('OtherPromptsStep', () => {
|
||||
expect(wrapper.find('VerbosityField')).toHaveLength(1);
|
||||
expect(
|
||||
wrapper.find('VerbosityField AnsibleSelect').prop('data')
|
||||
).toHaveLength(5);
|
||||
).toHaveLength(6);
|
||||
});
|
||||
|
||||
test('should render show changes toggle', async () => {
|
||||
|
||||
@ -14,6 +14,7 @@ import PromptProjectDetail from './PromptProjectDetail';
|
||||
import PromptInventorySourceDetail from './PromptInventorySourceDetail';
|
||||
import PromptJobTemplateDetail from './PromptJobTemplateDetail';
|
||||
import PromptWFJobTemplateDetail from './PromptWFJobTemplateDetail';
|
||||
import { VERBOSITY } from '../VerbositySelectField';
|
||||
|
||||
const PromptTitle = styled(Title)`
|
||||
margin-top: var(--pf-global--spacer--xl);
|
||||
@ -93,14 +94,6 @@ function PromptDetail({
|
||||
overrides = {},
|
||||
workflowNode = false,
|
||||
}) {
|
||||
const VERBOSITY = {
|
||||
0: t`0 (Normal)`,
|
||||
1: t`1 (Verbose)`,
|
||||
2: t`2 (More Verbose)`,
|
||||
3: t`3 (Debug)`,
|
||||
4: t`4 (Connection Debug)`,
|
||||
};
|
||||
|
||||
const details = omitOverrides(resource, overrides, launchConfig.defaults);
|
||||
details.type = overrides?.nodeType || details.type;
|
||||
const hasOverrides = Object.keys(overrides).length > 0;
|
||||
@ -226,7 +219,7 @@ function PromptDetail({
|
||||
launchConfig.ask_verbosity_on_launch ? (
|
||||
<Detail
|
||||
label={t`Verbosity`}
|
||||
value={VERBOSITY[overrides.verbosity]}
|
||||
value={VERBOSITY()[overrides.verbosity]}
|
||||
/>
|
||||
) : null}
|
||||
{launchConfig.ask_tags_on_launch && (
|
||||
|
||||
@ -13,6 +13,7 @@ import { VariablesDetail } from '../CodeEditor';
|
||||
import CredentialChip from '../CredentialChip';
|
||||
import ChipGroup from '../ChipGroup';
|
||||
import ExecutionEnvironmentDetail from '../ExecutionEnvironmentDetail';
|
||||
import { VERBOSITY } from '../VerbositySelectField';
|
||||
|
||||
function PromptInventorySourceDetail({ resource }) {
|
||||
const {
|
||||
@ -32,14 +33,6 @@ function PromptInventorySourceDetail({ resource }) {
|
||||
verbosity,
|
||||
} = resource;
|
||||
|
||||
const VERBOSITY = {
|
||||
0: t`0 (Normal)`,
|
||||
1: t`1 (Verbose)`,
|
||||
2: t`2 (More Verbose)`,
|
||||
3: t`3 (Debug)`,
|
||||
4: t`4 (Connection Debug)`,
|
||||
};
|
||||
|
||||
let optionsList = '';
|
||||
if (
|
||||
overwrite ||
|
||||
@ -115,7 +108,7 @@ function PromptInventorySourceDetail({ resource }) {
|
||||
executionEnvironment={summary_fields?.execution_environment}
|
||||
/>
|
||||
<Detail label={t`Inventory File`} value={source_path} />
|
||||
<Detail label={t`Verbosity`} value={VERBOSITY[verbosity]} />
|
||||
<Detail label={t`Verbosity`} value={VERBOSITY()[verbosity]} />
|
||||
<Detail
|
||||
label={t`Cache Timeout`}
|
||||
value={`${update_cache_timeout} ${t`Seconds`}`}
|
||||
|
||||
@ -15,6 +15,7 @@ import Sparkline from '../Sparkline';
|
||||
import { Detail, DeletedDetail } from '../DetailList';
|
||||
import { VariablesDetail } from '../CodeEditor';
|
||||
import ExecutionEnvironmentDetail from '../ExecutionEnvironmentDetail';
|
||||
import { VERBOSITY } from '../VerbositySelectField';
|
||||
|
||||
function PromptJobTemplateDetail({ resource }) {
|
||||
const {
|
||||
@ -42,14 +43,6 @@ function PromptJobTemplateDetail({ resource }) {
|
||||
custom_virtualenv,
|
||||
} = resource;
|
||||
|
||||
const VERBOSITY = {
|
||||
0: t`0 (Normal)`,
|
||||
1: t`1 (Verbose)`,
|
||||
2: t`2 (More Verbose)`,
|
||||
3: t`3 (Debug)`,
|
||||
4: t`4 (Connection Debug)`,
|
||||
};
|
||||
|
||||
let optionsList = '';
|
||||
if (
|
||||
become_enabled ||
|
||||
@ -153,7 +146,7 @@ function PromptJobTemplateDetail({ resource }) {
|
||||
<Detail label={t`Playbook`} value={playbook} />
|
||||
<Detail label={t`Forks`} value={forks || '0'} />
|
||||
<Detail label={t`Limit`} value={limit} />
|
||||
<Detail label={t`Verbosity`} value={VERBOSITY[verbosity]} />
|
||||
<Detail label={t`Verbosity`} value={VERBOSITY()[verbosity]} />
|
||||
{typeof diff_mode === 'boolean' && (
|
||||
<Detail label={t`Show Changes`} value={diff_mode ? t`On` : t`Off`} />
|
||||
)}
|
||||
|
||||
@ -23,6 +23,7 @@ import DeleteButton from '../../DeleteButton';
|
||||
import ErrorDetail from '../../ErrorDetail';
|
||||
import ChipGroup from '../../ChipGroup';
|
||||
import { VariablesDetail } from '../../CodeEditor';
|
||||
import { VERBOSITY } from '../../VerbositySelectField';
|
||||
|
||||
const PromptDivider = styled(Divider)`
|
||||
margin-top: var(--pf-global--spacer--lg);
|
||||
@ -67,14 +68,6 @@ function ScheduleDetail({ hasDaysToKeepField, schedule, surveyConfig }) {
|
||||
const { pathname } = useLocation();
|
||||
const pathRoot = pathname.substr(0, pathname.indexOf('schedules'));
|
||||
|
||||
const VERBOSITY = {
|
||||
0: t`0 (Normal)`,
|
||||
1: t`1 (Verbose)`,
|
||||
2: t`2 (More Verbose)`,
|
||||
3: t`3 (Debug)`,
|
||||
4: t`4 (Connection Debug)`,
|
||||
};
|
||||
|
||||
const {
|
||||
request: deleteSchedule,
|
||||
isLoading: isDeleteLoading,
|
||||
@ -216,7 +209,7 @@ function ScheduleDetail({ hasDaysToKeepField, schedule, surveyConfig }) {
|
||||
const showLimitDetail = ask_limit_on_launch && limit;
|
||||
const showJobTypeDetail = ask_job_type_on_launch && job_type;
|
||||
const showSCMBranchDetail = ask_scm_branch_on_launch && scm_branch;
|
||||
const showVerbosityDetail = ask_verbosity_on_launch && VERBOSITY[verbosity];
|
||||
const showVerbosityDetail = ask_verbosity_on_launch && VERBOSITY()[verbosity];
|
||||
|
||||
const showPromptedFields =
|
||||
showCredentialsDetail ||
|
||||
@ -313,7 +306,7 @@ function ScheduleDetail({ hasDaysToKeepField, schedule, surveyConfig }) {
|
||||
/>
|
||||
)}
|
||||
{ask_verbosity_on_launch && (
|
||||
<Detail label={t`Verbosity`} value={VERBOSITY[verbosity]} />
|
||||
<Detail label={t`Verbosity`} value={VERBOSITY()[verbosity]} />
|
||||
)}
|
||||
{ask_scm_branch_on_launch && (
|
||||
<Detail label={t`Source Control Branch`} value={scm_branch} />
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
import React from 'react';
|
||||
import { t } from '@lingui/macro';
|
||||
import { useField } from 'formik';
|
||||
import { FormGroup } from '@patternfly/react-core';
|
||||
import Popover from 'components/Popover';
|
||||
import AnsibleSelect from 'components/AnsibleSelect';
|
||||
import FieldWithPrompt from 'components/FieldWithPrompt';
|
||||
|
||||
const VERBOSITY = () => ({
|
||||
0: t`0 (Normal)`,
|
||||
1: t`1 (Verbose)`,
|
||||
2: t`2 (More Verbose)`,
|
||||
3: t`3 (Debug)`,
|
||||
4: t`4 (Connection Debug)`,
|
||||
5: t`5 (WinRM Debug)`,
|
||||
});
|
||||
|
||||
function VerbositySelectField({
|
||||
fieldId,
|
||||
promptId,
|
||||
promptName,
|
||||
tooltip,
|
||||
isValid,
|
||||
}) {
|
||||
const VERBOSE_OPTIONS = Object.entries(VERBOSITY()).map(([k, v]) => ({
|
||||
key: `${k}`,
|
||||
value: `${k}`,
|
||||
label: v,
|
||||
}));
|
||||
const [verbosityField, , verbosityHelpers] = useField('verbosity');
|
||||
return promptId ? (
|
||||
<FieldWithPrompt
|
||||
fieldId={fieldId}
|
||||
label={t`Verbosity`}
|
||||
promptId={promptId}
|
||||
promptName={promptName}
|
||||
tooltip={tooltip}
|
||||
>
|
||||
<AnsibleSelect id={fieldId} data={VERBOSE_OPTIONS} {...verbosityField} />
|
||||
</FieldWithPrompt>
|
||||
) : (
|
||||
<FormGroup
|
||||
fieldId={fieldId}
|
||||
validated={isValid ? 'default' : 'error'}
|
||||
label={t`Verbosity`}
|
||||
labelIcon={<Popover content={tooltip} />}
|
||||
>
|
||||
<AnsibleSelect
|
||||
id={fieldId}
|
||||
data={VERBOSE_OPTIONS}
|
||||
{...verbosityField}
|
||||
onChange={(event, value) => verbosityHelpers.setValue(value)}
|
||||
/>
|
||||
</FormGroup>
|
||||
);
|
||||
}
|
||||
|
||||
export { VerbositySelectField, VERBOSITY };
|
||||
1
awx/ui/src/components/VerbositySelectField/index.js
Normal file
1
awx/ui/src/components/VerbositySelectField/index.js
Normal file
@ -0,0 +1 @@
|
||||
export { VERBOSITY, VerbositySelectField } from './VerbositySelectField';
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -29,6 +29,7 @@ import { relatedResourceDeleteRequests } from 'util/getRelatedResourceDeleteDeta
|
||||
import useIsMounted from 'hooks/useIsMounted';
|
||||
import { formatDateString } from 'util/dates';
|
||||
import Popover from 'components/Popover';
|
||||
import { VERBOSITY } from 'components/VerbositySelectField';
|
||||
import InventorySourceSyncButton from '../shared/InventorySourceSyncButton';
|
||||
import useWsInventorySourcesDetails from '../InventorySources/useWsInventorySourcesDetails';
|
||||
import helpText from '../shared/Inventory.helptext';
|
||||
@ -111,12 +112,6 @@ function InventorySourceDetail({ inventorySource }) {
|
||||
inventorySource.id
|
||||
);
|
||||
|
||||
const VERBOSITY = {
|
||||
0: t`0 (Warning)`,
|
||||
1: t`1 (Info)`,
|
||||
2: t`2 (Debug)`,
|
||||
};
|
||||
|
||||
let optionsList = '';
|
||||
if (
|
||||
overwrite ||
|
||||
@ -251,7 +246,7 @@ function InventorySourceDetail({ inventorySource }) {
|
||||
<Detail
|
||||
label={t`Verbosity`}
|
||||
helpText={helpText.subFormVerbosityFields}
|
||||
value={VERBOSITY[verbosity]}
|
||||
value={VERBOSITY()[verbosity]}
|
||||
/>
|
||||
<Detail
|
||||
label={t`Cache timeout`}
|
||||
|
||||
@ -93,7 +93,7 @@ describe('InventorySourceDetail', () => {
|
||||
assertDetail(wrapper, 'Organization', 'Mock Org');
|
||||
assertDetail(wrapper, 'Project', 'Mock Project');
|
||||
assertDetail(wrapper, 'Inventory file', 'foo');
|
||||
assertDetail(wrapper, 'Verbosity', '2 (Debug)');
|
||||
assertDetail(wrapper, 'Verbosity', '2 (More Verbose)');
|
||||
assertDetail(wrapper, 'Cache timeout', '2 seconds');
|
||||
const executionEnvironment = wrapper.find('ExecutionEnvironmentDetail');
|
||||
expect(executionEnvironment).toHaveLength(1);
|
||||
|
||||
@ -25,6 +25,7 @@ import { LaunchButton, ReLaunchDropDown } from 'components/LaunchButton';
|
||||
import StatusLabel from 'components/StatusLabel';
|
||||
import JobCancelButton from 'components/JobCancelButton';
|
||||
import ExecutionEnvironmentDetail from 'components/ExecutionEnvironmentDetail';
|
||||
import { VERBOSITY } from 'components/VerbositySelectField';
|
||||
import { getJobModel, isJobRunning } from 'util/jobs';
|
||||
import { formatDateString } from 'util/dates';
|
||||
import { Job } from 'types';
|
||||
@ -37,14 +38,6 @@ const StatusDetailValue = styled.div`
|
||||
grid-template-columns: auto auto;
|
||||
`;
|
||||
|
||||
const VERBOSITY = {
|
||||
0: '0 (Normal)',
|
||||
1: '1 (Verbose)',
|
||||
2: '2 (More Verbose)',
|
||||
3: '3 (Debug)',
|
||||
4: '4 (Connection Debug)',
|
||||
};
|
||||
|
||||
function JobDetail({ job, inventorySourceLabels }) {
|
||||
const { me } = useConfig();
|
||||
const {
|
||||
@ -332,7 +325,7 @@ function JobDetail({ job, inventorySourceLabels }) {
|
||||
dataCy="job-verbosity"
|
||||
label={t`Verbosity`}
|
||||
helpText={jobHelpText.verbosity}
|
||||
value={VERBOSITY[job.verbosity]}
|
||||
value={VERBOSITY()[job.verbosity]}
|
||||
/>
|
||||
{job.type !== 'workflow_job' && !isJobRunning(job.status) && (
|
||||
<ExecutionEnvironmentDetail
|
||||
|
||||
@ -28,6 +28,7 @@ import DeleteButton from 'components/DeleteButton';
|
||||
import ErrorDetail from 'components/ErrorDetail';
|
||||
import { LaunchButton } from 'components/LaunchButton';
|
||||
import { VariablesDetail } from 'components/CodeEditor';
|
||||
import { VERBOSITY } from 'components/VerbositySelectField';
|
||||
import { JobTemplatesAPI } from 'api';
|
||||
import useRequest, { useDismissableError } from 'hooks/useRequest';
|
||||
import useBrandName from 'hooks/useBrandName';
|
||||
@ -104,17 +105,6 @@ function JobTemplateDetail({ template }) {
|
||||
relatedResourceDeleteRequests.template(template);
|
||||
const canLaunch =
|
||||
summary_fields.user_capabilities && summary_fields.user_capabilities.start;
|
||||
const verbosityOptions = [
|
||||
{ verbosity: 0, details: t`0 (Normal)` },
|
||||
{ verbosity: 1, details: t`1 (Verbose)` },
|
||||
{ verbosity: 2, details: t`2 (More Verbose)` },
|
||||
{ verbosity: 3, details: t`3 (Debug)` },
|
||||
{ verbosity: 4, details: t`4 (Connection Debug)` },
|
||||
{ verbosity: 5, details: t`5 (WinRM Debug)` },
|
||||
];
|
||||
const verbosityDetails = verbosityOptions.filter(
|
||||
(option) => option.verbosity === verbosity
|
||||
);
|
||||
const generateCallBackUrl = `${window.location.origin + url}callback/`;
|
||||
const renderOptionsField =
|
||||
become_enabled ||
|
||||
@ -272,7 +262,7 @@ function JobTemplateDetail({ template }) {
|
||||
/>
|
||||
<Detail
|
||||
label={t`Verbosity`}
|
||||
value={verbosityDetails[0].details}
|
||||
value={VERBOSITY()[verbosity]}
|
||||
dataCy="jt-detail-verbosity"
|
||||
helpText={helpText.verbosity}
|
||||
/>
|
||||
|
||||
@ -43,6 +43,7 @@ import Popover from 'components/Popover';
|
||||
import { JobTemplatesAPI } from 'api';
|
||||
import useIsMounted from 'hooks/useIsMounted';
|
||||
import LabelSelect from 'components/LabelSelect';
|
||||
import { VerbositySelectField } from 'components/VerbositySelectField';
|
||||
import PlaybookSelect from './PlaybookSelect';
|
||||
import WebhookSubForm from './WebhookSubForm';
|
||||
import helpText from './JobTemplate.helptext';
|
||||
@ -85,7 +86,6 @@ function JobTemplateForm({
|
||||
const [credentialField, , credentialHelpers] = useField('credentials');
|
||||
const [labelsField, , labelsHelpers] = useField('labels');
|
||||
const [limitField, limitMeta, limitHelpers] = useField('limit');
|
||||
const [verbosityField] = useField('verbosity');
|
||||
const [diffModeField, , diffModeHelpers] = useField('diff_mode');
|
||||
const [instanceGroupsField, , instanceGroupsHelpers] =
|
||||
useField('instanceGroups');
|
||||
@ -215,13 +215,6 @@ function JobTemplateForm({
|
||||
isDisabled: false,
|
||||
},
|
||||
];
|
||||
const verbosityOptions = [
|
||||
{ value: '0', key: '0', label: t`0 (Normal)` },
|
||||
{ value: '1', key: '1', label: t`1 (Verbose)` },
|
||||
{ value: '2', key: '2', label: t`2 (More Verbose)` },
|
||||
{ value: '3', key: '3', label: t`3 (Debug)` },
|
||||
{ value: '4', key: '4', label: t`4 (Connection Debug)` },
|
||||
];
|
||||
let callbackUrl;
|
||||
if (template?.related) {
|
||||
const path = template.related.callback || `${template.url}callback`;
|
||||
@ -428,19 +421,12 @@ function JobTemplateForm({
|
||||
}}
|
||||
/>
|
||||
</FieldWithPrompt>
|
||||
<FieldWithPrompt
|
||||
<VerbositySelectField
|
||||
fieldId="template-verbosity"
|
||||
label={t`Verbosity`}
|
||||
promptId="template-ask-verbosity-on-launch"
|
||||
promptName="ask_verbosity_on_launch"
|
||||
tooltip={helpText.verbosity}
|
||||
>
|
||||
<AnsibleSelect
|
||||
id="template-verbosity"
|
||||
data={verbosityOptions}
|
||||
{...verbosityField}
|
||||
/>
|
||||
</FieldWithPrompt>
|
||||
/>
|
||||
<FormField
|
||||
id="template-job-slicing"
|
||||
name="job_slice_count"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user