mirror of
https://github.com/ansible/awx.git
synced 2026-04-07 11:09:22 -02:30
migrated job type select to using api options as well
This commit is contained in:
@@ -272,13 +272,7 @@ export function JobTemplatesAdd($scope, $rootScope, $compile, $location, $log, $
|
|||||||
};
|
};
|
||||||
$scope.mode = "add";
|
$scope.mode = "add";
|
||||||
$scope.parseType = 'yaml';
|
$scope.parseType = 'yaml';
|
||||||
ParseTypeChange({ scope: $scope, field_id: 'job_templates_variables', onChange: callback });
|
ParseTypeChange({ scope: $scope, field_id: 'job_templates_variables', onChange: callback })
|
||||||
|
|
||||||
$scope.job_type_options = [
|
|
||||||
{ value: 'run', label: 'Run' },
|
|
||||||
{ value: 'check', label: 'Check' },
|
|
||||||
{ value: 'scan' , label: 'Scan'}
|
|
||||||
];
|
|
||||||
|
|
||||||
$scope.playbook_options = [];
|
$scope.playbook_options = [];
|
||||||
$scope.allow_callbacks = 'false';
|
$scope.allow_callbacks = 'false';
|
||||||
@@ -341,16 +335,22 @@ export function JobTemplatesAdd($scope, $rootScope, $compile, $location, $log, $
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var selectCount = 0;
|
||||||
|
|
||||||
if ($scope.removeChoicesReady) {
|
if ($scope.removeChoicesReady) {
|
||||||
$scope.removeChoicesReady();
|
$scope.removeChoicesReady();
|
||||||
}
|
}
|
||||||
$scope.removeChoicesReady = $scope.$on('choicesReadyVerbosity', function () {
|
$scope.removeChoicesReady = $scope.$on('choicesReadyVerbosity', function () {
|
||||||
// this sets the default option as specified by the controller.
|
selectCount++;
|
||||||
$scope.verbosity = $scope.verbosity_options[$scope.verbosity_field.default];
|
if (selectCount === 2) {
|
||||||
$scope.$emit('lookUpInitialize');
|
// this sets the default options for the selects as specified by the controller.
|
||||||
|
$scope.verbosity = $scope.verbosity_options[$scope.verbosity_field.default];
|
||||||
|
$scope.job_type = $scope.job_type_options[$scope.job_type_field.default];
|
||||||
|
$scope.$emit('lookUpInitialize');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// setup verbosity options lookup
|
// setup verbosity options select
|
||||||
GetChoices({
|
GetChoices({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
url: defaultUrl,
|
url: defaultUrl,
|
||||||
@@ -359,6 +359,15 @@ export function JobTemplatesAdd($scope, $rootScope, $compile, $location, $log, $
|
|||||||
callback: 'choicesReadyVerbosity'
|
callback: 'choicesReadyVerbosity'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// setup job type options select
|
||||||
|
GetChoices({
|
||||||
|
scope: $scope,
|
||||||
|
url: defaultUrl,
|
||||||
|
field: 'job_type',
|
||||||
|
variable: 'job_type_options',
|
||||||
|
callback: 'choicesReadyVerbosity'
|
||||||
|
});
|
||||||
|
|
||||||
// Update playbook select whenever project value changes
|
// Update playbook select whenever project value changes
|
||||||
selectPlaybook = function (oldValue, newValue) {
|
selectPlaybook = function (oldValue, newValue) {
|
||||||
var url;
|
var url;
|
||||||
@@ -668,13 +677,6 @@ export function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log,
|
|||||||
$scope.parseType = 'yaml';
|
$scope.parseType = 'yaml';
|
||||||
$scope.showJobType = false;
|
$scope.showJobType = false;
|
||||||
|
|
||||||
// Our job type options
|
|
||||||
$scope.job_type_options = [
|
|
||||||
{ value: 'run', label: 'Run' },
|
|
||||||
{ value: 'check', label: 'Check' },
|
|
||||||
{ value: 'scan', label: 'Scan'}
|
|
||||||
];
|
|
||||||
|
|
||||||
SurveyControllerInit({
|
SurveyControllerInit({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
parent_scope: $scope,
|
parent_scope: $scope,
|
||||||
@@ -972,7 +974,7 @@ export function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log,
|
|||||||
}
|
}
|
||||||
$scope.removeChoicesReady = $scope.$on('choicesReady', function() {
|
$scope.removeChoicesReady = $scope.$on('choicesReady', function() {
|
||||||
choicesCount++;
|
choicesCount++;
|
||||||
if (choicesCount === 3) {
|
if (choicesCount === 4) {
|
||||||
$scope.$emit('LoadJobs');
|
$scope.$emit('LoadJobs');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1002,6 +1004,15 @@ export function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log,
|
|||||||
callback: 'choicesReady'
|
callback: 'choicesReady'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// setup job type options lookup
|
||||||
|
GetChoices({
|
||||||
|
scope: $scope,
|
||||||
|
url: defaultUrl,
|
||||||
|
field: 'job_type',
|
||||||
|
variable: 'job_type_options',
|
||||||
|
callback: 'choicesReady'
|
||||||
|
});
|
||||||
|
|
||||||
function saveCompleted() {
|
function saveCompleted() {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$scope.$apply(function() {
|
$scope.$apply(function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user