Merge "Fix lint errors and update eslint"

This commit is contained in:
Jenkins
2016-02-11 03:50:47 +00:00
committed by Gerrit Code Review
21 changed files with 82 additions and 93 deletions

View File

@@ -1,14 +0,0 @@
# Use eslint-config-openstack
extends: openstack
# Set up globals
globals:
angular: false
module: false
env:
browser: true
jasmine: true
rules:
module-setter: 0

25
.eslintrc.json Normal file
View File

@@ -0,0 +1,25 @@
{
"extends" : "openstack",
"globals" : {
"angular": false,
"module": false
},
"env" : {
"browser": true,
"jasmine": true
},
"rules" : {
"module-setter": 0,
"strict": [2,"global"],
"valid-jsdoc": 0,
"brace-style": [2, "1tbs", { "allowSingleLine": true }],
"no-extra-parens": [2, "functions"],
"complexity": 0,
"no-unused-vars": 0,
"guard-for-in": 0
}
}

View File

@@ -10,7 +10,7 @@
<link rel="stylesheet" href="css/main.css"> <link rel="stylesheet" href="css/main.css">
</head> </head>
<body class="ng-cloak" ng-controller="MainCtrl"> <body class="ng-cloak" ng-controller="MainController">
<header class="navbar navbar-default navbar-fixed-top navbar-inner"> <header class="navbar navbar-default navbar-fixed-top navbar-inner">
<div class="container"> <div class="container">
<div class="navbar-header"> <div class="navbar-header">

View File

@@ -26,4 +26,4 @@ function HomeCtrl($scope, $state, datasetService) {
} }
controllersModule.controller('HomeCtrl', HomeCtrl); controllersModule.controller('HomeController', HomeCtrl);

View File

@@ -12,4 +12,4 @@ function MainCtrl($window, $scope) {
}); });
} }
controllersModule.controller('MainCtrl', MainCtrl); controllersModule.controller('MainController', MainCtrl);

View File

@@ -5,19 +5,18 @@ var controllersModule = require('./_index');
/** /**
* @ngInject * @ngInject
*/ */
function TestDetailsCtrl($scope, $location, $stateParams, datasetService, progressService) { var TestDetailsCtrl = function($scope, $location, $stateParams, datasetService, progressService) {
// ViewModel
var vm = this; var vm = this;
$scope.datasetId = $stateParams.datasetId; vm.datasetId = $stateParams.datasetId;
var testName = $stateParams.test; var testName = $stateParams.test;
$scope.testName = testName; vm.testName = testName;
progressService.start({ parent: 'div[role="main"] .panel-body' }); progressService.start({ parent: 'div[role="main"] .panel-body' });
// load dataset, raw json, and details json // load dataset, raw json, and details json
datasetService.get($stateParams.datasetId).then(function(response) { datasetService.get($stateParams.datasetId).then(function(response) {
$scope.dataset = response; vm.dataset = response;
$scope.stats = response.stats; vm.stats = response.stats;
datasetService.raw(response).then(function(raw) { datasetService.raw(response).then(function(raw) {
var item = null; var item = null;
for (var t in raw.data) { for (var t in raw.data) {
@@ -25,7 +24,7 @@ function TestDetailsCtrl($scope, $location, $stateParams, datasetService, progre
item = raw.data[t]; item = raw.data[t];
} }
} }
$scope.item = item; vm.item = item;
progressService.inc(); progressService.inc();
}).catch(function(ex) { }).catch(function(ex) {
@@ -33,9 +32,9 @@ function TestDetailsCtrl($scope, $location, $stateParams, datasetService, progre
progressService.done(); progressService.done();
}); });
datasetService.details(response).then(function(deets) { datasetService.details(response).then(function(deets) {
$scope.details = deets; vm.details = deets;
$scope.originalDetails = angular.copy(deets.data[testName]); vm.originalDetails = angular.copy(deets.data[testName]);
$scope.itemDetails = deets.data[testName]; vm.itemDetails = deets.data[testName];
progressService.done(); progressService.done();
}).catch(function(ex) { }).catch(function(ex) {
@@ -47,9 +46,9 @@ function TestDetailsCtrl($scope, $location, $stateParams, datasetService, progre
progressService.done(); progressService.done();
}); });
$scope.parsePythonLogging = function(showINFO, showDEBUG, showWARNING, showERROR) { vm.parsePythonLogging = function(showINFO, showDEBUG, showWARNING, showERROR) {
if ($scope.originalDetails && $scope.originalDetails.pythonlogging) { if (vm.originalDetails && vm.originalDetails.pythonlogging) {
var log = $scope.originalDetails.pythonlogging; var log = vm.originalDetails.pythonlogging;
var ret = []; var ret = [];
var lines = log.split('\n'); var lines = log.split('\n');
for (var i in lines) { for (var i in lines) {
@@ -57,19 +56,19 @@ function TestDetailsCtrl($scope, $location, $stateParams, datasetService, progre
if (showINFO && line.includes("INFO")) { if (showINFO && line.includes("INFO")) {
ret.push(line); ret.push(line);
} }
else if (showDEBUG && line.includes("DEBUG")) { if (showDEBUG && line.includes("DEBUG")) {
ret.push(line); ret.push(line);
} }
else if (showWARNING && line.includes("WARNING")) { if (showWARNING && line.includes("WARNING")) {
ret.push(line); ret.push(line);
} }
else if (showERROR && line.includes("ERROR")) { if (showERROR && line.includes("ERROR")) {
ret.push(line); ret.push(line);
} }
} }
$scope.itemDetails.pythonlogging = ret.join('\n'); vm.itemDetails.pythonlogging = ret.join('\n');
} }
}; };
} };
controllersModule.controller('TestDetailsCtrl', TestDetailsCtrl); controllersModule.controller('TestDetailsController', TestDetailsCtrl);

View File

@@ -34,4 +34,4 @@ function TimelineCtrl($scope, $location, $stateParams, datasetService) {
} }
controllersModule.controller('TimelineCtrl', TimelineCtrl); controllersModule.controller('TimelineController', TimelineCtrl);

View File

@@ -19,8 +19,7 @@ function testDetailsSearch() {
this.showERROR = true; this.showERROR = true;
var update = function() { var update = function() {
$scope.$parent $scope.filter(self.showINFO, self.showDEBUG, self.showWARNING, self.showERROR);
.parsePythonLogging(self.showINFO, self.showDEBUG, self.showWARNING, self.showERROR);
}; };
$scope.$watch(function() { return self.query; }, update); $scope.$watch(function() { return self.query; }, update);
@@ -32,9 +31,9 @@ function testDetailsSearch() {
return { return {
restrict: 'EA', restrict: 'EA',
require: ['^testDetailsSearch', '^testDetails'], require: ['^testDetailsSearch','^testDetails'],
scope: { scope: {
'parsePythonLogging': '&' 'filter': '='
}, },
controller: controller, controller: controller,
controllerAs: 'search', controllerAs: 'search',

View File

@@ -178,7 +178,6 @@ function timelineOverview() {
scope.$on('filter', function() { scope.$on('filter', function() {
if (loaded) { if (loaded) {
console.log('filtering');
updateItems(timelineController.data); updateItems(timelineController.data);
} }
}); });

View File

@@ -102,8 +102,8 @@ function timelineViewport($document) {
timelineController.setHover(d); timelineController.setHover(d);
scope.$apply(); scope.$apply();
if (!timelineController.selection if (!timelineController.selection ||
|| d !== timelineController.selection.item) { d !== timelineController.selection.item) {
color(d3.select(this), statusColorMap.hover); color(d3.select(this), statusColorMap.hover);
} }
}; };
@@ -112,8 +112,8 @@ function timelineViewport($document) {
timelineController.clearHover(); timelineController.clearHover();
scope.$apply(); scope.$apply();
if (!timelineController.selection if (!timelineController.selection ||
|| d !== timelineController.selection.item) { d !== timelineController.selection.item) {
var self = d3.select(this); var self = d3.select(this);
uncolor(d3.select(this)); uncolor(d3.select(this));
} }

View File

@@ -20,7 +20,7 @@ var parseWorker = function(tags) {
continue; continue;
} }
return parseInt(tags[i].split('-')[1]); return parseInt(tags[i].split('-')[1], 10);
} }
return null; return null;
@@ -286,10 +286,10 @@ function timeline($log, datasetService, progressService) {
d3.select(window) d3.select(window)
.on("keydown", function() { .on("keydown", function() {
var code = d3.event.keyCode; var code = d3.event.keyCode;
if (code == 37) { if (code === 37) {
ctrl.selectPreviousItem(); ctrl.selectPreviousItem();
} }
else if (code == 39) { if (code === 39) {
ctrl.selectNextItem(); ctrl.selectNextItem();
} }
scope.$apply(); scope.$apply();

View File

@@ -31,7 +31,7 @@ var onConfig = require('./on_config');
angular.module('app').config(onConfig); angular.module('app').config(onConfig);
var onRun = require('./on_run'); var onRun = require('./on_run');
angular.module('app').run(require('./on_run')); angular.module('app').run(onRun);
angular.bootstrap(document, ['app'], { angular.bootstrap(document, ['app'], {
strictDi: true strictDi: true

View File

@@ -8,14 +8,14 @@ function OnConfig($stateProvider, $locationProvider, $urlRouterProvider) {
$stateProvider.state('home', { $stateProvider.state('home', {
url: '/{datasetId:int}', url: '/{datasetId:int}',
params: { datasetId: 0 }, params: { datasetId: 0 },
controller: 'HomeCtrl as home', controller: 'HomeController as home',
templateUrl: 'home.html', templateUrl: 'home.html',
title: 'Home' title: 'Home'
}); });
$stateProvider.state('timeline', { $stateProvider.state('timeline', {
url: '/{datasetId:int}/timeline?test', url: '/{datasetId:int}/timeline?test',
controller: 'TimelineCtrl as timeline', controller: 'TimelineController as timeline',
templateUrl: 'timeline.html', templateUrl: 'timeline.html',
reloadOnSearch: false, reloadOnSearch: false,
title: 'Timeline' title: 'Timeline'
@@ -23,7 +23,8 @@ function OnConfig($stateProvider, $locationProvider, $urlRouterProvider) {
$stateProvider.state('testDetails', { $stateProvider.state('testDetails', {
url: '/{datasetId:int}/test-details/{test}', url: '/{datasetId:int}/test-details/{test}',
controller: 'TestDetailsCtrl as testDetails', controller: 'TestDetailsController',
controllerAs: 'testDetails',
templateUrl: 'test-details.html', templateUrl: 'test-details.html',
title: 'Test Details' title: 'Test Details'
}); });
@@ -32,4 +33,5 @@ function OnConfig($stateProvider, $locationProvider, $urlRouterProvider) {
} }
OnConfig.$inject = ['$stateProvider','$locationProvider','$urlRouterProvider'];
module.exports = OnConfig; module.exports = OnConfig;

View File

@@ -21,4 +21,5 @@ function OnRun($rootScope, AppSettings) {
} }
OnRun.$inject = ['$rootScope','AppSettings'];
module.exports = OnRun; module.exports = OnRun;

View File

@@ -20,7 +20,8 @@ function DatasetService($q, $http) {
service.get = function(id) { service.get = function(id) {
return $q(function(resolve, reject) { return $q(function(resolve, reject) {
service.list().then(function(response) { service.list().then(function(response) {
for (let entry of response.data.tempest) { for (var i in response.data.tempest) {
var entry = response.data.tempest[i];
if (entry.id === id) { if (entry.id === id) {
resolve(entry); resolve(entry);
return; return;

View File

@@ -1,5 +1,6 @@
"use strict";
var binaryMinIndex = function(min, array, func) { var binaryMinIndex = function(min, array, func) {
"use strict";
var left = 0; var left = 0;
var right = array.length - 1; var right = array.length - 1;
@@ -26,7 +27,6 @@ var binaryMinIndex = function(min, array, func) {
}; };
var binaryMaxIndex = function(max, array, func) { var binaryMaxIndex = function(max, array, func) {
"use strict";
var left = 0; var left = 0;
var right = array.length - 1; var right = array.length - 1;

View File

@@ -1,7 +1,8 @@
'use strict';
var d3 = require("d3"); var d3 = require("d3");
var fillArrayRight = function(array) { var fillArrayRight = function(array) {
"use strict";
// "fill" the array to the right, overwriting empty values with the next // "fill" the array to the right, overwriting empty values with the next
// non-empty value to the left // non-empty value to the left
@@ -14,7 +15,6 @@ var fillArrayRight = function(array) {
}; };
var mergeNames = function(primary, secondary) { var mergeNames = function(primary, secondary) {
"use strict";
// "zip" together strings in the same position in each array, and do some // "zip" together strings in the same position in each array, and do some
// basic cleanup of results // basic cleanup of results
@@ -26,7 +26,6 @@ var mergeNames = function(primary, secondary) {
}; };
var parseDstat = function(data, year) { var parseDstat = function(data, year) {
"use strict";
var primaryNames = null; var primaryNames = null;
var secondaryNames = null; var secondaryNames = null;

View File

@@ -10,8 +10,8 @@
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title"> <h3 class="panel-title">
{{testName | split:'.' | slice:-2 | join:'.'}} {{testDetails.testName | split:'.' | slice:-2 | join:'.'}}
<test-details-search class="pull-right"></test-details-search> <test-details-search class="pull-right" filter="testDetails.parsePythonLogging"></test-details-search>
</h3> </h3>
</div> </div>
@@ -21,26 +21,26 @@
<table class="table table-bordered table-hover table-striped"> <table class="table table-bordered table-hover table-striped">
<tr> <tr>
<td>Name</td> <td>Name</td>
<td>{{item.name | split:'.' | pickRight:1}}</td> <td>{{testDetails.item.name | split:'.' | pickRight:1}}</td>
<tr> <tr>
<td>Full Name</td> <td>Full Name</td>
<td>{{item.name}}</td> <td>{{testDetails.item.name}}</td>
</tr> </tr>
<tr> <tr>
<td>Status</td> <td>Status</td>
<td>{{item.status}}</td> <td>{{testDetails.item.status}}</td>
</tr> </tr>
<tr> <tr>
<td>Tags</td> <td>Tags</td>
<td>{{item.tags | join:', '}}</td> <td>{{testDetails.item.tags | join:', '}}</td>
</tr> </tr>
<tr> <tr>
<td>Duration</td> <td>Duration</td>
<td>{{item.duration | number:1}} seconds</td> <td>{{testDetails.item.duration | number:1}} seconds</td>
</tr> </tr>
</table> </table>
</uib-tab> </uib-tab>
<uib-tab ng-repeat="(entry,log) in itemDetails" heading="{{entry}}"> <uib-tab ng-repeat="(entry,log) in testDetails.itemDetails" heading="{{entry}}">
<pre style="height: 400px; overflow-y: scroll;">{{log}}</pre> <pre style="height: 400px; overflow-y: scroll;">{{log}}</pre>
</uib-tab> </uib-tab>
</uib-tabset> </uib-tabset>
@@ -48,7 +48,7 @@
<div class="panel-footer clearfix"> <div class="panel-footer clearfix">
<a class="btn btn-default pull-right" <a class="btn btn-default pull-right"
ui-sref="timeline({datasetId: dataset.id, test: item.name})"> ui-sref="timeline({datasetId: testDetails.dataset.id, test: testDetails.item.name})">
Timeline Timeline
</a> </a>
</div> </div>

View File

@@ -22,8 +22,8 @@
"bulkify": "^1.1.1", "bulkify": "^1.1.1",
"d3": "^3.5.6", "d3": "^3.5.6",
"del": "^0.1.3", "del": "^0.1.3",
"eslint": "1.5.1", "eslint": "^1.10.3",
"eslint-config-openstack": "1.2.2", "eslint-config-openstack": "^1.2.3",
"eslint-plugin-angular": "0.12.0", "eslint-plugin-angular": "0.12.0",
"express": "^4.7.2", "express": "^4.7.2",
"gulp": "^3.8.8", "gulp": "^3.8.8",

View File

@@ -1,7 +1,7 @@
'use strict'; 'use strict';
var istanbul = require('browserify-istanbul'); var istanbul = require('browserify-istanbul');
var isparta = require('isparta'); var isparta = require('isparta');
module.exports = function(config) { module.exports = function(config) {

View File

@@ -1,22 +0,0 @@
/*global angular */
'use strict';
describe('Unit: HomeCtrl', function() {
var ctrl;
beforeEach(function() {
// instantiate the app module
angular.mock.module('app');
angular.mock.inject(function($controller) {
ctrl = $controller('HomeCtrl');
});
});
it('should exist', function() {
expect(ctrl).toBeDefined();
});
});