mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
code-mirror: keep yaml/json setting in sync with modal
This commit is contained in:
@@ -18,6 +18,7 @@ function atCodeMirrorController (
|
|||||||
}
|
}
|
||||||
$scope.parseType = ParseType;
|
$scope.parseType = ParseType;
|
||||||
|
|
||||||
|
$scope.variablesName = variablesName;
|
||||||
$scope[variablesName] = $scope.variables;
|
$scope[variablesName] = $scope.variables;
|
||||||
ParseTypeChange({
|
ParseTypeChange({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
@@ -32,13 +33,14 @@ function atCodeMirrorController (
|
|||||||
vm.expanded = true;
|
vm.expanded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function close (varsFromModal) {
|
function close (varsFromModal, parseTypeFromModal) {
|
||||||
// TODO: make sure that the variables format matches
|
// TODO: make sure that the variables format matches
|
||||||
// parseType before re-initializing CodeMirror. Ex)
|
// parseType before re-initializing CodeMirror. Ex)
|
||||||
// user changes the format from yaml to json in the
|
// user changes the format from yaml to json in the
|
||||||
// modal but CM in the form is set to YAML
|
// modal but CM in the form is set to YAML
|
||||||
$scope.variables = varsFromModal;
|
$scope.variables = varsFromModal;
|
||||||
$scope[variablesName] = $scope.variables;
|
$scope[variablesName] = $scope.variables;
|
||||||
|
$scope.parseType = parseTypeFromModal;
|
||||||
// New set of variables from the modal, reinit codemirror
|
// New set of variables from the modal, reinit codemirror
|
||||||
ParseTypeChange({
|
ParseTypeChange({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
@@ -59,6 +61,7 @@ function atCodeMirrorController (
|
|||||||
vm.close = close;
|
vm.close = close;
|
||||||
vm.expand = expand;
|
vm.expand = expand;
|
||||||
vm.variablesName = variablesName;
|
vm.variablesName = variablesName;
|
||||||
|
vm.parseType = $scope.parseType;
|
||||||
if ($scope.init) {
|
if ($scope.init) {
|
||||||
$scope.init = init;
|
$scope.init = init;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,9 +53,10 @@
|
|||||||
name="{{ vm.name }}"
|
name="{{ vm.name }}"
|
||||||
ng-if="vm.expanded"
|
ng-if="vm.expanded"
|
||||||
modal-vars="variables"
|
modal-vars="variables"
|
||||||
|
parse-type="parseType"
|
||||||
tooltip="{{ tooltip || vm.strings.get('code_mirror.tooltip.TOOLTIP') }}"
|
tooltip="{{ tooltip || vm.strings.get('code_mirror.tooltip.TOOLTIP') }}"
|
||||||
label="{{ label || vm.strings.get('code_mirror.label.VARIABLES') }}"
|
label="{{ label || vm.strings.get('code_mirror.label.VARIABLES') }}"
|
||||||
disabled="{{ disabled || false }}"
|
disabled="{{ disabled || false }}"
|
||||||
close-fn="vm.close">
|
close-fn="vm.close(values, parseType)">
|
||||||
</at-code-mirror-modal>
|
</at-code-mirror-modal>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -58,7 +58,10 @@ function atCodeMirrorModalController (
|
|||||||
vm.strings = strings;
|
vm.strings = strings;
|
||||||
vm.toggle = toggle;
|
vm.toggle = toggle;
|
||||||
$scope.close = () => {
|
$scope.close = () => {
|
||||||
$scope.closeFn()($scope.modalVars);
|
$scope.closeFn({
|
||||||
|
values: $scope.modalVars,
|
||||||
|
parseType: $scope.parseType,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
if ($scope.init) {
|
if ($scope.init) {
|
||||||
$scope.init = init;
|
$scope.init = init;
|
||||||
@@ -88,6 +91,7 @@ function atCodeMirrorModal () {
|
|||||||
labelClass: '@',
|
labelClass: '@',
|
||||||
tooltip: '@',
|
tooltip: '@',
|
||||||
modalVars: '=',
|
modalVars: '=',
|
||||||
|
parseType: '=',
|
||||||
name: '@',
|
name: '@',
|
||||||
closeFn: '&'
|
closeFn: '&'
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user