Cleaned up linter errors.

pull/2/head
Kevan Ahlquist 2015-01-03 18:39:40 -06:00
parent e507af62aa
commit ab2819addd
11 changed files with 62 additions and 58 deletions

View File

@ -1,7 +1,6 @@
'use strict';
angular.module('<%= pkg.name %>', ['<%= pkg.name %>.templates', 'ngRoute', '<%= pkg.name %>.services', '<%= pkg.name %>.filters', 'masthead', 'footer', 'dashboard', 'container', 'containers', 'images', 'image', 'startContainer', 'sidebar', 'settings', 'builder', 'containerLogs']) angular.module('<%= pkg.name %>', ['<%= pkg.name %>.templates', 'ngRoute', '<%= pkg.name %>.services', '<%= pkg.name %>.filters', 'masthead', 'footer', 'dashboard', 'container', 'containers', 'images', 'image', 'startContainer', 'sidebar', 'settings', 'builder', 'containerLogs'])
.config(['$routeProvider', function ($routeProvider) { .config(['$routeProvider', function ($routeProvider) {
'use strict';
$routeProvider.when('/', {templateUrl: 'app/components/dashboard/dashboard.html', controller: 'DashboardController'}); $routeProvider.when('/', {templateUrl: 'app/components/dashboard/dashboard.html', controller: 'DashboardController'});
$routeProvider.when('/containers/', {templateUrl: 'app/components/containers/containers.html', controller: 'ContainersController'}); $routeProvider.when('/containers/', {templateUrl: 'app/components/containers/containers.html', controller: 'ContainersController'});
$routeProvider.when('/containers/:id/', {templateUrl: 'app/components/container/container.html', controller: 'ContainerController'}); $routeProvider.when('/containers/:id/', {templateUrl: 'app/components/container/container.html', controller: 'ContainerController'});

View File

@ -70,10 +70,10 @@
<td>Hostname:</td> <td>Hostname:</td>
<td>{{ container.Config.Hostname }}</td> <td>{{ container.Config.Hostname }}</td>
</tr> </tr>
<tr> <tr>
<td>IPAddress:</td> <td>IPAddress:</td>
<td>{{ container.NetworkSettings.IPAddress }}</td> <td>{{ container.NetworkSettings.IPAddress }}</td>
</tr> </tr>
<tr> <tr>
<td>Cmd:</td> <td>Cmd:</td>
<td>{{ container.Config.Cmd }}</td> <td>{{ container.Config.Cmd }}</td>

View File

@ -1,7 +1,7 @@
angular.module('containerLogs', []) angular.module('containerLogs', [])
.controller('ContainerLogsController', ['$scope', '$routeParams', '$location', '$anchorScroll', 'ContainerLogs', 'Container', 'ViewSpinner', .controller('ContainerLogsController', ['$scope', '$routeParams', '$location', '$anchorScroll', 'ContainerLogs', 'Container', 'ViewSpinner',
function($scope, $routeParams, $location, $anchorScroll, ContainerLogs, Container, ViewSpinner) { function($scope, $routeParams, $location, $anchorScroll, ContainerLogs, Container, ViewSpinner) {
$scope.stdout = ''; $scope.stdout = '';
$scope.stderr = ''; $scope.stderr = '';
$scope.showTimestamps = false; $scope.showTimestamps = false;
@ -20,7 +20,7 @@ function($scope, $routeParams, $location, $anchorScroll, ContainerLogs, Containe
function getLogs() { function getLogs() {
ContainerLogs.get($routeParams.id, {stdout: 1, stderr: 0, timestamps: $scope.showTimestamps}, function(data, status, headers, config) { ContainerLogs.get($routeParams.id, {stdout: 1, stderr: 0, timestamps: $scope.showTimestamps}, function(data, status, headers, config) {
// Replace carriage returns twith newlines to clean up output // Replace carriage returns twith newlines to clean up output
$scope.stdout = data.replace(/[\r]/g, '\n'); $scope.stdout = data.replace(/[\r]/g, '\n');
}); });
ContainerLogs.get($routeParams.id, {stdout: 0, stderr: 1}, function(data, status, headers, config) { ContainerLogs.get($routeParams.id, {stdout: 0, stderr: 1}, function(data, status, headers, config) {
@ -40,9 +40,9 @@ function($scope, $routeParams, $location, $anchorScroll, ContainerLogs, Containe
$scope.scrollTo = function(id) { $scope.scrollTo = function(id) {
$location.hash(id); $location.hash(id);
$anchorScroll(); $anchorScroll();
} };
$scope.toggleTimestamps = function() { $scope.toggleTimestamps = function() {
getLogs(); getLogs();
} };
}]); }]);

View File

@ -18,7 +18,7 @@
<div class="pull-right"> <div class="pull-right">
<input type="checkbox" ng-model="displayAll" <input type="checkbox" ng-model="displayAll"
ng-change="toggleGetAll()"/> Display All ng-change="toggleGetAll()"/> Display All
</div> </div>
</div> </div>
<table class="table table-striped"> <table class="table table-striped">

View File

@ -27,7 +27,7 @@ angular.module('dashboard', [])
} }
Container.query({all: 1}, function(d) { Container.query({all: 1}, function(d) {
var running = 0 var running = 0;
var ghost = 0; var ghost = 0;
var stopped = 0; var stopped = 0;

View File

@ -36,7 +36,7 @@ function($scope, $q, $routeParams, $location, Image, Container, Messages, LineCh
var containers = []; var containers = [];
for (var i = 0; i < d.length; i++) { for (var i = 0; i < d.length; i++) {
var c = d[i]; var c = d[i];
if (c.Image == tag) { if (c.Image === tag) {
containers.push(new ContainerViewModel(c)); containers.push(new ContainerViewModel(c));
} }
} }

View File

@ -1,13 +1,14 @@
'use strict';
angular.module('dockerui.filters', []) angular.module('dockerui.filters', [])
.filter('truncate', function() { .filter('truncate', function() {
'use strict';
return function(text, length, end) { return function(text, length, end) {
if (isNaN(length)) if (isNaN(length)) {
length = 10; length = 10;
}
if (end === undefined) if (end === undefined){
end = "..."; end = "...";
}
if (text.length <= length || text.length - end.length <= length) { if (text.length <= length || text.length - end.length <= length) {
return text; return text;
@ -18,19 +19,22 @@ angular.module('dockerui.filters', [])
}; };
}) })
.filter('statusbadge', function() { .filter('statusbadge', function() {
'use strict';
return function(text) { return function(text) {
if (text === 'Ghost') { if (text === 'Ghost') {
return 'important'; return 'important';
} else if (text.indexOf('Exit') != -1 && text !== 'Exit 0') { } else if (text.indexOf('Exit') !== -1 && text !== 'Exit 0') {
return 'warning'; return 'warning';
} }
return 'success'; return 'success';
}; };
}) })
.filter('getstatetext', function() { .filter('getstatetext', function() {
'use strict';
return function(state) { return function(state) {
if (state == undefined) return ''; if (state === undefined) {
return '';
}
if (state.Ghost && state.Running) { if (state.Ghost && state.Running) {
return 'Ghost'; return 'Ghost';
} }
@ -44,8 +48,11 @@ angular.module('dockerui.filters', [])
}; };
}) })
.filter('getstatelabel', function() { .filter('getstatelabel', function() {
'use strict';
return function(state) { return function(state) {
if (state == undefined) return ''; if (state === undefined) {
return '';
}
if (state.Ghost && state.Running) { if (state.Ghost && state.Running) {
return 'label-important'; return 'label-important';
@ -57,32 +64,36 @@ angular.module('dockerui.filters', [])
}; };
}) })
.filter('humansize', function() { .filter('humansize', function() {
'use strict';
return function(bytes) { return function(bytes) {
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
if (bytes == 0) { if (bytes === 0) {
return 'n/a'; return 'n/a';
} }
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)), 10);
return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[[i]]; return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[[i]];
}; };
}) })
.filter('containername', function() { .filter('containername', function() {
'use strict';
return function(container) { return function(container) {
var name = container.Names[0]; var name = container.Names[0];
return name.substring(1, name.length); return name.substring(1, name.length);
}; };
}) })
.filter('repotag', function() { .filter('repotag', function() {
'use strict';
return function(image) { return function(image) {
if (image.RepoTags && image.RepoTags.length > 0) { if (image.RepoTags && image.RepoTags.length > 0) {
var tag = image.RepoTags[0]; var tag = image.RepoTags[0];
if (tag == '<none>:<none>') { tag = ''; } if (tag === '<none>:<none>') { tag = ''; }
return tag; return tag;
} }
return ''; return '';
}; };
}) })
.filter('getdate', function() { .filter('getdate', function() {
'use strict';
return function(data) { return function(data) {
//Multiply by 1000 for the unix format //Multiply by 1000 for the unix format
var date = new Date(data * 1000); var date = new Date(data * 1000);

View File

@ -1,7 +1,6 @@
'use strict';
angular.module('dockerui.services', ['ngResource']) angular.module('dockerui.services', ['ngResource'])
.factory('Container', function($resource, Settings) { .factory('Container', function($resource, Settings) {
'use strict';
// Resource for interacting with the docker containers // Resource for interacting with the docker containers
// http://docs.docker.io/en/latest/api/docker_remote_api.html#containers // http://docs.docker.io/en/latest/api/docker_remote_api.html#containers
return $resource(Settings.url + '/containers/:id/:action', { return $resource(Settings.url + '/containers/:id/:action', {
@ -21,6 +20,7 @@ angular.module('dockerui.services', ['ngResource'])
}); });
}) })
.factory('ContainerLogs', function($resource, $http, Settings) { .factory('ContainerLogs', function($resource, $http, Settings) {
'use strict';
return { return {
get: function(id, params, callback) { get: function(id, params, callback) {
$http({ $http({
@ -31,9 +31,10 @@ angular.module('dockerui.services', ['ngResource'])
console.log(error, data); console.log(error, data);
}); });
} }
} };
}) })
.factory('Image', function($resource, Settings) { .factory('Image', function($resource, Settings) {
'use strict';
// Resource for docker images // Resource for docker images
// http://docs.docker.io/en/latest/api/docker_remote_api.html#images // http://docs.docker.io/en/latest/api/docker_remote_api.html#images
return $resource(Settings.url + '/images/:id/:action', {}, { return $resource(Settings.url + '/images/:id/:action', {}, {
@ -49,6 +50,7 @@ angular.module('dockerui.services', ['ngResource'])
}); });
}) })
.factory('Docker', function($resource, Settings) { .factory('Docker', function($resource, Settings) {
'use strict';
// Information for docker // Information for docker
// http://docs.docker.io/en/latest/api/docker_remote_api.html#display-system-wide-information // http://docs.docker.io/en/latest/api/docker_remote_api.html#display-system-wide-information
return $resource(Settings.url + '/version', {}, { return $resource(Settings.url + '/version', {}, {
@ -56,6 +58,7 @@ angular.module('dockerui.services', ['ngResource'])
}); });
}) })
.factory('Auth', function($resource, Settings) { .factory('Auth', function($resource, Settings) {
'use strict';
// Auto Information for docker // Auto Information for docker
// http://docs.docker.io/en/latest/api/docker_remote_api.html#set-auth-configuration // http://docs.docker.io/en/latest/api/docker_remote_api.html#set-auth-configuration
return $resource(Settings.url + '/auth', {}, { return $resource(Settings.url + '/auth', {}, {
@ -64,6 +67,7 @@ angular.module('dockerui.services', ['ngResource'])
}); });
}) })
.factory('System', function($resource, Settings) { .factory('System', function($resource, Settings) {
'use strict';
// System for docker // System for docker
// http://docs.docker.io/en/latest/api/docker_remote_api.html#display-system-wide-information // http://docs.docker.io/en/latest/api/docker_remote_api.html#display-system-wide-information
return $resource(Settings.url + '/info', {}, { return $resource(Settings.url + '/info', {}, {
@ -71,6 +75,7 @@ angular.module('dockerui.services', ['ngResource'])
}); });
}) })
.factory('Settings', function(DOCKER_ENDPOINT, DOCKER_PORT, DOCKER_API_VERSION, UI_VERSION) { .factory('Settings', function(DOCKER_ENDPOINT, DOCKER_PORT, DOCKER_API_VERSION, UI_VERSION) {
'use strict';
var url = DOCKER_ENDPOINT; var url = DOCKER_ENDPOINT;
if (DOCKER_PORT) { if (DOCKER_PORT) {
url = url + DOCKER_PORT + '\\' + DOCKER_PORT; url = url + DOCKER_PORT + '\\' + DOCKER_PORT;
@ -82,10 +87,11 @@ angular.module('dockerui.services', ['ngResource'])
rawUrl: DOCKER_ENDPOINT + DOCKER_PORT + '/' + DOCKER_API_VERSION, rawUrl: DOCKER_ENDPOINT + DOCKER_PORT + '/' + DOCKER_API_VERSION,
uiVersion: UI_VERSION, uiVersion: UI_VERSION,
url: url, url: url,
firstLoad: true, firstLoad: true
}; };
}) })
.factory('ViewSpinner', function() { .factory('ViewSpinner', function() {
'use strict';
var spinner = new Spinner(); var spinner = new Spinner();
var target = document.getElementById('view'); var target = document.getElementById('view');
@ -95,6 +101,7 @@ angular.module('dockerui.services', ['ngResource'])
}; };
}) })
.factory('Messages', function($rootScope) { .factory('Messages', function($rootScope) {
'use strict';
return { return {
send: function(title, text) { send: function(title, text) {
$.gritter.add({ $.gritter.add({
@ -102,7 +109,7 @@ angular.module('dockerui.services', ['ngResource'])
text: text, text: text,
time: 2000, time: 2000,
before_open: function() { before_open: function() {
if($('.gritter-item-wrapper').length == 3) { if($('.gritter-item-wrapper').length === 3) {
return false; return false;
} }
} }
@ -114,7 +121,7 @@ angular.module('dockerui.services', ['ngResource'])
text: text, text: text,
time: 6000, time: 6000,
before_open: function() { before_open: function() {
if($('.gritter-item-wrapper').length == 4) { if($('.gritter-item-wrapper').length === 4) {
return false; return false;
} }
} }
@ -123,6 +130,7 @@ angular.module('dockerui.services', ['ngResource'])
}; };
}) })
.factory('Dockerfile', function(Settings) { .factory('Dockerfile', function(Settings) {
'use strict';
var url = Settings.rawUrl + '/build'; var url = Settings.rawUrl + '/build';
return { return {
build: function(file, callback) { build: function(file, callback) {
@ -138,6 +146,7 @@ angular.module('dockerui.services', ['ngResource'])
}; };
}) })
.factory('LineChart', function(Settings) { .factory('LineChart', function(Settings) {
'use strict';
var url = Settings.rawUrl + '/build'; var url = Settings.rawUrl + '/build';
return { return {
build: function(id, data, getkey){ build: function(id, data, getkey){
@ -157,10 +166,10 @@ angular.module('dockerui.services', ['ngResource'])
} }
var labels = []; var labels = [];
var data = []; data = [];
var keys = Object.keys(map); var keys = Object.keys(map);
for (var i = keys.length - 1; i > -1; i--) { for (i = keys.length - 1; i > -1; i--) {
var k = keys[i]; var k = keys[i];
labels.push(k); labels.push(k);
data.push(map[k]); data.push(map[k]);

View File

@ -22,8 +22,8 @@ body {
} }
.jumbotron .btn { .jumbotron .btn {
font-size: 21px;
padding: 14px 24px; padding: 14px 24px;
font-size: 21px;
} }
.marketing { .marketing {
@ -46,15 +46,15 @@ body {
.masthead .nav li { .masthead .nav li {
display: table-cell; display: table-cell;
width: 1%;
float: none; float: none;
width: 1%;
} }
.masthead .nav li a { .masthead .nav li a {
font-weight: bold; font-weight: bold;
text-align: center; text-align: center;
border-left: 1px solid rgba(255,255,255,.75);
border-right: 1px solid rgba(0,0,0,.1); border-right: 1px solid rgba(0,0,0,.1);
border-left: 1px solid rgba(255,255,255,.75);
} }
.masthead .nav li:first-child a { .masthead .nav li:first-child a {
@ -81,8 +81,8 @@ body {
} }
.btn-remove { .btn-remove {
margin: 0 auto;
max-width: 70%; max-width: 70%;
margin: 0 auto;
} }
.actions { .actions {
@ -97,33 +97,15 @@ body {
padding: 10px 15px 0 15px; padding: 10px 15px 0 15px;
} }
#response {
width: 80%;
margin: 0 auto;
}
#editor {
height: 300px;
width: 100%;
border: 1px solid #DDD;
margin-top: 5px;
}
.messages { .messages {
max-height: 50px; max-height: 50px;
overflow-y: scroll;
overflow-x: hidden; overflow-x: hidden;
overflow-y: scroll;
} }
.legend .title { .legend .title {
padding: 0 0.3em;
margin: 0.5em; margin: 0.5em;
border-style: solid; border-style: solid;
border-width: 0 0 0 1em; border-width: 0 0 0 1em;
padding: 0 0.3em;
}
pre.pre-x-scrollable {
max-height: 700px;
word-wrap: normal;
white-space: pre;
} }

View File

@ -144,7 +144,10 @@ module.exports = function (grunt) {
sub:true, sub:true,
boss:true, boss:true,
eqnull:true, eqnull:true,
globals:{} globals:{
angular: false,
'$': false
}
} }
} }
}); });

View File