Skip to content

Commit

Permalink
Improve long fs name in WebUI
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolargo committed Dec 21, 2023
1 parent 56a7622 commit 380888a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion glances/outputs/static/js/components/plugin-fs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</div>
<div class="table-row" v-for="(fs, fsId) in fileSystems" :key="fsId">
<div class="table-cell text-left">
{{ $filters.minSize(fs.alias ? fs.alias : fs.mountPoint, 36) }}
{{ $filters.minSize(fs.alias ? fs.alias : fs.mountPoint, 36, begin=false) }}
<span v-if="(fs.alias ? fs.alias : fs.mountPoint).length + fs.name.length <= 34" class="visible-lg-inline">
({{ fs.name }})
</span>
Expand Down
8 changes: 6 additions & 2 deletions glances/outputs/static/js/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,14 @@ export function limitTo(value, limit) {
return value.slice(0, limit);
}

export function minSize(input, max) {
export function minSize(input, max, begin = true) {
max = max || 8;
if (input.length > max) {
return '_' + input.substring(input.length - max + 1);
if (begin) {
return input.substring(0, max - 1) + '_';
} else {
return '_' + input.substring(input.length - max + 1);
}
}
return input;
}
Expand Down
2 changes: 1 addition & 1 deletion glances/outputs/static/public/glances.js

Large diffs are not rendered by default.

0 comments on commit 380888a

Please sign in to comment.