mirror of
https://github.com/ansible/awx.git
synced 2026-05-20 07:17:40 -02:30
grabbed default verbosity from the API
This commit is contained in:
@@ -80,8 +80,13 @@ export function AdhocCtrl($scope, $rootScope, $location, $routeParams,
|
|||||||
choicesReadyCount++;
|
choicesReadyCount++;
|
||||||
|
|
||||||
if (choicesReadyCount === 2) {
|
if (choicesReadyCount === 2) {
|
||||||
|
var verbosity;
|
||||||
// this sets the default options for the selects as specified by the controller.
|
// this sets the default options for the selects as specified by the controller.
|
||||||
$scope.verbosity = $scope.adhoc_verbosity_options[$scope.verbosity_field.default];
|
for (verbosity in $scope.adhoc_verbosity_options) {
|
||||||
|
if ($scope.adhoc_verbosity_options[verbosity].isDefault) {
|
||||||
|
$scope.verbosity = $scope.adhoc_verbosity_options[verbosity];
|
||||||
|
}
|
||||||
|
}
|
||||||
$("#forks-number").spinner("value", $scope.forks_field.default);
|
$("#forks-number").spinner("value", $scope.forks_field.default);
|
||||||
$scope.forks = $scope.forks_field.default;
|
$scope.forks = $scope.forks_field.default;
|
||||||
Wait('stop'); // END: form population
|
Wait('stop'); // END: form population
|
||||||
|
|||||||
@@ -340,8 +340,13 @@ export function JobTemplatesAdd($scope, $rootScope, $compile, $location, $log, $
|
|||||||
$scope.removeChoicesReady = $scope.$on('choicesReadyVerbosity', function () {
|
$scope.removeChoicesReady = $scope.$on('choicesReadyVerbosity', function () {
|
||||||
selectCount++;
|
selectCount++;
|
||||||
if (selectCount === 2) {
|
if (selectCount === 2) {
|
||||||
|
var verbosity;
|
||||||
// this sets the default options for the selects as specified by the controller.
|
// this sets the default options for the selects as specified by the controller.
|
||||||
$scope.verbosity = $scope.verbosity_options[$scope.verbosity_field.default];
|
for (verbosity in $scope.verbosity_options) {
|
||||||
|
if ($scope.verbosity_options[verbosity].isDefault) {
|
||||||
|
$scope.verbosity = $scope.verbosity_options[verbosity];
|
||||||
|
}
|
||||||
|
}
|
||||||
$scope.job_type = $scope.job_type_options[$scope.job_type_field.default];
|
$scope.job_type = $scope.job_type_options[$scope.job_type_field.default];
|
||||||
|
|
||||||
// if you're getting to the form from the scan job section on inventories,
|
// if you're getting to the form from the scan job section on inventories,
|
||||||
|
|||||||
@@ -765,8 +765,9 @@ angular.module('Utilities', ['RestServices', 'Utilities', 'sanitizeFilter'])
|
|||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.options()
|
Rest.options()
|
||||||
.success(function (data) {
|
.success(function (data) {
|
||||||
var choices;
|
var choices, defaultChoice;
|
||||||
choices = (choice_name) ? data.actions.GET[field][choice_name] : data.actions.GET[field].choices;
|
choices = (choice_name) ? data.actions.GET[field][choice_name] : data.actions.GET[field].choices;
|
||||||
|
defaultChoice = data.actions.POST[field].default;
|
||||||
if (choices) {
|
if (choices) {
|
||||||
// including 'name' property so list can be used by search
|
// including 'name' property so list can be used by search
|
||||||
choices.forEach(function(choice) {
|
choices.forEach(function(choice) {
|
||||||
@@ -777,6 +778,14 @@ angular.module('Utilities', ['RestServices', 'Utilities', 'sanitizeFilter'])
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (defaultChoice !== undefined) {
|
||||||
|
var val;
|
||||||
|
for (val in scope[variable]) {
|
||||||
|
if (scope[variable][val].value === defaultChoice) {
|
||||||
|
scope[variable][val].isDefault = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (callback) {
|
if (callback) {
|
||||||
scope.$emit(callback);
|
scope.$emit(callback);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user