diff --git a/awx/ui_next/src/components/CodeEditor/VariablesDetail.jsx b/awx/ui_next/src/components/CodeEditor/VariablesDetail.jsx
index 602ef6695f..4c3af1fbe8 100644
--- a/awx/ui_next/src/components/CodeEditor/VariablesDetail.jsx
+++ b/awx/ui_next/src/components/CodeEditor/VariablesDetail.jsx
@@ -1,13 +1,14 @@
import 'styled-components/macro';
import React, { useState, useEffect } from 'react';
import { node, number, oneOfType, shape, string, arrayOf } from 'prop-types';
-import { Trans, withI18n } from '@lingui/react';
+import { withI18n } from '@lingui/react';
import { t } from '@lingui/macro';
import {
Split,
SplitItem,
TextListItemVariants,
Button,
+ Modal,
} from '@patternfly/react-core';
import { ExpandArrowsAltIcon } from '@patternfly/react-icons';
import { DetailName, DetailValue } from '../DetailList';
@@ -36,15 +37,7 @@ function getValueAsMode(value, mode) {
return mode === YAML_MODE ? jsonToYaml(value) : yamlToJson(value);
}
-function VariablesDetail({
- dataCy,
- helpText,
- value,
- label,
- rows,
- fullHeight,
- i18n,
-}) {
+function VariablesDetail({ dataCy, helpText, value, label, rows, i18n }) {
const [mode, setMode] = useState(
isJsonObject(value) || isJsonString(value) ? JSON_MODE : YAML_MODE
);
@@ -76,51 +69,18 @@ function VariablesDetail({
fullWidth
css="grid-column: 1 / -1"
>
-
-
-
-
-
-
- {label}
-
- {helpText && (
-
- )}
-
-
-
- {
- try {
- setCurrentValue(getValueAsMode(currentValue, newMode));
- setMode(newMode);
- } catch (err) {
- setError(err);
- }
- }}
- />
-
-
-
-
-
-
-
+ setIsExpanded(true)}
+ i18n={i18n}
+ />
{error && (
@@ -141,10 +100,48 @@ function VariablesDetail({
css="color: var(--pf-global--danger-color--100);
font-size: var(--pf-global--FontSize--sm"
>
- Error: {error.message}
+ {i18n._(t`Error:`)} {error.message}
)}
+ setIsExpanded(false)}
+ actions={[
+ ,
+ ]}
+ >
+
+
+
+
+
>
);
}
@@ -161,4 +158,67 @@ VariablesDetail.defaultProps = {
helpText: '',
};
+function ModeToggle({
+ label,
+ helpText,
+ dataCy,
+ currentValue,
+ setCurrentValue,
+ mode,
+ setMode,
+ setError,
+ onExpand,
+ i18n,
+}) {
+ return (
+
+
+
+
+
+
+ {label}
+
+ {helpText && (
+
+ )}
+
+
+
+ {
+ try {
+ setCurrentValue(getValueAsMode(currentValue, newMode));
+ setMode(newMode);
+ } catch (err) {
+ setError(err);
+ }
+ }}
+ />
+
+
+
+ {onExpand && (
+
+
+
+ )}
+
+ );
+}
+
export default withI18n()(VariablesDetail);