mirror of https://github.com/portainer/portainer
feat(volumes): new truncate method for volume paths (#1028)
parent
3f085a977c
commit
c04b9e5340
|
@ -85,7 +85,7 @@
|
||||||
<td><input type="checkbox" ng-model="volume.Checked" ng-change="selectItem(volume)"/></td>
|
<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><a ui-sref="volume({id: volume.Id})" class="monospaced">{{ volume.Id|truncate:25 }}</a></td>
|
||||||
<td>{{ volume.Driver }}</td>
|
<td>{{ volume.Driver }}</td>
|
||||||
<td>{{ volume.Mountpoint | truncate:52 }}</td>
|
<td>{{ volume.Mountpoint | truncatelr }}</td>
|
||||||
<td ng-if="applicationState.application.authentication">
|
<td ng-if="applicationState.application.authentication">
|
||||||
<span>
|
<span>
|
||||||
<i ng-class="volume.ResourceControl.Ownership | ownershipicon" aria-hidden="true"></i>
|
<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) {
|
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('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 () {
|
.filter('taskstatusbadge', function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
return function (text) {
|
return function (text) {
|
||||||
|
|
Loading…
Reference in New Issue