Skip to content

Commit

Permalink
Refactor display of +time in WebUI
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolargo committed Nov 21, 2024
1 parent 55d42d3 commit 2061d1b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 29 deletions.
6 changes: 6 additions & 0 deletions glances/outputs/static/css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ body {
text-align: right;
}
* > td:nth-child(6) {
text-overflow: ellipsis;
white-space: nowrap;
width: 7em;
}
* > td:nth-child(7) {
Expand All @@ -295,6 +297,10 @@ body {
* > td:nth-child(9),td:nth-child(10) {
width: 2em;
}
* > td:nth-child(13),* > td:nth-child(14) {
text-overflow: ellipsis;
white-space: nowrap;
}
.table {
margin-bottom: 1em;
}
Expand Down
38 changes: 12 additions & 26 deletions glances/outputs/static/js/components/plugin-processlist.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,8 @@
<td scope="row" v-show="!getDisableStats().includes('username')">
{{ process.username }}
</td>
<td scope="row" class="hidden-xs hidden-sm" v-if="process.timeplus != '?'"
v-show="!getDisableStats().includes('cpu_times')">
<span v-show="process.timeplus.hours > 0" class="highlight">{{ process.timeplus.hours }}h</span>
{{ $filters.leftPad(process.timeplus.minutes, 2, '0') }}:{{
$filters.leftPad(process.timeplus.seconds,
2, '0') }}
<span v-show="process.timeplus.hours <= 0">.{{ $filters.leftPad(process.timeplus.milliseconds,
2, '0')
}}</span>
<td scope="row" class="hidden-xs hidden-sm" v-show="!getDisableStats().includes('cpu_times')">
{{ process.timeforhuman }}
</td>
<td scope="row" class="hidden-xs hidden-sm" v-if="process.timeplus == '?'"
v-show="!getDisableStats().includes('cpu_times')">?</td>
Expand Down Expand Up @@ -202,18 +195,9 @@
<td scope="row" v-show="!getDisableStats().includes('username')">
{{ process.username }}
</td>
<td scope="row" class="hidden-xs hidden-sm" v-if="process.timeplus != '?'"
v-show="!getDisableStats().includes('cpu_times')">
<span v-show="process.timeplus.hours > 0" class="highlight">{{ process.timeplus.hours }}h</span>
{{ $filters.leftPad(process.timeplus.minutes, 2, '0') }}:{{
$filters.leftPad(process.timeplus.seconds,
2, '0') }}
<span v-show="process.timeplus.hours <= 0">.{{ $filters.leftPad(process.timeplus.milliseconds,
2, '0')
}}</span>
<td scope="row" class="hidden-xs hidden-sm" v-show="!getDisableStats().includes('cpu_times')">
{{ process.timeforhuman }}
</td>
<td scope="row" class="hidden-xs hidden-sm" v-if="process.timeplus == '?'"
v-show="!getDisableStats().includes('cpu_times')">?</td>
<td scope="row" class="hidden-xs hidden-sm" v-show="!getDisableStats().includes('num_threads')">
{{ process.num_threads == -1 ? '?' : process.num_threads }}
</td>
Expand Down Expand Up @@ -290,11 +274,12 @@ export default {
process.username = last(process.username.split('\\'));
}
process.timeplus = '?';
process.timemillis = '?';
process.timeforhuman = '?';
if (process.cpu_times) {
process.timeplus = timedelta([process.cpu_times['user'], process.cpu_times['system']]);
process.timemillis = timemillis([process.cpu_times['user'], process.cpu_times['system']]);
process.timeforhuman = process.timeplus.hours.toString().padStart(2, '0') + ':' +
process.timeplus.minutes.toString().padStart(2, '0') + ':' +
process.timeplus.seconds.toString().padStart(2, '0')
}
if (process.num_threads === null) {
Expand Down Expand Up @@ -368,11 +353,12 @@ export default {
process.username = last(process.username.split('\\'));
}
process.timeplus = '?';
process.timemillis = '?';
process.timeforhuman = '?';
if (process.cpu_times) {
process.timeplus = timedelta([process.cpu_times['user'], process.cpu_times['system']]);
process.timemillis = timemillis([process.cpu_times['user'], process.cpu_times['system']]);
process.timeforhuman = process.timeplus.hours.toString().padStart(2, '0') + ':' +
process.timeplus.minutes.toString().padStart(2, '0') + ':' +
process.timeplus.seconds.toString().padStart(2, '0')
}
if (process.num_threads === null) {
Expand Down
2 changes: 1 addition & 1 deletion glances/outputs/static/public/browser.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions glances/outputs/static/public/glances.js

Large diffs are not rendered by default.

0 comments on commit 2061d1b

Please sign in to comment.