mirror of
https://github.com/ansible/awx.git
synced 2026-05-21 07:47:44 -02:30
Projects
Fixed https://trello.com/c/qJ1vWQeQ/317-project-sync-icon-enabled-while-project-update-inprogress Project update status was not reflected correctly. Issue was PostRefresh not handling success/failed status correctly.
This commit is contained in:
@@ -45,18 +45,23 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
|||||||
}
|
}
|
||||||
$scope.removePostRefresh = $scope.$on('PostRefresh', function () {
|
$scope.removePostRefresh = $scope.$on('PostRefresh', function () {
|
||||||
Wait('stop');
|
Wait('stop');
|
||||||
|
|
||||||
if ($scope.projects) {
|
if ($scope.projects) {
|
||||||
|
console.log('here');
|
||||||
$scope.projects.forEach(function(project, i) {
|
$scope.projects.forEach(function(project, i) {
|
||||||
|
|
||||||
$scope.projects[i].statusIcon = GetProjectIcon(project.status);
|
$scope.projects[i].statusIcon = GetProjectIcon(project.status);
|
||||||
$scope.projects[i].statusTip = GetProjectToolTip(project.status);
|
$scope.projects[i].statusTip = GetProjectToolTip(project.status);
|
||||||
|
$scope.projects[i].scm_update_tooltip = "Start an SCM update";
|
||||||
|
$scope.projects[i].scm_schedule_tooltip = "Schedule future SCM updates";
|
||||||
|
$scope.projects[i].scm_type_class = "";
|
||||||
|
|
||||||
if (project.status === 'failed' && project.summary_fields.last_update && project.summary_fields.last_update.status === 'canceled') {
|
if (project.status === 'failed' && project.summary_fields.last_update && project.summary_fields.last_update.status === 'canceled') {
|
||||||
$scope.projects[i].statusTip = 'Canceled. Click for details';
|
$scope.projects[i].statusTip = 'Canceled. Click for details';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('project: ' + project.name + ' status: ' + project.status);
|
||||||
if (project.status === 'running' || project.status === 'updating') {
|
if (project.status === 'running' || project.status === 'updating') {
|
||||||
|
$scope.projects[i].scm_update_tooltip = "SCM update currently running";
|
||||||
|
$scope.projects[i].scm_type_class = "btn-disabled";
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.project_scm_type_options.forEach(function(type) {
|
$scope.project_scm_type_options.forEach(function(type) {
|
||||||
@@ -68,14 +73,6 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
|||||||
$scope.projects[i].scm_type_class = 'btn-disabled';
|
$scope.projects[i].scm_type_class = 'btn-disabled';
|
||||||
$scope.projects[i].statusTip = 'Not configured for SCM';
|
$scope.projects[i].statusTip = 'Not configured for SCM';
|
||||||
$scope.projects[i].statusIcon = 'none';
|
$scope.projects[i].statusIcon = 'none';
|
||||||
} else if (type.label === "Running" || type.label === "Updating") {
|
|
||||||
$scope.projects[i].scm_update_tooltip = "SCM update currently running";
|
|
||||||
$scope.projects[i].scm_type_class = 'btn-disabled';
|
|
||||||
$scope.projects[i].scm_schedule_tooltip = "Schedule future SCM updates";
|
|
||||||
} else {
|
|
||||||
$scope.projects[i].scm_update_tooltip = "Start an SCM update";
|
|
||||||
$scope.projects[i].scm_schedule_tooltip = "Schedule future SCM updates";
|
|
||||||
$scope.projects[i].scm_type_class = "";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -89,7 +86,6 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
|||||||
}
|
}
|
||||||
$rootScope.removeJobStatusChange = $rootScope.$on('JobStatusChange', function(e, data) {
|
$rootScope.removeJobStatusChange = $rootScope.$on('JobStatusChange', function(e, data) {
|
||||||
var project;
|
var project;
|
||||||
Wait('stop');
|
|
||||||
$log.debug(data);
|
$log.debug(data);
|
||||||
if ($scope.projects) {
|
if ($scope.projects) {
|
||||||
// Assuming we have a list of projects available
|
// Assuming we have a list of projects available
|
||||||
@@ -99,7 +95,7 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
|||||||
$log.debug('Received event for project: ' + project.name);
|
$log.debug('Received event for project: ' + project.name);
|
||||||
$log.debug('Status changed to: ' + data.status);
|
$log.debug('Status changed to: ' + data.status);
|
||||||
if (data.status === 'successful' || data.status === 'failed') {
|
if (data.status === 'successful' || data.status === 'failed') {
|
||||||
$scope.refresh();
|
$scope.search(list.iterator, null, null, null, null, false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
project.scm_update_tooltip = "SCM update currently running";
|
project.scm_update_tooltip = "SCM update currently running";
|
||||||
@@ -340,14 +336,15 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.refresh = function () {
|
$scope.refresh = function () {
|
||||||
Wait('start');
|
/*Wait('start');
|
||||||
$scope.projectLoading = false;
|
$scope.projectLoading = false;
|
||||||
Refresh({
|
Refresh({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
set: 'projects',
|
set: 'projects',
|
||||||
iterator: 'project',
|
iterator: 'project',
|
||||||
url: $scope.current_url
|
url: $scope.current_url
|
||||||
});
|
});*/
|
||||||
|
$scope.search(list.iterator);
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.SCMUpdate = function (project_id, event) {
|
$scope.SCMUpdate = function (project_id, event) {
|
||||||
|
|||||||
@@ -298,12 +298,14 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
|||||||
if (scope.removePrepareSearch) {
|
if (scope.removePrepareSearch) {
|
||||||
scope.removePrepareSearch();
|
scope.removePrepareSearch();
|
||||||
}
|
}
|
||||||
scope.removePrepareSearch = scope.$on('prepareSearch', function (e, iterator, page, load, calcOnly, deferWaitStop) {
|
scope.removePrepareSearch = scope.$on('prepareSearch', function (e, iterator, page, load, calcOnly, deferWaitStop, spinner) {
|
||||||
//
|
//
|
||||||
// Start building the search key/value pairs. This will process each search widget, if the
|
// Start building the search key/value pairs. This will process each search widget, if the
|
||||||
// selected field is an object type (used on activity stream).
|
// selected field is an object type (used on activity stream).
|
||||||
//
|
//
|
||||||
Wait('start');
|
if (spinner) {
|
||||||
|
Wait('start');
|
||||||
|
}
|
||||||
scope[iterator + 'SearchParams'] = '';
|
scope[iterator + 'SearchParams'] = '';
|
||||||
var i, modifier,
|
var i, modifier,
|
||||||
widgets = (list.searchWidgets) ? list.searchWidgets : 1;
|
widgets = (list.searchWidgets) ? list.searchWidgets : 1;
|
||||||
@@ -456,16 +458,18 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
|||||||
* @calcOnly: optional, set to true when you want to calc or figure out search params without executing the search
|
* @calcOnly: optional, set to true when you want to calc or figure out search params without executing the search
|
||||||
* @deferWaitStop: optional, when true refresh.js will NOT issue Wait('stop'), thus leaving the spinner. Caller is then
|
* @deferWaitStop: optional, when true refresh.js will NOT issue Wait('stop'), thus leaving the spinner. Caller is then
|
||||||
* responsible for stopping the spinner post refresh.
|
* responsible for stopping the spinner post refresh.
|
||||||
|
* @spinner: optional, if false, don't show the spinner.
|
||||||
*/
|
*/
|
||||||
scope.search = function (iterator, page, load, calcOnly, deferWaitStop) {
|
scope.search = function (iterator, page, load, calcOnly, deferWaitStop, spinner) {
|
||||||
page = page || null;
|
page = page || null;
|
||||||
load = (load || !scope[set] || scope[set].length === 0) ? true : false;
|
load = (load || !scope[set] || scope[set].length === 0) ? true : false;
|
||||||
calcOnly = (calcOnly) ? true : false;
|
calcOnly = (calcOnly) ? true : false;
|
||||||
deferWaitStop = (deferWaitStop) ? true : false;
|
deferWaitStop = (deferWaitStop) ? true : false;
|
||||||
|
spinner = (spinner === undefined) ? true : spinner;
|
||||||
if (load) {
|
if (load) {
|
||||||
scope[set] = []; //clear the list array to make sure 'Loading' is the only thing visible on the list
|
scope[set] = []; //clear the list array to make sure 'Loading' is the only thing visible on the list
|
||||||
}
|
}
|
||||||
scope.$emit('prepareSearch', iterator, page, load, calcOnly, deferWaitStop);
|
scope.$emit('prepareSearch', iterator, page, load, calcOnly, deferWaitStop, spinner);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user