mirror of
https://github.com/portainer/portainer.git
synced 2025-07-25 08:19:40 +02:00
Initial commit
This commit is contained in:
commit
bec8f53386
218 changed files with 55344 additions and 0 deletions
38
js/filters.ts
Normal file
38
js/filters.ts
Normal file
|
@ -0,0 +1,38 @@
|
|||
'use strict';
|
||||
|
||||
declare var angular: any;
|
||||
|
||||
angular.module('dockerui.filters', [])
|
||||
.filter('truncate', () => {
|
||||
return (text: string, length:any, end:string) => {
|
||||
if (isNaN(length))
|
||||
length = 10;
|
||||
|
||||
if (end === undefined)
|
||||
end = "...";
|
||||
|
||||
if (text.length <= length || text.length - end.length <= length) {
|
||||
return text;
|
||||
}
|
||||
else {
|
||||
return String(text).substring(0, length-end.length) + end;
|
||||
}
|
||||
};
|
||||
})
|
||||
.filter('statusbadge', () => {
|
||||
return (text: string) => {
|
||||
if (text === 'Ghost') {
|
||||
return 'important';
|
||||
}
|
||||
return 'success';
|
||||
};
|
||||
})
|
||||
.filter('isactive', ($location: any) => {
|
||||
return (text: string) => {
|
||||
if (text == $location) {
|
||||
return 'active';
|
||||
}
|
||||
return '';
|
||||
};
|
||||
});
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue