@@ -78,6 +80,7 @@
An error occurred: {{error}}
[yAxis]="true"
xAxisLabel="Time"
yAxisLabel="Latency (ms)"
+ [xAxisTickFormatting]="xAxisFormatFn"
[yScaleMin]="0"
[roundDomains]="true"
[results]="latencyGraphData">
@@ -108,6 +111,7 @@ An error occurred: {{error}}
[yAxis]="true"
xAxisLabel="Time"
yAxisLabel="Request Count"
+ [xAxisTickFormatting]="xAxisFormatFn"
[yScaleMin]="0"
[roundDomains]="true"
[results]="rateGraphData">
@@ -151,6 +155,7 @@ An error occurred: {{error}}
[yAxis]="true"
xAxisLabel="Time"
yAxisLabel="Input (kb/s)"
+ [xAxisTickFormatting]="xAxisFormatFn"
[yScaleMin]="0"
[roundDomains]="true"
[results]="inputGraphData">
@@ -181,6 +186,7 @@ An error occurred: {{error}}
[yAxis]="true"
xAxisLabel="Time"
yAxisLabel="Output (kb/s)"
+ [xAxisTickFormatting]="xAxisFormatFn"
[yScaleMin]="0"
[roundDomains]="true"
[results]="outputGraphData">
diff --git a/console/ui/src/app/status/status.component.ts b/console/ui/src/app/status/status.component.ts
index bffd3e7d01..000df3e5ac 100644
--- a/console/ui/src/app/status/status.component.ts
+++ b/console/ui/src/app/status/status.component.ts
@@ -32,6 +32,7 @@ export class StatusComponent implements OnInit, OnDestroy {
public latencyGraphData = [];
public inputGraphData = [];
public outputGraphData = [];
+ public utcForm: UntypedFormGroup;
public rangeForm: UntypedFormGroup;
public readonly ranges = {
1: 'last 1 minute',
@@ -42,7 +43,7 @@ export class StatusComponent implements OnInit, OnDestroy {
};
public rangesKeys = Object.keys(this.ranges).map(n => +n);
public readonly colorScheme = {
- domain: ['#5AA454', '#E44D25', '#1e59cf', '#7aa3e5', '#a8385d', '#d0bd00']
+ domain: ['#5AA454', '#E44D25', '#1e59cf', '#7aa3e5', '#a8385d', '#d0bd00'],
};
private readonly samples = 60; // Number of samples in the series
private refreshTimer: Observable;
@@ -55,6 +56,9 @@ export class StatusComponent implements OnInit, OnDestroy {
) {}
ngOnInit(): void {
+ this.utcForm = this.formBuilder.group({
+ isUTC: false, // Default show in local timezone
+ });
this.rangeForm = this.formBuilder.group({
rangeMinutes: [10], // Default range to 10 min window
});
@@ -162,9 +166,19 @@ export class StatusComponent implements OnInit, OnDestroy {
public setRange(event): void {
this.rangeForm.reset({rangeMinutes: +event.target.value});
+ }
+
+ public setIsUTC(event): void {
+ this.utcForm.reset({isUTC: event.target.checked});
this.reset();
}
+ private formatDateLocal = new Intl.DateTimeFormat(navigator.languages.slice(), { hour: "2-digit", minute: "2-digit" });
+ private formatDateUTC = new Intl.DateTimeFormat(navigator.languages.slice(), { hour: "2-digit", minute: "2-digit", timeZone: "UTC" });
+
+ // Declared as fat arrow to avoid having to bind it in xAxisTickFormatting (see https://github.com/swimlane/ngx-charts/issues/261)
+ xAxisFormatFn = (value) => this.utcForm?.value.isUTC ? this.formatDateUTC.format(value) : this.formatDateLocal.format(value);
+
private reset(): void {
this.consoleService.getStatus('').subscribe(data => {
this.initData(data.nodes.map(n => n.name));