Commit c979a9309920897295443586699f63c89d6671d7

Authored by Igor Kulikov
1 parent 66d08103

IE11 fixes.

@@ -11724,17 +11724,17 @@ @@ -11724,17 +11724,17 @@
11724 } 11724 }
11725 }, 11725 },
11726 "schema-inspector": { 11726 "schema-inspector": {
11727 - "version": "1.6.9",  
11728 - "resolved": "https://registry.npmjs.org/schema-inspector/-/schema-inspector-1.6.9.tgz",  
11729 - "integrity": "sha512-MNS3SOn6noecIv9R+gwroIgiOLQoRY1IRXToFvVBo2QMfnXy1E+SGRVWJFsJPqgy0lAivUfPLaVLhvAI35HKRg==", 11727 + "version": "1.6.8",
  11728 + "resolved": "https://registry.npmjs.org/schema-inspector/-/schema-inspector-1.6.8.tgz",
  11729 + "integrity": "sha1-ueU5g8xV/y29e2Xj2+CF2dEoXyo=",
11730 "requires": { 11730 "requires": {
11731 - "async": "^3.1.0" 11731 + "async": "^1.5.0"
11732 }, 11732 },
11733 "dependencies": { 11733 "dependencies": {
11734 "async": { 11734 "async": {
11735 - "version": "3.1.1",  
11736 - "resolved": "https://registry.npmjs.org/async/-/async-3.1.1.tgz",  
11737 - "integrity": "sha512-X5Dj8hK1pJNC2Wzo2Rcp9FBVdJMGRR/S7V+lH46s8GVFhtbo5O4Le5GECCF/8PISVdkUA6mMPvgz7qTTD1rf1g==" 11735 + "version": "1.5.2",
  11736 + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz",
  11737 + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo="
11738 } 11738 }
11739 } 11739 }
11740 }, 11740 },
@@ -74,7 +74,7 @@ @@ -74,7 +74,7 @@
74 "react-dropzone": "^10.2.1", 74 "react-dropzone": "^10.2.1",
75 "reactcss": "^1.2.3", 75 "reactcss": "^1.2.3",
76 "rxjs": "^6.5.4", 76 "rxjs": "^6.5.4",
77 - "schema-inspector": "^1.6.9", 77 + "schema-inspector": "1.6.8",
78 "screenfull": "^5.0.1", 78 "screenfull": "^5.0.1",
79 "split.js": "^1.5.11", 79 "split.js": "^1.5.11",
80 "systemjs": "0.21.5", 80 "systemjs": "0.21.5",
@@ -109,7 +109,7 @@ export function isString(value: any): boolean { @@ -109,7 +109,7 @@ export function isString(value: any): boolean {
109 109
110 export function formatValue(value: any, dec?: number, units?: string, showZeroDecimals?: boolean): string | undefined { 110 export function formatValue(value: any, dec?: number, units?: string, showZeroDecimals?: boolean): string | undefined {
111 if (isDefined(value) && 111 if (isDefined(value) &&
112 - value != null && isNumeric(value)) { 112 + value !== null && isNumeric(value)) {
113 let formatted: string | number = Number(value); 113 let formatted: string | number = Number(value);
114 if (isDefined(dec)) { 114 if (isDefined(dec)) {
115 formatted = formatted.toFixed(dec); 115 formatted = formatted.toFixed(dec);
@@ -123,10 +123,14 @@ export function formatValue(value: any, dec?: number, units?: string, showZeroDe @@ -123,10 +123,14 @@ export function formatValue(value: any, dec?: number, units?: string, showZeroDe
123 } 123 }
124 return formatted; 124 return formatted;
125 } else { 125 } else {
126 - return value; 126 + return value !== null ? value : '';
127 } 127 }
128 } 128 }
129 129
  130 +export function objectValues(obj: any): any[] {
  131 + return Object.keys(obj).map(e => obj[e]);
  132 +}
  133 +
130 export function deleteNullProperties(obj: any) { 134 export function deleteNullProperties(obj: any) {
131 if (isUndefined(obj) || obj == null) { 135 if (isUndefined(obj) || obj == null) {
132 return; 136 return;
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 limitations under the License. 15 limitations under the License.
16 16
17 --> 17 -->
18 -<form [formGroup]="alarmFormGroup" style="width: 600px;"> 18 +<form [formGroup]="alarmFormGroup" style="min-width: 600px;">
19 <mat-toolbar fxLayout="row" color="primary"> 19 <mat-toolbar fxLayout="row" color="primary">
20 <h2>{{ 'alarm.alarm-details' | translate }}</h2> 20 <h2>{{ 'alarm.alarm-details' | translate }}</h2>
21 <span fxFlex></span> 21 <span fxFlex></span>
@@ -221,7 +221,7 @@ @@ -221,7 +221,7 @@
221 'tb-current-entity': dataSource.isCurrentEntity(entity)}" 221 'tb-current-entity': dataSource.isCurrentEntity(entity)}"
222 *matRowDef="let entity; columns: displayedColumns;" (click)="onRowClick($event, entity)"></mat-row> 222 *matRowDef="let entity; columns: displayedColumns;" (click)="onRowClick($event, entity)"></mat-row>
223 </mat-table> 223 </mat-table>
224 - <span [fxShow]="dataSource.isEmpty() | async" 224 + <span [fxShow]="!(isLoading$ | async) && (dataSource.isEmpty() | async)"
225 fxLayoutAlign="center center" 225 fxLayoutAlign="center center"
226 class="no-data-found" translate>{{ translations.noEntities }}</span> 226 class="no-data-found" translate>{{ translations.noEntities }}</span>
227 </div> 227 </div>
@@ -419,7 +419,7 @@ export class EntitiesTableComponent extends PageComponent implements AfterViewIn @@ -419,7 +419,7 @@ export class EntitiesTableComponent extends PageComponent implements AfterViewIn
419 } 419 }
420 return res; 420 return res;
421 } else { 421 } else {
422 - return null; 422 + return '';
423 } 423 }
424 } 424 }
425 425
@@ -18,11 +18,9 @@ @@ -18,11 +18,9 @@
18 height: 100%; 18 height: 100%;
19 .tb-table-widget { 19 .tb-table-widget {
20 mat-footer-row, mat-row { 20 mat-footer-row, mat-row {
21 - min-height: 38px;  
22 height: 38px; 21 height: 38px;
23 } 22 }
24 mat-header-row { 23 mat-header-row {
25 - min-height: 40px;  
26 height: 40px; 24 height: 40px;
27 } 25 }
28 mat-toolbar { 26 mat-toolbar {
@@ -426,7 +426,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI @@ -426,7 +426,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
426 426
427 this.initialize().subscribe( 427 this.initialize().subscribe(
428 () => { 428 () => {
429 - this.cd.detectChanges(); 429 + this.detectChanges();
430 this.onInit(); 430 this.onInit();
431 }, 431 },
432 (err) => { 432 (err) => {
@@ -435,6 +435,12 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI @@ -435,6 +435,12 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
435 ); 435 );
436 } 436 }
437 437
  438 + private detectChanges() {
  439 + if (!this.destroyed) {
  440 + this.cd.detectChanges();
  441 + }
  442 + }
  443 +
438 private isReady(): boolean { 444 private isReady(): boolean {
439 return this.subscriptionInited && this.widgetSizeDetected; 445 return this.subscriptionInited && this.widgetSizeDetected;
440 } 446 }
@@ -546,7 +552,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI @@ -546,7 +552,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
546 this.widgetContext.reset(); 552 this.widgetContext.reset();
547 this.subscriptionInited = true; 553 this.subscriptionInited = true;
548 this.configureDynamicWidgetComponent(); 554 this.configureDynamicWidgetComponent();
549 - this.cd.detectChanges(); 555 + this.detectChanges();
550 this.onInit(); 556 this.onInit();
551 } 557 }
552 }, 558 },
@@ -564,7 +570,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI @@ -564,7 +570,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
564 this.widgetContext.reset(); 570 this.widgetContext.reset();
565 this.subscriptionInited = true; 571 this.subscriptionInited = true;
566 this.configureDynamicWidgetComponent(); 572 this.configureDynamicWidgetComponent();
567 - this.cd.detectChanges(); 573 + this.detectChanges();
568 this.onInit(); 574 this.onInit();
569 } 575 }
570 } 576 }
@@ -760,22 +766,18 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI @@ -760,22 +766,18 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
760 dataLoading: (subscription) => { 766 dataLoading: (subscription) => {
761 if (this.loadingData !== subscription.loadingData) { 767 if (this.loadingData !== subscription.loadingData) {
762 this.loadingData = subscription.loadingData; 768 this.loadingData = subscription.loadingData;
763 - if (!this.destroyed) {  
764 - this.cd.detectChanges();  
765 - } 769 + this.detectChanges();
766 } 770 }
767 }, 771 },
768 legendDataUpdated: (subscription, detectChanges) => { 772 legendDataUpdated: (subscription, detectChanges) => {
769 - if (detectChanges && !this.destroyed) {  
770 - this.cd.detectChanges(); 773 + if (detectChanges) {
  774 + this.detectChanges();
771 } 775 }
772 }, 776 },
773 timeWindowUpdated: (subscription, timeWindowConfig) => { 777 timeWindowUpdated: (subscription, timeWindowConfig) => {
774 this.ngZone.run(() => { 778 this.ngZone.run(() => {
775 this.widget.config.timewindow = timeWindowConfig; 779 this.widget.config.timewindow = timeWindowConfig;
776 - if (!this.destroyed) {  
777 - this.cd.detectChanges();  
778 - } 780 + this.detectChanges();
779 }); 781 });
780 } 782 }
781 }; 783 };
@@ -836,7 +838,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI @@ -836,7 +838,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
836 if (this.dynamicWidgetComponent) { 838 if (this.dynamicWidgetComponent) {
837 this.dynamicWidgetComponent.rpcEnabled = subscription.rpcEnabled; 839 this.dynamicWidgetComponent.rpcEnabled = subscription.rpcEnabled;
838 this.dynamicWidgetComponent.executingRpcRequest = subscription.executingRpcRequest; 840 this.dynamicWidgetComponent.executingRpcRequest = subscription.executingRpcRequest;
839 - this.cd.detectChanges(); 841 + this.detectChanges();
840 } 842 }
841 }, 843 },
842 onRpcSuccess: (subscription) => { 844 onRpcSuccess: (subscription) => {
@@ -844,7 +846,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI @@ -844,7 +846,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
844 this.dynamicWidgetComponent.executingRpcRequest = subscription.executingRpcRequest; 846 this.dynamicWidgetComponent.executingRpcRequest = subscription.executingRpcRequest;
845 this.dynamicWidgetComponent.rpcErrorText = subscription.rpcErrorText; 847 this.dynamicWidgetComponent.rpcErrorText = subscription.rpcErrorText;
846 this.dynamicWidgetComponent.rpcRejection = subscription.rpcRejection; 848 this.dynamicWidgetComponent.rpcRejection = subscription.rpcRejection;
847 - this.cd.detectChanges(); 849 + this.detectChanges();
848 } 850 }
849 }, 851 },
850 onRpcFailed: (subscription) => { 852 onRpcFailed: (subscription) => {
@@ -852,14 +854,14 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI @@ -852,14 +854,14 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
852 this.dynamicWidgetComponent.executingRpcRequest = subscription.executingRpcRequest; 854 this.dynamicWidgetComponent.executingRpcRequest = subscription.executingRpcRequest;
853 this.dynamicWidgetComponent.rpcErrorText = subscription.rpcErrorText; 855 this.dynamicWidgetComponent.rpcErrorText = subscription.rpcErrorText;
854 this.dynamicWidgetComponent.rpcRejection = subscription.rpcRejection; 856 this.dynamicWidgetComponent.rpcRejection = subscription.rpcRejection;
855 - this.cd.detectChanges(); 857 + this.detectChanges();
856 } 858 }
857 }, 859 },
858 onRpcErrorCleared: (subscription) => { 860 onRpcErrorCleared: (subscription) => {
859 if (this.dynamicWidgetComponent) { 861 if (this.dynamicWidgetComponent) {
860 this.dynamicWidgetComponent.rpcErrorText = null; 862 this.dynamicWidgetComponent.rpcErrorText = null;
861 this.dynamicWidgetComponent.rpcRejection = null; 863 this.dynamicWidgetComponent.rpcRejection = null;
862 - this.cd.detectChanges(); 864 + this.detectChanges();
863 } 865 }
864 } 866 }
865 }; 867 };
@@ -873,16 +875,16 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI @@ -873,16 +875,16 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
873 createSubscriptionSubject.error(err); 875 createSubscriptionSubject.error(err);
874 } 876 }
875 ); 877 );
876 - this.cd.detectChanges(); 878 + this.detectChanges();
877 } else if (this.widget.type === widgetType.static) { 879 } else if (this.widget.type === widgetType.static) {
878 this.loadingData = false; 880 this.loadingData = false;
879 createSubscriptionSubject.next(); 881 createSubscriptionSubject.next();
880 createSubscriptionSubject.complete(); 882 createSubscriptionSubject.complete();
881 - this.cd.detectChanges(); 883 + this.detectChanges();
882 } else { 884 } else {
883 createSubscriptionSubject.next(); 885 createSubscriptionSubject.next();
884 createSubscriptionSubject.complete(); 886 createSubscriptionSubject.complete();
885 - this.cd.detectChanges(); 887 + this.detectChanges();
886 } 888 }
887 return createSubscriptionSubject.asObservable(); 889 return createSubscriptionSubject.asObservable();
888 } 890 }
@@ -20,7 +20,7 @@ import { BehaviorSubject, Observable, of, ReplaySubject } from 'rxjs'; @@ -20,7 +20,7 @@ import { BehaviorSubject, Observable, of, ReplaySubject } from 'rxjs';
20 import { emptyPageData, PageData } from '@shared/models/page/page-data'; 20 import { emptyPageData, PageData } from '@shared/models/page/page-data';
21 import { BaseData, HasId } from '@shared/models/base-data'; 21 import { BaseData, HasId } from '@shared/models/base-data';
22 import { CollectionViewer, DataSource } from '@angular/cdk/typings/collections'; 22 import { CollectionViewer, DataSource } from '@angular/cdk/typings/collections';
23 -import { catchError, map, take, tap } from 'rxjs/operators'; 23 +import { catchError, map, share, take, tap } from 'rxjs/operators';
24 import { SelectionModel } from '@angular/cdk/collections'; 24 import { SelectionModel } from '@angular/cdk/collections';
25 import {EntityBooleanFunction} from '@home/models/entity/entities-table-config.models'; 25 import {EntityBooleanFunction} from '@home/models/entity/entities-table-config.models';
26 26
@@ -78,19 +78,22 @@ export class EntitiesDataSource<T extends BaseData<HasId>, P extends PageLink = @@ -78,19 +78,22 @@ export class EntitiesDataSource<T extends BaseData<HasId>, P extends PageLink =
78 isAllSelected(): Observable<boolean> { 78 isAllSelected(): Observable<boolean> {
79 const numSelected = this.selection.selected.length; 79 const numSelected = this.selection.selected.length;
80 return this.entitiesSubject.pipe( 80 return this.entitiesSubject.pipe(
81 - map((entities) => numSelected === this.selectableEntitiesCount(entities)) 81 + map((entities) => numSelected === this.selectableEntitiesCount(entities)),
  82 + share()
82 ); 83 );
83 } 84 }
84 85
85 isEmpty(): Observable<boolean> { 86 isEmpty(): Observable<boolean> {
86 return this.entitiesSubject.pipe( 87 return this.entitiesSubject.pipe(
87 - map((entities) => !entities.length) 88 + map((entities) => !entities.length),
  89 + share()
88 ); 90 );
89 } 91 }
90 92
91 total(): Observable<number> { 93 total(): Observable<number> {
92 return this.pageDataSubject.pipe( 94 return this.pageDataSubject.pipe(
93 - map((pageData) => pageData.totalElements) 95 + map((pageData) => pageData.totalElements),
  96 + share()
94 ); 97 );
95 } 98 }
96 99
@@ -84,7 +84,7 @@ export class EntityTableColumn<T extends BaseData<HasId>> extends BaseEntityTabl @@ -84,7 +84,7 @@ export class EntityTableColumn<T extends BaseData<HasId>> extends BaseEntityTabl
84 constructor(public key: string, 84 constructor(public key: string,
85 public title: string, 85 public title: string,
86 public width: string = '0px', 86 public width: string = '0px',
87 - public cellContentFunction: CellContentFunction<T> = (entity, property) => entity[property], 87 + public cellContentFunction: CellContentFunction<T> = (entity, property) => entity[property] ? entity[property] : '',
88 public cellStyleFunction: CellStyleFunction<T> = () => ({}), 88 public cellStyleFunction: CellStyleFunction<T> = () => ({}),
89 public sortable: boolean = true, 89 public sortable: boolean = true,
90 public headerCellStyleFunction: HeaderCellStyleFunction<T> = () => ({}), 90 public headerCellStyleFunction: HeaderCellStyleFunction<T> = () => ({}),
@@ -18,7 +18,6 @@ @@ -18,7 +18,6 @@
18 <div class="mat-padding" fxLayout="column"> 18 <div class="mat-padding" fxLayout="column">
19 <form #ruleNodeLinkForm="ngForm" [formGroup]="ruleNodeLinkFormGroup"> 19 <form #ruleNodeLinkForm="ngForm" [formGroup]="ruleNodeLinkFormGroup">
20 <tb-link-labels 20 <tb-link-labels
21 - fxFlex  
22 required 21 required
23 formControlName="labels" 22 formControlName="labels"
24 [allowedLabels]="allowedLabels" 23 [allowedLabels]="allowedLabels"
@@ -23,6 +23,7 @@ import { AppState } from '@app/core/core.state'; @@ -23,6 +23,7 @@ import { AppState } from '@app/core/core.state';
23 import { TranslateService } from '@ngx-translate/core'; 23 import { TranslateService } from '@ngx-translate/core';
24 import { coerceBooleanProperty } from '@angular/cdk/coercion'; 24 import { coerceBooleanProperty } from '@angular/cdk/coercion';
25 import { MessageType, messageTypeNames } from '@shared/models/rule-node.models'; 25 import { MessageType, messageTypeNames } from '@shared/models/rule-node.models';
  26 +import { objectValues } from '@core/utils';
26 27
27 @Component({ 28 @Component({
28 selector: 'tb-message-type-autocomplete', 29 selector: 'tb-message-type-autocomplete',
@@ -109,7 +110,7 @@ export class MessageTypeAutocompleteComponent implements ControlValueAccessor, O @@ -109,7 +110,7 @@ export class MessageTypeAutocompleteComponent implements ControlValueAccessor, O
109 this.modelValue = value; 110 this.modelValue = value;
110 let res: MessageType | string = null; 111 let res: MessageType | string = null;
111 if (value) { 112 if (value) {
112 - if (Object.values(MessageType).includes(value)) { 113 + if (objectValues(MessageType).includes(value)) {
113 res = MessageType[value]; 114 res = MessageType[value];
114 } else { 115 } else {
115 res = value; 116 res = value;
@@ -129,7 +130,7 @@ export class MessageTypeAutocompleteComponent implements ControlValueAccessor, O @@ -129,7 +130,7 @@ export class MessageTypeAutocompleteComponent implements ControlValueAccessor, O
129 updateView(value: MessageType | string | null) { 130 updateView(value: MessageType | string | null) {
130 let res: string = null; 131 let res: string = null;
131 if (value) { 132 if (value) {
132 - if (Object.values(MessageType).includes(value)) { 133 + if (objectValues(MessageType).includes(value)) {
133 res = MessageType[value]; 134 res = MessageType[value];
134 } else { 135 } else {
135 res = value; 136 res = value;
@@ -143,7 +144,7 @@ export class MessageTypeAutocompleteComponent implements ControlValueAccessor, O @@ -143,7 +144,7 @@ export class MessageTypeAutocompleteComponent implements ControlValueAccessor, O
143 144
144 displayMessageTypeFn(messageType?: MessageType | string): string | undefined { 145 displayMessageTypeFn(messageType?: MessageType | string): string | undefined {
145 if (messageType) { 146 if (messageType) {
146 - if (Object.values(MessageType).includes(messageType)) { 147 + if (objectValues(MessageType).includes(messageType)) {
147 return messageTypeNames.get(MessageType[messageType]); 148 return messageTypeNames.get(MessageType[messageType]);
148 } else { 149 } else {
149 return messageType; 150 return messageType;
@@ -120,7 +120,7 @@ export function getDashboardAssignedCustomersText(dashboard: DashboardInfo): str @@ -120,7 +120,7 @@ export function getDashboardAssignedCustomersText(dashboard: DashboardInfo): str
120 .map(customerInfo => customerInfo.title) 120 .map(customerInfo => customerInfo.title)
121 .join(', '); 121 .join(', ');
122 } else { 122 } else {
123 - return null; 123 + return '';
124 } 124 }
125 } 125 }
126 126
@@ -521,15 +521,17 @@ mat-label { @@ -521,15 +521,17 @@ mat-label {
521 } 521 }
522 522
523 mat-header-row { 523 mat-header-row {
524 - min-height: 60px;  
525 height: 60px; 524 height: 60px;
526 } 525 }
527 526
528 mat-footer-row, mat-row { 527 mat-footer-row, mat-row {
529 - min-height: 52px;  
530 height: 52px; 528 height: 52px;
531 } 529 }
532 530
  531 + mat-header-row, mat-footer-row, mat-row {
  532 + min-height: auto;
  533 + }
  534 +
533 .mat-row, 535 .mat-row,
534 .mat-header-row { 536 .mat-header-row {
535 display: table-row; 537 display: table-row;
@@ -537,17 +539,23 @@ mat-label { @@ -537,17 +539,23 @@ mat-label {
537 539
538 540
539 .mat-header-row.mat-table-sticky { 541 .mat-header-row.mat-table-sticky {
  542 + background-clip: padding-box;
540 .mat-header-cell { 543 .mat-header-cell {
541 position: sticky; 544 position: sticky;
542 top: 0; 545 top: 0;
543 z-index: 10; 546 z-index: 10;
544 background: inherit; 547 background: inherit;
  548 + background-clip: padding-box;
545 &.mat-table-sticky { 549 &.mat-table-sticky {
546 z-index: 11 !important; 550 z-index: 11 !important;
547 } 551 }
548 } 552 }
549 } 553 }
550 554
  555 + .mat-cell.mat-table-sticky {
  556 + background-clip: padding-box;
  557 + }
  558 +
551 .mat-row { 559 .mat-row {
552 transition: background-color .2s; 560 transition: background-color .2s;
553 &:hover:not(.tb-current-entity) { 561 &:hover:not(.tb-current-entity) {