mirror of
https://github.com/ansible/awx.git
synced 2026-08-01 10:29:56 -02:30
Adds Variables detail to node view when node is a system job template
This commit is contained in:
@@ -1,18 +1,15 @@
|
|||||||
import 'styled-components/macro';
|
import 'styled-components/macro';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { shape } from 'prop-types';
|
import { shape } from 'prop-types';
|
||||||
|
|
||||||
import { t, Trans } from '@lingui/macro';
|
import { t, Trans } from '@lingui/macro';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { Chip, Divider, Title } from '@patternfly/react-core';
|
import { Chip, Divider, Title } from '@patternfly/react-core';
|
||||||
import { toTitleCase } from 'util/strings';
|
import { toTitleCase } from 'util/strings';
|
||||||
|
|
||||||
import CredentialChip from '../CredentialChip';
|
import CredentialChip from '../CredentialChip';
|
||||||
import ChipGroup from '../ChipGroup';
|
import ChipGroup from '../ChipGroup';
|
||||||
import { DetailList, Detail, UserDateDetail } from '../DetailList';
|
import { DetailList, Detail, UserDateDetail } from '../DetailList';
|
||||||
import { VariablesDetail } from '../CodeEditor';
|
import { VariablesDetail } from '../CodeEditor';
|
||||||
|
|
||||||
import PromptProjectDetail from './PromptProjectDetail';
|
import PromptProjectDetail from './PromptProjectDetail';
|
||||||
import PromptInventorySourceDetail from './PromptInventorySourceDetail';
|
import PromptInventorySourceDetail from './PromptInventorySourceDetail';
|
||||||
import PromptJobTemplateDetail from './PromptJobTemplateDetail';
|
import PromptJobTemplateDetail from './PromptJobTemplateDetail';
|
||||||
@@ -139,9 +136,19 @@ function PromptDetail({ resource, launchConfig = {}, overrides = {} }) {
|
|||||||
user={details?.summary_fields?.modified_by}
|
user={details?.summary_fields?.modified_by}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{details?.type === 'system_job_template' && (
|
||||||
|
<VariablesDetail
|
||||||
|
label={t`Variables`}
|
||||||
|
rows={4}
|
||||||
|
value={overrides.extra_vars}
|
||||||
|
name="extra_vars"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</DetailList>
|
</DetailList>
|
||||||
|
|
||||||
{hasPromptData(launchConfig) && hasOverrides && (
|
{details?.type !== 'system_job_template' &&
|
||||||
|
hasPromptData(launchConfig) &&
|
||||||
|
hasOverrides && (
|
||||||
<>
|
<>
|
||||||
<PromptTitle headingLevel="h2">{t`Prompted Values`}</PromptTitle>
|
<PromptTitle headingLevel="h2">{t`Prompted Values`}</PromptTitle>
|
||||||
<PromptDivider />
|
<PromptDivider />
|
||||||
@@ -174,7 +181,10 @@ function PromptDetail({ resource, launchConfig = {}, overrides = {} }) {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{launchConfig.ask_inventory_on_launch && (
|
{launchConfig.ask_inventory_on_launch && (
|
||||||
<Detail label={t`Inventory`} value={overrides.inventory?.name} />
|
<Detail
|
||||||
|
label={t`Inventory`}
|
||||||
|
value={overrides.inventory?.name}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
{launchConfig.ask_scm_branch_on_launch && (
|
{launchConfig.ask_scm_branch_on_launch && (
|
||||||
<Detail
|
<Detail
|
||||||
|
|||||||
@@ -136,7 +136,11 @@ function NodeViewModal({ readOnly }) {
|
|||||||
if (promptValues) {
|
if (promptValues) {
|
||||||
overrides = promptValues;
|
overrides = promptValues;
|
||||||
|
|
||||||
if (launchConfig.ask_variables_on_launch || launchConfig.survey_enabled) {
|
if (
|
||||||
|
launchConfig.ask_variables_on_launch ||
|
||||||
|
launchConfig.survey_enabled ||
|
||||||
|
fullUnifiedJobTemplate.type === 'system_job_template'
|
||||||
|
) {
|
||||||
overrides.extra_vars = jsonToYaml(
|
overrides.extra_vars = jsonToYaml(
|
||||||
JSON.stringify(promptValues.extra_data)
|
JSON.stringify(promptValues.extra_data)
|
||||||
);
|
);
|
||||||
@@ -150,7 +154,11 @@ function NodeViewModal({ readOnly }) {
|
|||||||
if (launchConfig.ask_scm_branch_on_launch) {
|
if (launchConfig.ask_scm_branch_on_launch) {
|
||||||
overrides.scm_branch = originalNodeObject.scm_branch;
|
overrides.scm_branch = originalNodeObject.scm_branch;
|
||||||
}
|
}
|
||||||
if (launchConfig.ask_variables_on_launch || launchConfig.survey_enabled) {
|
if (
|
||||||
|
launchConfig.ask_variables_on_launch ||
|
||||||
|
launchConfig.survey_enabled ||
|
||||||
|
fullUnifiedJobTemplate.type === 'system_job_template'
|
||||||
|
) {
|
||||||
overrides.extra_vars = jsonToYaml(
|
overrides.extra_vars = jsonToYaml(
|
||||||
JSON.stringify(originalNodeObject.extra_data)
|
JSON.stringify(originalNodeObject.extra_data)
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user