From 5f38b4fde4692a9bfde0926573963429032db543 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Wed, 25 Apr 2018 16:41:48 -0700 Subject: [PATCH] removes code/references related to cleanup_facts mgmt jobs, and their schedules --- .../management-jobs/card/card.controller.js | 124 ------------------ .../management-jobs/card/card.partial.html | 4 +- .../management-jobs/card/mgmtcards.block.less | 2 +- .../scheduler/schedulerForm.partial.html | 40 +----- .../factories/schedule-post.factory.js | 8 +- .../src/scheduler/schedulerAdd.controller.js | 36 +---- .../src/scheduler/schedulerEdit.controller.js | 67 ++-------- 7 files changed, 18 insertions(+), 263 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 e2c1b1a844..846b95a6ff 100644 --- a/awx/ui/client/src/management-jobs/card/card.controller.js +++ b/awx/ui/client/src/management-jobs/card/card.controller.js @@ -38,121 +38,6 @@ export default $scope.cardAction = "notifications"; } - $scope.submitCleanupJob = function(id, name){ - defaultUrl = GetBasePath('system_job_templates')+id+'/launch/'; - CreateDialog({ - id: 'prompt-for-days-facts', - title: name, - scope: $scope, - width: 500, - height: 470, - minWidth: 200, - callback: 'PromptForDaysFacts', - resizable: false, - onOpen: function(){ - $scope.$watch('prompt_for_days_facts_form.$invalid', function(invalid) { - if (invalid === true) { - $('#prompt-for-days-facts-launch').prop("disabled", true); - } else { - $('#prompt-for-days-facts-launch').prop("disabled", false); - } - }); - - var fieldScope = $scope.$parent; - - // set these form elements up on the $scope where the form - // is the parent of the current $scope - - fieldScope.keep_unit_choices = [{ - "label" : "Days", - "value" : "d" - }, - { - "label": "Weeks", - "value" : "w" - }, - { - "label" : "Years", - "value" : "y" - }]; - fieldScope.granularity_keep_unit_choices = [{ - "label" : "Days", - "value" : "d" - }, - { - "label": "Weeks", - "value" : "w" - }, - { - "label" : "Years", - "value" : "y" - }]; - $scope.prompt_for_days_facts_form.$setPristine(); - $scope.prompt_for_days_facts_form.$invalid = false; - fieldScope.keep_unit = fieldScope.keep_unit_choices[0]; - fieldScope.granularity_keep_unit = fieldScope.granularity_keep_unit_choices[1]; - fieldScope.keep_amount = 30; - fieldScope.granularity_keep_amount = 1; - }, - buttons: [ - { - "label": "Cancel", - "onClick": function() { - $(this).dialog('close'); - }, - "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 - }, - data = {}; - data.extra_vars = JSON.stringify(extra_vars); - - Rest.setUrl(defaultUrl); - Rest.post(data) - .then(({data}) => { - Wait('stop'); - $("#prompt-for-days-facts").dialog("close"); - $("#configure-dialog").dialog('close'); - $state.go('jobz', { id: data.system_job, type: 'system' }, { reload: true }); - }) - .catch(({data, status}) => { - let template_id = $scope.job_template_id; - template_id = (template_id === undefined) ? "undefined" : i18n.sprintf("%d", template_id); - ProcessErrors($scope, data, status, null, { hdr: i18n._('Error!'), - msg: i18n.sprintf(i18n._('Failed updating job %s with variables. POST returned: %d'), template_id, status) }); - }); - }, - "class": "btn btn-primary", - "id": "prompt-for-days-facts-launch", - } - ] - }); - - if ($scope.removePromptForDays) { - $scope.removePromptForDays(); - } - $scope.removePromptForDays = $scope.$on('PromptForDaysFacts', function() { - // $('#configure-dialog').dialog('close'); - $('#prompt-for-days-facts').show(); - $('#prompt-for-days-facts').dialog('open'); - CreateSelect2({ - element: '#keep_unit', - multiple: false - }); - CreateSelect2({ - element: '#granularity_keep_unit', - multiple: false - }); - Wait('stop'); - }); - }; - $scope.goToNotifications = function(card){ $state.transitionTo('managementJobsList.notifications',{ card: card, @@ -235,15 +120,6 @@ export default }); }; - $scope.chooseRunJob = function(id, name) { - if(this.card.job_type === "cleanup_facts") { - // Run only for 'Cleanup Fact Details' - $scope.submitCleanupJob(id, name); - } else { - $scope.submitJob(id, name); - } - }; - $scope.configureSchedule = function(id) { $state.transitionTo('managementJobsList.schedule', { id: id 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 66aa4befbe..008786dc7f 100644 --- a/awx/ui/client/src/management-jobs/card/card.partial.html +++ b/awx/ui/client/src/management-jobs/card/card.partial.html @@ -18,7 +18,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 75a463dc82..57c09e84e3 100644 --- a/awx/ui/client/src/management-jobs/card/mgmtcards.block.less +++ b/awx/ui/client/src/management-jobs/card/mgmtcards.block.less @@ -1,7 +1,6 @@ .MgmtCards { display: flex; flex-flow: row wrap; - justify-content: space-between; } .MgmtCards-card { @@ -11,6 +10,7 @@ border: 1px solid @b7grey; align-items: baseline; margin-top: 20px; + margin-right: 20px; width: 32%; } diff --git a/awx/ui/client/src/management-jobs/scheduler/schedulerForm.partial.html b/awx/ui/client/src/management-jobs/scheduler/schedulerForm.partial.html index 9723193d39..a735e4c825 100644 --- a/awx/ui/client/src/management-jobs/scheduler/schedulerForm.partial.html +++ b/awx/ui/client/src/management-jobs/scheduler/schedulerForm.partial.html @@ -161,7 +161,7 @@ ng-show="sheduler_frequency_error"> -
+
A value is required.
@@ -521,44 +521,6 @@
- -
- Note: 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.
- -
- -
- - -
- - -
-
Please enter the number of days you would like to keep this data.
-
Please enter a valid number.
-
Please enter a non-negative number.
-
Please enter a number smaller than 9999.
-
-
- -
- -
- - -
- - -
-
Please enter the number of days you would like to keep this data.
-
Please enter a valid number.
-
Please enter a non-negative number.
-
Please enter a number smaller than 9999.
-
-
-
{ scheduler.scope.timeZones = data; scheduler.scope.schedulerTimeZone = _.find(data, function(x) { - let tz = $scope.schedule_obj.rrule.match(/TZID=\s*(.*?)\s*:/)[1]; - return x.name === tz; + let tz = $scope.schedule_obj.rrule.match(/TZID=\s*(.*?)\s*:/); + if (_.has(tz, '1')) { + return x.name === tz[1]; + } else { + return false; + } + }); }); scheduler.inject('form-container', false); @@ -200,56 +203,8 @@ function($filter, $state, $stateParams, Wait, $scope, moment, scheduler.setRRule(schedule.rrule); scheduler.setName(schedule.name); - if ($scope.isFactCleanup || $scope.cleanupJob){ - var a,b, prompt_for_days, - keep_unit, - granularity, - granularity_keep_unit; - - if ($scope.cleanupJob){ - $scope.schedulerPurgeDays = Number(schedule.extra_data.days); - } else if ($scope.isFactCleanup){ - $scope.keep_unit_choices = [{ - "label" : "Days", - "value" : "d" - }, - { - "label": "Weeks", - "value" : "w" - }, - { - "label" : "Years", - "value" : "y" - }]; - $scope.granularity_keep_unit_choices = [{ - "label" : "Days", - "value" : "d" - }, - { - "label": "Weeks", - "value" : "w" - }, - { - "label" : "Years", - "value" : "y" - }]; - // the API returns something like 20w or 1y - a = schedule.extra_data.older_than; // "20y" - b = schedule.extra_data.granularity; // "1w" - prompt_for_days = Number(_.initial(a,1).join('')); // 20 - keep_unit = _.last(a); // "y" - granularity = Number(_.initial(b,1).join('')); // 1 - granularity_keep_unit = _.last(b); // "w" - - $scope.keep_amount = prompt_for_days; - $scope.granularity_keep_amount = granularity; - $scope.keep_unit = _.find($scope.keep_unit_choices, function(i){ - return i.value === keep_unit; - }); - $scope.granularity_keep_unit =_.find($scope.granularity_keep_unit_choices, function(i){ - return i.value === granularity_keep_unit; - }); - } + if ($scope.cleanupJob){ + $scope.schedulerPurgeDays = Number(schedule.extra_data.days); } if ($state.current.name === 'jobTemplateSchedules.edit'){