From c979a9309920897295443586699f63c89d6671d7 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Wed, 5 Feb 2020 17:52:18 +0200 Subject: [PATCH] IE11 fixes. --- ui-ngx/package-lock.json | 14 +++---- ui-ngx/package.json | 2 +- ui-ngx/src/app/core/utils.ts | 8 +++- .../alarm/alarm-details-dialog.component.html | 2 +- .../entity/entities-table.component.html | 2 +- .../entity/entities-table.component.ts | 2 +- .../timeseries-table-widget.component.scss | 2 - .../components/widget/widget.component.ts | 38 ++++++++++--------- .../models/datasource/entity-datasource.ts | 11 ++++-- .../entity/entities-table-config.models.ts | 2 +- .../rulechain/rule-node-link.component.html | 1 - .../message-type-autocomplete.component.ts | 7 ++-- .../src/app/shared/models/dashboard.models.ts | 2 +- ui-ngx/src/styles.scss | 12 +++++- 14 files changed, 60 insertions(+), 45 deletions(-) diff --git a/ui-ngx/package-lock.json b/ui-ngx/package-lock.json index 6fa83746a7..d283c9b2c4 100644 --- a/ui-ngx/package-lock.json +++ b/ui-ngx/package-lock.json @@ -11724,17 +11724,17 @@ } }, "schema-inspector": { - "version": "1.6.9", - "resolved": "https://registry.npmjs.org/schema-inspector/-/schema-inspector-1.6.9.tgz", - "integrity": "sha512-MNS3SOn6noecIv9R+gwroIgiOLQoRY1IRXToFvVBo2QMfnXy1E+SGRVWJFsJPqgy0lAivUfPLaVLhvAI35HKRg==", + "version": "1.6.8", + "resolved": "https://registry.npmjs.org/schema-inspector/-/schema-inspector-1.6.8.tgz", + "integrity": "sha1-ueU5g8xV/y29e2Xj2+CF2dEoXyo=", "requires": { - "async": "^3.1.0" + "async": "^1.5.0" }, "dependencies": { "async": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/async/-/async-3.1.1.tgz", - "integrity": "sha512-X5Dj8hK1pJNC2Wzo2Rcp9FBVdJMGRR/S7V+lH46s8GVFhtbo5O4Le5GECCF/8PISVdkUA6mMPvgz7qTTD1rf1g==" + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" } } }, diff --git a/ui-ngx/package.json b/ui-ngx/package.json index b602107fb2..203b3c038c 100644 --- a/ui-ngx/package.json +++ b/ui-ngx/package.json @@ -74,7 +74,7 @@ "react-dropzone": "^10.2.1", "reactcss": "^1.2.3", "rxjs": "^6.5.4", - "schema-inspector": "^1.6.9", + "schema-inspector": "1.6.8", "screenfull": "^5.0.1", "split.js": "^1.5.11", "systemjs": "0.21.5", diff --git a/ui-ngx/src/app/core/utils.ts b/ui-ngx/src/app/core/utils.ts index 9db6351283..27442e32af 100644 --- a/ui-ngx/src/app/core/utils.ts +++ b/ui-ngx/src/app/core/utils.ts @@ -109,7 +109,7 @@ export function isString(value: any): boolean { export function formatValue(value: any, dec?: number, units?: string, showZeroDecimals?: boolean): string | undefined { if (isDefined(value) && - value != null && isNumeric(value)) { + value !== null && isNumeric(value)) { let formatted: string | number = Number(value); if (isDefined(dec)) { formatted = formatted.toFixed(dec); @@ -123,10 +123,14 @@ export function formatValue(value: any, dec?: number, units?: string, showZeroDe } return formatted; } else { - return value; + return value !== null ? value : ''; } } +export function objectValues(obj: any): any[] { + return Object.keys(obj).map(e => obj[e]); +} + export function deleteNullProperties(obj: any) { if (isUndefined(obj) || obj == null) { return; diff --git a/ui-ngx/src/app/modules/home/components/alarm/alarm-details-dialog.component.html b/ui-ngx/src/app/modules/home/components/alarm/alarm-details-dialog.component.html index 7d0f82b39c..dac69795c6 100644 --- a/ui-ngx/src/app/modules/home/components/alarm/alarm-details-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/alarm/alarm-details-dialog.component.html @@ -15,7 +15,7 @@ limitations under the License. --> -
+

{{ 'alarm.alarm-details' | translate }}

diff --git a/ui-ngx/src/app/modules/home/components/entity/entities-table.component.html b/ui-ngx/src/app/modules/home/components/entity/entities-table.component.html index 1e5342a2b5..a5c3ee52f2 100644 --- a/ui-ngx/src/app/modules/home/components/entity/entities-table.component.html +++ b/ui-ngx/src/app/modules/home/components/entity/entities-table.component.html @@ -221,7 +221,7 @@ 'tb-current-entity': dataSource.isCurrentEntity(entity)}" *matRowDef="let entity; columns: displayedColumns;" (click)="onRowClick($event, entity)"> - {{ translations.noEntities }} diff --git a/ui-ngx/src/app/modules/home/components/entity/entities-table.component.ts b/ui-ngx/src/app/modules/home/components/entity/entities-table.component.ts index dfdaaded22..a6b4f2b379 100644 --- a/ui-ngx/src/app/modules/home/components/entity/entities-table.component.ts +++ b/ui-ngx/src/app/modules/home/components/entity/entities-table.component.ts @@ -419,7 +419,7 @@ export class EntitiesTableComponent extends PageComponent implements AfterViewIn } return res; } else { - return null; + return ''; } } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.scss index c469bf9cfe..c2992a2984 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.scss +++ b/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.scss @@ -18,11 +18,9 @@ height: 100%; .tb-table-widget { mat-footer-row, mat-row { - min-height: 38px; height: 38px; } mat-header-row { - min-height: 40px; height: 40px; } mat-toolbar { diff --git a/ui-ngx/src/app/modules/home/components/widget/widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/widget.component.ts index 80ddf9ceb0..c91a533c55 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/widget.component.ts @@ -426,7 +426,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI this.initialize().subscribe( () => { - this.cd.detectChanges(); + this.detectChanges(); this.onInit(); }, (err) => { @@ -435,6 +435,12 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI ); } + private detectChanges() { + if (!this.destroyed) { + this.cd.detectChanges(); + } + } + private isReady(): boolean { return this.subscriptionInited && this.widgetSizeDetected; } @@ -546,7 +552,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI this.widgetContext.reset(); this.subscriptionInited = true; this.configureDynamicWidgetComponent(); - this.cd.detectChanges(); + this.detectChanges(); this.onInit(); } }, @@ -564,7 +570,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI this.widgetContext.reset(); this.subscriptionInited = true; this.configureDynamicWidgetComponent(); - this.cd.detectChanges(); + this.detectChanges(); this.onInit(); } } @@ -760,22 +766,18 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI dataLoading: (subscription) => { if (this.loadingData !== subscription.loadingData) { this.loadingData = subscription.loadingData; - if (!this.destroyed) { - this.cd.detectChanges(); - } + this.detectChanges(); } }, legendDataUpdated: (subscription, detectChanges) => { - if (detectChanges && !this.destroyed) { - this.cd.detectChanges(); + if (detectChanges) { + this.detectChanges(); } }, timeWindowUpdated: (subscription, timeWindowConfig) => { this.ngZone.run(() => { this.widget.config.timewindow = timeWindowConfig; - if (!this.destroyed) { - this.cd.detectChanges(); - } + this.detectChanges(); }); } }; @@ -836,7 +838,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI if (this.dynamicWidgetComponent) { this.dynamicWidgetComponent.rpcEnabled = subscription.rpcEnabled; this.dynamicWidgetComponent.executingRpcRequest = subscription.executingRpcRequest; - this.cd.detectChanges(); + this.detectChanges(); } }, onRpcSuccess: (subscription) => { @@ -844,7 +846,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI this.dynamicWidgetComponent.executingRpcRequest = subscription.executingRpcRequest; this.dynamicWidgetComponent.rpcErrorText = subscription.rpcErrorText; this.dynamicWidgetComponent.rpcRejection = subscription.rpcRejection; - this.cd.detectChanges(); + this.detectChanges(); } }, onRpcFailed: (subscription) => { @@ -852,14 +854,14 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI this.dynamicWidgetComponent.executingRpcRequest = subscription.executingRpcRequest; this.dynamicWidgetComponent.rpcErrorText = subscription.rpcErrorText; this.dynamicWidgetComponent.rpcRejection = subscription.rpcRejection; - this.cd.detectChanges(); + this.detectChanges(); } }, onRpcErrorCleared: (subscription) => { if (this.dynamicWidgetComponent) { this.dynamicWidgetComponent.rpcErrorText = null; this.dynamicWidgetComponent.rpcRejection = null; - this.cd.detectChanges(); + this.detectChanges(); } } }; @@ -873,16 +875,16 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI createSubscriptionSubject.error(err); } ); - this.cd.detectChanges(); + this.detectChanges(); } else if (this.widget.type === widgetType.static) { this.loadingData = false; createSubscriptionSubject.next(); createSubscriptionSubject.complete(); - this.cd.detectChanges(); + this.detectChanges(); } else { createSubscriptionSubject.next(); createSubscriptionSubject.complete(); - this.cd.detectChanges(); + this.detectChanges(); } return createSubscriptionSubject.asObservable(); } diff --git a/ui-ngx/src/app/modules/home/models/datasource/entity-datasource.ts b/ui-ngx/src/app/modules/home/models/datasource/entity-datasource.ts index d0ab2bec71..70c51c46c4 100644 --- a/ui-ngx/src/app/modules/home/models/datasource/entity-datasource.ts +++ b/ui-ngx/src/app/modules/home/models/datasource/entity-datasource.ts @@ -20,7 +20,7 @@ import { BehaviorSubject, Observable, of, ReplaySubject } from 'rxjs'; import { emptyPageData, PageData } from '@shared/models/page/page-data'; import { BaseData, HasId } from '@shared/models/base-data'; import { CollectionViewer, DataSource } from '@angular/cdk/typings/collections'; -import { catchError, map, take, tap } from 'rxjs/operators'; +import { catchError, map, share, take, tap } from 'rxjs/operators'; import { SelectionModel } from '@angular/cdk/collections'; import {EntityBooleanFunction} from '@home/models/entity/entities-table-config.models'; @@ -78,19 +78,22 @@ export class EntitiesDataSource, P extends PageLink = isAllSelected(): Observable { const numSelected = this.selection.selected.length; return this.entitiesSubject.pipe( - map((entities) => numSelected === this.selectableEntitiesCount(entities)) + map((entities) => numSelected === this.selectableEntitiesCount(entities)), + share() ); } isEmpty(): Observable { return this.entitiesSubject.pipe( - map((entities) => !entities.length) + map((entities) => !entities.length), + share() ); } total(): Observable { return this.pageDataSubject.pipe( - map((pageData) => pageData.totalElements) + map((pageData) => pageData.totalElements), + share() ); } diff --git a/ui-ngx/src/app/modules/home/models/entity/entities-table-config.models.ts b/ui-ngx/src/app/modules/home/models/entity/entities-table-config.models.ts index ed819866ca..6f947dd960 100644 --- a/ui-ngx/src/app/modules/home/models/entity/entities-table-config.models.ts +++ b/ui-ngx/src/app/modules/home/models/entity/entities-table-config.models.ts @@ -84,7 +84,7 @@ export class EntityTableColumn> extends BaseEntityTabl constructor(public key: string, public title: string, public width: string = '0px', - public cellContentFunction: CellContentFunction = (entity, property) => entity[property], + public cellContentFunction: CellContentFunction = (entity, property) => entity[property] ? entity[property] : '', public cellStyleFunction: CellStyleFunction = () => ({}), public sortable: boolean = true, public headerCellStyleFunction: HeaderCellStyleFunction = () => ({}), diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-link.component.html b/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-link.component.html index 4b54c92e6b..9c2545e504 100644 --- a/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-link.component.html +++ b/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-link.component.html @@ -18,7 +18,6 @@
customerInfo.title) .join(', '); } else { - return null; + return ''; } } diff --git a/ui-ngx/src/styles.scss b/ui-ngx/src/styles.scss index ae0eb63c60..1dddf94f5c 100644 --- a/ui-ngx/src/styles.scss +++ b/ui-ngx/src/styles.scss @@ -521,15 +521,17 @@ mat-label { } mat-header-row { - min-height: 60px; height: 60px; } mat-footer-row, mat-row { - min-height: 52px; height: 52px; } + mat-header-row, mat-footer-row, mat-row { + min-height: auto; + } + .mat-row, .mat-header-row { display: table-row; @@ -537,17 +539,23 @@ mat-label { .mat-header-row.mat-table-sticky { + background-clip: padding-box; .mat-header-cell { position: sticky; top: 0; z-index: 10; background: inherit; + background-clip: padding-box; &.mat-table-sticky { z-index: 11 !important; } } } + .mat-cell.mat-table-sticky { + background-clip: padding-box; + } + .mat-row { transition: background-color .2s; &:hover:not(.tb-current-entity) {