diff --git a/ui-ngx/src/app/modules/home/home.component.ts b/ui-ngx/src/app/modules/home/home.component.ts
index daf22ee81a..2d0632bba5 100644
--- a/ui-ngx/src/app/modules/home/home.component.ts
+++ b/ui-ngx/src/app/modules/home/home.component.ts
@@ -50,7 +50,7 @@ export class HomeComponent extends PageComponent implements AfterViewInit, OnIni
activeComponent: any;
searchableComponent: ISearchableComponent;
- sidenavMode = 'side';
+ sidenavMode: 'over' | 'push' | 'side' = 'side';
sidenavOpened = true;
logo = require('../../../assets/logo_title_white.svg');
diff --git a/ui-ngx/src/app/modules/home/models/dashboard-component.models.ts b/ui-ngx/src/app/modules/home/models/dashboard-component.models.ts
index d3395043e2..6cfb596f44 100644
--- a/ui-ngx/src/app/modules/home/models/dashboard-component.models.ts
+++ b/ui-ngx/src/app/modules/home/models/dashboard-component.models.ts
@@ -134,11 +134,10 @@ export class DashboardWidgets implements Iterable {
}
if (widgetLayoutChange !== null) {
widgetLayoutChange.forEachChangedItem((changed) => {
- let operation = updateRecords.find((record) => record.widgetId === changed.key);
+ const operation = updateRecords.find((record) => record.widgetId === changed.key);
if (!operation) {
- let index = this.dashboardWidgets.findIndex((dashboardWidget) => dashboardWidget.widgetId === changed.key);
- if (index > -1) {
- const widget = this.dashboardWidgets[index];
+ const widget = this.dashboardWidgets.find((dashboardWidget) => dashboardWidget.widgetId === changed.key);
+ if (widget) {
updateRecords.push({
widget: widget.widget,
widgetId: changed.key,
@@ -167,7 +166,8 @@ export class DashboardWidgets implements Iterable {
index = this.dashboardWidgets.findIndex((dashboardWidget) => dashboardWidget.widgetId === record.widgetId);
if (index > -1) {
const prevDashboardWidget = this.dashboardWidgets[index];
- if (!deepEqual(prevDashboardWidget.widget, record.widget) || !deepEqual(prevDashboardWidget.widgetLayout, record.widgetLayout)) {
+ if (!deepEqual(prevDashboardWidget.widget, record.widget) ||
+ !deepEqual(prevDashboardWidget.widgetLayout, record.widgetLayout)) {
this.dashboardWidgets[index] = new DashboardWidget(this.dashboard, record.widget, record.widgetLayout);
this.dashboardWidgets[index].highlighted = prevDashboardWidget.highlighted;
this.dashboardWidgets[index].selected = prevDashboardWidget.selected;
diff --git a/ui-ngx/src/app/modules/home/models/widget-component.models.ts b/ui-ngx/src/app/modules/home/models/widget-component.models.ts
index 818f94391e..e4f307f4ab 100644
--- a/ui-ngx/src/app/modules/home/models/widget-component.models.ts
+++ b/ui-ngx/src/app/modules/home/models/widget-component.models.ts
@@ -108,36 +108,10 @@ export class WidgetContext {
}
set changeDetector(cd: ChangeDetectorRef) {
- this._changeDetector = cd;
+ this.changeDetectorValue = cd;
}
- private _changeDetector: ChangeDetectorRef;
-
- detectChanges(updateWidgetParams: boolean = false) {
- if (!this.destroyed) {
- if (updateWidgetParams) {
- this.dashboardWidget.updateWidgetParams();
- }
- this._changeDetector.detectChanges();
- }
- }
-
- updateWidgetParams() {
- if (!this.destroyed) {
- setTimeout(() => {
- this.dashboardWidget.updateWidgetParams();
- }, 0);
- }
- }
-
- reset() {
- this.destroyed = false;
- this.hideTitlePanel = false;
- this.widgetTitleTemplate = undefined;
- this.widgetTitle = undefined;
- this.customHeaderActions = undefined;
- this.widgetActions = undefined;
- }
+ private changeDetectorValue: ChangeDetectorRef;
inited = false;
destroyed = false;
@@ -209,6 +183,32 @@ export class WidgetContext {
$injector?: Injector;
ngZone?: NgZone;
+
+ detectChanges(updateWidgetParams: boolean = false) {
+ if (!this.destroyed) {
+ if (updateWidgetParams) {
+ this.dashboardWidget.updateWidgetParams();
+ }
+ this.changeDetectorValue.detectChanges();
+ }
+ }
+
+ updateWidgetParams() {
+ if (!this.destroyed) {
+ setTimeout(() => {
+ this.dashboardWidget.updateWidgetParams();
+ }, 0);
+ }
+ }
+
+ reset() {
+ this.destroyed = false;
+ this.hideTitlePanel = false;
+ this.widgetTitleTemplate = undefined;
+ this.widgetTitle = undefined;
+ this.customHeaderActions = undefined;
+ this.widgetActions = undefined;
+ }
}
export interface IDynamicWidgetComponent {
diff --git a/ui-ngx/src/app/modules/home/pages/admin/admin-routing.module.ts b/ui-ngx/src/app/modules/home/pages/admin/admin-routing.module.ts
index 0b36672d72..9fa87c6600 100644
--- a/ui-ngx/src/app/modules/home/pages/admin/admin-routing.module.ts
+++ b/ui-ngx/src/app/modules/home/pages/admin/admin-routing.module.ts
@@ -20,8 +20,8 @@ import { Routes, RouterModule } from '@angular/router';
import { MailServerComponent } from '@modules/home/pages/admin/mail-server.component';
import { ConfirmOnExitGuard } from '@core/guards/confirm-on-exit.guard';
import { Authority } from '@shared/models/authority.enum';
-import {GeneralSettingsComponent} from "@modules/home/pages/admin/general-settings.component";
-import {SecuritySettingsComponent} from "@modules/home/pages/admin/security-settings.component";
+import {GeneralSettingsComponent} from '@modules/home/pages/admin/general-settings.component';
+import {SecuritySettingsComponent} from '@modules/home/pages/admin/security-settings.component';
const routes: Routes = [
{
diff --git a/ui-ngx/src/app/modules/home/pages/dashboard/states/manage-dashboard-states-dialog.component.html b/ui-ngx/src/app/modules/home/pages/dashboard/states/manage-dashboard-states-dialog.component.html
index 681ff8cd59..663cc4f96c 100644
--- a/ui-ngx/src/app/modules/home/pages/dashboard/states/manage-dashboard-states-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/pages/dashboard/states/manage-dashboard-states-dialog.component.html
@@ -76,7 +76,7 @@
+ matSort [matSortActive]="pageLink.sortOrder.property" [matSortDirection]="pageLink.sortDirection()" matSortDisableClear>
{{ 'dashboard.state-name' | translate }}
diff --git a/ui-ngx/src/app/modules/home/pages/dashboard/states/state-controller.component.ts b/ui-ngx/src/app/modules/home/pages/dashboard/states/state-controller.component.ts
index 0a9eafa09d..2e96f1c5b7 100644
--- a/ui-ngx/src/app/modules/home/pages/dashboard/states/state-controller.component.ts
+++ b/ui-ngx/src/app/modules/home/pages/dashboard/states/state-controller.component.ts
@@ -89,10 +89,10 @@ export abstract class StateControllerComponent implements IStateControllerCompon
private inited = false;
- constructor(protected router: Router,
- protected route: ActivatedRoute,
- protected ngZone: NgZone,
- protected statesControllerService: StatesControllerService) {
+ protected constructor(protected router: Router,
+ protected route: ActivatedRoute,
+ protected ngZone: NgZone,
+ protected statesControllerService: StatesControllerService) {
}
ngOnInit(): void {
diff --git a/ui-ngx/src/app/modules/home/pages/dashboard/states/states-component.directive.ts b/ui-ngx/src/app/modules/home/pages/dashboard/states/states-component.directive.ts
index 534eb1d6f7..c2455b1d6a 100644
--- a/ui-ngx/src/app/modules/home/pages/dashboard/states/states-component.directive.ts
+++ b/ui-ngx/src/app/modules/home/pages/dashboard/states/states-component.directive.ts
@@ -34,6 +34,7 @@ import { IStateController } from '@core/api/widget-api.models';
import { IStateControllerComponent } from '@home/pages/dashboard/states/state-controller.models';
@Directive({
+ // tslint:disable-next-line:directive-selector
selector: 'tb-states-component'
})
export class StatesComponentDirective implements OnInit, OnDestroy, OnChanges {
diff --git a/ui-ngx/src/app/modules/home/pages/device/device-credentials-dialog.component.html b/ui-ngx/src/app/modules/home/pages/device/device-credentials-dialog.component.html
index 95975082a9..1ee3635765 100644
--- a/ui-ngx/src/app/modules/home/pages/device/device-credentials-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/pages/device/device-credentials-dialog.component.html
@@ -35,7 +35,7 @@
- {{ credentialTypeNamesMap.get(credentialsType) }}
+ {{ credentialTypeNamesMap.get(deviceCredentialsType[credentialsType]) }}
diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-page.component.ts b/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-page.component.ts
index 1eac5e3b67..3f9c2a988f 100644
--- a/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-page.component.ts
+++ b/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-page.component.ts
@@ -817,7 +817,7 @@ export class RuleChainPageComponent extends PageComponent
menuItems: []
};
const sourceNode: FcRuleNode = this.ruleChainCanvas.modelService.nodes.getNodeByConnectorId(edge.source);
- if (sourceNode.component.type != RuleNodeType.INPUT) {
+ if (sourceNode.component.type !== RuleNodeType.INPUT) {
contextInfo.menuItems.push(
{
action: () => {
@@ -900,14 +900,14 @@ export class RuleChainPageComponent extends PageComponent
edges.forEach((edge) => {
const sourceNode = this.ruleChainCanvas.modelService.nodes.getNodeByConnectorId(edge.source);
const destNode = this.ruleChainCanvas.modelService.nodes.getNodeByConnectorId(edge.destination);
- const isInputSource = sourceNode.component.type == RuleNodeType.INPUT;
+ const isInputSource = sourceNode.component.type === RuleNodeType.INPUT;
const fromIndex = nodes.indexOf(sourceNode);
const toIndex = nodes.indexOf(destNode);
if ( (isInputSource || fromIndex > -1) && toIndex > -1 ) {
const connection: RuleNodeConnection = {
- isInputSource: isInputSource,
- fromIndex: fromIndex,
- toIndex: toIndex,
+ isInputSource,
+ fromIndex,
+ toIndex,
label: edge.label,
labels: edge.labels
};
@@ -929,8 +929,8 @@ export class RuleChainPageComponent extends PageComponent
const scrollParent = canvas.parent();
const scrollTop = scrollParent.scrollTop();
const scrollLeft = scrollParent.scrollLeft();
- x = scrollLeft + scrollParent.width()/2;
- y = scrollTop + scrollParent.height()/2;
+ x = scrollLeft + scrollParent.width() / 2;
+ y = scrollTop + scrollParent.height() / 2;
}
const ruleNodes = this.itembuffer.pasteRuleNodes(x, y);
if (ruleNodes) {
@@ -972,19 +972,21 @@ export class RuleChainPageComponent extends PageComponent
this.ruleChainCanvas.modelService.edges.delete(found);
}
} else {
- const sourceConnectors = this.ruleChainCanvas.modelService.nodes.getConnectorsByType(sourceNode, FlowchartConstants.rightConnectorType);
+ const sourceConnectors = this.ruleChainCanvas.modelService.nodes
+ .getConnectorsByType(sourceNode, FlowchartConstants.rightConnectorType);
if (sourceConnectors && sourceConnectors.length) {
source = sourceConnectors[0].id;
}
}
- const destConnectors = this.ruleChainCanvas.modelService.nodes.getConnectorsByType(destNode, FlowchartConstants.leftConnectorType);
+ const destConnectors = this.ruleChainCanvas.modelService.nodes
+ .getConnectorsByType(destNode, FlowchartConstants.leftConnectorType);
if (destConnectors && destConnectors.length) {
destination = destConnectors[0].id;
}
if (source && destination) {
const edge: FcRuleEdge = {
- source: source,
- destination: destination,
+ source,
+ destination,
label: connection.label,
labels: connection.labels
};
@@ -1203,7 +1205,7 @@ export class RuleChainPageComponent extends PageComponent
nodes.push(node);
}
});
- const firstNodeEdge = this.ruleChainModel.edges.find((edge) => edge.source === this.inputConnectorId+'');
+ const firstNodeEdge = this.ruleChainModel.edges.find((edge) => edge.source === this.inputConnectorId + '');
if (firstNodeEdge) {
const firstNode = this.ruleChainCanvas.modelService.nodes.getNodeByConnectorId(firstNodeEdge.destination);
ruleChainMetaData.firstNodeIndex = nodes.indexOf(firstNode);
@@ -1241,8 +1243,8 @@ export class RuleChainPageComponent extends PageComponent
}
}
});
- this.ruleChainService.saveAndGetResolvedRuleChainMetadata(ruleChainMetaData).subscribe((ruleChainMetaData) => {
- this.ruleChainMetaData = ruleChainMetaData;
+ this.ruleChainService.saveAndGetResolvedRuleChainMetadata(ruleChainMetaData).subscribe((savedRuleChainMetaData) => {
+ this.ruleChainMetaData = savedRuleChainMetaData;
if (this.isImport) {
this.isDirtyValue = false;
this.isImport = false;
diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-routing.module.ts b/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-routing.module.ts
index 9fb8b17daa..cf768adebb 100644
--- a/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-routing.module.ts
+++ b/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-routing.module.ts
@@ -113,7 +113,8 @@ export class RuleChainImportGuard implements CanActivate {
private router: Router) {
}
- canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree {
+ canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot):
+ Observable | Promise | boolean | UrlTree {
if (this.itembuffer.hasRuleChainImport()) {
return true;
} else {
diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/rulenode.component.ts b/ui-ngx/src/app/modules/home/pages/rulechain/rulenode.component.ts
index d6bb3cc588..26af6b7061 100644
--- a/ui-ngx/src/app/modules/home/pages/rulechain/rulenode.component.ts
+++ b/ui-ngx/src/app/modules/home/pages/rulechain/rulenode.component.ts
@@ -19,6 +19,7 @@ import { Component, OnInit } from '@angular/core';
import { FcNodeComponent } from 'ngx-flowchart/dist/ngx-flowchart';
@Component({
+ // tslint:disable-next-line:component-selector
selector: 'rule-node',
templateUrl: './rulenode.component.html',
styleUrls: ['./rulenode.component.scss']
diff --git a/ui-ngx/src/app/modules/home/pages/user/add-user-dialog.component.html b/ui-ngx/src/app/modules/home/pages/user/add-user-dialog.component.html
index a6444c325c..340971b510 100644
--- a/ui-ngx/src/app/modules/home/pages/user/add-user-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/pages/user/add-user-dialog.component.html
@@ -35,7 +35,7 @@
user.activation-method
- {{ activationMethodTranslations.get(activationMethod) | translate }}
+ {{ activationMethodTranslations.get(activationMethodEnum[activationMethod]) | translate }}
diff --git a/ui-ngx/src/app/modules/home/pages/user/add-user-dialog.component.ts b/ui-ngx/src/app/modules/home/pages/user/add-user-dialog.component.ts
index b6edc66ee6..fbbd7cf6aa 100644
--- a/ui-ngx/src/app/modules/home/pages/user/add-user-dialog.component.ts
+++ b/ui-ngx/src/app/modules/home/pages/user/add-user-dialog.component.ts
@@ -50,6 +50,7 @@ export class AddUserDialogComponent extends DialogComponent
diff --git a/ui-ngx/src/app/modules/home/pages/widget/widget-editor.component.html b/ui-ngx/src/app/modules/home/pages/widget/widget-editor.component.html
index e530d85203..7df68508a9 100644
--- a/ui-ngx/src/app/modules/home/pages/widget/widget-editor.component.html
+++ b/ui-ngx/src/app/modules/home/pages/widget/widget-editor.component.html
@@ -29,7 +29,7 @@
- {{ widgetTypesDataMap.get(type).name | translate }}
+ {{ widgetTypesDataMap.get(widgetTypes[type]).name | translate }}
diff --git a/ui-ngx/src/app/modules/home/pages/widget/widget-library.component.ts b/ui-ngx/src/app/modules/home/pages/widget/widget-library.component.ts
index 795f164775..89be4d594c 100644
--- a/ui-ngx/src/app/modules/home/pages/widget/widget-library.component.ts
+++ b/ui-ngx/src/app/modules/home/pages/widget/widget-library.component.ts
@@ -88,7 +88,8 @@ export class WidgetLibraryComponent extends PageComponent implements OnInit {
getStateParams(): StateParams {
return {};
}
- } as IStateController},
+ } as IStateController;
+ },
{});
@ViewChild('dashboard', {static: true}) dashboard: IDashboardComponent;
diff --git a/ui-ngx/src/app/modules/login/login-routing.module.ts b/ui-ngx/src/app/modules/login/login-routing.module.ts
index bfc37edba2..50b1867c32 100644
--- a/ui-ngx/src/app/modules/login/login-routing.module.ts
+++ b/ui-ngx/src/app/modules/login/login-routing.module.ts
@@ -15,10 +15,10 @@
///
import { NgModule } from '@angular/core';
-import { Routes, RouterModule } from '@angular/router';
+import { RouterModule, Routes } from '@angular/router';
import { LoginComponent } from './pages/login/login.component';
-import { AuthGuard } from '../../core/guards/auth.guard';
+import { AuthGuard } from '@core/guards/auth.guard';
import { ResetPasswordRequestComponent } from '@modules/login/pages/login/reset-password-request.component';
import { ResetPasswordComponent } from '@modules/login/pages/login/reset-password.component';
import { CreatePasswordComponent } from '@modules/login/pages/login/create-password.component';
diff --git a/ui-ngx/src/app/modules/login/pages/login/create-password.component.ts b/ui-ngx/src/app/modules/login/pages/login/create-password.component.ts
index 2e471db8a3..620aab2146 100644
--- a/ui-ngx/src/app/modules/login/pages/login/create-password.component.ts
+++ b/ui-ngx/src/app/modules/login/pages/login/create-password.component.ts
@@ -15,17 +15,15 @@
///
import { Component, OnDestroy, OnInit } from '@angular/core';
-import { AuthService } from '../../../../core/auth/auth.service';
-import { LoginRequest } from '../../../../shared/models/login.models';
+import { AuthService } from '@core/auth/auth.service';
import { Store } from '@ngrx/store';
-import { AppState } from '../../../../core/core.state';
-import { PageComponent } from '../../../../shared/components/page.component';
+import { AppState } from '@core/core.state';
+import { PageComponent } from '@shared/components/page.component';
import { FormBuilder } from '@angular/forms';
import { ActionNotificationShow } from '@core/notification/notification.actions';
import { TranslateService } from '@ngx-translate/core';
-import { ActivatedRoute, ActivatedRouteSnapshot } from '@angular/router';
-import { Observable, Subscription } from 'rxjs';
-import { map } from 'rxjs/operators';
+import { ActivatedRoute } from '@angular/router';
+import { Subscription } from 'rxjs';
@Component({
selector: 'tb-create-password',
diff --git a/ui-ngx/src/app/modules/login/pages/login/login.component.ts b/ui-ngx/src/app/modules/login/pages/login/login.component.ts
index c048276a57..f34d7beef0 100644
--- a/ui-ngx/src/app/modules/login/pages/login/login.component.ts
+++ b/ui-ngx/src/app/modules/login/pages/login/login.component.ts
@@ -15,11 +15,10 @@
///
import { Component, OnInit } from '@angular/core';
-import { AuthService } from '../../../../core/auth/auth.service';
-import { LoginRequest } from '../../../../shared/models/login.models';
+import { AuthService } from '@core/auth/auth.service';
import { Store } from '@ngrx/store';
-import { AppState } from '../../../../core/core.state';
-import { PageComponent } from '../../../../shared/components/page.component';
+import { AppState } from '@core/core.state';
+import { PageComponent } from '@shared/components/page.component';
import { FormBuilder } from '@angular/forms';
import { HttpErrorResponse } from '@angular/common/http';
import { Constants } from '@shared/models/constants';
diff --git a/ui-ngx/src/app/modules/login/pages/login/reset-password-request.component.ts b/ui-ngx/src/app/modules/login/pages/login/reset-password-request.component.ts
index b8ac67df3f..8259ad9ccf 100644
--- a/ui-ngx/src/app/modules/login/pages/login/reset-password-request.component.ts
+++ b/ui-ngx/src/app/modules/login/pages/login/reset-password-request.component.ts
@@ -15,11 +15,10 @@
///
import { Component, OnInit } from '@angular/core';
-import { AuthService } from '../../../../core/auth/auth.service';
-import { LoginRequest } from '../../../../shared/models/login.models';
+import { AuthService } from '@core/auth/auth.service';
import { Store } from '@ngrx/store';
-import { AppState } from '../../../../core/core.state';
-import { PageComponent } from '../../../../shared/components/page.component';
+import { AppState } from '@core/core.state';
+import { PageComponent } from '@shared/components/page.component';
import { FormBuilder } from '@angular/forms';
import { ActionNotificationShow } from '@core/notification/notification.actions';
import { TranslateService } from '@ngx-translate/core';
diff --git a/ui-ngx/src/app/modules/login/pages/login/reset-password.component.ts b/ui-ngx/src/app/modules/login/pages/login/reset-password.component.ts
index 7ad658fcba..067aeae677 100644
--- a/ui-ngx/src/app/modules/login/pages/login/reset-password.component.ts
+++ b/ui-ngx/src/app/modules/login/pages/login/reset-password.component.ts
@@ -15,17 +15,15 @@
///
import { Component, OnDestroy, OnInit } from '@angular/core';
-import { AuthService } from '../../../../core/auth/auth.service';
-import { LoginRequest } from '../../../../shared/models/login.models';
+import { AuthService } from '@core/auth/auth.service';
import { Store } from '@ngrx/store';
-import { AppState } from '../../../../core/core.state';
-import { PageComponent } from '../../../../shared/components/page.component';
+import { AppState } from '@core/core.state';
+import { PageComponent } from '@shared/components/page.component';
import { FormBuilder } from '@angular/forms';
import { ActionNotificationShow } from '@core/notification/notification.actions';
import { TranslateService } from '@ngx-translate/core';
import { ActivatedRoute } from '@angular/router';
-import { Observable, Subscription } from 'rxjs';
-import { map } from 'rxjs/operators';
+import { Subscription } from 'rxjs';
@Component({
selector: 'tb-reset-password',
diff --git a/ui-ngx/src/app/shared/components/breadcrumb.component.ts b/ui-ngx/src/app/shared/components/breadcrumb.component.ts
index 57c99d4340..8b1ec0853c 100644
--- a/ui-ngx/src/app/shared/components/breadcrumb.component.ts
+++ b/ui-ngx/src/app/shared/components/breadcrumb.component.ts
@@ -22,7 +22,7 @@ import { distinctUntilChanged, filter, map } from 'rxjs/operators';
import { TranslateService } from '@ngx-translate/core';
@Component({
- selector: '[tb-breadcrumb]',
+ selector: 'tb-breadcrumb',
templateUrl: './breadcrumb.component.html',
styleUrls: ['./breadcrumb.component.scss']
})
diff --git a/ui-ngx/src/app/shared/components/cheatsheet.component.ts b/ui-ngx/src/app/shared/components/cheatsheet.component.ts
index 3c7412add8..995b62dccc 100644
--- a/ui-ngx/src/app/shared/components/cheatsheet.component.ts
+++ b/ui-ngx/src/app/shared/components/cheatsheet.component.ts
@@ -128,7 +128,7 @@ import { Hotkey, HotkeysService } from 'angular2-hotkeys';
export class TbCheatSheetComponent implements OnInit, OnDestroy {
helpVisible = false;
- @Input() title: string = 'Keyboard Shortcuts:';
+ @Input() title = 'Keyboard Shortcuts:';
@Input()
hotkeys: Hotkey[];
@@ -137,9 +137,9 @@ export class TbCheatSheetComponent implements OnInit, OnDestroy {
private mousetrap: MousetrapInstance;
- constructor(private _elementRef: ElementRef,
+ constructor(private elementRef: ElementRef,
private hotkeysService: HotkeysService) {
- this.mousetrap = new Mousetrap(this._elementRef.nativeElement);
+ this.mousetrap = new Mousetrap(this.elementRef.nativeElement);
this.mousetrap.bind('?', (event: KeyboardEvent, combo: string) => {
this.toggleCheatSheet();
});
diff --git a/ui-ngx/src/app/shared/components/entity/entity-list-select.component.ts b/ui-ngx/src/app/shared/components/entity/entity-list-select.component.ts
index c10d37d9a8..09e712330f 100644
--- a/ui-ngx/src/app/shared/components/entity/entity-list-select.component.ts
+++ b/ui-ngx/src/app/shared/components/entity/entity-list-select.component.ts
@@ -66,7 +66,7 @@ export class EntityListSelectComponent implements ControlValueAccessor, OnInit,
displayEntityTypeSelect: boolean;
- private defaultEntityType: EntityType | AliasEntityType = null;
+ private readonly defaultEntityType: EntityType | AliasEntityType = null;
private propagateChange = (v: any) => { };
diff --git a/ui-ngx/src/app/shared/components/entity/entity-select.component.ts b/ui-ngx/src/app/shared/components/entity/entity-select.component.ts
index 6465fb6fa0..252a05fff6 100644
--- a/ui-ngx/src/app/shared/components/entity/entity-select.component.ts
+++ b/ui-ngx/src/app/shared/components/entity/entity-select.component.ts
@@ -60,7 +60,7 @@ export class EntitySelectComponent implements ControlValueAccessor, OnInit, Afte
displayEntityTypeSelect: boolean;
- private defaultEntityType: EntityType | AliasEntityType = null;
+ private readonly defaultEntityType: EntityType | AliasEntityType = null;
private propagateChange = (v: any) => { };
diff --git a/ui-ngx/src/app/shared/components/entity/entity-type-select.component.ts b/ui-ngx/src/app/shared/components/entity/entity-type-select.component.ts
index 4b445572a6..415b19ac13 100644
--- a/ui-ngx/src/app/shared/components/entity/entity-type-select.component.ts
+++ b/ui-ngx/src/app/shared/components/entity/entity-type-select.component.ts
@@ -21,7 +21,7 @@ import {AppState} from '@app/core/core.state';
import {TranslateService} from '@ngx-translate/core';
import {AliasEntityType, EntityType, entityTypeTranslations} from '@app/shared/models/entity-type.models';
import {EntityService} from '@core/http/entity.service';
-import {coerceBooleanProperty} from "@angular/cdk/coercion";
+import {coerceBooleanProperty} from '@angular/cdk/coercion';
@Component({
selector: 'tb-entity-type-select',
diff --git a/ui-ngx/src/app/shared/components/fab-toolbar.component.ts b/ui-ngx/src/app/shared/components/fab-toolbar.component.ts
index 144a3910aa..f6b813c3da 100644
--- a/ui-ngx/src/app/shared/components/fab-toolbar.component.ts
+++ b/ui-ngx/src/app/shared/components/fab-toolbar.component.ts
@@ -38,6 +38,7 @@ class MatFabToolbarBase {
const MatFabToolbarMixinBase: CanColorCtor & typeof MatFabToolbarBase = mixinColor(MatFabToolbarBase);
@Directive({
+ // tslint:disable-next-line:directive-selector
selector: 'mat-fab-trigger'
})
export class FabTriggerDirective {
@@ -48,6 +49,7 @@ export class FabTriggerDirective {
}
@Directive({
+ // tslint:disable-next-line:directive-selector
selector: 'mat-fab-actions'
})
export class FabActionsDirective implements OnInit {
@@ -65,6 +67,7 @@ export class FabActionsDirective implements OnInit {
// @dynamic
@Component({
+ // tslint:disable-next-line:component-selector
selector: 'mat-fab-toolbar',
templateUrl: './fab-toolbar.component.html',
styleUrls: ['./fab-toolbar.component.scss'],
diff --git a/ui-ngx/src/app/shared/components/help.component.ts b/ui-ngx/src/app/shared/components/help.component.ts
index 0bc85834d4..217e02dfce 100644
--- a/ui-ngx/src/app/shared/components/help.component.ts
+++ b/ui-ngx/src/app/shared/components/help.component.ts
@@ -18,6 +18,7 @@ import { Component, Input } from '@angular/core';
import { HelpLinks } from '@shared/models/constants';
@Component({
+ // tslint:disable-next-line:component-selector
selector: '[tb-help]',
templateUrl: './help.component.html'
})
diff --git a/ui-ngx/src/app/shared/components/hotkeys.directive.ts b/ui-ngx/src/app/shared/components/hotkeys.directive.ts
index c39aaed204..bcd737c754 100644
--- a/ui-ngx/src/app/shared/components/hotkeys.directive.ts
+++ b/ui-ngx/src/app/shared/components/hotkeys.directive.ts
@@ -29,21 +29,21 @@ export class TbHotkeysDirective implements OnInit, OnDestroy {
private mousetrap: MousetrapInstance;
private hotkeysList: Hotkey[] = [];
- private _preventIn = ['INPUT', 'SELECT', 'TEXTAREA'];
+ private preventIn = ['INPUT', 'SELECT', 'TEXTAREA'];
- constructor(private _elementRef: ElementRef) {
- this.mousetrap = new Mousetrap(this._elementRef.nativeElement);
- (this._elementRef.nativeElement as HTMLElement).tabIndex = -1;
- (this._elementRef.nativeElement as HTMLElement).style.outline = '0';
+ constructor(private elementRef: ElementRef) {
+ this.mousetrap = new Mousetrap(this.elementRef.nativeElement);
+ (this.elementRef.nativeElement as HTMLElement).tabIndex = -1;
+ (this.elementRef.nativeElement as HTMLElement).style.outline = '0';
}
ngOnInit() {
- for (let hotkey of this.hotkeys) {
+ for (const hotkey of this.hotkeys) {
this.hotkeysList.push(hotkey);
this.bindEvent(hotkey);
}
if (this.cheatSheet) {
- let hotkeyObj: Hotkey = new Hotkey(
+ const hotkeyObj: Hotkey = new Hotkey(
'?',
(event: KeyboardEvent) => {
this.cheatSheet.toggleCheatSheet();
@@ -59,26 +59,27 @@ export class TbHotkeysDirective implements OnInit, OnDestroy {
}
private bindEvent(hotkey: Hotkey): void {
- this.mousetrap.bind((
hotkey).combo, (event: KeyboardEvent, combo: string) => {
+ this.mousetrap.bind((hotkey as Hotkey).combo, (event: KeyboardEvent, combo: string) => {
let shouldExecute = true;
- if(event) {
- let target: HTMLElement = (event.target || event.srcElement);
- let nodeName: string = target.nodeName.toUpperCase();
- if((' ' + target.className + ' ').indexOf(' mousetrap ') > -1) {
+ if (event) {
+ const target: HTMLElement = (event.target || event.srcElement) as HTMLElement;
+ const nodeName: string = target.nodeName.toUpperCase();
+ if ((' ' + target.className + ' ').indexOf(' mousetrap ') > -1) {
shouldExecute = true;
- } else if(this._preventIn.indexOf(nodeName) > -1 && (hotkey).allowIn.map(allow => allow.toUpperCase()).indexOf(nodeName) === -1) {
+ } else if (this.preventIn.indexOf(nodeName) > -1 && (hotkey as Hotkey).
+ allowIn.map(allow => allow.toUpperCase()).indexOf(nodeName) === -1) {
shouldExecute = false;
}
}
- if(shouldExecute) {
- return (hotkey).callback.apply(this, [event, combo]);
+ if (shouldExecute) {
+ return (hotkey as Hotkey).callback.apply(this, [event, combo]);
}
});
}
ngOnDestroy() {
- for (let hotkey of this.hotkeysList) {
+ for (const hotkey of this.hotkeysList) {
this.mousetrap.unbind(hotkey.combo);
}
}
diff --git a/ui-ngx/src/app/shared/components/js-func.component.ts b/ui-ngx/src/app/shared/components/js-func.component.ts
index ddfbeb37f8..215ed1d4df 100644
--- a/ui-ngx/src/app/shared/components/js-func.component.ts
+++ b/ui-ngx/src/app/shared/components/js-func.component.ts
@@ -66,7 +66,7 @@ export class JsFuncComponent implements OnInit, OnDestroy, ControlValueAccessor,
@Input() functionArgs: Array;
- @Input() validationArgs: Array;
+ @Input() validationArgs: Array;
@Input() resultType: string;
diff --git a/ui-ngx/src/app/shared/components/json-form/react/json-form-schema-form.tsx b/ui-ngx/src/app/shared/components/json-form/react/json-form-schema-form.tsx
index 45e9513ef9..153a9b0d7e 100644
--- a/ui-ngx/src/app/shared/components/json-form/react/json-form-schema-form.tsx
+++ b/ui-ngx/src/app/shared/components/json-form/react/json-form-schema-form.tsx
@@ -41,7 +41,7 @@ const tinycolor = tinycolor_;
class ThingsboardSchemaForm extends React.Component {
private hasConditions: boolean;
- private mapper: {[type: string]: any};
+ private readonly mapper: {[type: string]: any};
constructor(props) {
super(props);
diff --git a/ui-ngx/src/app/shared/components/mat-chip-draggable.directive.ts b/ui-ngx/src/app/shared/components/mat-chip-draggable.directive.ts
index 3d20f45a39..32e0dc61ac 100644
--- a/ui-ngx/src/app/shared/components/mat-chip-draggable.directive.ts
+++ b/ui-ngx/src/app/shared/components/mat-chip-draggable.directive.ts
@@ -98,7 +98,7 @@ let globalDraggingChipListId = null;
class DraggableChip {
private chipElement: HTMLElement;
- private handle: HTMLElement;
+ private readonly handle: HTMLElement;
private dragging = false;
private counter = 0;
diff --git a/ui-ngx/src/app/shared/components/nav-tree.component.ts b/ui-ngx/src/app/shared/components/nav-tree.component.ts
index 81d3a303fd..02e221bf92 100644
--- a/ui-ngx/src/app/shared/components/nav-tree.component.ts
+++ b/ui-ngx/src/app/shared/components/nav-tree.component.ts
@@ -103,10 +103,10 @@ export class NavTreeComponent implements OnInit {
private initTree() {
const loadNodes: LoadNodesCallback = (node, cb) => {
- const outCb = (_nodes: NavTreeNode[]) => {
+ const outCb = (nodes: NavTreeNode[]) => {
const copied: NavTreeNode[] = [];
- if (_nodes) {
- _nodes.forEach((n) => {
+ if (nodes) {
+ nodes.forEach((n) => {
copied.push(deepClone(n, ['data']));
});
}
diff --git a/ui-ngx/src/app/shared/components/page.component.ts b/ui-ngx/src/app/shared/components/page.component.ts
index 64922008c4..e027ea2132 100644
--- a/ui-ngx/src/app/shared/components/page.component.ts
+++ b/ui-ngx/src/app/shared/components/page.component.ts
@@ -16,9 +16,9 @@
import { OnDestroy } from '@angular/core';
import { select, Store } from '@ngrx/store';
-import { AppState } from '../../core/core.state';
+import { AppState } from '@core/core.state';
import { Observable, Subscription } from 'rxjs';
-import { selectIsLoading } from '../../core/interceptors/load.selectors';
+import { selectIsLoading } from '@core/interceptors/load.selectors';
import { delay, share } from 'rxjs/operators';
import { AbstractControl } from '@angular/forms';
diff --git a/ui-ngx/src/app/shared/components/time/timewindow-panel.component.html b/ui-ngx/src/app/shared/components/time/timewindow-panel.component.html
index a1c86ee82b..d7c32c5bf2 100644
--- a/ui-ngx/src/app/shared/components/time/timewindow-panel.component.html
+++ b/ui-ngx/src/app/shared/components/time/timewindow-panel.component.html
@@ -63,7 +63,7 @@
aggregation.function
- {{ aggregationTypesTranslations.get(aggregation) | translate }}
+ {{ aggregationTypesTranslations.get(aggregationTypes[aggregation]) | translate }}
diff --git a/ui-ngx/src/app/shared/components/value-input.component.html b/ui-ngx/src/app/shared/components/value-input.component.html
index 741b0f49d5..b7fa9d591d 100644
--- a/ui-ngx/src/app/shared/components/value-input.component.html
+++ b/ui-ngx/src/app/shared/components/value-input.component.html
@@ -25,8 +25,8 @@
{{ valueTypes.get(valueType).name | translate }}
-
- {{ valueTypes.get(valueType).name | translate }}
+
+ {{ valueTypes.get(valueTypeEnum[valueType]).name | translate }}
diff --git a/ui-ngx/src/app/shared/models/alarm.models.ts b/ui-ngx/src/app/shared/models/alarm.models.ts
index cae70c9863..57ce7a373d 100644
--- a/ui-ngx/src/app/shared/models/alarm.models.ts
+++ b/ui-ngx/src/app/shared/models/alarm.models.ts
@@ -116,13 +116,13 @@ export const simulatedAlarm: AlarmInfo = {
originatorName: 'Simulated',
originator: {
entityType: EntityType.DEVICE,
- id: "1"
+ id: '1'
},
type: 'TEMPERATURE',
severity: AlarmSeverity.MAJOR,
status: AlarmStatus.ACTIVE_UNACK,
details: {
- message: "Temperature is high!"
+ message: 'Temperature is high!'
},
propagate: false
};
diff --git a/ui-ngx/src/app/shared/models/page/page-link.ts b/ui-ngx/src/app/shared/models/page/page-link.ts
index 8cd5c7fe56..c60023944d 100644
--- a/ui-ngx/src/app/shared/models/page/page-link.ts
+++ b/ui-ngx/src/app/shared/models/page/page-link.ts
@@ -17,6 +17,7 @@
import { Direction, SortOrder } from '@shared/models/page/sort-order';
import { emptyPageData, PageData } from '@shared/models/page/page-data';
import { getDescendantProp, isObject } from '@core/utils';
+import { SortDirection } from '@angular/material/sort';
export type PageLinkSearchFunction = (entity: T, textSearch: string) => boolean;
@@ -113,6 +114,14 @@ export class PageLink {
return pageData;
}
+ public sortDirection(): SortDirection {
+ if (this.sortOrder) {
+ return (this.sortOrder.direction + '').toLowerCase() as SortDirection;
+ } else {
+ return '' as SortDirection;
+ }
+ }
+
}
export class TimePageLink extends PageLink {
diff --git a/ui-ngx/src/app/shared/models/telemetry/telemetry.models.ts b/ui-ngx/src/app/shared/models/telemetry/telemetry.models.ts
index cf2f9d93db..6d356208ef 100644
--- a/ui-ngx/src/app/shared/models/telemetry/telemetry.models.ts
+++ b/ui-ngx/src/app/shared/models/telemetry/telemetry.models.ts
@@ -46,6 +46,14 @@ export enum TelemetryFeature {
export type TelemetryType = LatestTelemetry | AttributeScope;
+export function toTelemetryType(val: string): TelemetryType {
+ if (LatestTelemetry[val]) {
+ return LatestTelemetry[val];
+ } else {
+ return AttributeScope[val];
+ }
+}
+
export const telemetryTypeTranslations = new Map(
[
[LatestTelemetry.LATEST_TELEMETRY, 'attribute.scope-latest-telemetry'],
diff --git a/ui-ngx/src/karma.conf.js b/ui-ngx/src/karma.conf.js
index 637bf8fbff..1ad4573140 100644
--- a/ui-ngx/src/karma.conf.js
+++ b/ui-ngx/src/karma.conf.js
@@ -16,32 +16,32 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
-module.exports = function (config) {
+module.exports = function(config) {
config.set({
- basePath: '',
- frameworks: ['jasmine', '@angular-devkit/build-angular'],
+ basePath: "",
+ frameworks: ["jasmine", "@angular-devkit/build-angular"],
plugins: [
- require('karma-jasmine'),
- require('karma-chrome-launcher'),
- require('karma-jasmine-html-reporter'),
- require('karma-coverage-istanbul-reporter'),
- require('@angular-devkit/build-angular/plugins/karma')
+ require("karma-jasmine"),
+ require("karma-chrome-launcher"),
+ require("karma-jasmine-html-reporter"),
+ require("karma-coverage-istanbul-reporter"),
+ require("@angular-devkit/build-angular/plugins/karma"),
],
client: {
- clearContext: false // leave Jasmine Spec Runner output visible in browser
+ clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
- dir: require('path').join(__dirname, '../coverage/tb-license-server'),
- reports: ['html', 'lcovonly', 'text-summary'],
- fixWebpackSourcePaths: true
+ dir: require("path").join(__dirname, "../coverage/tb-license-server"),
+ reports: ["html", "lcovonly", "text-summary"],
+ fixWebpackSourcePaths: true,
},
- reporters: ['progress', 'kjhtml'],
+ reporters: ["progress", "kjhtml"],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
- browsers: ['Chrome'],
+ browsers: ["Chrome"],
singleRun: false,
- restartOnFileChange: true
+ restartOnFileChange: true,
});
};
diff --git a/ui-ngx/src/main.ts b/ui-ngx/src/main.ts
index f8673a520d..efc77ee56d 100644
--- a/ui-ngx/src/main.ts
+++ b/ui-ngx/src/main.ts
@@ -19,8 +19,8 @@ import 'hammerjs';
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
-import { AppModule } from './app/app.module';
-import { environment } from './environments/environment';
+import { AppModule } from '@app/app.module';
+import { environment } from '@env/environment';
if (environment.production) {
enableProdMode();
diff --git a/ui-ngx/src/tslint.json b/ui-ngx/src/tslint.json
index 87b632c398..839fcd0d77 100644
--- a/ui-ngx/src/tslint.json
+++ b/ui-ngx/src/tslint.json
@@ -5,7 +5,7 @@
true,
"attribute",
"tb",
- "camelCase"
+ "kebab-case"
],
"component-selector": [
true,