mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 18:07:36 -02:30
Latest UI changes.
This commit is contained in:
@@ -237,7 +237,7 @@ angular.module('ansible', [
|
|||||||
|
|
||||||
$rootScope.breadcrumbs = new Array();
|
$rootScope.breadcrumbs = new Array();
|
||||||
$rootScope.crumbCache = new Array();
|
$rootScope.crumbCache = new Array();
|
||||||
|
|
||||||
$rootScope.$on("$routeChangeStart", function(event, next, current) {
|
$rootScope.$on("$routeChangeStart", function(event, next, current) {
|
||||||
// On each navigation request, check that the user is logged in
|
// On each navigation request, check that the user is logged in
|
||||||
if (Authorization.isUserLoggedIn() == false) {
|
if (Authorization.isUserLoggedIn() == false) {
|
||||||
@@ -252,9 +252,9 @@ angular.module('ansible', [
|
|||||||
CheckLicense();
|
CheckLicense();
|
||||||
}
|
}
|
||||||
// Make the correct tab active
|
// Make the correct tab active
|
||||||
var base = ($location.path().replace(/^\//,'').split('/')[0]);
|
var base = $location.path().replace(/^\//,'').split('/')[0];
|
||||||
if (base == '') {
|
if (base == '') {
|
||||||
$('.nav-tabs a[href="#' + 'organizations' + '"]').tab('show');
|
$('.nav-tabs a[href="#' + 'organizations' + '"]').tab('show');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
base.replace(/\_/g,' ');
|
base.replace(/\_/g,' ');
|
||||||
|
|||||||
@@ -12,11 +12,12 @@
|
|||||||
|
|
||||||
function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, ProjectList,
|
function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, ProjectList,
|
||||||
GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller,
|
GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller,
|
||||||
ClearScope, ProcessErrors, GetBasePath, SelectionInit, SCMUpdate, ProjectStatus,
|
ClearScope, ProcessErrors, GetBasePath, SelectionInit, ProjectUpdate, ProjectStatus,
|
||||||
FormatDate)
|
FormatDate)
|
||||||
{
|
{
|
||||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||||
//scope.
|
//scope.
|
||||||
|
|
||||||
var list = ProjectList;
|
var list = ProjectList;
|
||||||
var defaultUrl = GetBasePath('projects');
|
var defaultUrl = GetBasePath('projects');
|
||||||
var view = GenerateList;
|
var view = GenerateList;
|
||||||
@@ -119,13 +120,7 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
|||||||
scope.refresh = function() {
|
scope.refresh = function() {
|
||||||
scope.search(list.iterator);
|
scope.search(list.iterator);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scope.removeUpdateSubmitted) {
|
|
||||||
scope.removeUpdateSubmitted();
|
|
||||||
}
|
|
||||||
scope.removeUpdateSubmitted = scope.$on('UpdateSubmitted', function() {
|
|
||||||
scope.search(list.iterator);
|
|
||||||
});
|
|
||||||
scope.SCMUpdate = function(project_id) {
|
scope.SCMUpdate = function(project_id) {
|
||||||
for (var i=0; i < scope.projects.length; i++) {
|
for (var i=0; i < scope.projects.length; i++) {
|
||||||
if (scope.projects[i].id == project_id) {
|
if (scope.projects[i].id == project_id) {
|
||||||
@@ -136,9 +131,8 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
|||||||
Alert('Update in Progress', 'The SCM update process is running. Use the Refresh button to monitor the status.', 'alert-info');
|
Alert('Update in Progress', 'The SCM update process is running. Use the Refresh button to monitor the status.', 'alert-info');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SCMUpdate({ scope: scope, project_id: project_id });
|
ProjectUpdate({ scope: scope, project_id: project_id });
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -146,7 +140,7 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
|||||||
|
|
||||||
ProjectsList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'ProjectList', 'GenerateList',
|
ProjectsList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'ProjectList', 'GenerateList',
|
||||||
'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors',
|
'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors',
|
||||||
'GetBasePath', 'SelectionInit', 'SCMUpdate', 'ProjectStatus', 'FormatDate'];
|
'GetBasePath', 'SelectionInit', 'ProjectUpdate', 'ProjectStatus', 'FormatDate'];
|
||||||
|
|
||||||
|
|
||||||
function ProjectsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, ProjectsForm,
|
function ProjectsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, ProjectsForm,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'CredentialFormDefinition', 'CredentialsListDefinition',
|
angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'CredentialFormDefinition', 'CredentialsListDefinition',
|
||||||
'LookUpHelper', 'ProjectFormDefinition' ])
|
'LookUpHelper', 'ProjectFormDefinition', 'JobSubmissionHelper'])
|
||||||
|
|
||||||
.factory('PromptPasswords', ['CredentialForm', 'JobTemplateForm', 'ProjectsForm', '$compile', 'Rest', '$location', 'ProcessErrors', 'GetBasePath',
|
.factory('PromptPasswords', ['CredentialForm', 'JobTemplateForm', 'ProjectsForm', '$compile', 'Rest', '$location', 'ProcessErrors', 'GetBasePath',
|
||||||
'Alert',
|
'Alert',
|
||||||
@@ -15,7 +15,7 @@ angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'Credential
|
|||||||
var scope = params.scope;
|
var scope = params.scope;
|
||||||
var passwords = params.passwords;
|
var passwords = params.passwords;
|
||||||
var start_url = params.start_url;
|
var start_url = params.start_url;
|
||||||
var form = CredentialForm;
|
var form = params.form;
|
||||||
var html = '';
|
var html = '';
|
||||||
var field, element, dialogScope, fld;
|
var field, element, dialogScope, fld;
|
||||||
var base = $location.path().replace(/^\//,'').split('/')[0];
|
var base = $location.path().replace(/^\//,'').split('/')[0];
|
||||||
@@ -31,11 +31,12 @@ angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'Credential
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
console.log('navigating to: ' + base);
|
||||||
$location.path('/' + base);
|
$location.path('/' + base);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancelJob() {
|
function cancel() {
|
||||||
// Delete a job
|
// Delete a job
|
||||||
var url = GetBasePath('jobs') + scope.job_id +'/'
|
var url = GetBasePath('jobs') + scope.job_id +'/'
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
@@ -55,7 +56,7 @@ angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'Credential
|
|||||||
// User clicked cancel button
|
// User clicked cancel button
|
||||||
$('#password-modal').modal('hide');
|
$('#password-modal').modal('hide');
|
||||||
if (form.name == 'credential') {
|
if (form.name == 'credential') {
|
||||||
cancelJob();
|
cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,7 +89,7 @@ angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'Credential
|
|||||||
if (form.name == 'credential') {
|
if (form.name == 'credential') {
|
||||||
// No passwords provided, so we can't start the job. Rather than leave the job in a 'new'
|
// No passwords provided, so we can't start the job. Rather than leave the job in a 'new'
|
||||||
// state, let's delete it.
|
// state, let's delete it.
|
||||||
scope.cancelJob();
|
cancelJob();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,10 +146,10 @@ angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'Credential
|
|||||||
html += "</div>\n";
|
html += "</div>\n";
|
||||||
}
|
}
|
||||||
html += "</form>\n";
|
html += "</form>\n";
|
||||||
element = angular.element(document.getElementById('password-body'));
|
var element = angular.element(document.getElementById('password-body'));
|
||||||
element.html(html);
|
element.html(html);
|
||||||
$compile(element.contents())(scope);
|
$compile(element.contents())(scope);
|
||||||
$('#password-modal').modal({ });
|
$('#password-modal').modal();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
scope.startJob();
|
scope.startJob();
|
||||||
@@ -269,24 +270,40 @@ angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'Credential
|
|||||||
}])
|
}])
|
||||||
|
|
||||||
// Sumbit SCM Update request
|
// Sumbit SCM Update request
|
||||||
.factory('SCMUpdate',['PromptPasswords', '$compile', 'Rest', '$location', 'GetBasePath', 'ProcessErrors', 'Alert',
|
.factory('ProjectUpdate',['PromptPasswords', '$compile', 'Rest', '$location', 'GetBasePath', 'ProcessErrors', 'Alert',
|
||||||
'ProjectsForm',
|
'ProjectsForm',
|
||||||
function(PromptPasswords, $compile, Rest, $location, GetBasePath, ProcessErrors, Alert, ProjectsForm) {
|
function(PromptPasswords, $compile, Rest, $location, GetBasePath, ProcessErrors, Alert, ProjectsForm) {
|
||||||
return function(params) {
|
return function(params) {
|
||||||
var scope = params.scope;
|
var scope = params.scope;
|
||||||
var project_id = params.project_id;
|
var project_id = params.project_id;
|
||||||
var url = GetBasePath('projects') + project_id + '/update/';
|
var url = GetBasePath('projects') + project_id + '/update/';
|
||||||
|
|
||||||
|
if (scope.removeUpdateSubmitted) {
|
||||||
|
scope.removeUpdateSubmitted();
|
||||||
|
}
|
||||||
|
scope.removeUpdateSubmitted = scope.$on('UpdateSubmitted', function() {
|
||||||
|
$location.path('/projects');
|
||||||
|
});
|
||||||
|
|
||||||
|
if (scope.removeSCMSubmit) {
|
||||||
|
scope.removeSCMSubmit();
|
||||||
|
}
|
||||||
|
scope.removeSCMSubmit = scope.$on('SCMSubmit', function(e, passwords_needed_to_update) {
|
||||||
|
// After the call to update, kick off the job.
|
||||||
|
PromptPasswords({
|
||||||
|
scope: scope,
|
||||||
|
passwords: passwords_needed_to_update,
|
||||||
|
start_url: url,
|
||||||
|
form: ProjectsForm
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// Check to see if we have permission to perform the update and if any passwords are needed
|
// Check to see if we have permission to perform the update and if any passwords are needed
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.get()
|
Rest.get()
|
||||||
.success( function(data, status, headers, config) {
|
.success( function(data, status, headers, config) {
|
||||||
if (data.can_update) {
|
if (data.can_update) {
|
||||||
PromptPasswords({
|
scope.$emit('SCMSubmit', data.passwords_needed_to_update);
|
||||||
scope: scope,
|
|
||||||
passwords: data.passwords_needed_to_update,
|
|
||||||
start_url: url,
|
|
||||||
form: ProjectsForm
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Alert('Permission Denied', 'You do not have access to update this project. Please contact your system administrator.',
|
Alert('Permission Denied', 'You do not have access to update this project. Please contact your system administrator.',
|
||||||
@@ -300,26 +317,3 @@ angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'Credential
|
|||||||
};
|
};
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user