refactor(global): change file format (dos2unix) (#620)

pull/632/head
WTFKr0 2017-02-25 12:21:55 +01:00 committed by Anthony Lapenna
parent ec0cc84c7c
commit cff999d7bb
2 changed files with 739 additions and 739 deletions

1016
app/app.js

File diff suppressed because it is too large Load Diff

View File

@ -1,231 +1,231 @@
angular.module('portainer.filters', []) angular.module('portainer.filters', [])
.filter('truncate', function () { .filter('truncate', function () {
'use strict'; '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;
} }
else { else {
return String(text).substring(0, length - end.length) + end; return String(text).substring(0, length - end.length) + end;
} }
}; };
}) })
.filter('taskstatusbadge', function () { .filter('taskstatusbadge', function () {
'use strict'; 'use strict';
return function (text) { return function (text) {
var status = _.toLower(text); var status = _.toLower(text);
if (status.indexOf('new') !== -1 || status.indexOf('allocated') !== -1 || if (status.indexOf('new') !== -1 || status.indexOf('allocated') !== -1 ||
status.indexOf('assigned') !== -1 || status.indexOf('accepted') !== -1) { status.indexOf('assigned') !== -1 || status.indexOf('accepted') !== -1) {
return 'info'; return 'info';
} else if (status.indexOf('pending') !== -1) { } else if (status.indexOf('pending') !== -1) {
return 'warning'; return 'warning';
} else if (status.indexOf('shutdown') !== -1 || status.indexOf('failed') !== -1 || } else if (status.indexOf('shutdown') !== -1 || status.indexOf('failed') !== -1 ||
status.indexOf('rejected') !== -1) { status.indexOf('rejected') !== -1) {
return 'danger'; return 'danger';
} else if (status.indexOf('complete') !== -1) { } else if (status.indexOf('complete') !== -1) {
return 'primary'; return 'primary';
} }
return 'success'; return 'success';
}; };
}) })
.filter('containerstatusbadge', function () { .filter('containerstatusbadge', function () {
'use strict'; 'use strict';
return function (text) { return function (text) {
var status = _.toLower(text); var status = _.toLower(text);
if (status.indexOf('paused') !== -1) { if (status.indexOf('paused') !== -1) {
return 'warning'; return 'warning';
} else if (status.indexOf('created') !== -1) { } else if (status.indexOf('created') !== -1) {
return 'info'; return 'info';
} else if (status.indexOf('stopped') !== -1) { } else if (status.indexOf('stopped') !== -1) {
return 'danger'; return 'danger';
} }
return 'success'; return 'success';
}; };
}) })
.filter('containerstatus', function () { .filter('containerstatus', function () {
'use strict'; 'use strict';
return function (text) { return function (text) {
var status = _.toLower(text); var status = _.toLower(text);
if (status.indexOf('paused') !== -1) { if (status.indexOf('paused') !== -1) {
return 'paused'; return 'paused';
} else if (status.indexOf('created') !== -1) { } else if (status.indexOf('created') !== -1) {
return 'created'; return 'created';
} else if (status.indexOf('exited') !== -1) { } else if (status.indexOf('exited') !== -1) {
return 'stopped'; return 'stopped';
} }
return 'running'; return 'running';
}; };
}) })
.filter('nodestatusbadge', function () { .filter('nodestatusbadge', function () {
'use strict'; 'use strict';
return function (text) { return function (text) {
if (text === 'down' || text === 'Unhealthy') { if (text === 'down' || text === 'Unhealthy') {
return 'danger'; return 'danger';
} }
return 'success'; return 'success';
}; };
}) })
.filter('trimcontainername', function () { .filter('trimcontainername', function () {
'use strict'; 'use strict';
return function (name) { return function (name) {
if (name) { if (name) {
return (name.indexOf('/') === 0 ? name.replace('/','') : name); return (name.indexOf('/') === 0 ? name.replace('/','') : name);
} }
return ''; return '';
}; };
}) })
.filter('capitalize', function () { .filter('capitalize', function () {
'use strict'; 'use strict';
return function (text) { return function (text) {
return _.capitalize(text); return _.capitalize(text);
}; };
}) })
.filter('getstatetext', function () { .filter('getstatetext', function () {
'use strict'; 'use strict';
return function (state) { return function (state) {
if (state === undefined) { if (state === undefined) {
return ''; return '';
} }
if (state.Ghost && state.Running) { if (state.Ghost && state.Running) {
return 'Ghost'; return 'Ghost';
} }
if (state.Running && state.Paused) { if (state.Running && state.Paused) {
return 'Running (Paused)'; return 'Running (Paused)';
} }
if (state.Running) { if (state.Running) {
return 'Running'; return 'Running';
} }
return 'Stopped'; return 'Stopped';
}; };
}) })
.filter('stripprotocol', function() { .filter('stripprotocol', function() {
'use strict'; 'use strict';
return function (url) { return function (url) {
return url.replace(/.*?:\/\//g, ''); return url.replace(/.*?:\/\//g, '');
}; };
}) })
.filter('getstatelabel', function () { .filter('getstatelabel', function () {
'use strict'; 'use strict';
return function (state) { return function (state) {
if (state === undefined) { if (state === undefined) {
return 'label-default'; return 'label-default';
} }
if (state.Ghost && state.Running) { if (state.Ghost && state.Running) {
return 'label-important'; return 'label-important';
} }
if (state.Running) { if (state.Running) {
return 'label-success'; return 'label-success';
} }
return 'label-default'; return 'label-default';
}; };
}) })
.filter('humansize', function () { .filter('humansize', function () {
'use strict'; 'use strict';
return function (bytes, round) { return function (bytes, round) {
if (!round) { if (!round) {
round = 1; round = 1;
} }
if (bytes || bytes === 0) { if (bytes || bytes === 0) {
return filesize(bytes, {base: 10, round: round}); return filesize(bytes, {base: 10, round: round});
} }
}; };
}) })
.filter('containername', function () { .filter('containername', function () {
'use strict'; '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('swarmcontainername', function () { .filter('swarmcontainername', function () {
'use strict'; 'use strict';
return function (container) { return function (container) {
return _.split(container.Names[0], '/')[2]; return _.split(container.Names[0], '/')[2];
}; };
}) })
.filter('swarmversion', function () { .filter('swarmversion', function () {
'use strict'; 'use strict';
return function (text) { return function (text) {
return _.split(text, '/')[1]; return _.split(text, '/')[1];
}; };
}) })
.filter('swarmhostname', function () { .filter('swarmhostname', function () {
'use strict'; 'use strict';
return function (container) { return function (container) {
return _.split(container.Names[0], '/')[1]; return _.split(container.Names[0], '/')[1];
}; };
}) })
.filter('repotags', function () { .filter('repotags', function () {
'use strict'; '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>') { if (tag === '<none>:<none>') {
return []; return [];
} }
return image.RepoTags; return image.RepoTags;
} }
return []; return [];
}; };
}) })
.filter('getisodatefromtimestamp', function () { .filter('getisodatefromtimestamp', function () {
'use strict'; 'use strict';
return function (timestamp) { return function (timestamp) {
return moment.unix(timestamp).format('YYYY-MM-DD HH:mm:ss'); return moment.unix(timestamp).format('YYYY-MM-DD HH:mm:ss');
}; };
}) })
.filter('getisodate', function () { .filter('getisodate', function () {
'use strict'; 'use strict';
return function (date) { return function (date) {
return moment(date).format('YYYY-MM-DD HH:mm:ss'); return moment(date).format('YYYY-MM-DD HH:mm:ss');
}; };
}) })
.filter('command', function () { .filter('command', function () {
'use strict'; 'use strict';
return function (command) { return function (command) {
if (command) { if (command) {
return command.join(' '); return command.join(' ');
} }
}; };
}) })
.filter('key', function () { .filter('key', function () {
'use strict'; 'use strict';
return function (pair, separator) { return function (pair, separator) {
return pair.slice(0, pair.indexOf(separator)); return pair.slice(0, pair.indexOf(separator));
}; };
}) })
.filter('value', function () { .filter('value', function () {
'use strict'; 'use strict';
return function (pair, separator) { return function (pair, separator) {
return pair.slice(pair.indexOf(separator) + 1); return pair.slice(pair.indexOf(separator) + 1);
}; };
}) })
.filter('emptyobject', function () { .filter('emptyobject', function () {
'use strict'; 'use strict';
return function (obj) { return function (obj) {
return _.isEmpty(obj); return _.isEmpty(obj);
}; };
}) })
.filter('ipaddress', function () { .filter('ipaddress', function () {
'use strict'; 'use strict';
return function (ip) { return function (ip) {
return ip.slice(0, ip.indexOf('/')); return ip.slice(0, ip.indexOf('/'));
}; };
}) })
.filter('arraytostr', function () { .filter('arraytostr', function () {
'use strict'; 'use strict';
return function (arr, separator) { return function (arr, separator) {
if (arr) { if (arr) {
return _.join(arr, separator); return _.join(arr, separator);
} }
return ''; return '';
}; };
}); });