From dcb792f5a4049522d2d54cfc44858cde40cbdde6 Mon Sep 17 00:00:00 2001 From: Ken Hoes Date: Thu, 14 Apr 2016 11:51:58 -0400 Subject: [PATCH 1/2] Management job modals restyled & shows correct modals. --- .../management-jobs/card/card.controller.js | 111 +++++++++--------- .../management-jobs/card/card.partial.html | 4 +- .../management-jobs/card/mgmtcards.block.less | 9 ++ awx/ui/templates/ui/index.html | 9 +- 4 files changed, 73 insertions(+), 60 deletions(-) diff --git a/awx/ui/client/src/management-jobs/card/card.controller.js b/awx/ui/client/src/management-jobs/card/card.controller.js index b74926f652..4a1f5007d6 100644 --- a/awx/ui/client/src/management-jobs/card/card.controller.js +++ b/awx/ui/client/src/management-jobs/card/card.controller.js @@ -12,18 +12,19 @@ export default 'SchedulesList', 'Rest' , 'ProcessErrors', 'managementJobsListObject', '$rootScope', '$state','$scope', - function( Wait, $location, $compile, CreateDialog, + function( Wait, $location, $compile, CreateDialog, GetBasePath, SearchInit, PaginateInit, SchedulesList, Rest, ProcessErrors, managementJobsListObject, $rootScope, $state, $scope) { - + var defaultUrl = GetBasePath('system_job_templates'); var getManagementJobs = function(){ Rest.setUrl(defaultUrl); Rest.get() .success(function(data){ + console.info(data.results); $scope.mgmtCards = data.results; Wait('stop'); }) @@ -32,7 +33,7 @@ export default msg: 'Call to '+ defaultUrl + ' failed. Return status: '+ status}); }); }; - getManagementJobs(); + getManagementJobs(); var scope = $rootScope.$new(), parent_scope = scope, list = managementJobsListObject; @@ -51,9 +52,6 @@ export default if (scope.searchCleanup) { scope.searchCleanup(); } - // if (!Empty(parent_scope) && parent_scope.restoreSearch) { - // parent_scope.restoreSearch(); - // } else { Wait('stop'); } @@ -69,6 +67,7 @@ export default height: 470, minWidth: 200, callback: 'PromptForDaysFacts', + resizable: false, onOpen: function(){ scope.$watch('prompt_for_days_facts_form.$invalid', function(invalid) { if (invalid === true) { @@ -113,41 +112,40 @@ export default fieldScope.keep_amount = 30; fieldScope.granularity_keep_amount = 1; }, - buttons: [{ - "label": "Cancel", - "onClick": function() { - $(this).dialog('close'); + buttons: [ + { + "label": "Launch", + "onClick": function() { + var extra_vars = { + "older_than": scope.keep_amount+scope.keep_unit.value, + "granularity": scope.granularity_keep_amount+scope.granularity_keep_unit.value + }, + data = {}; + data.extra_vars = JSON.stringify(extra_vars); - }, - "icon": "fa-times", - "class": "btn btn-default", - "id": "prompt-for-days-facts-cancel" - },{ - "label": "Launch", - "onClick": function() { - var extra_vars = { - "older_than": scope.keep_amount+scope.keep_unit.value, - "granularity": scope.granularity_keep_amount+scope.granularity_keep_unit.value + Rest.setUrl(defaultUrl); + Rest.post(data) + .success(function() { + Wait('stop'); + $("#prompt-for-days-facts").dialog("close"); + $("#configure-tower-dialog").dialog('close'); + $location.path('/jobs/'); + }) + .error(function(data, status) { + ProcessErrors(scope, data, status, null, { hdr: 'Error!', + msg: 'Failed updating job ' + scope.job_template_id + ' with variables. POST returned: ' + status }); + }); }, - data = {}; - data.extra_vars = JSON.stringify(extra_vars); - - Rest.setUrl(defaultUrl); - Rest.post(data) - .success(function() { - Wait('stop'); - $("#prompt-for-days-facts").dialog("close"); - $("#configure-tower-dialog").dialog('close'); - $location.path('/jobs/'); - }) - .error(function(data, status) { - ProcessErrors(scope, data, status, null, { hdr: 'Error!', - msg: 'Failed updating job ' + scope.job_template_id + ' with variables. POST returned: ' + status }); - }); + "class": "btn btn-primary", + "id": "prompt-for-days-facts-launch", }, - "icon": "fa-rocket", - "class": "btn btn-primary", - "id": "prompt-for-days-facts-launch" + { + "label": "Cancel", + "onClick": function() { + $(this).dialog('close'); + }, + "class": "btn btn-default", + "id": "prompt-for-days-facts-cancel" }] }); @@ -162,12 +160,8 @@ export default }); }; - $scope.submitJob = function (id, name) { + $scope.submitJob = function (id, name, card) { Wait('start'); - if(this.configure_job.job_type === "cleanup_facts"){ - scope.submitCleanupJob(id, name); - } - else { defaultUrl = GetBasePath('system_job_templates')+id+'/launch/'; CreateDialog({ id: 'prompt-for-days' , @@ -177,6 +171,7 @@ export default height: 300, minWidth: 200, callback: 'PromptForDays', + resizable: false, onOpen: function(){ scope.$watch('prompt_for_days_form.$invalid', function(invalid) { if (invalid === true) { @@ -191,16 +186,8 @@ export default scope.prompt_for_days_form.$setPristine(); scope.prompt_for_days_form.$invalid = false; }, - buttons: [{ - "label": "Cancel", - "onClick": function() { - $(this).dialog('close'); - - }, - "icon": "fa-times", - "class": "btn btn-default", - "id": "prompt-for-days-cancel" - },{ + buttons: [ + { "label": "Launch", "onClick": function() { var extra_vars = {"days": scope.days_to_keep }, @@ -220,9 +207,17 @@ export default msg: 'Failed updating job ' + scope.job_template_id + ' with variables. POST returned: ' + status }); }); }, - "icon": "fa-rocket", "class": "btn btn-primary", "id": "prompt-for-days-launch" + }, + { + "label": "Cancel", + "onClick": function() { + $(this).dialog('close'); + + }, + "class": "btn btn-default", + "id": "prompt-for-days-cancel" }] }); @@ -235,6 +230,14 @@ export default $('#prompt-for-days').dialog('open'); Wait('stop'); }); + }; + + $scope.chooseRunJob = function(id, name) { + if(id === 4) { + // Run only for 'Cleanup Fact Details' + $scope.submitCleanupJob(id, name); + } else { + $scope.submitJob(id, name); } }; diff --git a/awx/ui/client/src/management-jobs/card/card.partial.html b/awx/ui/client/src/management-jobs/card/card.partial.html index 17332be2bc..f0884e96a7 100644 --- a/awx/ui/client/src/management-jobs/card/card.partial.html +++ b/awx/ui/client/src/management-jobs/card/card.partial.html @@ -7,7 +7,7 @@

{{ card.name }}

- \ No newline at end of file + diff --git a/awx/ui/client/src/management-jobs/card/mgmtcards.block.less b/awx/ui/client/src/management-jobs/card/mgmtcards.block.less index 1f83e43df2..87818f55e5 100644 --- a/awx/ui/client/src/management-jobs/card/mgmtcards.block.less +++ b/awx/ui/client/src/management-jobs/card/mgmtcards.block.less @@ -114,3 +114,12 @@ margin-right: 0px; } } + +#prompt-for-days-facts, #prompt-for-days { + overflow-x: hidden; + font-family: "Open Sans"; + .label-text { + text-transform: uppercase; + font-weight: normal; + } +} diff --git a/awx/ui/templates/ui/index.html b/awx/ui/templates/ui/index.html index 01593e0a0c..678edad92c 100644 --- a/awx/ui/templates/ui/index.html +++ b/awx/ui/templates/ui/index.html @@ -171,10 +171,11 @@
For facts collected older than the time period specified, save one fact scan (snapshot) per time window (frequency). For example, facts older than 30 days are purged, while one - weekly fact scan is kept.
- Caution: Setting both numerical variables to "0" will delete all facts.
+ weekly fact scan is kept.

+ + CAUTION: Setting both numerical variables to "0" will delete all facts.

-
+
From 3067dfa144fe397c99a2d41af5498005be97a964 Mon Sep 17 00:00:00 2001 From: Ken Hoes Date: Thu, 14 Apr 2016 14:57:04 -0400 Subject: [PATCH 2/2] Removing debug statement that slipped by. --- awx/ui/client/src/management-jobs/card/card.controller.js | 1 - 1 file changed, 1 deletion(-) diff --git a/awx/ui/client/src/management-jobs/card/card.controller.js b/awx/ui/client/src/management-jobs/card/card.controller.js index 4a1f5007d6..85c4d825ab 100644 --- a/awx/ui/client/src/management-jobs/card/card.controller.js +++ b/awx/ui/client/src/management-jobs/card/card.controller.js @@ -24,7 +24,6 @@ export default Rest.setUrl(defaultUrl); Rest.get() .success(function(data){ - console.info(data.results); $scope.mgmtCards = data.results; Wait('stop'); })