1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 23:51:09 +03:00

Merge pull request #1539 from kensible/1048-managementJobs

Management job modals restyled & shows correct modals.
This commit is contained in:
kensible 2016-04-15 15:44:37 -04:00
commit 3b765e8dda
4 changed files with 72 additions and 60 deletions

View File

@ -51,9 +51,6 @@ export default
if (scope.searchCleanup) { if (scope.searchCleanup) {
scope.searchCleanup(); scope.searchCleanup();
} }
// if (!Empty(parent_scope) && parent_scope.restoreSearch) {
// parent_scope.restoreSearch();
// }
else { else {
Wait('stop'); Wait('stop');
} }
@ -69,6 +66,7 @@ export default
height: 470, height: 470,
minWidth: 200, minWidth: 200,
callback: 'PromptForDaysFacts', callback: 'PromptForDaysFacts',
resizable: false,
onOpen: function(){ onOpen: function(){
scope.$watch('prompt_for_days_facts_form.$invalid', function(invalid) { scope.$watch('prompt_for_days_facts_form.$invalid', function(invalid) {
if (invalid === true) { if (invalid === true) {
@ -113,41 +111,40 @@ export default
fieldScope.keep_amount = 30; fieldScope.keep_amount = 30;
fieldScope.granularity_keep_amount = 1; fieldScope.granularity_keep_amount = 1;
}, },
buttons: [{ buttons: [
"label": "Cancel", {
"onClick": function() { "label": "Launch",
$(this).dialog('close'); "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);
"icon": "fa-times", Rest.post(data)
"class": "btn btn-default", .success(function() {
"id": "prompt-for-days-facts-cancel" Wait('stop');
},{ $("#prompt-for-days-facts").dialog("close");
"label": "Launch", $("#configure-tower-dialog").dialog('close');
"onClick": function() { $location.path('/jobs/');
var extra_vars = { })
"older_than": scope.keep_amount+scope.keep_unit.value, .error(function(data, status) {
"granularity": scope.granularity_keep_amount+scope.granularity_keep_unit.value ProcessErrors(scope, data, status, null, { hdr: 'Error!',
msg: 'Failed updating job ' + scope.job_template_id + ' with variables. POST returned: ' + status });
});
}, },
data = {}; "class": "btn btn-primary",
data.extra_vars = JSON.stringify(extra_vars); "id": "prompt-for-days-facts-launch",
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 });
});
}, },
"icon": "fa-rocket", {
"class": "btn btn-primary", "label": "Cancel",
"id": "prompt-for-days-facts-launch" "onClick": function() {
$(this).dialog('close');
},
"class": "btn btn-default",
"id": "prompt-for-days-facts-cancel"
}] }]
}); });
@ -162,12 +159,8 @@ export default
}); });
}; };
$scope.submitJob = function (id, name) { $scope.submitJob = function (id, name, card) {
Wait('start'); Wait('start');
if(this.configure_job.job_type === "cleanup_facts"){
scope.submitCleanupJob(id, name);
}
else {
defaultUrl = GetBasePath('system_job_templates')+id+'/launch/'; defaultUrl = GetBasePath('system_job_templates')+id+'/launch/';
CreateDialog({ CreateDialog({
id: 'prompt-for-days' , id: 'prompt-for-days' ,
@ -177,6 +170,7 @@ export default
height: 300, height: 300,
minWidth: 200, minWidth: 200,
callback: 'PromptForDays', callback: 'PromptForDays',
resizable: false,
onOpen: function(){ onOpen: function(){
scope.$watch('prompt_for_days_form.$invalid', function(invalid) { scope.$watch('prompt_for_days_form.$invalid', function(invalid) {
if (invalid === true) { if (invalid === true) {
@ -191,16 +185,8 @@ export default
scope.prompt_for_days_form.$setPristine(); scope.prompt_for_days_form.$setPristine();
scope.prompt_for_days_form.$invalid = false; scope.prompt_for_days_form.$invalid = false;
}, },
buttons: [{ buttons: [
"label": "Cancel", {
"onClick": function() {
$(this).dialog('close');
},
"icon": "fa-times",
"class": "btn btn-default",
"id": "prompt-for-days-cancel"
},{
"label": "Launch", "label": "Launch",
"onClick": function() { "onClick": function() {
var extra_vars = {"days": scope.days_to_keep }, var extra_vars = {"days": scope.days_to_keep },
@ -220,9 +206,17 @@ export default
msg: 'Failed updating job ' + scope.job_template_id + ' with variables. POST returned: ' + status }); msg: 'Failed updating job ' + scope.job_template_id + ' with variables. POST returned: ' + status });
}); });
}, },
"icon": "fa-rocket",
"class": "btn btn-primary", "class": "btn btn-primary",
"id": "prompt-for-days-launch" "id": "prompt-for-days-launch"
},
{
"label": "Cancel",
"onClick": function() {
$(this).dialog('close');
},
"class": "btn btn-default",
"id": "prompt-for-days-cancel"
}] }]
}); });
@ -235,6 +229,14 @@ export default
$('#prompt-for-days').dialog('open'); $('#prompt-for-days').dialog('open');
Wait('stop'); 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);
} }
}; };

View File

@ -7,7 +7,7 @@
<h3 class="MgmtCards-label"> {{ card.name }}</h3> <h3 class="MgmtCards-label"> {{ card.name }}</h3>
<div class="MgmtCards-actionItems"> <div class="MgmtCards-actionItems">
<button class="MgmtCards-actionItem List-actionButton" <button class="MgmtCards-actionItem List-actionButton"
ng-click='submitCleanupJob(card.id, card.name)'> ng-click='chooseRunJob(card.id, card.name)'>
<i class="MgmtCards-actionItemIcon fa fa-rocket"></i> <i class="MgmtCards-actionItemIcon fa fa-rocket"></i>
</button> </button>
<button class="MgmtCards-actionItem List-actionButton" <button class="MgmtCards-actionItem List-actionButton"

View File

@ -114,3 +114,12 @@
margin-right: 0px; 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;
}
}

View File

@ -171,10 +171,11 @@
<div style="padding-bottom:15px;">For facts collected older than the time period specified, <div style="padding-bottom:15px;">For facts collected older than the time period specified,
save one fact scan (snapshot) per time window (frequency). save one fact scan (snapshot) per time window (frequency).
For example, facts older than 30 days are purged, while one For example, facts older than 30 days are purged, while one
weekly fact scan is kept.<br> weekly fact scan is kept.<br> <br>
Caution: Setting both numerical variables to "0" will delete all facts.<br>
CAUTION: Setting both numerical variables to "0" will delete all facts.<br><br>
</div> </div>
<div class="form-group "> <div class="form-group">
<label for="description"> <label for="description">
<span class="label-text"> <span class="label-text">
Select a time period after which to remove old facts Select a time period after which to remove old facts