Improved how LogViewer determines status icon.

This commit is contained in:
Chris Houseknecht
2014-04-01 14:16:27 -04:00
parent 54599578a0
commit 8fc0450dd9
4 changed files with 75 additions and 162 deletions

View File

@@ -12,7 +12,7 @@
function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, ProjectList, GenerateList, LoadBreadCrumbs,
Prompt, SearchInit, PaginateInit, ReturnToCaller, ClearScope, ProcessErrors, GetBasePath, SelectionInit, ProjectUpdate,
ProjectStatus, FormatDate, Refresh, Wait, Stream, GetChoices, Empty, Find, LogViewer) {
Refresh, Wait, Stream, GetChoices, Empty, Find, LogViewer, GetProjectIcon, GetProjectToolTip) {
ClearScope();
@@ -48,30 +48,9 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
if ($scope.projects) {
$scope.projects.forEach(function(project, i) {
if (project.status === 'ok') {
$scope.projects[i].status = 'n/a';
}
switch (project.status) {
case 'n/a':
case 'never updated':
$scope.projects[i].statusIcon = 'none';
$scope.projects[i].statusTip = 'No SCM updates have run for this project';
break;
case 'updating':
case 'running':
$scope.projects[i].statusIcon = 'running pulsate';
$scope.projects[i].statusTip = 'Running! Click for details';
break;
case 'successful':
$scope.projects[i].statusIcon = 'success';
$scope.projects[i].statusTip = 'Success! Click for details';
break;
case 'failed':
case 'missing':
$scope.projects[i].statusTip = 'Failed. Click for details';
$scope.projects[i].statusIcon = 'error';
break;
}
$scope.projects[i].statusIcon = GetProjectIcon(project.status);
$scope.projects[i].statusTip = GetProjectToolTip(project.status);
if (project.status === 'failed' && project.summary_fields.last_update && project.summary_fields.last_update.status === 'canceled') {
$scope.projects[i].statusTip = 'Canceled. Click for details';
@@ -201,22 +180,18 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
} else {
if (project.related.current_update) {
Wait('start');
ProjectStatus({
project_id: id,
last_update: project.related.current_update
LogViewer({
scope: $scope,
url: project.related.current_update,
getIcon: GetProjectIcon
});
} else if (project.related.last_update) {
Wait('start');
LogViewer({
scope: $scope,
url: project.related.last_update,
status_icon: 'icon-job-' + project.statusIcon
getIcon: GetProjectIcon
});
/*
ProjectStatus({
project_id: id,
last_update: project.related.last_update
});*/
} else {
Alert('No Updates Available', 'There is no SCM update information available for this project. An update has not yet been ' +
' completed. If you have not already done so, start an update for this project.', 'alert-info');
@@ -361,8 +336,8 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
ProjectsList.$inject = ['$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'ProjectList', 'GenerateList',
'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', 'GetBasePath',
'SelectionInit', 'ProjectUpdate', 'ProjectStatus', 'FormatDate', 'Refresh', 'Wait', 'Stream', 'GetChoices', 'Empty', 'Find',
'LogViewer'
'SelectionInit', 'ProjectUpdate', 'Refresh', 'Wait', 'Stream', 'GetChoices', 'Empty', 'Find',
'LogViewer', 'GetProjectIcon', 'GetProjectToolTip'
];