mirror of https://github.com/portainer/portainer
commit
2974f69932
@ -0,0 +1 @@
|
||||
node_modules
|
@ -0,0 +1,154 @@
|
||||
module.exports = function (grunt) {
|
||||
|
||||
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-contrib-clean');
|
||||
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||
grunt.loadNpmTasks('grunt-recess');
|
||||
grunt.loadNpmTasks('grunt-karma');
|
||||
grunt.loadNpmTasks('grunt-html2js');
|
||||
|
||||
// Default task.
|
||||
grunt.registerTask('default', ['jshint','build','karma:unit']);
|
||||
grunt.registerTask('build', ['clean','html2js','concat','recess:build', 'copy']);
|
||||
grunt.registerTask('release', ['clean','html2js','uglify','jshint','karma:unit','concat:index', 'recess:min', 'copy']);
|
||||
grunt.registerTask('test-watch', ['karma:watch']);
|
||||
|
||||
// Print a timestamp (useful for when watching)
|
||||
grunt.registerTask('timestamp', function() {
|
||||
grunt.log.subhead(Date());
|
||||
});
|
||||
|
||||
var karmaConfig = function(configFile, customOptions) {
|
||||
var options = { configFile: configFile, keepalive: true };
|
||||
var travisOptions = process.env.TRAVIS && { browsers: ['Firefox'], reporters: 'dots' };
|
||||
return grunt.util._.extend(options, customOptions, travisOptions);
|
||||
};
|
||||
|
||||
// Project configuration.
|
||||
grunt.initConfig({
|
||||
distdir: 'dist',
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
banner:
|
||||
'/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
|
||||
'<%= pkg.homepage ? " * " + pkg.homepage + "\\n" : "" %>' +
|
||||
' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %>;\n' +
|
||||
' * Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %>\n */\n',
|
||||
src: {
|
||||
js: ['app/**/*.js'],
|
||||
jsTpl: ['<%= distdir %>/templates/**/*.js'],
|
||||
specs: ['test/**/*.spec.js'],
|
||||
scenarios: ['test/**/*.scenario.js'],
|
||||
html: ['index.html'],
|
||||
tpl: {
|
||||
app: ['app/components/**/*.html']
|
||||
},
|
||||
css: ['assets/css/app.css']
|
||||
},
|
||||
clean: ['<%= distdir %>/*'],
|
||||
copy: {
|
||||
assets: {
|
||||
files: [{ dest: '<%= distdir %>/assets', src : '**', expand: true, cwd: 'assets/' }]
|
||||
}
|
||||
},
|
||||
karma: {
|
||||
unit: { options: karmaConfig('test/unit/karma.conf.js') },
|
||||
watch: { options: karmaConfig('test/unit/karma.conf.js', { singleRun:false, autoWatch: true}) }
|
||||
},
|
||||
html2js: {
|
||||
app: {
|
||||
options: {
|
||||
base: '.'
|
||||
},
|
||||
src: ['<%= src.tpl.app %>'],
|
||||
dest: '<%= distdir %>/templates/app.js',
|
||||
module: '<%= pkg.name %>.templates'
|
||||
}
|
||||
},
|
||||
concat:{
|
||||
dist:{
|
||||
options: {
|
||||
banner: "<%= banner %>",
|
||||
process: true
|
||||
},
|
||||
src:['<%= src.js %>', '<%= src.jsTpl %>'],
|
||||
dest:'<%= distdir %>/<%= pkg.name %>.js'
|
||||
},
|
||||
index: {
|
||||
src: ['index.html'],
|
||||
dest: '<%= distdir %>/index.html',
|
||||
options: {
|
||||
process: true
|
||||
}
|
||||
},
|
||||
angular: {
|
||||
src:['assets/js/angularjs/1.2.6/angular.min.js',
|
||||
'assets/js/angularjs/1.2.6/angular-route.min.js',
|
||||
'assets/js/angularjs/1.2.6/angular-resource.min.js'],
|
||||
dest: '<%= distdir %>/angular.js'
|
||||
}
|
||||
},
|
||||
uglify: {
|
||||
dist:{
|
||||
options: {
|
||||
banner: "<%= banner %>"
|
||||
},
|
||||
src:['<%= src.js %>' ,'<%= src.jsTpl %>'],
|
||||
dest:'<%= distdir %>/<%= pkg.name %>.js'
|
||||
},
|
||||
angular: {
|
||||
src:['<%= concat.angular.src %>'],
|
||||
dest: '<%= distdir %>/angular.js'
|
||||
}
|
||||
},
|
||||
recess: {
|
||||
build: {
|
||||
files: {
|
||||
'<%= distdir %>/<%= pkg.name %>.css':
|
||||
['<%= src.css %>'] },
|
||||
options: {
|
||||
compile: true,
|
||||
noOverqualifying: false // TODO: Added because of .nav class, rename
|
||||
}
|
||||
},
|
||||
min: {
|
||||
files: {
|
||||
'<%= distdir %>/<%= pkg.name %>.css': ['<%= src.css %>']
|
||||
},
|
||||
options: {
|
||||
compress: true
|
||||
}
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
all: {
|
||||
files:['<%= src.js %>', '<%= src.specs %>', '<%= src.css %>', '<%= src.tpl.app %>', '<%= src.tpl.common %>', '<%= src.html %>'],
|
||||
tasks:['default','timestamp']
|
||||
},
|
||||
build: {
|
||||
files:['<%= src.js %>', '<%= src.specs %>', '<%= src.css %>', '<%= src.tpl.app %>', '<%= src.tpl.common %>', '<%= src.html %>'],
|
||||
tasks:['build','timestamp']
|
||||
}
|
||||
},
|
||||
jshint:{
|
||||
files:['gruntFile.js', '<%= src.js %>', '<%= src.jsTpl %>', '<%= src.specs %>', '<%= src.scenarios %>'],
|
||||
options:{
|
||||
curly:true,
|
||||
eqeqeq:true,
|
||||
immed:true,
|
||||
latedef:true,
|
||||
newcap:true,
|
||||
noarg:true,
|
||||
sub:true,
|
||||
boss:true,
|
||||
eqnull:true,
|
||||
globals:{
|
||||
angular: false,
|
||||
'$': false
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
@ -0,0 +1,35 @@
|
||||
{
|
||||
"author": "Michael Crosby",
|
||||
"name": "dockerui",
|
||||
"homepage": "https://github.com/crosbymichael/dockerui",
|
||||
"version": "0.6.0-SNAPSHOT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:crosbymichael/dockerui.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/crosbymichael/dockerui/issues"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://raw.githubusercontent.com/crosbymichael/dockerui/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 0.8.4"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"grunt": "~0.4.0",
|
||||
"grunt-recess": "~0.3",
|
||||
"grunt-contrib-clean": "~0.4.0",
|
||||
"grunt-contrib-copy": "~0.4.0",
|
||||
"grunt-contrib-jshint": "~0.2.0",
|
||||
"grunt-contrib-concat": "~0.1.3",
|
||||
"grunt-contrib-uglify": "~0.1.1",
|
||||
"grunt-karma": "~0.4.4",
|
||||
"grunt-html2js": "~0.1.0",
|
||||
"grunt-contrib-watch": "~0.3.1"
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,56 @@
|
||||
// base path, that will be used to resolve files and exclude
|
||||
basePath = '../..';
|
||||
|
||||
// list of files / patterns to load in the browser
|
||||
files = [
|
||||
JASMINE,
|
||||
JASMINE_ADAPTER,
|
||||
'assets/js/jquery-1.11.1.min.js',
|
||||
'assets/js/angularjs/1.2.6/angular.min.js',
|
||||
'assets/js/angularjs/1.2.6/angular-route.min.js',
|
||||
'assets/js/angularjs/1.2.6/angular-resource.min.js',
|
||||
'test/assets/angular/angular-mocks.js',
|
||||
'app/**/*.js',
|
||||
'test/unit/**/*.spec.js',
|
||||
'dist/templates/**/*.js'
|
||||
];
|
||||
|
||||
// use dots reporter, as travis terminal does not support escaping sequences
|
||||
// possible values: 'dots' || 'progress'
|
||||
reporters = 'progress';
|
||||
|
||||
// these are default values, just to show available options
|
||||
|
||||
// web server port
|
||||
port = 8089;
|
||||
|
||||
// cli runner port
|
||||
runnerPort = 9109;
|
||||
|
||||
urlRoot = '/__test/';
|
||||
|
||||
// enable / disable colors in the output (reporters and logs)
|
||||
colors = true;
|
||||
|
||||
// level of logging
|
||||
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
|
||||
logLevel = LOG_INFO;
|
||||
|
||||
// enable / disable watching file and executing tests whenever any file changes
|
||||
autoWatch = false;
|
||||
|
||||
// polling interval in ms (ignored on OS that support inotify)
|
||||
autoWatchInterval = 0;
|
||||
|
||||
// Start these browsers, currently available:
|
||||
// - Chrome
|
||||
// - ChromeCanary
|
||||
// - Firefox
|
||||
// - Opera
|
||||
// - Safari
|
||||
// - PhantomJS
|
||||
browsers = ['Chrome'];
|
||||
|
||||
// Continuous Integration mode
|
||||
// if true, it capture browsers, run tests and exit
|
||||
singleRun = true;
|
@ -0,0 +1,156 @@
|
||||
describe('filters', function () {
|
||||
beforeEach(module('<%= pkg.name %>.filters'));
|
||||
|
||||
describe('truncate', function () {
|
||||
it('should truncate the string to 10 characters ending in "..." by default', inject(function(truncateFilter) {
|
||||
expect(truncateFilter('this is 20 chars long')).toBe('this is...');
|
||||
}));
|
||||
|
||||
it('should truncate the string to 7 characters ending in "..."', inject(function(truncateFilter) {
|
||||
expect(truncateFilter('this is 20 chars long', 7)).toBe('this...');
|
||||
}));
|
||||
|
||||
it('should truncate the string to 10 characters ending in "???"', inject(function(truncateFilter) {
|
||||
expect(truncateFilter('this is 20 chars long', 10, '???')).toBe('this is???');
|
||||
}));
|
||||
});
|
||||
|
||||
describe('statusbadge', function () {
|
||||
it('should be "important" when input is "Ghost"', inject(function(statusbadgeFilter) {
|
||||
expect(statusbadgeFilter('Ghost')).toBe('important');
|
||||
}));
|
||||
|
||||
it('should be "success" when input is "Exit 0"', inject(function(statusbadgeFilter) {
|
||||
expect(statusbadgeFilter('Exit 0')).toBe('success');
|
||||
}));
|
||||
|
||||
it('should be "warning" when exit code is non-zero', inject(function(statusbadgeFilter) {
|
||||
expect(statusbadgeFilter('Exit 1')).toBe('warning');
|
||||
}));
|
||||
});
|
||||
|
||||
describe('getstatetext', function () {
|
||||
|
||||
it('should return an empty string when state is undefined', inject(function(getstatetextFilter) {
|
||||
expect(getstatetextFilter(undefined)).toBe('');
|
||||
}));
|
||||
|
||||
it('should detect a Ghost state', inject(function(getstatetextFilter) {
|
||||
var state = {
|
||||
Ghost: true,
|
||||
Running: true,
|
||||
Paused: false
|
||||
};
|
||||
expect(getstatetextFilter(state)).toBe('Ghost');
|
||||
}));
|
||||
|
||||
it('should detect a Paused state', inject(function(getstatetextFilter) {
|
||||
var state = {
|
||||
Ghost: false,
|
||||
Running: true,
|
||||
Paused: true
|
||||
};
|
||||
expect(getstatetextFilter(state)).toBe('Running (Paused)');
|
||||
}));
|
||||
|
||||
it('should detect a Running state', inject(function(getstatetextFilter) {
|
||||
var state = {
|
||||
Ghost: false,
|
||||
Running: true,
|
||||
Paused: false
|
||||
};
|
||||
expect(getstatetextFilter(state)).toBe('Running');
|
||||
}));
|
||||
|
||||
it('should detect a Stopped state', inject(function(getstatetextFilter) {
|
||||
var state = {
|
||||
Ghost: false,
|
||||
Running: false,
|
||||
Paused: false
|
||||
};
|
||||
expect(getstatetextFilter(state)).toBe('Stopped');
|
||||
}));
|
||||
});
|
||||
|
||||
describe('getstatelabel', function () {
|
||||
it('should return an empty string when state is undefined', inject(function(getstatelabelFilter) {
|
||||
expect(getstatelabelFilter(undefined)).toBe('');
|
||||
}));
|
||||
|
||||
it('should return label-important when a ghost state is detected', inject(function(getstatelabelFilter) {
|
||||
var state = {
|
||||
Ghost: true,
|
||||
Running: true,
|
||||
Paused: false
|
||||
};
|
||||
expect(getstatelabelFilter(state)).toBe('label-important');
|
||||
}));
|
||||
|
||||
it('should return label-success when a running state is detected', inject(function(getstatelabelFilter) {
|
||||
var state = {
|
||||
Ghost: false,
|
||||
Running: true,
|
||||
Paused: false
|
||||
};
|
||||
expect(getstatelabelFilter(state)).toBe('label-success');
|
||||
}));
|
||||
});
|
||||
|
||||
describe('humansize', function () {
|
||||
it('should return n/a when size is zero', inject(function(humansizeFilter) {
|
||||
expect(humansizeFilter(0)).toBe('n/a');
|
||||
}));
|
||||
|
||||
it('should handle Bytes values', inject(function(humansizeFilter) {
|
||||
expect(humansizeFilter(512)).toBe('512 Bytes');
|
||||
}));
|
||||
|
||||
it('should handle KB values', inject(function(humansizeFilter) {
|
||||
expect(humansizeFilter(5120)).toBe('5 KB');
|
||||
}));
|
||||
|
||||
it('should handle MB values', inject(function(humansizeFilter) {
|
||||
expect(humansizeFilter(5 * Math.pow(10, 6))).toBe('5 MB');
|
||||
}));
|
||||
|
||||
it('should handle GB values', inject(function(humansizeFilter) {
|
||||
expect(humansizeFilter(5 * Math.pow(10, 9))).toBe('5 GB');
|
||||
}));
|
||||
|
||||
it('should handle TB values', inject(function(humansizeFilter) {
|
||||
expect(humansizeFilter(5 * Math.pow(10, 12))).toBe('5 TB');
|
||||
}));
|
||||
});
|
||||
|
||||
describe('containername', function () {
|
||||
it('should strip the leading slash from container name', inject(function(containernameFilter) {
|
||||
var container = {
|
||||
Names: ['/elegant_ardinghelli']
|
||||
};
|
||||
|
||||
expect(containernameFilter(container)).toBe('elegant_ardinghelli');
|
||||
}));
|
||||
});
|
||||
|
||||
describe('repotag', function () {
|
||||
it('should not display empty repo tag', inject(function(repotagFilter) {
|
||||
var image = {
|
||||
RepoTags: ['<none>:<none>']
|
||||
};
|
||||
expect(repotagFilter(image)).toBe('');
|
||||
}));
|
||||
|
||||
it('should display a normal repo tag', inject(function(repotagFilter) {
|
||||
var image = {
|
||||
RepoTags: ['ubuntu:latest']
|
||||
};
|
||||
expect(repotagFilter(image)).toBe('ubuntu:latest');
|
||||
}));
|
||||
});
|
||||
|
||||
describe('getdate', function () {
|
||||
it('should convert the Docker date to a human readable form', inject(function(getdateFilter) {
|
||||
expect(getdateFilter(1420424998)).toBe('Sun Jan 04 2015');
|
||||
}));
|
||||
});
|
||||
});
|
Loading…
Reference in new issue