migrated job templates to use new verbosity format

This commit is contained in:
John Mitchell 2015-04-20 20:03:06 -04:00
parent 537ab3b317
commit 802fed2a76
2 changed files with 56 additions and 38 deletions

View File

@ -249,7 +249,7 @@ JobTemplatesList.$inject = ['$scope', '$rootScope', '$location', '$log', '$route
export function JobTemplatesAdd($scope, $rootScope, $compile, $location, $log, $routeParams, JobTemplateForm,
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope, GetBasePath,
InventoryList, CredentialList, ProjectList, LookUpInit, md5Setup, ParseTypeChange, Wait, Empty, ToJSON,
CallbackHelpInit, SurveyControllerInit, Prompt) {
CallbackHelpInit, SurveyControllerInit, Prompt, GetChoices) {
ClearScope();
@ -280,12 +280,6 @@ export function JobTemplatesAdd($scope, $rootScope, $compile, $location, $log, $
{ value: 'scan' , label: 'Scan'}
];
$scope.verbosity_options = [
{ value: 0, label: 'Default' },
{ value: 1, label: 'Verbose' },
{ value: 3, label: 'Debug' }
];
$scope.playbook_options = [];
$scope.allow_callbacks = 'false';
@ -315,34 +309,55 @@ export function JobTemplatesAdd($scope, $rootScope, $compile, $location, $log, $
CloudCredentialList.name = 'cloudcredentials';
CloudCredentialList.iterator = 'cloudcredential';
LookUpInit({
url: GetBasePath('credentials') + '?cloud=true',
scope: $scope,
form: form,
current_item: null,
list: CloudCredentialList,
field: 'cloud_credential',
hdr: 'Select Cloud Credential',
input_type: 'radio'
});
LookUpInit({
url: GetBasePath('credentials') + '?kind=ssh',
scope: $scope,
form: form,
current_item: null,
list: CredentialList,
field: 'credential',
hdr: 'Select Machine Credential',
input_type: "radio"
});
SurveyControllerInit({
scope: $scope,
parent_scope: $scope
});
if ($scope.removeLookUpInitialize) {
$scope.removeLookUpInitialize();
}
$scope.removeLookUpInitialize = $scope.$on('lookUpInitialize', function () {
LookUpInit({
url: GetBasePath('credentials') + '?cloud=true',
scope: $scope,
form: form,
current_item: null,
list: CloudCredentialList,
field: 'cloud_credential',
hdr: 'Select Cloud Credential',
input_type: 'radio'
});
LookUpInit({
url: GetBasePath('credentials') + '?kind=ssh',
scope: $scope,
form: form,
current_item: null,
list: CredentialList,
field: 'credential',
hdr: 'Select Machine Credential',
input_type: "radio"
});
});
if ($scope.removeChoicesReady) {
$scope.removeChoicesReady();
}
$scope.removeChoicesReady = $scope.$on('choicesReadyVerbosity', function () {
// this sets the default option as specified by the controller.
$scope.verbosity = $scope.verbosity_options[$scope.verbosity_field.default];
$scope.$emit('lookUpInitialize');
});
// setup verbosity options lookup
GetChoices({
scope: $scope,
url: defaultUrl,
field: 'verbosity',
variable: 'verbosity_options',
callback: 'choicesReadyVerbosity'
});
// Update playbook select whenever project value changes
selectPlaybook = function (oldValue, newValue) {
@ -621,7 +636,7 @@ export function JobTemplatesAdd($scope, $rootScope, $compile, $location, $log, $
JobTemplatesAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'JobTemplateForm',
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope',
'GetBasePath', 'InventoryList', 'CredentialList', 'ProjectList', 'LookUpInit',
'md5Setup', 'ParseTypeChange', 'Wait', 'Empty', 'ToJSON', 'CallbackHelpInit', 'SurveyControllerInit', 'Prompt'
'md5Setup', 'ParseTypeChange', 'Wait', 'Empty', 'ToJSON', 'CallbackHelpInit', 'SurveyControllerInit', 'Prompt', 'GetChoices'
];
@ -660,12 +675,6 @@ export function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log,
{ value: 'scan', label: 'Scan'}
];
$scope.verbosity_options = [
{ value: 0, label: 'Default' },
{ value: 1, label: 'Verbose' },
{ value: 3, label: 'Debug' }
];
SurveyControllerInit({
scope: $scope,
parent_scope: $scope,
@ -963,7 +972,7 @@ export function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log,
}
$scope.removeChoicesReady = $scope.$on('choicesReady', function() {
choicesCount++;
if (choicesCount === 2) {
if (choicesCount === 3) {
$scope.$emit('LoadJobs');
}
});
@ -984,6 +993,15 @@ export function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log,
callback: 'choicesReady'
});
// setup verbosity options lookup
GetChoices({
scope: $scope,
url: defaultUrl,
field: 'verbosity',
variable: 'verbosity_options',
callback: 'choicesReady'
});
function saveCompleted() {
setTimeout(function() {
$scope.$apply(function() {

View File

@ -199,7 +199,7 @@ export default
label: 'Verbosity',
type: 'select',
ngOptions: 'v.label for v in verbosity_options track by v.value',
"default": 0,
"default": 1,
addRequired: true,
editRequired: true,
column: 1,