
This patch adds eslint, a permissively licensed (as opposed to jshint or jslint) javascript style linter. It also enables the use of 'npm run lint', which may be used in OpenStack's gate to cause build failures when improperly formed javascript is committed. Existing javascript was updated to pass linting rules. Note that most of these changes were formatting and file length concerns. The noted stylistic change that we should probably discuss is the use of singlequote vs. doublequote. Single is the pep8 standard used in python, and thus enforcing that seems to make the most sense. Change-Id: I52768fe6e7ee1f76f0d67f44273fdc48b159489a
64 lines
1.8 KiB
JavaScript
64 lines
1.8 KiB
JavaScript
/* App Module */
|
|
|
|
var refstackApp = angular.module('refstackApp', [
|
|
'ui.router', 'ui.bootstrap', 'cgBusy']);
|
|
|
|
/*
|
|
* Handle application routing.
|
|
*/
|
|
refstackApp.config([
|
|
'$stateProvider', '$urlRouterProvider',
|
|
function ($stateProvider, $urlRouterProvider) {
|
|
'use strict';
|
|
|
|
$urlRouterProvider.otherwise('/');
|
|
$stateProvider.
|
|
state('home', {
|
|
url: '/',
|
|
templateUrl: '/components/home/home.html'
|
|
}).
|
|
state('about', {
|
|
url: '/about',
|
|
templateUrl: '/components/about/about.html'
|
|
}).
|
|
state('capabilities', {
|
|
url: '/capabilities',
|
|
templateUrl: '/components/capabilities/capabilities.html',
|
|
controller: 'capabilitiesController'
|
|
}).
|
|
state('results', {
|
|
url: '/results',
|
|
templateUrl: '/components/results/results.html',
|
|
controller: 'resultsController'
|
|
}).
|
|
state('resultsDetail', {
|
|
url: '/results/:testID',
|
|
templateUrl: '/components/results-report/resultsReport.html',
|
|
controller: 'resultsReportController'
|
|
});
|
|
}
|
|
]);
|
|
|
|
/*
|
|
* Load Config and start up the angular application.
|
|
*/
|
|
angular.element(document).ready(function () {
|
|
'use strict';
|
|
|
|
var $http = angular.injector(['ng']).get('$http');
|
|
|
|
function startApp(config) {
|
|
// Add config options as constants.
|
|
for (var key in config) {
|
|
angular.module('refstackApp').constant(key, config[key]);
|
|
}
|
|
angular.bootstrap(document, ['refstackApp']);
|
|
}
|
|
|
|
$http.get('config.json').success(function (data) {
|
|
startApp(data);
|
|
}).error(function () {
|
|
startApp({});
|
|
});
|
|
});
|