mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 18:40:01 -03:30
Added socket button to projects. Project page now updated realtime with job status.
This commit is contained in:
parent
49c26aad10
commit
389d99875f
@ -495,6 +495,8 @@ function InventoriesEdit($scope, $location, $routeParams, $compile, $log, $rootS
|
||||
}
|
||||
$rootScope.removeJobStatusChange = $rootScope.$on('JobStatusChange', function(e, data) {
|
||||
var group, stat;
|
||||
Wait('stop');
|
||||
$log.debug(data);
|
||||
if ($scope.groups) {
|
||||
// Assuming we have a list of groups available
|
||||
group = Find({ list: $scope.groups, key: 'group_id', val: data.group_id });
|
||||
|
||||
@ -76,6 +76,36 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
||||
}
|
||||
});
|
||||
|
||||
// Handle project update status changes
|
||||
if ($rootScope.rmoveJobStatusChange) {
|
||||
$rootScope.removeJobStatusChange();
|
||||
}
|
||||
$rootScope.removeJobStatusChange = $rootScope.$on('JobStatusChange', function(e, data) {
|
||||
var project;
|
||||
Wait('stop');
|
||||
$log.debug(data);
|
||||
if ($scope.projects) {
|
||||
// Assuming we have a list of projects available
|
||||
project = Find({ list: $scope.projects, key: 'id', val: data.project_id });
|
||||
if (project) {
|
||||
// And we found the affected project
|
||||
$log.debug('Received event for project: ' + project.name);
|
||||
$log.debug('Status changed to: ' + data.status);
|
||||
if (data.status === 'successful' || data.status === 'failed') {
|
||||
project.scm_update_tooltip = "Start an SCM update";
|
||||
project.scm_type_class = "";
|
||||
}
|
||||
else {
|
||||
project.scm_update_tooltip = "SCM update currently running";
|
||||
project.scm_type_class = "btn-disabled";
|
||||
}
|
||||
project.status = data.status;
|
||||
project.statusIcon = GetProjectIcon(data.status);
|
||||
project.statusTip = GetProjectToolTip(data.status);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if ($scope.removeChoicesHere) {
|
||||
$scope.removeChoicesHere();
|
||||
}
|
||||
@ -312,8 +342,8 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
||||
// Do not respond. Button appears greyed out as if it is disabled. Not disabled though, because we need mouse over event
|
||||
// to work. So user can click, but we just won't do anything.
|
||||
//Alert('Missing SCM Setup', 'Before running an SCM update, edit the project and provide the SCM access information.', 'alert-info');
|
||||
} else if (project.status === 'updating' || project.status === 'running') {
|
||||
Alert('Update in Progress', 'The SCM update process is running. Use the Refresh button to monitor the status.', 'alert-info');
|
||||
} else if (project.status === 'updating' || project.status === 'running' || project.status === 'pending') {
|
||||
// Alert('Update in Progress', 'The SCM update process is running. Use the Refresh button to monitor the status.', 'alert-info');
|
||||
} else {
|
||||
ProjectUpdate({ scope: $scope, project_id: project.id });
|
||||
}
|
||||
|
||||
@ -382,15 +382,15 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi
|
||||
}
|
||||
scope.removeUpdateSubmitted = scope.$on('UpdateSubmitted', function() {
|
||||
// Refresh the project list after update request submitted
|
||||
Wait('stop');
|
||||
Alert('Update Started', 'The request to start the SCM update process was submitted. ' +
|
||||
'To monitor the update status, refresh the page by clicking the <i class="fa fa-refresh"></i> button.', 'alert-info');
|
||||
if (scope.refreshJobs) {
|
||||
Wait('stop');
|
||||
Alert('Update Started', 'The request to start the SCM update process was submitted. ' +
|
||||
'To monitor the update status, refresh the page by clicking the <i class="fa fa-refresh"></i> button.', 'alert-info');
|
||||
scope.refreshJobs();
|
||||
}
|
||||
else if (scope.refresh) {
|
||||
scope.refresh();
|
||||
}
|
||||
//else if (scope.refresh) {
|
||||
// scope.refresh();
|
||||
//}
|
||||
});
|
||||
|
||||
if (scope.removePromptForPasswords) {
|
||||
@ -413,9 +413,9 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi
|
||||
Rest.get()
|
||||
.success(function (data) {
|
||||
project = data;
|
||||
Wait('stop');
|
||||
if (project.can_update) {
|
||||
if (project.passwords_needed_to_updated) {
|
||||
Wait('stop');
|
||||
scope.$emit('PromptForPasswords');
|
||||
}
|
||||
else {
|
||||
@ -443,8 +443,8 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi
|
||||
|
||||
var scope = params.scope,
|
||||
url = params.url,
|
||||
group_id = params.group_id,
|
||||
tree_id = params.tree_id,
|
||||
//group_id = params.group_id,
|
||||
//tree_id = params.tree_id,
|
||||
//base = $location.path().replace(/^\//, '').split('/')[0],
|
||||
inventory_source;
|
||||
|
||||
@ -460,7 +460,7 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi
|
||||
}
|
||||
});*/
|
||||
|
||||
function getJobID(url) {
|
||||
/*function getJobID(url) {
|
||||
var result='';
|
||||
url.split(/\//).every(function(path) {
|
||||
if (/^\d+$/.test(path)) {
|
||||
@ -470,14 +470,14 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi
|
||||
return true;
|
||||
});
|
||||
return result;
|
||||
}
|
||||
}*/
|
||||
|
||||
if (scope.removeUpdateSubmitted) {
|
||||
scope.removeUpdateSubmitted();
|
||||
}
|
||||
scope.removeUpdateSubmitted = scope.$on('UpdateSubmitted', function () {
|
||||
// Get the current job
|
||||
var path = url.replace(/update\/$/,'');
|
||||
/*var path = url.replace(/update\/$/,'');
|
||||
Rest.setUrl(path);
|
||||
Rest.get()
|
||||
.success(function(data) {
|
||||
@ -492,7 +492,7 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi
|
||||
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||
msg: 'Failed to get inventory source ' + url + ' GET returned: ' + status });
|
||||
});
|
||||
|
||||
*/
|
||||
//console.log('job submitted. callback returned: ');
|
||||
//console.log(data);
|
||||
/*setTimeout(function() {
|
||||
@ -532,6 +532,7 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi
|
||||
inventory_source = data;
|
||||
if (data.can_update) {
|
||||
if (data.passwords_needed_to_update) {
|
||||
Wait('stop');
|
||||
scope.$emit('PromptForPasswords');
|
||||
}
|
||||
else {
|
||||
|
||||
@ -27,6 +27,7 @@ angular.module('ProjectsListDefinition', [])
|
||||
iconOnly: true,
|
||||
ngClick: 'showSCMStatus(project.id)',
|
||||
awToolTip: '{{ project.statusTip }}',
|
||||
dataTipWatch: 'project.statusTip',
|
||||
dataPlacement: 'top',
|
||||
icon: "icon-job-{{ project.statusIcon }}",
|
||||
columnClass: "col-md-1 col-sm-2 col-xs-3",
|
||||
@ -75,10 +76,17 @@ angular.module('ProjectsListDefinition', [])
|
||||
awToolTip: 'Click for help',
|
||||
awTipPlacement: 'top'
|
||||
},*/
|
||||
refresh: {
|
||||
/*refresh: {
|
||||
mode: 'all',
|
||||
awToolTip: "Refresh the page",
|
||||
ngClick: "refresh()"
|
||||
},*/
|
||||
socket: {
|
||||
mode: 'all',
|
||||
iconClass: "{{ 'fa fa-power-off fa-lg socket-' + socketStatus }}",
|
||||
awToolTip: "{{ socketTip }}",
|
||||
dataTipWatch: "socketTip",
|
||||
ngClick: "socketToggle()",
|
||||
},
|
||||
stream: {
|
||||
ngClick: "showActivity()",
|
||||
@ -91,6 +99,7 @@ angular.module('ProjectsListDefinition', [])
|
||||
scm_update: {
|
||||
ngClick: 'SCMUpdate(project.id, $event)',
|
||||
awToolTip: "{{ project.scm_update_tooltip }}",
|
||||
dataTipWatch: "project.scm_update_tooltip",
|
||||
ngClass: "project.scm_type_class",
|
||||
dataPlacement: 'top'
|
||||
},
|
||||
@ -109,13 +118,13 @@ angular.module('ProjectsListDefinition', [])
|
||||
"delete": {
|
||||
ngClick: "deleteProject(project.id, project.name)",
|
||||
awToolTip: 'Delete the project',
|
||||
ngShow: "project.status !== 'updating' && project.status !== 'running'",
|
||||
ngShow: "project.status !== 'updating' && project.status !== 'running' && project.status !== 'pending'",
|
||||
dataPlacement: 'top'
|
||||
},
|
||||
cancel: {
|
||||
ngClick: "cancelUpdate(project.id, project.name)",
|
||||
awToolTip: 'Cancel the SCM update',
|
||||
ngShow: "project.status == 'updating' || project.status == 'running'",
|
||||
ngShow: "project.status == 'updating' || project.status == 'running' || project.status == 'pending'",
|
||||
dataPlacement: 'top'
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user