mirror of
https://github.com/ansible/awx.git
synced 2026-01-16 04:10:44 -03:30
AC-174 If user clicks cancel, closes the dialog or otherwise fails to provide passwords, then destroy the job record. This gets rid of jobs left in 'new' status when no passwords provided.
This commit is contained in:
parent
ea4d7abd4b
commit
69abbb147d
2
awx/ui/static/css/bootstrap-responsive.css
vendored
2
awx/ui/static/css/bootstrap-responsive.css
vendored
@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Bootstrap Responsive v2.3.1
|
||||
* Bootstrap Responsive v2.3.2
|
||||
*
|
||||
* Copyright 2012 Twitter, Inc
|
||||
* Licensed under the Apache License v2.0
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Bootstrap Responsive v2.3.1
|
||||
* Bootstrap Responsive v2.3.2
|
||||
*
|
||||
* Copyright 2012 Twitter, Inc
|
||||
* Licensed under the Apache License v2.0
|
||||
|
||||
13
awx/ui/static/css/bootstrap.css
vendored
13
awx/ui/static/css/bootstrap.css
vendored
@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Bootstrap v2.3.1
|
||||
* Bootstrap v2.3.2
|
||||
*
|
||||
* Copyright 2012 Twitter, Inc
|
||||
* Licensed under the Apache License v2.0
|
||||
@ -3009,6 +3009,15 @@ table th[class*="span"],
|
||||
display: block;
|
||||
}
|
||||
|
||||
.dropdown-backdrop {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 990;
|
||||
}
|
||||
|
||||
.pull-right > .dropdown-menu {
|
||||
right: 0;
|
||||
left: auto;
|
||||
@ -5198,7 +5207,7 @@ input[type="submit"].btn.btn-mini {
|
||||
border: 1px solid #999;
|
||||
border: 1px solid rgba(0, 0, 0, 0.3);
|
||||
*border: 1px solid #999;
|
||||
*-webkit-border-radius: 6px;
|
||||
-webkit-border-radius: 6px;
|
||||
-moz-border-radius: 6px;
|
||||
border-radius: 6px;
|
||||
outline: none;
|
||||
|
||||
4
awx/ui/static/css/bootstrap.min.css
vendored
4
awx/ui/static/css/bootstrap.min.css
vendored
File diff suppressed because one or more lines are too long
@ -7,8 +7,8 @@
|
||||
angular.module('JobTemplateHelper', [ 'RestServices', 'Utilities', 'CredentialFormDefinition', 'CredentialsListDefinition',
|
||||
'LookUpHelper', 'JobTemplateFormDefinition' ])
|
||||
|
||||
.factory('PromptPasswords',['CredentialForm', '$compile', 'Rest', '$location',
|
||||
function(JobTemplateForm, $compile, Rest, $location) {
|
||||
.factory('PromptPasswords',['CredentialForm', '$compile', 'Rest', '$location', 'ProcessErrors', 'GetBasePath',
|
||||
function(JobTemplateForm, $compile, Rest, $location, ProcessErrors, GetBasePath) {
|
||||
return function(params) {
|
||||
|
||||
var scope = params.scope;
|
||||
@ -17,28 +17,64 @@ angular.module('JobTemplateHelper', [ 'RestServices', 'Utilities', 'CredentialFo
|
||||
var form = JobTemplateForm;
|
||||
var html = '';
|
||||
var field, element, dialogScope, fld;
|
||||
var base = $location.path().replace(/^\//,'').split('/')[0];
|
||||
|
||||
function navigate(canceled) {
|
||||
//Decide where to send the user once the modal dialog closes
|
||||
if (!canceled && base == 'jobs') {
|
||||
scope.refreshJob();
|
||||
}
|
||||
else {
|
||||
$location.path('/' + base);
|
||||
}
|
||||
}
|
||||
|
||||
function cancelJob() {
|
||||
// Delete a job
|
||||
var url = GetBasePath('jobs') + scope.job_id +'/'
|
||||
Rest.setUrl(url);
|
||||
Rest.destroy()
|
||||
.success ( function(data, status, headers, config) {
|
||||
navigate(true);
|
||||
})
|
||||
.error( function(data, status, headers, config) {
|
||||
ProcessErrors(scope, data, status, null,
|
||||
{ hdr: 'Error!', msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status });
|
||||
});
|
||||
}
|
||||
|
||||
scope.cancelJob = function() {
|
||||
// User clicked cancel button
|
||||
$('#password-modal').modal('hide');
|
||||
cancelJob();
|
||||
}
|
||||
|
||||
scope.startJob = function() {
|
||||
$('#password-modal').modal('hide');
|
||||
var pswd = {};
|
||||
var pswd = {};
|
||||
var value_supplied = false;
|
||||
$('.password-field').each(function(index) {
|
||||
pswd[$(this).attr('name')] = $(this).val();
|
||||
if ($(this).val() != '' && $(this).val() !== null) {
|
||||
value_supplied = true;
|
||||
}
|
||||
});
|
||||
Rest.setUrl(start_url);
|
||||
Rest.post(pswd)
|
||||
.success( function(data, status, headers, config) {
|
||||
var base = $location.path().replace(/^\//,'').split('/')[0];
|
||||
if (base == 'jobs') {
|
||||
scope.refreshJob();
|
||||
}
|
||||
else {
|
||||
$location.path('/jobs');
|
||||
}
|
||||
})
|
||||
.error( function(data, status, headers, config) {
|
||||
ProcessErrors(scope, data, status, null,
|
||||
{ hdr: 'Error!', msg: 'Failed to start job. POST returned status: ' + status });
|
||||
});
|
||||
if (value_supplied) {
|
||||
Rest.setUrl(start_url);
|
||||
Rest.post(pswd)
|
||||
.success( function(data, status, headers, config) {
|
||||
navigate(false);
|
||||
})
|
||||
.error( function(data, status, headers, config) {
|
||||
ProcessErrors(scope, data, status, null,
|
||||
{ hdr: 'Error!', msg: 'Failed to start job. POST returned status: ' + status });
|
||||
});
|
||||
}
|
||||
else {
|
||||
// No passwords provided, so we can't start the job. Rather than leave the job in a 'new'
|
||||
// state, let's delete it.
|
||||
scope.cancelJob();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -94,7 +130,7 @@ angular.module('JobTemplateHelper', [ 'RestServices', 'Utilities', 'CredentialFo
|
||||
element = angular.element(document.getElementById('password-body'));
|
||||
element.html(html);
|
||||
$compile(element.contents())(scope);
|
||||
$('#password-modal').modal();
|
||||
$('#password-modal').modal({ });
|
||||
}
|
||||
}])
|
||||
|
||||
@ -132,6 +168,7 @@ angular.module('JobTemplateHelper', [ 'RestServices', 'Utilities', 'CredentialFo
|
||||
extra_vars: data.extra_vars
|
||||
})
|
||||
.success( function(data, status, headers, config) {
|
||||
scope.job_id = data.id;
|
||||
if (data.passwords_needed_to_start.length > 0) {
|
||||
// Passwords needed. Prompt for passwords, then start job.
|
||||
PromptPasswords({
|
||||
|
||||
32
awx/ui/static/lib/twitter/bootstrap.js
vendored
32
awx/ui/static/lib/twitter/bootstrap.js
vendored
@ -1,5 +1,5 @@
|
||||
/* ===================================================
|
||||
* bootstrap-transition.js v2.3.1
|
||||
* bootstrap-transition.js v2.3.2
|
||||
* http://twitter.github.com/bootstrap/javascript.html#transitions
|
||||
* ===================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
@ -58,7 +58,7 @@
|
||||
})
|
||||
|
||||
}(window.jQuery);/* ==========================================================
|
||||
* bootstrap-alert.js v2.3.1
|
||||
* bootstrap-alert.js v2.3.2
|
||||
* http://twitter.github.com/bootstrap/javascript.html#alerts
|
||||
* ==========================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
@ -156,7 +156,7 @@
|
||||
$(document).on('click.alert.data-api', dismiss, Alert.prototype.close)
|
||||
|
||||
}(window.jQuery);/* ============================================================
|
||||
* bootstrap-button.js v2.3.1
|
||||
* bootstrap-button.js v2.3.2
|
||||
* http://twitter.github.com/bootstrap/javascript.html#buttons
|
||||
* ============================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
@ -260,7 +260,7 @@
|
||||
})
|
||||
|
||||
}(window.jQuery);/* ==========================================================
|
||||
* bootstrap-carousel.js v2.3.1
|
||||
* bootstrap-carousel.js v2.3.2
|
||||
* http://twitter.github.com/bootstrap/javascript.html#carousel
|
||||
* ==========================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
@ -466,7 +466,7 @@
|
||||
})
|
||||
|
||||
}(window.jQuery);/* =============================================================
|
||||
* bootstrap-collapse.js v2.3.1
|
||||
* bootstrap-collapse.js v2.3.2
|
||||
* http://twitter.github.com/bootstrap/javascript.html#collapse
|
||||
* =============================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
@ -632,7 +632,7 @@
|
||||
})
|
||||
|
||||
}(window.jQuery);/* ============================================================
|
||||
* bootstrap-dropdown.js v2.3.1
|
||||
* bootstrap-dropdown.js v2.3.2
|
||||
* http://twitter.github.com/bootstrap/javascript.html#dropdowns
|
||||
* ============================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
@ -685,6 +685,10 @@
|
||||
clearMenus()
|
||||
|
||||
if (!isActive) {
|
||||
if ('ontouchstart' in document.documentElement) {
|
||||
// if mobile we we use a backdrop because click events don't delegate
|
||||
$('<div class="dropdown-backdrop"/>').insertBefore($(this)).on('click', clearMenus)
|
||||
}
|
||||
$parent.toggleClass('open')
|
||||
}
|
||||
|
||||
@ -737,6 +741,7 @@
|
||||
}
|
||||
|
||||
function clearMenus() {
|
||||
$('.dropdown-backdrop').remove()
|
||||
$(toggle).each(function () {
|
||||
getParent($(this)).removeClass('open')
|
||||
})
|
||||
@ -791,13 +796,12 @@
|
||||
$(document)
|
||||
.on('click.dropdown.data-api', clearMenus)
|
||||
.on('click.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
|
||||
.on('click.dropdown-menu', function (e) { e.stopPropagation() })
|
||||
.on('click.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
|
||||
.on('keydown.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
|
||||
|
||||
}(window.jQuery);
|
||||
/* =========================================================
|
||||
* bootstrap-modal.js v2.3.1
|
||||
* bootstrap-modal.js v2.3.2
|
||||
* http://twitter.github.com/bootstrap/javascript.html#modals
|
||||
* =========================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
@ -1044,7 +1048,7 @@
|
||||
|
||||
}(window.jQuery);
|
||||
/* ===========================================================
|
||||
* bootstrap-tooltip.js v2.3.1
|
||||
* bootstrap-tooltip.js v2.3.2
|
||||
* http://twitter.github.com/bootstrap/javascript.html#tooltips
|
||||
* Inspired by the original jQuery.tipsy by Jason Frame
|
||||
* ===========================================================
|
||||
@ -1405,7 +1409,7 @@
|
||||
|
||||
}(window.jQuery);
|
||||
/* ===========================================================
|
||||
* bootstrap-popover.js v2.3.1
|
||||
* bootstrap-popover.js v2.3.2
|
||||
* http://twitter.github.com/bootstrap/javascript.html#popovers
|
||||
* ===========================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
@ -1519,7 +1523,7 @@
|
||||
|
||||
}(window.jQuery);
|
||||
/* =============================================================
|
||||
* bootstrap-scrollspy.js v2.3.1
|
||||
* bootstrap-scrollspy.js v2.3.2
|
||||
* http://twitter.github.com/bootstrap/javascript.html#scrollspy
|
||||
* =============================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
@ -1680,7 +1684,7 @@
|
||||
})
|
||||
|
||||
}(window.jQuery);/* ========================================================
|
||||
* bootstrap-tab.js v2.3.1
|
||||
* bootstrap-tab.js v2.3.2
|
||||
* http://twitter.github.com/bootstrap/javascript.html#tabs
|
||||
* ========================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
@ -1823,7 +1827,7 @@
|
||||
})
|
||||
|
||||
}(window.jQuery);/* =============================================================
|
||||
* bootstrap-typeahead.js v2.3.1
|
||||
* bootstrap-typeahead.js v2.3.2
|
||||
* http://twitter.github.com/bootstrap/javascript.html#typeahead
|
||||
* =============================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
@ -2158,7 +2162,7 @@
|
||||
|
||||
}(window.jQuery);
|
||||
/* ==========================================================
|
||||
* bootstrap-affix.js v2.3.1
|
||||
* bootstrap-affix.js v2.3.2
|
||||
* http://twitter.github.com/bootstrap/javascript.html#affix
|
||||
* ==========================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
|
||||
2
awx/ui/static/lib/twitter/bootstrap.min.js
vendored
2
awx/ui/static/lib/twitter/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
@ -150,14 +150,13 @@
|
||||
<!-- Password Dialog -->
|
||||
<div id="password-modal" class="modal hide">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-target="#prompt-modal"
|
||||
data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<button type="button" class="close" ng-click="cancelJob()" aria-hidden="true">×</button>
|
||||
<h3>Password Required</h3>
|
||||
</div>
|
||||
<div class="modal-body" id="password-body">
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#" data-target="#password-modal" data-dismiss="modal" class="btn">Cancel</a>
|
||||
<a href="#" ng-click="cancelJob()" class="btn">Cancel</a>
|
||||
<a href="" ng-click="startJob()" class="btn btn-primary" ng-disabled="password_form.$pristine || password_form.$invalid">Continue</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user