From 034c665c83bab279036a41473c3d11fb2a28f644 Mon Sep 17 00:00:00 2001 From: mabashian Date: Thu, 1 Jul 2021 11:17:46 -0400 Subject: [PATCH] Adds Variables detail to node view when node is a system job template --- .../components/PromptDetail/PromptDetail.js | 244 +++++++++--------- .../Modals/NodeModals/NodeViewModal.js | 12 +- 2 files changed, 137 insertions(+), 119 deletions(-) diff --git a/awx/ui_next/src/components/PromptDetail/PromptDetail.js b/awx/ui_next/src/components/PromptDetail/PromptDetail.js index b23eed0bd9..c58a1f99d6 100644 --- a/awx/ui_next/src/components/PromptDetail/PromptDetail.js +++ b/awx/ui_next/src/components/PromptDetail/PromptDetail.js @@ -1,18 +1,15 @@ import 'styled-components/macro'; import React from 'react'; import { shape } from 'prop-types'; - import { t, Trans } from '@lingui/macro'; import { Link } from 'react-router-dom'; import styled from 'styled-components'; import { Chip, Divider, Title } from '@patternfly/react-core'; import { toTitleCase } from 'util/strings'; - import CredentialChip from '../CredentialChip'; import ChipGroup from '../ChipGroup'; import { DetailList, Detail, UserDateDetail } from '../DetailList'; import { VariablesDetail } from '../CodeEditor'; - import PromptProjectDetail from './PromptProjectDetail'; import PromptInventorySourceDetail from './PromptInventorySourceDetail'; import PromptJobTemplateDetail from './PromptJobTemplateDetail'; @@ -139,123 +136,136 @@ function PromptDetail({ resource, launchConfig = {}, overrides = {} }) { user={details?.summary_fields?.modified_by} /> )} + {details?.type === 'system_job_template' && ( + + )} - {hasPromptData(launchConfig) && hasOverrides && ( - <> - {t`Prompted Values`} - - - {launchConfig.ask_job_type_on_launch && ( - - )} - {launchConfig.ask_credential_on_launch && ( - - {overrides.credentials.map((cred) => ( - - ))} - - } - /> - )} - {launchConfig.ask_inventory_on_launch && ( - - )} - {launchConfig.ask_scm_branch_on_launch && ( - - )} - {launchConfig.ask_limit_on_launch && ( - - )} - {Object.prototype.hasOwnProperty.call(overrides, 'verbosity') && - launchConfig.ask_verbosity_on_launch ? ( - - ) : null} - {launchConfig.ask_tags_on_launch && ( - - {overrides.job_tags.length > 0 && - overrides.job_tags.split(',').map((jobTag) => ( - - {jobTag} - + {details?.type !== 'system_job_template' && + hasPromptData(launchConfig) && + hasOverrides && ( + <> + {t`Prompted Values`} + + + {launchConfig.ask_job_type_on_launch && ( + + )} + {launchConfig.ask_credential_on_launch && ( + + {overrides.credentials.map((cred) => ( + ))} - - } - /> - )} - {launchConfig.ask_skip_tags_on_launch && ( - - {overrides.skip_tags.length > 0 && - overrides.skip_tags.split(',').map((skipTag) => ( - - {skipTag} - - ))} - - } - /> - )} - {launchConfig.ask_diff_mode_on_launch && ( - - )} - {(launchConfig.survey_enabled || - launchConfig.ask_variables_on_launch) && ( - - )} - - - )} + + } + /> + )} + {launchConfig.ask_inventory_on_launch && ( + + )} + {launchConfig.ask_scm_branch_on_launch && ( + + )} + {launchConfig.ask_limit_on_launch && ( + + )} + {Object.prototype.hasOwnProperty.call(overrides, 'verbosity') && + launchConfig.ask_verbosity_on_launch ? ( + + ) : null} + {launchConfig.ask_tags_on_launch && ( + + {overrides.job_tags.length > 0 && + overrides.job_tags.split(',').map((jobTag) => ( + + {jobTag} + + ))} + + } + /> + )} + {launchConfig.ask_skip_tags_on_launch && ( + + {overrides.skip_tags.length > 0 && + overrides.skip_tags.split(',').map((skipTag) => ( + + {skipTag} + + ))} + + } + /> + )} + {launchConfig.ask_diff_mode_on_launch && ( + + )} + {(launchConfig.survey_enabled || + launchConfig.ask_variables_on_launch) && ( + + )} + + + )} ); } diff --git a/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeViewModal.js b/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeViewModal.js index 550319df41..d5903cf5ef 100644 --- a/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeViewModal.js +++ b/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeViewModal.js @@ -136,7 +136,11 @@ function NodeViewModal({ readOnly }) { if (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( JSON.stringify(promptValues.extra_data) ); @@ -150,7 +154,11 @@ function NodeViewModal({ readOnly }) { if (launchConfig.ask_scm_branch_on_launch) { 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( JSON.stringify(originalNodeObject.extra_data) );