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 | 34 | (click)="openEditMode()" |
35 | 35 | matTooltip="{{ 'timewindow.edit' | translate }}" |
36 | 36 | [matTooltipPosition]="tooltipPosition"> |
37 | - {{innerValue?.displayValue}} | |
37 | + {{innerValue?.displayValue}} <span [fxShow]="innerValue?.displayTimezoneAbbr !== ''">| <span class="timezone-abbr">{{innerValue.displayTimezoneAbbr}}</span></span> | |
38 | 38 | </span> |
39 | 39 | <button *ngIf="direction === 'right'" [disabled]="timewindowDisabled" mat-icon-button class="tb-mat-32" |
40 | 40 | type="button" | ... | ... |
... | ... | @@ -31,6 +31,7 @@ import { TranslateService } from '@ngx-translate/core'; |
31 | 31 | import { MillisecondsToTimeStringPipe } from '@shared/pipe/milliseconds-to-time-string.pipe'; |
32 | 32 | import { |
33 | 33 | cloneSelectedTimewindow, |
34 | + getTimezoneInfo, | |
34 | 35 | HistoryWindowType, |
35 | 36 | initModelFromDefaultTimewindow, |
36 | 37 | QuickTimeIntervalTranslationMap, |
... | ... | @@ -51,7 +52,7 @@ import { BreakpointObserver } from '@angular/cdk/layout'; |
51 | 52 | import { WINDOW } from '@core/services/window.service'; |
52 | 53 | import { TimeService } from '@core/services/time.service'; |
53 | 54 | import { TooltipPosition } from '@angular/material/tooltip'; |
54 | -import { deepClone } from '@core/utils'; | |
55 | +import { deepClone, isDefinedAndNotNull } from '@core/utils'; | |
55 | 56 | import { coerceBooleanProperty } from '@angular/cdk/coercion'; |
56 | 57 | |
57 | 58 | // @dynamic |
... | ... | @@ -306,6 +307,12 @@ export class TimewindowComponent implements OnInit, OnDestroy, ControlValueAcces |
306 | 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 | 318 | hideLabel() { | ... | ... |
... | ... | @@ -92,6 +92,7 @@ export interface Aggregation { |
92 | 92 | |
93 | 93 | export interface Timewindow { |
94 | 94 | displayValue?: string; |
95 | + displayTimezoneAbbr?: string; | |
95 | 96 | hideInterval?: boolean; |
96 | 97 | hideAggregation?: boolean; |
97 | 98 | hideAggInterval?: boolean; |
... | ... | @@ -731,6 +732,7 @@ export interface TimezoneInfo { |
731 | 732 | name: string; |
732 | 733 | offset: string; |
733 | 734 | nOffset: number; |
735 | + abbr: string; | |
734 | 736 | } |
735 | 737 | |
736 | 738 | let timezones: TimezoneInfo[] = null; |
... | ... | @@ -744,7 +746,8 @@ export function getTimezones(): TimezoneInfo[] { |
744 | 746 | id: zoneName, |
745 | 747 | name: zoneName.replace(/_/g, ' '), |
746 | 748 | offset: `UTC${tz.format('Z')}`, |
747 | - nOffset: tz.utcOffset() | |
749 | + nOffset: tz.utcOffset(), | |
750 | + abbr: tz.zoneAbbr() | |
748 | 751 | }; |
749 | 752 | }); |
750 | 753 | } | ... | ... |