Commit 4b0cf383802c1432ff661b35548e33c451341120
Committed by
GitHub
Merge pull request #4259 from vvlladd28/feature/abbr/timezone
UI: Added show timezone Abbr in timewindow component
Showing
4 changed files
with
17 additions
and
3 deletions
@@ -34,7 +34,7 @@ | @@ -34,7 +34,7 @@ | ||
34 | (click)="openEditMode()" | 34 | (click)="openEditMode()" |
35 | matTooltip="{{ 'timewindow.edit' | translate }}" | 35 | matTooltip="{{ 'timewindow.edit' | translate }}" |
36 | [matTooltipPosition]="tooltipPosition"> | 36 | [matTooltipPosition]="tooltipPosition"> |
37 | - {{innerValue?.displayValue}} | 37 | + {{innerValue?.displayValue}} <span [fxShow]="innerValue?.displayTimezoneAbbr !== ''">| <span class="timezone-abbr">{{innerValue.displayTimezoneAbbr}}</span></span> |
38 | </span> | 38 | </span> |
39 | <button *ngIf="direction === 'right'" [disabled]="timewindowDisabled" mat-icon-button class="tb-mat-32" | 39 | <button *ngIf="direction === 'right'" [disabled]="timewindowDisabled" mat-icon-button class="tb-mat-32" |
40 | type="button" | 40 | type="button" |
@@ -31,6 +31,7 @@ import { TranslateService } from '@ngx-translate/core'; | @@ -31,6 +31,7 @@ import { TranslateService } from '@ngx-translate/core'; | ||
31 | import { MillisecondsToTimeStringPipe } from '@shared/pipe/milliseconds-to-time-string.pipe'; | 31 | import { MillisecondsToTimeStringPipe } from '@shared/pipe/milliseconds-to-time-string.pipe'; |
32 | import { | 32 | import { |
33 | cloneSelectedTimewindow, | 33 | cloneSelectedTimewindow, |
34 | + getTimezoneInfo, | ||
34 | HistoryWindowType, | 35 | HistoryWindowType, |
35 | initModelFromDefaultTimewindow, | 36 | initModelFromDefaultTimewindow, |
36 | QuickTimeIntervalTranslationMap, | 37 | QuickTimeIntervalTranslationMap, |
@@ -51,7 +52,7 @@ import { BreakpointObserver } from '@angular/cdk/layout'; | @@ -51,7 +52,7 @@ import { BreakpointObserver } from '@angular/cdk/layout'; | ||
51 | import { WINDOW } from '@core/services/window.service'; | 52 | import { WINDOW } from '@core/services/window.service'; |
52 | import { TimeService } from '@core/services/time.service'; | 53 | import { TimeService } from '@core/services/time.service'; |
53 | import { TooltipPosition } from '@angular/material/tooltip'; | 54 | import { TooltipPosition } from '@angular/material/tooltip'; |
54 | -import { deepClone } from '@core/utils'; | 55 | +import { deepClone, isDefinedAndNotNull } from '@core/utils'; |
55 | import { coerceBooleanProperty } from '@angular/cdk/coercion'; | 56 | import { coerceBooleanProperty } from '@angular/cdk/coercion'; |
56 | 57 | ||
57 | // @dynamic | 58 | // @dynamic |
@@ -306,6 +307,12 @@ export class TimewindowComponent implements OnInit, OnDestroy, ControlValueAcces | @@ -306,6 +307,12 @@ export class TimewindowComponent implements OnInit, OnDestroy, ControlValueAcces | ||
306 | this.innerValue.displayValue += this.translate.instant('timewindow.period', {startTime: startString, endTime: endString}); | 307 | this.innerValue.displayValue += this.translate.instant('timewindow.period', {startTime: startString, endTime: endString}); |
307 | } | 308 | } |
308 | } | 309 | } |
310 | + if (isDefinedAndNotNull(this.innerValue.timezone) && this.innerValue.timezone !== '') { | ||
311 | + this.innerValue.displayValue += ' '; | ||
312 | + this.innerValue.displayTimezoneAbbr = getTimezoneInfo(this.innerValue.timezone).abbr; | ||
313 | + } else { | ||
314 | + this.innerValue.displayTimezoneAbbr = ''; | ||
315 | + } | ||
309 | } | 316 | } |
310 | 317 | ||
311 | hideLabel() { | 318 | hideLabel() { |
@@ -92,6 +92,7 @@ export interface Aggregation { | @@ -92,6 +92,7 @@ export interface Aggregation { | ||
92 | 92 | ||
93 | export interface Timewindow { | 93 | export interface Timewindow { |
94 | displayValue?: string; | 94 | displayValue?: string; |
95 | + displayTimezoneAbbr?: string; | ||
95 | hideInterval?: boolean; | 96 | hideInterval?: boolean; |
96 | hideAggregation?: boolean; | 97 | hideAggregation?: boolean; |
97 | hideAggInterval?: boolean; | 98 | hideAggInterval?: boolean; |
@@ -731,6 +732,7 @@ export interface TimezoneInfo { | @@ -731,6 +732,7 @@ export interface TimezoneInfo { | ||
731 | name: string; | 732 | name: string; |
732 | offset: string; | 733 | offset: string; |
733 | nOffset: number; | 734 | nOffset: number; |
735 | + abbr: string; | ||
734 | } | 736 | } |
735 | 737 | ||
736 | let timezones: TimezoneInfo[] = null; | 738 | let timezones: TimezoneInfo[] = null; |
@@ -744,7 +746,8 @@ export function getTimezones(): TimezoneInfo[] { | @@ -744,7 +746,8 @@ export function getTimezones(): TimezoneInfo[] { | ||
744 | id: zoneName, | 746 | id: zoneName, |
745 | name: zoneName.replace(/_/g, ' '), | 747 | name: zoneName.replace(/_/g, ' '), |
746 | offset: `UTC${tz.format('Z')}`, | 748 | offset: `UTC${tz.format('Z')}`, |
747 | - nOffset: tz.utcOffset() | 749 | + nOffset: tz.utcOffset(), |
750 | + abbr: tz.zoneAbbr() | ||
748 | }; | 751 | }; |
749 | }); | 752 | }); |
750 | } | 753 | } |