From ea670dac45f755468f3054129e39c51f57ef116d Mon Sep 17 00:00:00 2001 From: Ilya Radchenko Date: Tue, 27 Jan 2015 09:45:57 -0500 Subject: [PATCH] Fix past builds status icons --- client/dashboard/controllers/dashboard.js | 10 ++-------- client/job-status/controllers/job.js | 24 ++++++++++------------- client/utils/status-classes.js | 9 +++++++++ 3 files changed, 21 insertions(+), 22 deletions(-) create mode 100644 client/utils/status-classes.js diff --git a/client/dashboard/controllers/dashboard.js b/client/dashboard/controllers/dashboard.js index c5a57d234..87d6bb21e 100644 --- a/client/dashboard/controllers/dashboard.js +++ b/client/dashboard/controllers/dashboard.js @@ -4,15 +4,9 @@ var $ = require('jquery'); var _ = require('lodash'); -var JobMonitor = require('../../utils/job-monitor'); var io = require('socket.io-client'); -var statusClasses = { - passed: 'fa-check-circle success-text', - failed: 'fa-exclamation-circle failure-text', - running: 'fa-cog fa-spin', - submitted: 'fa-clock-o waiting-text', - errored: 'fa-minus-circle error-text' -}; +var JobMonitor = require('../../utils/job-monitor'); +var statusClasses = require('../../utils/status-classes'); module.exports = function ($scope, $element) { var socket = io.connect(); diff --git a/client/job-status/controllers/job.js b/client/job-status/controllers/job.js index 896b48b12..5738d58d3 100644 --- a/client/job-status/controllers/job.js +++ b/client/job-status/controllers/job.js @@ -7,25 +7,29 @@ var io = require('socket.io-client'); var JobDataMonitor = require('../../utils/job-data-monitor'); var PHASES = require('../../utils/phases'); var SKELS = require('../../utils/skels'); +var statusClasses = require('../../utils/status-classes'); var outputConsole; var runtime = null; var job = global.job; module.exports = function ($scope, $route, $location, $filter) { var params = $route.current ? $route.current.params : {} - , project = global.project - , jobid = params.id || (global.job && global.job._id) - , socket = io.connect() - , lastRoute = $route.current - , jobman = new BuildPage(socket, project.name, $scope.$digest.bind($scope), $scope, global.jobs, global.job) + var project = global.project; + var jobid = params.id || (global.job && global.job._id); + var socket = io.connect(); + var lastRoute = $route.current; + var jobman = new BuildPage(socket, project.name, $scope.$digest.bind($scope), $scope, global.jobs, global.job); outputConsole = global.document.querySelector('.console-output'); + + $scope.statusClasses = statusClasses; $scope.phases = ['environment', 'prepare', 'test', 'deploy', 'cleanup']; $scope.project = project; $scope.jobs = global.jobs; $scope.job = global.job; - $scope.canAdminProject = global.canAdminProject + $scope.canAdminProject = global.canAdminProject; $scope.showStatus = global.showStatus; + if ($scope.job && $scope.job.phases.test.commands.length) { if (job.phases.environment) { job.phases.environment.collapsed = true; @@ -38,14 +42,6 @@ module.exports = function ($scope, $route, $location, $filter) { } } - /* - var now = new Date().getTime() - $scope.sortDate = function (item) { - if (!item.finished) return new Date().getTime(); - return new Date(item.finished).getTime(); - }; - */ - $scope.toggleErrorDetails = function () { if ($scope.showErrorDetails) { $scope.showErrorDetails = false; diff --git a/client/utils/status-classes.js b/client/utils/status-classes.js new file mode 100644 index 000000000..121aa89b3 --- /dev/null +++ b/client/utils/status-classes.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = { + passed: 'fa-check-circle success-text', + failed: 'fa-exclamation-circle failure-text', + running: 'fa-cog fa-spin', + submitted: 'fa-clock-o waiting-text', + errored: 'fa-minus-circle error-text' +};