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'])
.config(['$routeProvider', function ($routeProvider) {
'use strict';
$routeProvider.when('/', {templateUrl: 'app/components/dashboard/dashboard.html', controller: 'DashboardController'});
$routeProvider.when('/containers/', {templateUrl: 'app/components/containers/containers.html', controller: 'ContainersController'});
$routeProvider.when('/containers/:id/', {templateUrl: 'app/components/container/container.html', controller: 'ContainerController'});

View File

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

View File

@ -1,7 +1,7 @@
angular.module('containerLogs', [])
.controller('ContainerLogsController', ['$scope', '$routeParams', '$location', '$anchorScroll', 'ContainerLogs', 'Container', 'ViewSpinner',
function($scope, $routeParams, $location, $anchorScroll, ContainerLogs, Container, ViewSpinner) {
$scope.stdout = '';
$scope.stdout = '';
$scope.stderr = '';
$scope.showTimestamps = false;
@ -20,7 +20,7 @@ function($scope, $routeParams, $location, $anchorScroll, ContainerLogs, Containe
function getLogs() {
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');
});
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) {
$location.hash(id);
$anchorScroll();
}
};
$scope.toggleTimestamps = function() {
getLogs();
}
getLogs();
};
}]);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -22,8 +22,8 @@ body {
}
.jumbotron .btn {
font-size: 21px;
padding: 14px 24px;
font-size: 21px;
}
.marketing {
@ -46,15 +46,15 @@ body {
.masthead .nav li {
display: table-cell;
width: 1%;
float: none;
width: 1%;
}
.masthead .nav li a {
font-weight: bold;
text-align: center;
border-left: 1px solid rgba(255,255,255,.75);
border-right: 1px solid rgba(0,0,0,.1);
border-left: 1px solid rgba(255,255,255,.75);
}
.masthead .nav li:first-child a {
@ -81,8 +81,8 @@ body {
}
.btn-remove {
margin: 0 auto;
max-width: 70%;
margin: 0 auto;
}
.actions {
@ -97,33 +97,15 @@ body {
padding: 10px 15px 0 15px;
}
#response {
width: 80%;
margin: 0 auto;
}
#editor {
height: 300px;
width: 100%;
border: 1px solid #DDD;
margin-top: 5px;
}
.messages {
max-height: 50px;
overflow-y: scroll;
overflow-x: hidden;
overflow-y: scroll;
}
.legend .title {
padding: 0 0.3em;
margin: 0.5em;
border-style: solid;
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,
boss:true,
eqnull:true,
globals:{}
globals:{
angular: false,
'$': false
}
}
}
});

View File