Commit 28d48933f21dda167268d866ac09cf9e58f46e1f

Authored by Igor Kulikov
1 parent 392edbae

UI: Minor fixes

@@ -123,7 +123,7 @@ export class AliasController implements IAliasController { @@ -123,7 +123,7 @@ export class AliasController implements IAliasController {
123 } 123 }
124 124
125 getAliasInfo(aliasId: string): Observable<AliasInfo> { 125 getAliasInfo(aliasId: string): Observable<AliasInfo> {
126 - const aliasInfo = this.resolvedAliases[aliasId]; 126 + let aliasInfo = this.resolvedAliases[aliasId];
127 if (aliasInfo) { 127 if (aliasInfo) {
128 return of(aliasInfo); 128 return of(aliasInfo);
129 } else if (this.resolvedAliasesObservable[aliasId]) { 129 } else if (this.resolvedAliasesObservable[aliasId]) {
@@ -159,7 +159,12 @@ export class AliasController implements IAliasController { @@ -159,7 +159,12 @@ export class AliasController implements IAliasController {
159 delete this.resolvedAliasesObservable[aliasId]; 159 delete this.resolvedAliasesObservable[aliasId];
160 return res; 160 return res;
161 } 161 }
162 - return this.resolvedAliasesObservable[aliasId]; 162 + aliasInfo = this.resolvedAliases[aliasId];
  163 + if (aliasInfo) {
  164 + return of(aliasInfo);
  165 + } else {
  166 + return this.resolvedAliasesObservable[aliasId];
  167 + }
163 } 168 }
164 } 169 }
165 170
@@ -19,7 +19,7 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; @@ -19,7 +19,7 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
19 import { Store } from '@ngrx/store'; 19 import { Store } from '@ngrx/store';
20 import { AppState } from '@core/core.state'; 20 import { AppState } from '@core/core.state';
21 import { FormBuilder, FormGroup } from '@angular/forms'; 21 import { FormBuilder, FormGroup } from '@angular/forms';
22 -import { Observable, Subject } from 'rxjs'; 22 +import { Observable, ReplaySubject } from 'rxjs';
23 import { Router } from '@angular/router'; 23 import { Router } from '@angular/router';
24 import { DialogComponent } from '@app/shared/components/dialog.component'; 24 import { DialogComponent } from '@app/shared/components/dialog.component';
25 import { 25 import {
@@ -30,7 +30,7 @@ import { @@ -30,7 +30,7 @@ import {
30 alarmStatusTranslations 30 alarmStatusTranslations
31 } from '@app/shared/models/alarm.models'; 31 } from '@app/shared/models/alarm.models';
32 import { AlarmService } from '@core/http/alarm.service'; 32 import { AlarmService } from '@core/http/alarm.service';
33 -import { share, tap } from 'rxjs/operators'; 33 +import { tap } from 'rxjs/operators';
34 import { DatePipe } from '@angular/common'; 34 import { DatePipe } from '@angular/common';
35 import { TranslateService } from '@ngx-translate/core'; 35 import { TranslateService } from '@ngx-translate/core';
36 36
@@ -54,10 +54,9 @@ export class AlarmDetailsDialogComponent extends DialogComponent<AlarmDetailsDia @@ -54,10 +54,9 @@ export class AlarmDetailsDialogComponent extends DialogComponent<AlarmDetailsDia
54 allowClear: boolean; 54 allowClear: boolean;
55 displayDetails: boolean; 55 displayDetails: boolean;
56 56
57 - loadAlarmSubject = new Subject<AlarmInfo>(); 57 + loadAlarmSubject = new ReplaySubject<AlarmInfo>();
58 alarm$: Observable<AlarmInfo> = this.loadAlarmSubject.asObservable().pipe( 58 alarm$: Observable<AlarmInfo> = this.loadAlarmSubject.asObservable().pipe(
59 - tap(alarm => this.loadAlarmFields(alarm)),  
60 - share() 59 + tap(alarm => this.loadAlarmFields(alarm))
61 ); 60 );
62 61
63 alarmSeverityColorsMap = alarmSeverityColors; 62 alarmSeverityColorsMap = alarmSeverityColors;
@@ -63,12 +63,16 @@ export class AliasesEntitySelectComponent implements OnInit, OnDestroy { @@ -63,12 +63,16 @@ export class AliasesEntitySelectComponent implements OnInit, OnDestroy {
63 ngOnInit(): void { 63 ngOnInit(): void {
64 this.rxSubscriptions.push(this.aliasController.entityAliasesChanged.subscribe( 64 this.rxSubscriptions.push(this.aliasController.entityAliasesChanged.subscribe(
65 () => { 65 () => {
66 - this.updateDisplayValue(); 66 + setTimeout(() => {
  67 + this.updateDisplayValue();
  68 + }, 0);
67 } 69 }
68 )); 70 ));
69 this.rxSubscriptions.push(this.aliasController.entityAliasResolved.subscribe( 71 this.rxSubscriptions.push(this.aliasController.entityAliasResolved.subscribe(
70 () => { 72 () => {
71 - this.updateDisplayValue(); 73 + setTimeout(() => {
  74 + this.updateDisplayValue();
  75 + }, 0);
72 } 76 }
73 )); 77 ));
74 } 78 }
@@ -389,7 +389,7 @@ export class DashboardWidget implements GridsterItem, IDashboardWidget { @@ -389,7 +389,7 @@ export class DashboardWidget implements GridsterItem, IDashboardWidget {
389 padding: this.padding, 389 padding: this.padding,
390 margin: this.margin}; 390 margin: this.margin};
391 if (this.widget.config.widgetStyle) { 391 if (this.widget.config.widgetStyle) {
392 - this.style = {...this.widget.config.widgetStyle, ...this.style}; 392 + this.style = {...this.style, ...this.widget.config.widgetStyle};
393 } 393 }
394 394
395 this.showWidgetTitlePanel = this.widgetContext.hideTitlePanel ? false : 395 this.showWidgetTitlePanel = this.widgetContext.hideTitlePanel ? false :
@@ -93,7 +93,6 @@ export class BreadcrumbComponent implements OnInit, OnDestroy { @@ -93,7 +93,6 @@ export class BreadcrumbComponent implements OnInit, OnDestroy {
93 const icon = breadcrumbConfig.icon || 'home'; 93 const icon = breadcrumbConfig.icon || 'home';
94 const isMdiIcon = icon.startsWith('mdi:'); 94 const isMdiIcon = icon.startsWith('mdi:');
95 const link = [ route.pathFromRoot.map(v => v.url.map(segment => segment.toString()).join('/')).join('/') ]; 95 const link = [ route.pathFromRoot.map(v => v.url.map(segment => segment.toString()).join('/')).join('/') ];
96 - const queryParams = route.queryParams;  
97 const breadcrumb = { 96 const breadcrumb = {
98 label, 97 label,
99 labelFunction, 98 labelFunction,
@@ -101,7 +100,7 @@ export class BreadcrumbComponent implements OnInit, OnDestroy { @@ -101,7 +100,7 @@ export class BreadcrumbComponent implements OnInit, OnDestroy {
101 icon, 100 icon,
102 isMdiIcon, 101 isMdiIcon,
103 link, 102 link,
104 - queryParams 103 + queryParams: null
105 }; 104 };
106 newBreadcrumbs = [...breadcrumbs, breadcrumb]; 105 newBreadcrumbs = [...breadcrumbs, breadcrumb];
107 } 106 }