feat(volumes): new truncate method for volume paths (#1028)

pull/1031/head
Anthony Lapenna 7 years ago committed by GitHub
parent 3f085a977c
commit c04b9e5340

@ -85,7 +85,7 @@
<td><input type="checkbox" ng-model="volume.Checked" ng-change="selectItem(volume)"/></td>
<td><a ui-sref="volume({id: volume.Id})" class="monospaced">{{ volume.Id|truncate:25 }}</a></td>
<td>{{ volume.Driver }}</td>
<td>{{ volume.Mountpoint | truncate:52 }}</td>
<td>{{ volume.Mountpoint | truncatelr }}</td>
<td ng-if="applicationState.application.authentication">
<span>
<i ng-class="volume.ResourceControl.Ownership | ownershipicon" aria-hidden="true"></i>

@ -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) {

Loading…
Cancel
Save