mirror of
https://github.com/ZwareBear/awx.git
synced 2026-04-09 01:21:49 -05:00
add use code-mirror directive for host variables; fix multiple code-mirrors on page at once
This commit is contained in:
@@ -9,18 +9,19 @@ function atCodeMirrorController (
|
||||
ParseTypeChange
|
||||
) {
|
||||
const vm = this;
|
||||
const variablesName = `${$scope.name}_variables`;
|
||||
function init () {
|
||||
if ($scope.disabled === 'true') {
|
||||
$scope.disabled = true;
|
||||
} else if ($scope.disabled === 'false') {
|
||||
$scope.disabled = false;
|
||||
}
|
||||
$scope.value = $scope.variables.value;
|
||||
$scope.parseType = ParseType;
|
||||
|
||||
$scope[variablesName] = $scope.variables;
|
||||
ParseTypeChange({
|
||||
scope: $scope,
|
||||
variable: 'variables',
|
||||
variable: variablesName,
|
||||
parse_variable: 'parseType',
|
||||
field_id: `${$scope.name}_variables`,
|
||||
readOnly: $scope.disabled
|
||||
@@ -37,10 +38,11 @@ function atCodeMirrorController (
|
||||
// user changes the format from yaml to json in the
|
||||
// modal but CM in the form is set to YAML
|
||||
$scope.variables = varsFromModal;
|
||||
$scope[variablesName] = $scope.variables;
|
||||
// New set of variables from the modal, reinit codemirror
|
||||
ParseTypeChange({
|
||||
scope: $scope,
|
||||
variable: 'variables',
|
||||
variable: variablesName,
|
||||
parse_variable: 'parseType',
|
||||
field_id: `${$scope.name}_variables`,
|
||||
readOnly: $scope.disabled
|
||||
@@ -56,6 +58,7 @@ function atCodeMirrorController (
|
||||
vm.expanded = false;
|
||||
vm.close = close;
|
||||
vm.expand = expand;
|
||||
vm.variablesName = variablesName;
|
||||
if ($scope.init) {
|
||||
$scope.init = init;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
type="radio"
|
||||
value="yaml"
|
||||
ng-model="parseType"
|
||||
ng-change="parseTypeChange('parseType', 'variables')"
|
||||
ng-change="parseTypeChange('parseType', vm.variablesName)"
|
||||
class="ng-pristine ng-untouched ng-valid ng-not-empty">
|
||||
{{ vm.strings.get('label.YAML')}}
|
||||
</label>
|
||||
@@ -32,7 +32,7 @@
|
||||
type="radio"
|
||||
value="json"
|
||||
ng-model="parseType"
|
||||
ng-change="parseTypeChange('parseType', 'variables')"
|
||||
ng-change="parseTypeChange('parseType', vm.variablesName)"
|
||||
class="ng-pristine ng-untouched ng-valid ng-not-empty">
|
||||
{{ vm.strings.get('label.JSON')}}
|
||||
</label>
|
||||
|
||||
@@ -13,7 +13,7 @@ function atCodeMirrorModalController (
|
||||
ParseTypeChange
|
||||
) {
|
||||
const vm = this;
|
||||
const variablesName = `${$scope.name}_variables`;
|
||||
// const variablesName = `${$scope.name}_variables`;
|
||||
function resize () {
|
||||
if ($scope.disabled === 'true') {
|
||||
$scope.disabled = true;
|
||||
@@ -53,8 +53,6 @@ function atCodeMirrorModalController (
|
||||
minWidth: 600
|
||||
});
|
||||
$(`${CodeMirrorModalID} .modal-dialog`).on('resize', resize);
|
||||
|
||||
$scope.foovars = 'testing';
|
||||
}
|
||||
|
||||
vm.strings = strings;
|
||||
|
||||
Reference in New Issue
Block a user