diff --git a/app/components/volumes/volumes.html b/app/components/volumes/volumes.html index d0eb0f744..d467c2c9b 100644 --- a/app/components/volumes/volumes.html +++ b/app/components/volumes/volumes.html @@ -85,7 +85,7 @@ {{ volume.Id|truncate:25 }} {{ volume.Driver }} - {{ volume.Mountpoint | truncate:52 }} + {{ volume.Mountpoint | truncatelr }} diff --git a/app/filters/filters.js b/app/filters/filters.js index b1201dcf7..b5573bcd5 100644 --- a/app/filters/filters.js +++ b/app/filters/filters.js @@ -12,12 +12,25 @@ angular.module('portainer.filters', []) if (text.length <= length || text.length - end.length <= length) { return text; - } - else { + } else { return String(text).substring(0, length - end.length) + end; } }; }) +.filter('truncatelr', function () { + 'use strict'; + return function (text, max, left, right) { + max = isNaN(max) ? 50 : max; + left = isNaN(left) ? 25 : left; + right = isNaN(right) ? 25 : right; + + if (text.length <= max) { + return text; + } else { + return text.substring(0, left) + '[...]' + text.substring(text.length - right, text.length); + } + }; +}) .filter('taskstatusbadge', function () { 'use strict'; return function (text) {