Browse Source

Fix TS warnings. Update RPC shell widgets.

pull/2411/head
Igor Kulikov 6 years ago
parent
commit
ccfebce870
  1. 4
      application/src/main/data/json/system/widget_bundles/control_widgets.json
  2. 20
      ui-ngx/e2e/protractor.conf.js
  3. 20
      ui-ngx/extra-webpack.config.js
  4. 3754
      ui-ngx/package-lock.json
  5. 52
      ui-ngx/package.json
  6. 24
      ui-ngx/proxy.conf.js
  7. 4
      ui-ngx/src/app/app.component.ts
  8. 8
      ui-ngx/src/app/app.module.ts
  9. 4
      ui-ngx/src/app/core/api/data-aggregator.ts
  10. 2
      ui-ngx/src/app/core/auth/auth.actions.ts
  11. 2
      ui-ngx/src/app/core/auth/auth.models.ts
  12. 12
      ui-ngx/src/app/core/auth/auth.service.ts
  13. 208
      ui-ngx/src/app/core/css/css.js
  14. 4
      ui-ngx/src/app/core/http/admin.service.ts
  15. 2
      ui-ngx/src/app/core/http/asset.service.ts
  16. 4
      ui-ngx/src/app/core/http/attribute.service.ts
  17. 6
      ui-ngx/src/app/core/http/audit-log.service.ts
  18. 4
      ui-ngx/src/app/core/http/customer.service.ts
  19. 16
      ui-ngx/src/app/core/http/dashboard.service.ts
  20. 13
      ui-ngx/src/app/core/http/device.service.ts
  21. 4
      ui-ngx/src/app/core/http/entity-relation.service.ts
  22. 15
      ui-ngx/src/app/core/http/entity-view.service.ts
  23. 8
      ui-ngx/src/app/core/http/entity.service.ts
  24. 4
      ui-ngx/src/app/core/http/event.service.ts
  25. 12
      ui-ngx/src/app/core/http/rule-chain.service.ts
  26. 4
      ui-ngx/src/app/core/http/tenant.service.ts
  27. 9
      ui-ngx/src/app/core/http/user.service.ts
  28. 10
      ui-ngx/src/app/core/http/widget.service.ts
  29. 11
      ui-ngx/src/app/core/interceptors/global-http-interceptor.ts
  30. 13
      ui-ngx/src/app/core/services/item-buffer.service.ts
  31. 4
      ui-ngx/src/app/core/services/raf.service.ts
  32. 2
      ui-ngx/src/app/core/utils.ts
  33. 2
      ui-ngx/src/app/modules/home/components/alarm/alarm-table-header.component.html
  34. 1
      ui-ngx/src/app/modules/home/components/alarm/alarm-table-header.component.ts
  35. 2
      ui-ngx/src/app/modules/home/components/attribute/add-attribute-dialog.component.html
  36. 4
      ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.html
  37. 3
      ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.ts
  38. 3
      ui-ngx/src/app/modules/home/components/entity/add-entity-dialog.component.ts
  39. 4
      ui-ngx/src/app/modules/home/components/entity/contact-based.component.ts
  40. 2
      ui-ngx/src/app/modules/home/components/entity/entities-table.component.html
  41. 4
      ui-ngx/src/app/modules/home/components/entity/entity-filter.component.html
  42. 1
      ui-ngx/src/app/modules/home/components/entity/entity-filter.component.ts
  43. 2
      ui-ngx/src/app/modules/home/components/event/event-table-config.ts
  44. 4
      ui-ngx/src/app/modules/home/components/import-export/import-dialog.component.ts
  45. 2
      ui-ngx/src/app/modules/home/components/import-export/import-export.service.ts
  46. 4
      ui-ngx/src/app/modules/home/components/relation/relation-table.component.html
  47. 2
      ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions.component.html
  48. 2
      ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.html
  49. 6
      ui-ngx/src/app/modules/home/components/widget/dialog/custom-dialog-container.component.ts
  50. 4
      ui-ngx/src/app/modules/home/components/widget/legend-config-panel.component.html
  51. 2
      ui-ngx/src/app/modules/home/components/widget/lib/alarm-status-filter-panel.component.html
  52. 1
      ui-ngx/src/app/modules/home/components/widget/lib/alarm-status-filter-panel.component.ts
  53. 2
      ui-ngx/src/app/modules/home/components/widget/lib/alarms-table-widget.component.html
  54. 24
      ui-ngx/src/app/modules/home/components/widget/lib/alarms-table-widget.component.ts
  55. 12
      ui-ngx/src/app/modules/home/components/widget/lib/entities-hierarchy-widget.component.ts
  56. 10
      ui-ngx/src/app/modules/home/components/widget/lib/entities-hierarchy-widget.models.ts
  57. 2
      ui-ngx/src/app/modules/home/components/widget/lib/entities-table-widget.component.html
  58. 27
      ui-ngx/src/app/modules/home/components/widget/lib/entities-table-widget.component.ts
  59. 3
      ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.models.ts
  60. 22
      ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.ts
  61. 180
      ui-ngx/src/app/modules/home/components/widget/lib/table-widget.models.ts
  62. 2
      ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.html
  63. 50
      ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts
  64. 4
      ui-ngx/src/app/modules/home/components/widget/widget-config.component.ts
  65. 6
      ui-ngx/src/app/modules/home/home.component.html
  66. 2
      ui-ngx/src/app/modules/home/home.component.ts
  67. 10
      ui-ngx/src/app/modules/home/models/dashboard-component.models.ts
  68. 56
      ui-ngx/src/app/modules/home/models/widget-component.models.ts
  69. 4
      ui-ngx/src/app/modules/home/pages/admin/admin-routing.module.ts
  70. 2
      ui-ngx/src/app/modules/home/pages/dashboard/states/manage-dashboard-states-dialog.component.html
  71. 8
      ui-ngx/src/app/modules/home/pages/dashboard/states/state-controller.component.ts
  72. 1
      ui-ngx/src/app/modules/home/pages/dashboard/states/states-component.directive.ts
  73. 2
      ui-ngx/src/app/modules/home/pages/device/device-credentials-dialog.component.html
  74. 30
      ui-ngx/src/app/modules/home/pages/rulechain/rulechain-page.component.ts
  75. 3
      ui-ngx/src/app/modules/home/pages/rulechain/rulechain-routing.module.ts
  76. 1
      ui-ngx/src/app/modules/home/pages/rulechain/rulenode.component.ts
  77. 2
      ui-ngx/src/app/modules/home/pages/user/add-user-dialog.component.html
  78. 1
      ui-ngx/src/app/modules/home/pages/user/add-user-dialog.component.ts
  79. 10
      ui-ngx/src/app/modules/home/pages/widget/select-widget-type-dialog.component.html
  80. 2
      ui-ngx/src/app/modules/home/pages/widget/widget-editor.component.html
  81. 3
      ui-ngx/src/app/modules/home/pages/widget/widget-library.component.ts
  82. 4
      ui-ngx/src/app/modules/login/login-routing.module.ts
  83. 12
      ui-ngx/src/app/modules/login/pages/login/create-password.component.ts
  84. 7
      ui-ngx/src/app/modules/login/pages/login/login.component.ts
  85. 7
      ui-ngx/src/app/modules/login/pages/login/reset-password-request.component.ts
  86. 10
      ui-ngx/src/app/modules/login/pages/login/reset-password.component.ts
  87. 2
      ui-ngx/src/app/shared/components/breadcrumb.component.ts
  88. 6
      ui-ngx/src/app/shared/components/cheatsheet.component.ts
  89. 2
      ui-ngx/src/app/shared/components/entity/entity-list-select.component.ts
  90. 2
      ui-ngx/src/app/shared/components/entity/entity-select.component.ts
  91. 2
      ui-ngx/src/app/shared/components/entity/entity-type-select.component.ts
  92. 3
      ui-ngx/src/app/shared/components/fab-toolbar.component.ts
  93. 1
      ui-ngx/src/app/shared/components/help.component.ts
  94. 33
      ui-ngx/src/app/shared/components/hotkeys.directive.ts
  95. 2
      ui-ngx/src/app/shared/components/js-func.component.ts
  96. 2
      ui-ngx/src/app/shared/components/json-form/react/json-form-schema-form.tsx
  97. 2
      ui-ngx/src/app/shared/components/mat-chip-draggable.directive.ts
  98. 6
      ui-ngx/src/app/shared/components/nav-tree.component.ts
  99. 4
      ui-ngx/src/app/shared/components/page.component.ts
  100. 2
      ui-ngx/src/app/shared/components/time/timewindow-panel.component.html

4
application/src/main/data/json/system/widget_bundles/control_widgets.json

File diff suppressed because one or more lines are too long

20
ui-ngx/e2e/protractor.conf.js

@ -16,28 +16,28 @@
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
const { SpecReporter } = require("jasmine-spec-reporter");
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
"./src/**/*.e2e-spec.ts",
],
capabilities: {
'browserName': 'chrome'
"browserName": "chrome",
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
baseUrl: "http://localhost:4200/",
framework: "jasmine",
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
print: function() {},
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.e2e.json')
require("ts-node").register({
project: require("path").join(__dirname, "./tsconfig.e2e.json"),
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};
},
};

20
ui-ngx/extra-webpack.config.js

@ -13,23 +13,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const CompressionPlugin = require('compression-webpack-plugin');
const webpack = require('webpack');
const dirTree = require('directory-tree');
const CompressionPlugin = require("compression-webpack-plugin");
const webpack = require("webpack");
const dirTree = require("directory-tree");
var langs = [];
dirTree('./src/assets/locale/', {extensions:/\.json$/}, (item) => {
dirTree("./src/assets/locale/", {extensions: /\.json$/}, (item) => {
/* It is expected what the name of a locale file has the following format: */
/* 'locale.constant-LANG_CODE[_REGION_CODE].json', e.g. locale.constant-es.json or locale.constant-zh_CN.json*/
langs.push(item.name.slice(item.name.lastIndexOf('-') + 1, -5));
langs.push(item.name.slice(item.name.lastIndexOf("-") + 1, -5));
});
module.exports = {
plugins: [
new webpack.DefinePlugin({
TB_VERSION: JSON.stringify(require('./package.json').version),
SUPPORTED_LANGS: JSON.stringify(langs)
TB_VERSION: JSON.stringify(require("./package.json").version),
SUPPORTED_LANGS: JSON.stringify(langs),
}),
new CompressionPlugin({
filename: "[path].gz[query]",
@ -37,7 +37,7 @@ module.exports = {
test: /\.js$|\.css$|\.html$|\.svg?.+$|\.jpg$|\.ttf?.+$|\.woff?.+$|\.eot?.+$|\.json$/,
threshold: 10240,
minRatio: 0.8,
deleteOriginalAssets: false
})
]
deleteOriginalAssets: false,
}),
],
};

3754
ui-ngx/package-lock.json

File diff suppressed because it is too large

52
ui-ngx/package.json

@ -25,24 +25,24 @@
"@angular/router": "~8.2.14",
"@auth0/angular-jwt": "^3.0.1",
"@date-io/date-fns": "^1.3.13",
"@flowjs/flow.js": "^2.13.2",
"@flowjs/flow.js": "^2.14.0",
"@flowjs/ngx-flow": "^0.4.3",
"@mat-datetimepicker/core": "^2.0.1",
"@material-ui/core": "^4.7.2",
"@material-ui/icons": "^4.5.1",
"@material-ui/pickers": "^3.2.8",
"@ngrx/effects": "^8.5.2",
"@ngrx/store": "^8.5.2",
"@ngrx/store-devtools": "^8.5.2",
"@material-ui/core": "^4.9.1",
"@material-ui/icons": "^4.9.1",
"@material-ui/pickers": "^3.2.10",
"@ngrx/effects": "^8.6.0",
"@ngrx/store": "^8.6.0",
"@ngrx/store-devtools": "^8.6.0",
"@ngx-share/core": "^7.1.4",
"@ngx-translate/core": "^11.0.1",
"@ngx-translate/http-loader": "^4.0.0",
"ace-builds": "^1.4.7",
"angular-gridster2": "^8.2.0",
"ace-builds": "^1.4.8",
"angular-gridster2": "^8.3.0",
"angular2-hotkeys": "^2.1.5",
"base64-js": "^1.3.1",
"compass-sass-mixins": "^0.12.7",
"core-js": "^3.5.0",
"core-js": "^3.6.4",
"date-fns": "2.8.1",
"deep-equal": "^1.1.1",
"flot": "git://github.com/thingsboard/flot.git#0.9-work",
@ -51,8 +51,8 @@
"hammerjs": "^2.0.8",
"javascript-detect-element-resize": "^0.5.3",
"jquery": "^3.4.1",
"jquery.terminal": "^2.9.0",
"js-beautify": "^1.10.2",
"jquery.terminal": "^1.5.0",
"js-beautify": "^1.10.3",
"json-schema-defaults": "^0.4.0",
"jstree": "^3.3.8",
"jstree-bootstrap-theme": "^1.0.1",
@ -67,15 +67,15 @@
"objectpath": "^1.2.2",
"prop-types": "^15.7.2",
"raphael": "^2.3.0",
"rc-select": "^9.2.1",
"rc-select": "^9.2.3",
"react": "^16.12.0",
"react-ace": "^8.0.0",
"react-dom": "^16.12.0",
"react-dropzone": "^10.2.1",
"reactcss": "^1.2.3",
"rxjs": "~6.5.3",
"schema-inspector": "^1.6.8",
"screenfull": "^5.0.0",
"rxjs": "^6.5.4",
"schema-inspector": "^1.6.9",
"screenfull": "^5.0.1",
"split.js": "^1.5.11",
"systemjs": "0.21.5",
"tinycolor2": "^1.4.1",
@ -87,24 +87,24 @@
},
"devDependencies": {
"@angular-builders/custom-webpack": "^8.4.1",
"@angular-devkit/build-angular": "^0.803.20",
"@angular/cli": "~8.3.20",
"@angular-devkit/build-angular": "^0.803.24",
"@angular/cli": "^8.3.24",
"@angular/compiler-cli": "~8.2.14",
"@angular/language-service": "~8.2.14",
"@types/flot": "0.0.31",
"@types/jasmine": "~3.5.0",
"@types/jasmine": "^3.5.2",
"@types/jasminewd2": "~2.0.8",
"@types/jquery": "^3.3.31",
"@types/js-beautify": "^1.8.1",
"@types/jstree": "^3.3.39",
"@types/node": "~12.12.17",
"@types/node": "^12.12.26",
"@types/raphael": "^2.1.30",
"@types/react": "^16.9.16",
"@types/react-dom": "^16.9.4",
"@types/react": "^16.9.19",
"@types/react-dom": "^16.9.5",
"@types/tinycolor2": "^1.4.2",
"@types/tooltipster": "0.0.29",
"codelyzer": "~5.2.0",
"compression-webpack-plugin": "^3.0.1",
"codelyzer": "^5.2.1",
"compression-webpack-plugin": "^3.1.0",
"directory-tree": "^2.2.4",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
@ -112,9 +112,9 @@
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"karma-jasmine-html-reporter": "^1.5.2",
"ngrx-store-freeze": "^0.2.4",
"protractor": "~5.4.2",
"protractor": "^5.4.3",
"ts-node": "~8.5.4",
"tslint": "~5.20.1",
"typescript": "~3.5.3"

24
ui-ngx/proxy.conf.js

@ -14,22 +14,22 @@
* limitations under the License.
*/
const ruleNodeUiforwardHost = 'localhost';
const ruleNodeUiforwardHost = "localhost";
const ruleNodeUiforwardPort = 8080;
const PROXY_CONFIG = {
'/api': {
'target': 'http://localhost:8080',
'secure': false
"/api": {
"target": "http://localhost:8080",
"secure": false,
},
'/static/rulenode': {
'target': `http://${ruleNodeUiforwardHost}:${ruleNodeUiforwardPort}`,
'secure': false
"/static/rulenode": {
"target": `http://${ruleNodeUiforwardHost}:${ruleNodeUiforwardPort}`,
"secure": false,
},
'/api/ws': {
'target': 'ws://localhost:8080',
'ws': true
}
}
"/api/ws": {
"target": "ws://localhost:8080",
"ws": true,
},
};
module.exports = PROXY_CONFIG;

4
ui-ngx/src/app/app.component.ts

@ -20,8 +20,8 @@ import { environment as env } from '@env/environment';
import { TranslateService } from '@ngx-translate/core';
import { select, Store } from '@ngrx/store';
import { AppState } from './core/core.state';
import { LocalStorageService } from './core/local-storage/local-storage.service';
import { AppState } from '@core/core.state';
import { LocalStorageService } from '@core/local-storage/local-storage.service';
import { DomSanitizer } from '@angular/platform-browser';
import { MatIconRegistry } from '@angular/material';
import { combineLatest } from 'rxjs';

8
ui-ngx/src/app/app.module.ts

@ -19,12 +19,12 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { CoreModule } from './core/core.module';
import { LoginModule } from './modules/login/login.module';
import { HomeModule } from './modules/home/home.module';
import { CoreModule } from '@core/core.module';
import { LoginModule } from '@modules/login/login.module';
import { HomeModule } from '@home/home.module';
import { AppComponent } from './app.component';
import { DashboardRoutingModule } from './modules/dashboard/dashboard-routing.module';
import { DashboardRoutingModule } from '@modules/dashboard/dashboard-routing.module';
@NgModule({
declarations: [

4
ui-ngx/src/app/core/api/data-aggregator.ts

@ -65,7 +65,7 @@ export class DataAggregator {
private dataBuffer: SubscriptionData = {};
private data: SubscriptionData;
private lastPrevKvPairData: {[key: string]: [number, any]};
private readonly lastPrevKvPairData: {[key: string]: [number, any]};
private aggregationMap: AggregationMap;
@ -74,7 +74,7 @@ export class DataAggregator {
private noAggregation = this.aggregationType === AggregationType.NONE;
private aggregationTimeout = Math.max(this.interval, 1000);
private aggFunction: AggFunction;
private readonly aggFunction: AggFunction;
private intervalTimeoutHandle: Timeout;
private intervalScheduledTime: number;

2
ui-ngx/src/app/core/auth/auth.actions.ts

@ -15,7 +15,7 @@
///
import { Action } from '@ngrx/store';
import { AuthUser, User } from '../../shared/models/user.model';
import { User } from '@shared/models/user.model';
import { AuthPayload } from '@core/auth/auth.models';
export enum AuthActionTypes {

2
ui-ngx/src/app/core/auth/auth.models.ts

@ -14,7 +14,7 @@
/// limitations under the License.
///
import { AuthUser, User } from '../../shared/models/user.model';
import { AuthUser, User } from '@shared/models/user.model';
export interface AuthPayload {
authUser: AuthUser;

12
ui-ngx/src/app/core/auth/auth.service.ts

@ -18,19 +18,19 @@ import { Injectable, NgZone } from '@angular/core';
import { JwtHelperService } from '@auth0/angular-jwt';
import { HttpClient } from '@angular/common/http';
import { combineLatest, forkJoin, Observable, of, throwError } from 'rxjs';
import { catchError, distinctUntilChanged, filter, map, mergeMap, skip, tap } from 'rxjs/operators';
import { forkJoin, Observable, of, throwError } from 'rxjs';
import { catchError, map, mergeMap, tap } from 'rxjs/operators';
import { LoginRequest, LoginResponse, PublicLoginRequest } from '../../shared/models/login.models';
import { LoginRequest, LoginResponse, PublicLoginRequest } from '@shared/models/login.models';
import { ActivatedRoute, Router, UrlTree } from '@angular/router';
import { defaultHttpOptions } from '../http/http-utils';
import { ReplaySubject } from 'rxjs/internal/ReplaySubject';
import { UserService } from '../http/user.service';
import { select, Store } from '@ngrx/store';
import { Store } from '@ngrx/store';
import { AppState } from '../core.state';
import { ActionAuthAuthenticated, ActionAuthLoadUser, ActionAuthUnauthenticated } from './auth.actions';
import { getCurrentAuthState, getCurrentAuthUser, selectIsAuthenticated, selectIsUserLoaded } from './auth.selectors';
import { Authority } from '../../shared/models/authority.enum';
import { getCurrentAuthState, getCurrentAuthUser } from './auth.selectors';
import { Authority } from '@shared/models/authority.enum';
import { ActionSettingsChangeLanguage } from '@app/core/settings/settings.actions';
import { AuthPayload, AuthState } from '@core/auth/auth.models';
import { TranslateService } from '@ngx-translate/core';

208
ui-ngx/src/app/core/css/css.js

@ -17,17 +17,17 @@
/* jshint unused:false */
/* global base64_decode, CSSWizardView, window, console, jQuery */
var fi = function () {
var fi = function() {
this.cssImportStatements = [];
this.cssKeyframeStatements = [];
this.cssRegex = new RegExp('([\\s\\S]*?){([\\s\\S]*?)}', 'gi');
this.cssMediaQueryRegex = '((@media [\\s\\S]*?){([\\s\\S]*?}\\s*?)})';
this.cssKeyframeRegex = '((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})';
this.combinedCSSRegex = '((\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})'; //to match css & media queries together
this.cssCommentsRegex = '(\\/\\*[\\s\\S]*?\\*\\/)';
this.cssImportStatementRegex = new RegExp('@import .*?;', 'gi');
this.cssRegex = new RegExp("([\\s\\S]*?){([\\s\\S]*?)}", "gi");
this.cssMediaQueryRegex = "((@media [\\s\\S]*?){([\\s\\S]*?}\\s*?)})";
this.cssKeyframeRegex = "((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})";
this.combinedCSSRegex = "((\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})"; //to match css & media queries together
this.cssCommentsRegex = "(\\/\\*[\\s\\S]*?\\*\\/)";
this.cssImportStatementRegex = new RegExp("@import .*?;", "gi");
};
/*
@ -37,10 +37,10 @@ var fi = function () {
@return cleanedCSS contains no css comments
*/
fi.prototype.stripComments = function (cssString) {
var regex = new RegExp(this.cssCommentsRegex, 'gi');
fi.prototype.stripComments = function(cssString) {
var regex = new RegExp(this.cssCommentsRegex, "gi");
return cssString.replace(regex, '');
return cssString.replace(regex, "");
};
/*
@ -52,7 +52,7 @@ fi.prototype.stripComments = function (cssString) {
@return object css
*/
fi.prototype.parseCSS = function (source) {
fi.prototype.parseCSS = function(source) {
if (source === undefined) {
return [];
@ -69,17 +69,17 @@ fi.prototype.parseCSS = function (source) {
if (imports !== null) {
this.cssImportStatements.push(imports[0]);
css.push({
selector: '@imports',
type: 'imports',
styles: imports[0]
selector: "@imports",
type: "imports",
styles: imports[0],
});
} else {
break;
}
}
source = source.replace(this.cssImportStatementRegex, '');
source = source.replace(this.cssImportStatementRegex, "");
//get keyframe statements
var keyframesRegex = new RegExp(this.cssKeyframeRegex, 'gi');
var keyframesRegex = new RegExp(this.cssKeyframeRegex, "gi");
var arr;
while (true) {
arr = keyframesRegex.exec(source);
@ -87,44 +87,44 @@ fi.prototype.parseCSS = function (source) {
break;
}
css.push({
selector: '@keyframes',
type: 'keyframes',
styles: arr[0]
selector: "@keyframes",
type: "keyframes",
styles: arr[0],
});
}
source = source.replace(keyframesRegex, '');
source = source.replace(keyframesRegex, "");
//unified regex
var unified = new RegExp(this.combinedCSSRegex, 'gi');
var unified = new RegExp(this.combinedCSSRegex, "gi");
while (true) {
arr = unified.exec(source);
if (arr === null) {
break;
}
var selector = '';
var selector = "";
if (arr[2] === undefined) {
selector = arr[5].split('\r\n').join('\n').trim();
selector = arr[5].split("\r\n").join("\n").trim();
} else {
selector = arr[2].split('\r\n').join('\n').trim();
selector = arr[2].split("\r\n").join("\n").trim();
}
/*
fetch comments and associate it with current selector
*/
var commentsRegex = new RegExp(this.cssCommentsRegex, 'gi');
var commentsRegex = new RegExp(this.cssCommentsRegex, "gi");
var comments = commentsRegex.exec(selector);
if (comments !== null) {
selector = selector.replace(commentsRegex, '').trim();
selector = selector.replace(commentsRegex, "").trim();
}
//determine the type
if (selector.indexOf('@media') !== -1) {
if (selector.indexOf("@media") !== -1) {
//we have a media query
var cssObject = {
selector: selector,
type: 'media',
subStyles: this.parseCSS(arr[3] + '\n}') //recursively parse media query inner css
type: "media",
subStyles: this.parseCSS(arr[3] + "\n}"), //recursively parse media query inner css
};
if (comments !== null) {
cssObject.comments = comments[0];
@ -135,10 +135,10 @@ fi.prototype.parseCSS = function (source) {
var rules = this.parseRules(arr[6]);
var style = {
selector: selector,
rules: rules
rules: rules,
};
if (selector === '@font-face') {
style.type = 'font-face';
if (selector === "@font-face") {
style.type = "font-face";
}
if (comments !== null) {
style.comments = comments[0];
@ -157,9 +157,9 @@ fi.prototype.parseCSS = function (source) {
@param rules, css directive string example
\n\ncolor:white;\n font-size:18px;\n
*/
fi.prototype.parseRules = function (rules) {
fi.prototype.parseRules = function(rules) {
//convert all windows style line endings to unix style line endings
rules = rules.split('\r\n').join('\n');
rules = rules.split("\r\n").join("\n");
var ret = [];
// Split all rules but keep semicolon for base64 url data
@ -171,11 +171,11 @@ fi.prototype.parseRules = function (rules) {
//determine if line is a valid css directive, ie color:white;
line = line.trim();
if (line.indexOf(':') !== -1) {
if (line.indexOf(":") !== -1) {
//line contains :
line = line.split(':');
line = line.split(":");
var cssDirective = line[0].trim();
var cssValue = line.slice(1).join(':').trim();
var cssValue = line.slice(1).join(":").trim();
//more checks
if (cssDirective.length < 1 || cssValue.length < 1) {
@ -186,19 +186,19 @@ fi.prototype.parseRules = function (rules) {
//push rule
ret.push({
directive: cssDirective,
value: cssValue
value: cssValue,
});
} else {
//if there is no ':', but what if it was mis splitted value which starts with base64
if (line.trim().substr(0, 7) == 'base64,') { //hack :)
if (line.trim().substr(0, 7) == "base64,") { //hack :)
ret[ret.length - 1].value += line.trim();
} else {
//add rule, even if it is defective
if (line.length > 0) {
ret.push({
directive: '',
directive: "",
value: line,
defective: true
defective: true,
});
}
}
@ -211,7 +211,7 @@ fi.prototype.parseRules = function (rules) {
just returns the rule having given directive
if not found returns false;
*/
fi.prototype.findCorrespondingRule = function (rules, directive, value) {
fi.prototype.findCorrespondingRule = function(rules, directive, value) {
if (value === undefined) {
value = false;
}
@ -231,7 +231,7 @@ fi.prototype.findCorrespondingRule = function (rules, directive, value) {
Finds styles that have given selector, compress them,
and returns them
*/
fi.prototype.findBySelector = function (cssObjectArray, selector, contains) {
fi.prototype.findBySelector = function(cssObjectArray, selector, contains) {
if (contains === undefined) {
contains = false;
}
@ -263,7 +263,7 @@ fi.prototype.findBySelector = function (cssObjectArray, selector, contains) {
/*
deletes cssObjects having given selector, and returns new array
*/
fi.prototype.deleteBySelector = function (cssObjectArray, selector) {
fi.prototype.deleteBySelector = function(cssObjectArray, selector) {
var ret = [];
for (var i = 0; i < cssObjectArray.length; i++) {
if (cssObjectArray[i].selector !== selector) {
@ -277,7 +277,7 @@ fi.prototype.deleteBySelector = function (cssObjectArray, selector) {
Compresses given cssObjectArray and tries to minimize
selector redundence.
*/
fi.prototype.compressCSS = function (cssObjectArray) {
fi.prototype.compressCSS = function(cssObjectArray) {
var compressed = [];
var done = {};
for (var i = 0; i < cssObjectArray.length; i++) {
@ -315,19 +315,19 @@ fi.prototype.compressCSS = function (cssObjectArray) {
@return diff css object contains changed values in css1 in regards to css2 see test input output in /test/data/css.js
*/
fi.prototype.cssDiff = function (css1, css2) {
fi.prototype.cssDiff = function(css1, css2) {
if (css1.selector !== css2.selector) {
return false;
}
//if one of them is media query return false, because diff function can not operate on media queries
if ((css1.type === 'media' || css2.type === 'media')) {
if ((css1.type === "media" || css2.type === "media")) {
return false;
}
var diff = {
selector: css1.selector,
rules: []
rules: [],
};
var rule1, rule2;
for (var i = 0; i < css1.rules.length; i++) {
@ -352,12 +352,11 @@ fi.prototype.cssDiff = function (css1, css2) {
rule1 = this.findCorrespondingRule(css1.rules, rule2.directive);
if (rule1 === false) {
//rule1 is a new rule
rule2.type = 'DELETED'; //mark it as a deleted rule, so that other merge operations could be true
rule2.type = "DELETED"; //mark it as a deleted rule, so that other merge operations could be true
diff.rules.push(rule2);
}
}
if (diff.rules.length === 0) {
return false;
}
@ -373,18 +372,17 @@ fi.prototype.cssDiff = function (css1, css2) {
@param reverse, [optional], if given true, first parameter will be traversed on reversed order
effectively giving priority to the styles in newArray
*/
fi.prototype.intelligentMerge = function (cssObjectArray, newArray, reverse) {
fi.prototype.intelligentMerge = function(cssObjectArray, newArray, reverse) {
if (reverse === undefined) {
reverse = false;
}
for (var i = 0; i < newArray.length; i++) {
this.intelligentCSSPush(cssObjectArray, newArray[i], reverse);
}
for (i = 0; i < cssObjectArray.length; i++) {
var cobj = cssObjectArray[i];
if (cobj.type === 'media' || (cobj.type === 'keyframes')) {
if (cobj.type === "media" || (cobj.type === "keyframes")) {
continue;
}
cobj.rules = this.compactRules(cobj.rules);
@ -400,7 +398,7 @@ fi.prototype.intelligentMerge = function (cssObjectArray, newArray, reverse) {
@param reverse [optional] default is false, if given, cssObjectArray will be reversly traversed
resulting more priority in minimalObject's styles
*/
fi.prototype.intelligentCSSPush = function (cssObjectArray, minimalObject, reverse) {
fi.prototype.intelligentCSSPush = function(cssObjectArray, minimalObject, reverse) {
var pushSelector = minimalObject.selector;
//find correct selector if not found just push minimalObject into cssObject
var cssObject = false;
@ -428,15 +426,15 @@ fi.prototype.intelligentCSSPush = function (cssObjectArray, minimalObject, rever
if (cssObject === false) {
cssObjectArray.push(minimalObject); //just push, because cssSelector is new
} else {
if (minimalObject.type !== 'media') {
if (minimalObject.type !== "media") {
for (var ii = 0; ii < minimalObject.rules.length; ii++) {
var rule = minimalObject.rules[ii];
//find rule inside cssObject
var oldRule = this.findCorrespondingRule(cssObject.rules, rule.directive);
if (oldRule === false) {
cssObject.rules.push(rule);
} else if (rule.type == 'DELETED') {
oldRule.type = 'DELETED';
} else if (rule.type == "DELETED") {
oldRule.type = "DELETED";
} else {
//rule found just update value
@ -457,10 +455,10 @@ fi.prototype.intelligentCSSPush = function (cssObjectArray, minimalObject, rever
@returns rules array, compacted by deleting all unneccessary rules
*/
fi.prototype.compactRules = function (rules) {
fi.prototype.compactRules = function(rules) {
var newRules = [];
for (var i = 0; i < rules.length; i++) {
if (rules[i].type !== 'DELETED') {
if (rules[i].type !== "DELETED") {
newRules.push(rules[i]);
}
}
@ -471,18 +469,18 @@ fi.prototype.compactRules = function (rules) {
@param [optional] cssBase, if given computes cssString from cssObject array
*/
fi.prototype.getCSSForEditor = function (cssBase, depth) {
fi.prototype.getCSSForEditor = function(cssBase, depth) {
if (depth === undefined) {
depth = 0;
}
var ret = '';
var ret = "";
if (cssBase === undefined) {
cssBase = this.css;
}
//append imports
for (var i = 0; i < cssBase.length; i++) {
if (cssBase[i].type == 'imports') {
ret += cssBase[i].styles + '\n\n';
if (cssBase[i].type == "imports") {
ret += cssBase[i].styles + "\n\n";
}
}
for (i = 0; i < cssBase.length; i++) {
@ -492,34 +490,34 @@ fi.prototype.getCSSForEditor = function (cssBase, depth) {
}
var comments = "";
if (tmp.comments !== undefined) {
comments = tmp.comments + '\n';
comments = tmp.comments + "\n";
}
if (tmp.type == 'media') { //also put media queries to output
ret += comments + tmp.selector + '{\n';
if (tmp.type == "media") { //also put media queries to output
ret += comments + tmp.selector + "{\n";
ret += this.getCSSForEditor(tmp.subStyles, depth + 1);
ret += '}\n\n';
} else if (tmp.type !== 'keyframes' && tmp.type !== 'imports') {
ret += this.getSpaces(depth) + comments + tmp.selector + ' {\n';
ret += "}\n\n";
} else if (tmp.type !== "keyframes" && tmp.type !== "imports") {
ret += this.getSpaces(depth) + comments + tmp.selector + " {\n";
ret += this.getCSSOfRules(tmp.rules, depth + 1);
ret += this.getSpaces(depth) + '}\n\n';
ret += this.getSpaces(depth) + "}\n\n";
}
}
//append keyFrames
for (i = 0; i < cssBase.length; i++) {
if (cssBase[i].type == 'keyframes') {
ret += cssBase[i].styles + '\n\n';
if (cssBase[i].type == "keyframes") {
ret += cssBase[i].styles + "\n\n";
}
}
return ret;
};
fi.prototype.getImports = function (cssObjectArray) {
fi.prototype.getImports = function(cssObjectArray) {
var imps = [];
for (var i = 0; i < cssObjectArray.length; i++) {
if (cssObjectArray[i].type == 'imports') {
if (cssObjectArray[i].type == "imports") {
imps.push(cssObjectArray[i].styles);
}
}
@ -529,30 +527,30 @@ fi.prototype.getImports = function (cssObjectArray) {
given rules array, returns visually formatted css string
to be used inside editor
*/
fi.prototype.getCSSOfRules = function (rules, depth) {
var ret = '';
fi.prototype.getCSSOfRules = function(rules, depth) {
var ret = "";
for (var i = 0; i < rules.length; i++) {
if (rules[i] === undefined) {
continue;
}
if (rules[i].defective === undefined) {
ret += this.getSpaces(depth) + rules[i].directive + ' : ' + rules[i].value + ';\n';
ret += this.getSpaces(depth) + rules[i].directive + " : " + rules[i].value + ";\n";
} else {
ret += this.getSpaces(depth) + rules[i].value + ';\n';
ret += this.getSpaces(depth) + rules[i].value + ";\n";
}
}
return ret || '\n';
return ret || "\n";
};
/*
A very simple helper function returns number of spaces appended in a single string,
the number depends input parameter, namely input*2
*/
fi.prototype.getSpaces = function (num) {
var ret = '';
fi.prototype.getSpaces = function(num) {
var ret = "";
for (var i = 0; i < num * 4; i++) {
ret += ' ';
ret += " ";
}
return ret;
};
@ -563,14 +561,14 @@ fi.prototype.getSpaces = function (num) {
@returns css string in which this.cssPreviewNamespace prepended
*/
fi.prototype.applyNamespacing = function (css, forcedNamespace) {
fi.prototype.applyNamespacing = function(css, forcedNamespace) {
var cssObjectArray = css;
var namespaceClass = '.' + this.cssPreviewNamespace;
var namespaceClass = "." + this.cssPreviewNamespace;
if (forcedNamespace !== undefined) {
namespaceClass = forcedNamespace;
}
if (typeof css === 'string') {
if (typeof css === "string") {
cssObjectArray = this.parseCSS(css);
}
@ -578,21 +576,21 @@ fi.prototype.applyNamespacing = function (css, forcedNamespace) {
var obj = cssObjectArray[i];
//bypass namespacing for @font-face @keyframes @import
if (obj.selector.indexOf('@font-face') > -1 || obj.selector.indexOf('keyframes') > -1 || obj.selector.indexOf('@import') > -1 || obj.selector.indexOf('.form-all') > -1 || obj.selector.indexOf('#stage') > -1) {
if (obj.selector.indexOf("@font-face") > -1 || obj.selector.indexOf("keyframes") > -1 || obj.selector.indexOf("@import") > -1 || obj.selector.indexOf(".form-all") > -1 || obj.selector.indexOf("#stage") > -1) {
continue;
}
if (obj.type !== 'media') {
var selector = obj.selector.split(',');
if (obj.type !== "media") {
var selector = obj.selector.split(",");
var newSelector = [];
for (var j = 0; j < selector.length; j++) {
if (selector[j].indexOf('.supernova') === -1) { //do not apply namespacing to selectors including supernova
newSelector.push(namespaceClass + ' ' + selector[j]);
if (selector[j].indexOf(".supernova") === -1) { //do not apply namespacing to selectors including supernova
newSelector.push(namespaceClass + " " + selector[j]);
} else {
newSelector.push(selector[j]);
}
}
obj.selector = newSelector.join(',');
obj.selector = newSelector.join(",");
} else {
obj.subStyles = this.applyNamespacing(obj.subStyles, forcedNamespace); //handle media queries as well
}
@ -605,26 +603,26 @@ fi.prototype.applyNamespacing = function (css, forcedNamespace) {
given css string or object array, clears possible namespacing from
all of the selectors inside the css
*/
fi.prototype.clearNamespacing = function (css, returnObj) {
fi.prototype.clearNamespacing = function(css, returnObj) {
if (returnObj === undefined) {
returnObj = false;
}
var cssObjectArray = css;
var namespaceClass = '.' + this.cssPreviewNamespace;
if (typeof css === 'string') {
var namespaceClass = "." + this.cssPreviewNamespace;
if (typeof css === "string") {
cssObjectArray = this.parseCSS(css);
}
for (var i = 0; i < cssObjectArray.length; i++) {
var obj = cssObjectArray[i];
if (obj.type !== 'media') {
var selector = obj.selector.split(',');
if (obj.type !== "media") {
var selector = obj.selector.split(",");
var newSelector = [];
for (var j = 0; j < selector.length; j++) {
newSelector.push(selector[j].split(namespaceClass + ' ').join(''));
newSelector.push(selector[j].split(namespaceClass + " ").join(""));
}
obj.selector = newSelector.join(',');
obj.selector = newSelector.join(",");
} else {
obj.subStyles = this.clearNamespacing(obj.subStyles, true); //handle media queries as well
}
@ -641,17 +639,17 @@ fi.prototype.clearNamespacing = function (css, returnObj) {
creates a new style tag (also destroys the previous one)
and injects given css string into that css tag
*/
fi.prototype.createStyleElement = function (id, css, format) {
fi.prototype.createStyleElement = function(id, css, format) {
if (format === undefined) {
format = false;
}
if (this.testMode === false && format !== 'nonamespace') {
if (this.testMode === false && format !== "nonamespace") {
//apply namespacing classes
css = this.applyNamespacing(css);
}
if (typeof css != 'string') {
if (typeof css != "string") {
css = this.getCSSForEditor(css);
}
//apply formatting for css
@ -660,7 +658,7 @@ fi.prototype.createStyleElement = function (id, css, format) {
}
if (this.testMode !== false) {
return this.testMode('create style #' + id, css); //if test mode, just pass result to callback
return this.testMode("create style #" + id, css); //if test mode, just pass result to callback
}
var __el = document.getElementById(id);
@ -668,11 +666,11 @@ fi.prototype.createStyleElement = function (id, css, format) {
__el.parentNode.removeChild(__el);
}
var head = document.head || document.getElementsByTagName('head')[0],
style = document.createElement('style');
var head = document.head || document.getElementsByTagName("head")[0],
style = document.createElement("style");
style.id = id;
style.type = 'text/css';
style.type = "text/css";
head.appendChild(style);

4
ui-ngx/src/app/core/http/admin.service.ts

@ -15,8 +15,8 @@
///
import { Injectable } from '@angular/core';
import { defaultHttpOptions, defaultHttpOptionsFromConfig, RequestConfig } from './http-utils';
import { Observable } from 'rxjs/index';
import { defaultHttpOptionsFromConfig, RequestConfig } from './http-utils';
import { Observable } from 'rxjs';
import { HttpClient } from '@angular/common/http';
import { AdminSettings, MailServerSettings, SecuritySettings, UpdateMessage } from '@shared/models/settings.models';

2
ui-ngx/src/app/core/http/asset.service.ts

@ -16,7 +16,7 @@
import { Injectable } from '@angular/core';
import { defaultHttpOptionsFromConfig, RequestConfig } from './http-utils';
import { Observable } from 'rxjs/index';
import { Observable } from 'rxjs';
import { HttpClient } from '@angular/common/http';
import { PageLink } from '@shared/models/page/page-link';
import { PageData } from '@shared/models/page/page-data';

4
ui-ngx/src/app/core/http/attribute.service.ts

@ -15,8 +15,8 @@
///
import { Injectable } from '@angular/core';
import { defaultHttpOptions, defaultHttpOptionsFromConfig, RequestConfig } from './http-utils';
import { forkJoin, Observable, of } from 'rxjs/index';
import { defaultHttpOptionsFromConfig, RequestConfig } from './http-utils';
import { forkJoin, Observable, of } from 'rxjs';
import { HttpClient } from '@angular/common/http';
import { EntityId } from '@shared/models/id/entity-id';
import { AttributeData, AttributeScope } from '@shared/models/telemetry/telemetry.models';

6
ui-ngx/src/app/core/http/audit-log.service.ts

@ -15,10 +15,10 @@
///
import { Injectable } from '@angular/core';
import { defaultHttpOptions, defaultHttpOptionsFromConfig, RequestConfig } from './http-utils';
import { Observable } from 'rxjs/index';
import { defaultHttpOptionsFromConfig, RequestConfig } from './http-utils';
import { Observable } from 'rxjs';
import { HttpClient } from '@angular/common/http';
import { PageLink, TimePageLink } from '@shared/models/page/page-link';
import { TimePageLink } from '@shared/models/page/page-link';
import { PageData } from '@shared/models/page/page-data';
import { AuditLog } from '@shared/models/audit-log.models';
import { EntityId } from '@shared/models/id/entity-id';

4
ui-ngx/src/app/core/http/customer.service.ts

@ -15,8 +15,8 @@
///
import { Injectable } from '@angular/core';
import { defaultHttpOptions, defaultHttpOptionsFromConfig, RequestConfig } from './http-utils';
import { Observable } from 'rxjs/index';
import { defaultHttpOptionsFromConfig, RequestConfig } from './http-utils';
import { Observable } from 'rxjs';
import { HttpClient } from '@angular/common/http';
import { PageLink } from '@shared/models/page/page-link';
import { PageData } from '@shared/models/page/page-data';

16
ui-ngx/src/app/core/http/dashboard.service.ts

@ -14,15 +14,15 @@
/// limitations under the License.
///
import {Inject, Injectable} from '@angular/core';
import { Inject, Injectable } from '@angular/core';
import { defaultHttpOptions, defaultHttpOptionsFromConfig, RequestConfig } from './http-utils';
import { Observable, ReplaySubject, Subject } from 'rxjs/index';
import {HttpClient} from '@angular/common/http';
import {PageLink} from '@shared/models/page/page-link';
import {PageData} from '@shared/models/page/page-data';
import {Dashboard, DashboardInfo} from '@shared/models/dashboard.models';
import {WINDOW} from '@core/services/window.service';
import { ActivationEnd, NavigationEnd, Router } from '@angular/router';
import { Observable } from 'rxjs';
import { HttpClient } from '@angular/common/http';
import { PageLink } from '@shared/models/page/page-link';
import { PageData } from '@shared/models/page/page-data';
import { Dashboard, DashboardInfo } from '@shared/models/dashboard.models';
import { WINDOW } from '@core/services/window.service';
import { NavigationEnd, Router } from '@angular/router';
import { filter, map, publishReplay, refCount } from 'rxjs/operators';
// @dynamic

13
ui-ngx/src/app/core/http/device.service.ts

@ -15,17 +15,14 @@
///
import { Injectable } from '@angular/core';
import { defaultHttpOptions, defaultHttpOptionsFromConfig, RequestConfig } from './http-utils';
import { Observable, Subject, ReplaySubject } from 'rxjs/index';
import { defaultHttpOptionsFromConfig, RequestConfig } from './http-utils';
import { Observable, ReplaySubject } from 'rxjs';
import { HttpClient } from '@angular/common/http';
import { PageLink } from '@shared/models/page/page-link';
import { PageData } from '@shared/models/page/page-data';
import { Tenant } from '@shared/models/tenant.model';
import {DashboardInfo, Dashboard} from '@shared/models/dashboard.models';
import {map} from 'rxjs/operators';
import { DeviceInfo, Device, DeviceCredentials, DeviceSearchQuery } from '@app/shared/models/device.models';
import {EntitySubtype} from '@app/shared/models/entity-type.models';
import {AuthService} from '../auth/auth.service';
import { Device, DeviceCredentials, DeviceInfo, DeviceSearchQuery } from '@app/shared/models/device.models';
import { EntitySubtype } from '@app/shared/models/entity-type.models';
import { AuthService } from '@core/auth/auth.service';
@Injectable({
providedIn: 'root'

4
ui-ngx/src/app/core/http/entity-relation.service.ts

@ -15,8 +15,8 @@
///
import { Injectable } from '@angular/core';
import { defaultHttpOptions, defaultHttpOptionsFromConfig, RequestConfig } from './http-utils';
import { Observable } from 'rxjs/index';
import { defaultHttpOptionsFromConfig, RequestConfig } from './http-utils';
import { Observable } from 'rxjs';
import { HttpClient } from '@angular/common/http';
import { EntityRelation, EntityRelationInfo, EntityRelationsQuery } from '@shared/models/relation.models';
import { EntityId } from '@app/shared/models/id/entity-id';

15
ui-ngx/src/app/core/http/entity-view.service.ts

@ -14,15 +14,14 @@
/// limitations under the License.
///
import {Injectable} from '@angular/core';
import { defaultHttpOptions, defaultHttpOptionsFromConfig, RequestConfig } from './http-utils';
import {Observable} from 'rxjs/index';
import {HttpClient} from '@angular/common/http';
import {PageLink} from '@shared/models/page/page-link';
import {PageData} from '@shared/models/page/page-data';
import {EntitySubtype} from '@app/shared/models/entity-type.models';
import { Injectable } from '@angular/core';
import { defaultHttpOptionsFromConfig, RequestConfig } from './http-utils';
import { Observable } from 'rxjs';
import { HttpClient } from '@angular/common/http';
import { PageLink } from '@shared/models/page/page-link';
import { PageData } from '@shared/models/page/page-data';
import { EntitySubtype } from '@app/shared/models/entity-type.models';
import { EntityView, EntityViewInfo, EntityViewSearchQuery } from '@app/shared/models/entity-view.models';
import { Asset, AssetSearchQuery } from '@shared/models/asset.models';
@Injectable({
providedIn: 'root'

8
ui-ngx/src/app/core/http/entity.service.ts

@ -15,7 +15,7 @@
///
import { Injectable } from '@angular/core';
import { EMPTY, forkJoin, Observable, of, throwError } from 'rxjs/index';
import { EMPTY, forkJoin, Observable, of, throwError } from 'rxjs';
import { HttpClient } from '@angular/common/http';
import { PageLink } from '@shared/models/page/page-link';
import { AliasEntityType, EntityType } from '@shared/models/entity-type.models';
@ -28,7 +28,7 @@ import { UserService } from './user.service';
import { DashboardService } from '@core/http/dashboard.service';
import { Direction } from '@shared/models/page/sort-order';
import { PageData } from '@shared/models/page/page-data';
import { getCurrentAuthUser } from '../auth/auth.selectors';
import { getCurrentAuthUser } from '@core/auth/auth.selectors';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { Authority } from '@shared/models/authority.enum';
@ -44,7 +44,7 @@ import { AliasInfo, StateParams, SubscriptionInfo } from '@core/api/widget-api.m
import { Datasource, DatasourceType, KeyInfo } from '@app/shared/models/widget.models';
import { UtilsService } from '@core/services/utils.service';
import { AliasFilterType, EntityAlias, EntityAliasFilter, EntityAliasFilterResult } from '@shared/models/alias.models';
import { EntityInfo, ImportEntityData, ImportEntitiesResultInfo } from '@shared/models/entity.models';
import { EntityInfo, ImportEntitiesResultInfo, ImportEntityData } from '@shared/models/entity.models';
import {
EntityRelationInfo,
EntityRelationsQuery,
@ -52,7 +52,7 @@ import {
EntitySearchQuery
} from '@shared/models/relation.models';
import { EntityRelationService } from '@core/http/entity-relation.service';
import { isDefined } from '../utils';
import { isDefined } from '@core/utils';
import { Asset, AssetSearchQuery } from '@shared/models/asset.models';
import { Device, DeviceCredentialsType, DeviceSearchQuery } from '@shared/models/device.models';
import { EntityViewSearchQuery } from '@shared/models/entity-view.models';

4
ui-ngx/src/app/core/http/event.service.ts

@ -15,8 +15,8 @@
///
import { Injectable } from '@angular/core';
import { defaultHttpOptions, defaultHttpOptionsFromConfig, RequestConfig } from './http-utils';
import { Observable } from 'rxjs/index';
import { defaultHttpOptionsFromConfig, RequestConfig } from './http-utils';
import { Observable } from 'rxjs';
import { HttpClient } from '@angular/common/http';
import { TimePageLink } from '@shared/models/page/page-link';
import { PageData } from '@shared/models/page/page-data';

12
ui-ngx/src/app/core/http/rule-chain.service.ts

@ -16,22 +16,26 @@
import { ComponentFactory, Injectable } from '@angular/core';
import { defaultHttpOptionsFromConfig, RequestConfig } from './http-utils';
import { forkJoin, Observable, of } from 'rxjs/index';
import { forkJoin, Observable, of } from 'rxjs';
import { HttpClient } from '@angular/common/http';
import { PageLink } from '@shared/models/page/page-link';
import { PageData } from '@shared/models/page/page-data';
import {
ResolvedRuleChainMetaData,
RuleChain, RuleChainConnectionInfo,
RuleChain,
RuleChainConnectionInfo,
RuleChainMetaData,
ruleChainNodeComponent,
ruleNodeTypeComponentTypes, unknownNodeComponent
ruleNodeTypeComponentTypes,
unknownNodeComponent
} from '@shared/models/rule-chain.models';
import { ComponentDescriptorService } from './component-descriptor.service';
import {
IRuleNodeConfigurationComponent,
LinkLabel,
RuleNodeComponentDescriptor, TestScriptInputParams, TestScriptResult
RuleNodeComponentDescriptor,
TestScriptInputParams,
TestScriptResult
} from '@app/shared/models/rule-node.models';
import { ResourcesService } from '../services/resources.service';
import { catchError, map, mergeMap } from 'rxjs/operators';

4
ui-ngx/src/app/core/http/tenant.service.ts

@ -15,8 +15,8 @@
///
import { Injectable } from '@angular/core';
import { defaultHttpOptions, defaultHttpOptionsFromConfig, RequestConfig } from './http-utils';
import { Observable } from 'rxjs/index';
import { defaultHttpOptionsFromConfig, RequestConfig } from './http-utils';
import { Observable } from 'rxjs';
import { HttpClient } from '@angular/common/http';
import { PageLink } from '@shared/models/page/page-link';
import { PageData } from '@shared/models/page/page-data';

9
ui-ngx/src/app/core/http/user.service.ts

@ -15,11 +15,10 @@
///
import { Injectable } from '@angular/core';
import { defaultHttpOptions, defaultHttpOptionsFromConfig, RequestConfig } from './http-utils';
import { User } from '../../shared/models/user.model';
import { Observable } from 'rxjs/index';
import { HttpClient, HttpResponse } from '@angular/common/http';
import { AdminSettings } from '@shared/models/settings.models';
import { defaultHttpOptionsFromConfig, RequestConfig } from './http-utils';
import { User } from '@shared/models/user.model';
import { Observable } from 'rxjs';
import { HttpClient } from '@angular/common/http';
import { PageLink } from '@shared/models/page/page-link';
import { PageData } from '@shared/models/page/page-data';

10
ui-ngx/src/app/core/http/widget.service.ts

@ -15,18 +15,18 @@
///
import { Injectable } from '@angular/core';
import { defaultHttpOptions, defaultHttpOptionsFromConfig, RequestConfig } from './http-utils';
import { Observable, Subject, of, ReplaySubject } from 'rxjs/index';
import { defaultHttpOptionsFromConfig, RequestConfig } from './http-utils';
import { Observable, of, ReplaySubject, Subject } from 'rxjs';
import { HttpClient } from '@angular/common/http';
import { PageLink } from '@shared/models/page/page-link';
import { PageData } from '@shared/models/page/page-data';
import { WidgetsBundle } from '@shared/models/widgets-bundle.model';
import { Widget, WidgetType, widgetType, WidgetTypeData, widgetTypesData } from '@shared/models/widget.models';
import { Widget, WidgetType, widgetType, widgetTypesData } from '@shared/models/widget.models';
import { UtilsService } from '@core/services/utils.service';
import { TranslateService } from '@ngx-translate/core';
import { ResourcesService } from '../services/resources.service';
import { toWidgetInfo, WidgetInfo, toWidgetType } from '@app/modules/home/models/widget-component.models';
import { map, tap, mergeMap, filter } from 'rxjs/operators';
import { toWidgetInfo, toWidgetType, WidgetInfo } from '@app/modules/home/models/widget-component.models';
import { filter, map, mergeMap, tap } from 'rxjs/operators';
import { WidgetTypeId } from '@shared/models/id/widget-type-id';
import { NULL_UUID } from '@shared/models/id/has-uuid';
import { ActivationEnd, Router } from '@angular/router';

11
ui-ngx/src/app/core/interceptors/global-http-interceptor.ts

@ -24,15 +24,15 @@ import {
} from '@angular/common/http';
import { Observable } from 'rxjs/internal/Observable';
import { Inject, Injectable } from '@angular/core';
import { AuthService } from '../auth/auth.service';
import { Constants } from '../../shared/models/constants';
import { AuthService } from '@core/auth/auth.service';
import { Constants } from '@shared/models/constants';
import { InterceptorHttpParams } from './interceptor-http-params';
import {catchError, delay, switchMap, tap, map, mergeMap} from 'rxjs/operators';
import { catchError, delay, mergeMap, switchMap, tap } from 'rxjs/operators';
import { throwError } from 'rxjs/internal/observable/throwError';
import { of } from 'rxjs/internal/observable/of';
import { InterceptorConfig } from './interceptor-config';
import { Store } from '@ngrx/store';
import { AppState } from '../core.state';
import { AppState } from '@core/core.state';
import { ActionLoadFinish, ActionLoadStart } from './load.actions';
import { ActionNotificationShow } from '@app/core/notification/notification.actions';
import { DialogService } from '@core/services/dialog.service';
@ -127,7 +127,8 @@ export class GlobalHttpInterceptor implements HttpInterceptor {
const resendRequest = config.resendRequest;
const errorCode = errorResponse.error ? errorResponse.error.errorCode : null;
if (errorResponse.error && errorResponse.error.refreshTokenPending || errorResponse.status === 401) {
if (errorResponse.error && errorResponse.error.refreshTokenPending || errorCode && errorCode === Constants.serverErrorCode.jwtTokenExpired) {
if (errorResponse.error && errorResponse.error.refreshTokenPending ||
errorCode && errorCode === Constants.serverErrorCode.jwtTokenExpired) {
return this.refreshTokenAndRetry(req, next);
} else if (errorCode !== Constants.serverErrorCode.credentialsExpired) {
unhandled = true;

13
ui-ngx/src/app/core/services/item-buffer.service.ts

@ -240,7 +240,10 @@ export class ItemBufferService {
nodes: [],
connections: []
};
let top = -1, left = -1, bottom = -1, right = -1;
let top = -1;
let left = -1;
let bottom = -1;
let right = -1;
for (let i = 0; i < nodes.length; i++) {
const origNode = nodes[i];
const node: FcRuleNode = {
@ -253,7 +256,7 @@ export class ItemBufferService {
y: origNode.y,
name: origNode.name,
componentClazz: origNode.component.clazz,
}
};
if (origNode.targetRuleChainId) {
node.targetRuleChainId = origNode.targetRuleChainId;
}
@ -261,7 +264,7 @@ export class ItemBufferService {
node.error = origNode.error;
}
ruleNodes.nodes.push(node);
if (i==0) {
if (i === 0) {
top = node.y;
left = node.x;
bottom = node.y + 50;
@ -273,8 +276,8 @@ export class ItemBufferService {
right = Math.max(right, node.x + 170);
}
}
ruleNodes.originX = left + (right-left)/2;
ruleNodes.originY = top + (bottom-top)/2;
ruleNodes.originX = left + (right - left) / 2;
ruleNodes.originY = top + (bottom - top) / 2;
connections.forEach(connection => {
ruleNodes.connections.push(connection);
});

4
ui-ngx/src/app/core/services/raf.service.ts

@ -26,8 +26,8 @@ export type CancelAnimationFrame = () => void;
})
export class RafService {
private rafFunction: (frameCallback: () => void) => CancelAnimationFrame;
private rafSupported: boolean;
private readonly rafFunction: (frameCallback: () => void) => CancelAnimationFrame;
private readonly rafSupported: boolean;
constructor(
@Inject(WINDOW) private window: Window,

2
ui-ngx/src/app/core/utils.ts

@ -400,5 +400,5 @@ export function snakeCase(name: string, separator: string): string {
}
export function getDescendantProp(obj: any, path: string): any {
return path.split('.').reduce((acc, part) => acc && acc[part], obj)
return path.split('.').reduce((acc, part) => acc && acc[part], obj);
}

2
ui-ngx/src/app/modules/home/components/alarm/alarm-table-header.component.html

@ -21,7 +21,7 @@
<mat-select matInput [ngModel]="alarmTableConfig.searchStatus"
(ngModelChange)="searchStatusChanged($event)">
<mat-option *ngFor="let status of alarmSearchStatusTypes" [value]="status">
{{ alarmSearchStatusTranslationsMap.get(status) | translate }}
{{ alarmSearchStatusTranslationsMap.get(alarmSearchStatusEnum[status]) | translate }}
</mat-option>
</mat-select>
</mat-form-field>

1
ui-ngx/src/app/modules/home/components/alarm/alarm-table-header.component.ts

@ -31,6 +31,7 @@ export class AlarmTableHeaderComponent extends EntityTableHeaderComponent<AlarmI
alarmSearchStatusTranslationsMap = alarmSearchStatusTranslations;
alarmSearchStatusTypes = Object.keys(AlarmSearchStatus);
alarmSearchStatusEnum = AlarmSearchStatus;
get alarmTableConfig(): AlarmTableConfig {
return this.entitiesTableConfig as AlarmTableConfig;

2
ui-ngx/src/app/modules/home/components/attribute/add-attribute-dialog.component.html

@ -15,7 +15,7 @@
limitations under the License.
-->
<form #attributeForm="ngForm" [formGroup]="attributeFormGroup" (ngSubmit)="add()" style="min-width: 400px;">
<form [formGroup]="attributeFormGroup" (ngSubmit)="add()" style="min-width: 400px;">
<mat-toolbar fxLayout="row" color="primary">
<h2>{{ 'attribute.add' | translate }}</h2>
<span fxFlex></span>

4
ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.html

@ -26,7 +26,7 @@
matInput [ngModel]="attributeScope"
(ngModelChange)="attributeScopeChanged($event)">
<mat-option *ngFor="let scope of attributeScopes" [value]="scope">
{{ telemetryTypeTranslationsMap.get(scope) | translate }}
{{ telemetryTypeTranslationsMap.get(toTelemetryTypeFunc(scope)) | translate }}
</mat-option>
</mat-select>
</mat-form-field>
@ -135,7 +135,7 @@
</mat-toolbar>
<div fxFlex class="table-container" [fxShow]="mode !== 'widget'">
<mat-table [dataSource]="dataSource"
matSort [matSortActive]="pageLink.sortOrder.property" [matSortDirection]="(pageLink.sortOrder.direction + '').toLowerCase()" matSortDisableClear>
matSort [matSortActive]="pageLink.sortOrder.property" [matSortDirection]="pageLink.sortDirection()" matSortDisableClear>
<ng-container matColumnDef="select" sticky>
<mat-header-cell *matHeaderCellDef>
<mat-checkbox (change)="$event ? dataSource.masterToggle() : null"

3
ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.ts

@ -45,7 +45,7 @@ import {
isClientSideTelemetryType,
LatestTelemetry,
TelemetryType,
telemetryTypeTranslations
telemetryTypeTranslations, toTelemetryType
} from '@shared/models/telemetry/telemetry.models';
import { AttributeDatasource } from '@home/models/datasource/attribute-datasource';
import { AttributeService } from '@app/core/http/attribute.service';
@ -98,6 +98,7 @@ export class AttributeTableComponent extends PageComponent implements AfterViewI
attributeScopes: Array<string> = [];
attributeScope: TelemetryType;
toTelemetryTypeFunc = toTelemetryType;
displayedColumns = ['select', 'lastUpdateTs', 'key', 'value'];
pageLink: PageLink;

3
ui-ngx/src/app/modules/home/components/entity/add-entity-dialog.component.ts

@ -36,7 +36,8 @@ import { Router } from '@angular/router';
providers: [{provide: ErrorStateMatcher, useExisting: AddEntityDialogComponent}],
styleUrls: ['./add-entity-dialog.component.scss']
})
export class AddEntityDialogComponent extends DialogComponent<AddEntityDialogComponent, BaseData<HasId>> implements OnInit, ErrorStateMatcher {
export class AddEntityDialogComponent extends
DialogComponent<AddEntityDialogComponent, BaseData<HasId>> implements OnInit, ErrorStateMatcher {
entityComponent: EntityComponent<BaseData<HasId>>;
detailsForm: NgForm;

4
ui-ngx/src/app/modules/home/components/entity/contact-based.component.ts

@ -25,8 +25,8 @@ import {EntityComponent} from './entity.component';
export abstract class ContactBasedComponent<T extends ContactBased<HasId>> extends EntityComponent<T> implements AfterViewInit {
constructor(protected store: Store<AppState>,
protected fb: FormBuilder) {
protected constructor(protected store: Store<AppState>,
protected fb: FormBuilder) {
super(store);
}

2
ui-ngx/src/app/modules/home/components/entity/entities-table.component.html

@ -136,7 +136,7 @@
</mat-toolbar>
<div fxFlex class="table-container">
<mat-table [dataSource]="dataSource" [trackBy]="trackByEntityId"
matSort [matSortActive]="pageLink.sortOrder.property" [matSortDirection]="(pageLink.sortOrder.direction + '').toLowerCase()" matSortDisableClear>
matSort [matSortActive]="pageLink.sortOrder.property" [matSortDirection]="pageLink.sortDirection()" matSortDisableClear>
<ng-container matColumnDef="select" sticky>
<mat-header-cell *matHeaderCellDef>
<mat-checkbox (change)="$event ? dataSource.masterToggle() : null"

4
ui-ngx/src/app/modules/home/components/entity/entity-filter.component.html

@ -138,7 +138,7 @@
<mat-label translate>relation.direction</mat-label>
<mat-select required matInput formControlName="direction">
<mat-option *ngFor="let type of directionTypes" [value]="type">
{{ directionTypeTranslations.get(type) | translate }}
{{ directionTypeTranslations.get(directionTypeEnum[type]) | translate }}
</mat-option>
</mat-select>
</mat-form-field>
@ -196,7 +196,7 @@
<mat-label translate>relation.direction</mat-label>
<mat-select required matInput formControlName="direction">
<mat-option *ngFor="let type of directionTypes" [value]="type">
{{ directionTypeTranslations.get(type) | translate }}
{{ directionTypeTranslations.get(directionTypeEnum[type]) | translate }}
</mat-option>
</mat-select>
</mat-form-field>

1
ui-ngx/src/app/modules/home/components/entity/entity-filter.component.ts

@ -62,6 +62,7 @@ export class EntityFilterComponent implements ControlValueAccessor, OnInit {
directionTypes = Object.keys(EntitySearchDirection);
directionTypeTranslations = entitySearchDirectionTranslations;
directionTypeEnum = EntitySearchDirection;
private propagateChange = null;

2
ui-ngx/src/app/modules/home/components/event/event-table-config.ts

@ -191,7 +191,7 @@ export class EventTableConfig extends EntityTableConfig<Event, TimePageLink> {
}),
entity => entity.body.msgType),
new EntityTableColumn<Event>('relationType', 'event.relation-type', '100px',
(entity) => entity.body.relationType, entity => ({padding: '0 12px 0 0',}),false, key => ({
(entity) => entity.body.relationType, entity => ({padding: '0 12px 0 0', }), false, key => ({
padding: '0 12px 0 0'
})),
new EntityActionTableColumn<Event>('data', 'event.data',

4
ui-ngx/src/app/modules/home/components/import-export/import-dialog.component.ts

@ -51,7 +51,7 @@ export interface ImportDialogData {
providers: [{provide: ErrorStateMatcher, useExisting: ImportDialogComponent}],
styleUrls: []
})
export class ImportDialogComponent extends DialogComponent<ImportDialogComponent, any>
export class ImportDialogComponent extends DialogComponent<ImportDialogComponent>
implements OnInit, ErrorStateMatcher {
importTitle: string;
@ -65,7 +65,7 @@ export class ImportDialogComponent extends DialogComponent<ImportDialogComponent
protected router: Router,
@Inject(MAT_DIALOG_DATA) public data: ImportDialogData,
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
public dialogRef: MatDialogRef<ImportDialogComponent, any>,
public dialogRef: MatDialogRef<ImportDialogComponent>,
private fb: FormBuilder) {
super(store, router, dialogRef);
this.importTitle = data.importTitle;

2
ui-ngx/src/app/modules/home/components/import-export/import-export.service.ts

@ -426,7 +426,7 @@ export class ImportExportService {
private prepareRuleChainMetaData(ruleChainMetaData: RuleChainMetaData) {
delete ruleChainMetaData.ruleChainId;
for (let i = 0; i < ruleChainMetaData.nodes.length; i++) {
var node = ruleChainMetaData.nodes[i];
const node = ruleChainMetaData.nodes[i];
delete node.ruleChainId;
ruleChainMetaData.nodes[i] = this.prepareExport(node);
}

4
ui-ngx/src/app/modules/home/components/relation/relation-table.component.html

@ -26,7 +26,7 @@
<mat-select matInput [ngModel]="direction"
(ngModelChange)="directionChanged($event)">
<mat-option *ngFor="let type of directionTypes" [value]="type">
{{ directionTypeTranslations.get(type) | translate }}
{{ directionTypeTranslations.get(directions[type]) | translate }}
</mat-option>
</mat-select>
</mat-form-field>
@ -85,7 +85,7 @@
</mat-toolbar>
<div fxFlex class="table-container">
<mat-table [dataSource]="dataSource"
matSort [matSortActive]="pageLink.sortOrder.property" [matSortDirection]="(pageLink.sortOrder.direction + '').toLowerCase()" matSortDisableClear>
matSort [matSortActive]="pageLink.sortOrder.property" [matSortDirection]="pageLink.sortDirection()" matSortDisableClear>
<ng-container matColumnDef="select" sticky>
<mat-header-cell *matHeaderCellDef>
<mat-checkbox (change)="$event ? dataSource.masterToggle() : null"

2
ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions.component.html

@ -60,7 +60,7 @@
</mat-toolbar>
<div fxFlex class="table-container">
<mat-table [dataSource]="dataSource"
matSort [matSortActive]="pageLink.sortOrder.property" [matSortDirection]="(pageLink.sortOrder.direction + '').toLowerCase()" matSortDisableClear>
matSort [matSortActive]="pageLink.sortOrder.property" [matSortDirection]="pageLink.sortDirection()" matSortDisableClear>
<ng-container matColumnDef="actionSourceName">
<mat-header-cell *matHeaderCellDef mat-sort-header> {{ 'widget-config.action-source' | translate }} </mat-header-cell>
<mat-cell *matCellDef="let action">

2
ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.html

@ -58,7 +58,7 @@
<mat-label translate>widget-config.action-type</mat-label>
<mat-select required matInput formControlName="type">
<mat-option *ngFor="let actionType of widgetActionTypes" [value]="actionType">
{{ widgetActionTypeTranslations.get(actionType) | translate }}
{{ widgetActionTypeTranslations.get(widgetActionType[actionType]) | translate }}
</mat-option>
</mat-select>
<mat-error *ngIf="widgetActionFormGroup.get('type').hasError('required')">

6
ui-ngx/src/app/modules/home/components/widget/dialog/custom-dialog-container.component.ts

@ -46,14 +46,14 @@ export interface CustomDialogContainerData {
selector: 'tb-custom-dialog-container-component',
template: ''
})
export class CustomDialogContainerComponent extends DialogComponent<CustomDialogContainerComponent, any> implements OnDestroy {
export class CustomDialogContainerComponent extends DialogComponent<CustomDialogContainerComponent> implements OnDestroy {
private customComponentRef: ComponentRef<CustomDialogComponent>;
private readonly customComponentRef: ComponentRef<CustomDialogComponent>;
constructor(protected store: Store<AppState>,
protected router: Router,
public viewContainerRef: ViewContainerRef,
public dialogRef: MatDialogRef<CustomDialogContainerComponent, any>,
public dialogRef: MatDialogRef<CustomDialogContainerComponent>,
@Inject(MAT_DIALOG_DATA) public data: CustomDialogContainerData) {
super(store, router, dialogRef);
let customDialogData: CustomDialogData = {

4
ui-ngx/src/app/modules/home/components/widget/legend-config-panel.component.html

@ -24,7 +24,7 @@
<mat-label translate>legend.direction</mat-label>
<mat-select matInput formControlName="direction" style="min-width: 150px;">
<mat-option *ngFor="let direction of legendDirections" [value]="direction">
{{ legendDirectionTranslations.get(direction) | translate }}
{{ legendDirectionTranslations.get(legendDirection[direction]) | translate }}
</mat-option>
</mat-select>
</mat-form-field>
@ -34,7 +34,7 @@
<mat-option *ngFor="let pos of legendPositions" [value]="pos"
[disabled]="legendConfigForm.get('direction').value === legendDirection.row &&
(pos === legendPosition.left || pos === legendPosition.right)">
{{ legendPositionTranslations.get(pos) | translate }}
{{ legendPositionTranslations.get(legendPosition[pos]) | translate }}
</mat-option>
</mat-select>
</mat-form-field>

2
ui-ngx/src/app/modules/home/components/widget/lib/alarm-status-filter-panel.component.html

@ -19,7 +19,7 @@
<label class="tb-title" translate>alarm.alarm-status-filter</label>
<mat-radio-group [(ngModel)]="subscription.alarmSearchStatus" fxLayout="column" fxLayoutGap="16px">
<mat-radio-button *ngFor="let searchStatus of alarmSearchStatuses" [value]="searchStatus" color="primary">
{{ alarmSearchStatusTranslationMap.get(searchStatus) | translate }}
{{ alarmSearchStatusTranslationMap.get(alarmSearchStatusEnum[searchStatus]) | translate }}
</mat-radio-button>
</mat-radio-group>
</div>

1
ui-ngx/src/app/modules/home/components/widget/lib/alarm-status-filter-panel.component.ts

@ -35,6 +35,7 @@ export class AlarmStatusFilterPanelComponent {
alarmSearchStatuses = Object.keys(AlarmSearchStatus);
alarmSearchStatusTranslationMap = alarmSearchStatusTranslations;
alarmSearchStatusEnum = AlarmSearchStatus;
constructor(@Inject(ALARM_STATUS_FILTER_PANEL_DATA) public data: AlarmStatusFilterPanelData) {
this.subscription = this.data.subscription;

2
ui-ngx/src/app/modules/home/components/widget/lib/alarms-table-widget.component.html

@ -62,7 +62,7 @@
</mat-toolbar>
<div fxFlex class="table-container">
<mat-table [dataSource]="alarmsDatasource"
matSort [matSortActive]="sortOrderProperty" [matSortDirection]="(pageLink.sortOrder.direction + '').toLowerCase()" matSortDisableClear>
matSort [matSortActive]="sortOrderProperty" [matSortDirection]="pageLink.sortDirection()" matSortDisableClear>
<ng-container matColumnDef="select" sticky>
<mat-header-cell *matHeaderCellDef style="width: 30px;">
<mat-checkbox (change)="$event ? alarmsDatasource.masterToggle() : null"

24
ui-ngx/src/app/modules/home/components/widget/lib/alarms-table-widget.component.ts

@ -100,9 +100,6 @@ interface AlarmsTableWidgetSettings extends TableWidgetSettings {
allowClear: boolean;
}
interface AlarmsTableDataKeySettings extends TableWidgetDataKeySettings {
}
interface AlarmWidgetActionDescriptor extends WidgetActionDescriptor {
details?: boolean;
acknowledge?: boolean;
@ -301,7 +298,7 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit,
if (isDefined(pageSize) && isNumber(pageSize) && pageSize > 0) {
this.defaultPageSize = pageSize;
}
this.pageSizeOptions = [this.defaultPageSize, this.defaultPageSize*2, this.defaultPageSize*3];
this.pageSizeOptions = [this.defaultPageSize, this.defaultPageSize * 2, this.defaultPageSize * 3];
this.pageLink.pageSize = this.displayPagination ? this.defaultPageSize : Number.POSITIVE_INFINITY;
const cssString = constructTableCssString(this.widgetConfig);
@ -320,11 +317,11 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit,
}
if (this.alarmSource) {
this.alarmSource.dataKeys.forEach((_dataKey) => {
const dataKey: EntityColumn = deepClone(_dataKey) as EntityColumn;
this.alarmSource.dataKeys.forEach((alarmDataKey) => {
const dataKey: EntityColumn = deepClone(alarmDataKey) as EntityColumn;
dataKey.title = this.utils.customTranslation(dataKey.label, dataKey.label);
dataKey.def = 'def' + this.columns.length;
const keySettings: AlarmsTableDataKeySettings = dataKey.settings;
const keySettings: TableWidgetDataKeySettings = dataKey.settings;
this.stylesInfo[dataKey.def] = getCellStyleInfo(keySettings);
this.contentsInfo[dataKey.def] = getCellContentInfo(keySettings, 'value, alarm, ctx');
@ -383,7 +380,7 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit,
title: column.title,
def: column.def,
display: this.displayedColumns.indexOf(column.def) > -1
}
};
});
const injectionTokens = new WeakMap<any, any>([
@ -481,7 +478,7 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit,
const columnWidth = this.columnWidth[key.def];
return {
width: columnWidth
}
};
}
public cellStyle(alarm: AlarmInfo, key: EntityColumn): any {
@ -629,7 +626,7 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit,
}
if (this.alarmsDatasource.selection.hasValue()) {
const alarms = this.alarmsDatasource.selection.selected.filter(
(alarm) => { return alarm.id.id !== NULL_UUID }
(alarm) => alarm.id.id !== NULL_UUID
);
if (alarms.length) {
const title = this.translate.instant('alarm.aknowledge-alarms-title', {count: alarms.length});
@ -685,7 +682,7 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit,
}
if (this.alarmsDatasource.selection.hasValue()) {
const alarms = this.alarmsDatasource.selection.selected.filter(
(alarm) => { return alarm.id.id !== NULL_UUID }
(alarm) => alarm.id.id !== NULL_UUID
);
if (alarms.length) {
const title = this.translate.instant('alarm.clear-alarms-title', {count: alarms.length});
@ -725,8 +722,7 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit,
return this.translate.instant(alarmStatusTranslations.get(value));
} else if (alarmField.value === alarmFields.originatorType.value) {
return this.translate.instant(entityTypeTranslations.get(value).type);
}
else {
} else {
return value;
}
} else {
@ -741,7 +737,7 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit,
if (isDefined(value)) {
const alarmField = alarmFields[key.name];
if (alarmField) {
if (alarmField.value == alarmFields.severity.value) {
if (alarmField.value === alarmFields.severity.value) {
return {
fontWeight: 'bold',
color: alarmSeverityColors.get(value)

12
ui-ngx/src/app/modules/home/components/widget/lib/entities-hierarchy-widget.component.ts

@ -227,7 +227,7 @@ export class EntitiesHierarchyWidgetComponent extends PageComponent implements O
if (datasource.nodeId) {
const node = this.nodesMap[datasource.nodeId];
const key = datasourceData.dataKey.label;
let value = undefined;
let value;
if (datasourceData.data && datasourceData.data.length) {
value = datasourceData.data[0][1];
}
@ -292,7 +292,7 @@ export class EntitiesHierarchyWidgetComponent extends PageComponent implements O
cb([]);
}
}
};
}
public onNodeSelected: NodeSelectedCallback = (node, event) => {
let nodeId;
@ -311,7 +311,7 @@ export class EntitiesHierarchyWidgetComponent extends PageComponent implements O
}
}
}
};
}
public onNodesInserted: NodesInsertedCallback = (nodes, parent) => {
if (nodes) {
@ -323,7 +323,7 @@ export class EntitiesHierarchyWidgetComponent extends PageComponent implements O
}
});
}
};
}
public searchCallback: NodeSearchCallback = (searchText, node) => {
const theNode = this.nodesMap[node.id];
@ -331,7 +331,7 @@ export class EntitiesHierarchyWidgetComponent extends PageComponent implements O
return theNode.data.searchText.includes(searchText.toLowerCase());
}
return false;
};
}
private updateNodeStyle(node: HierarchyNavTreeNode) {
const newText = this.prepareNodeText(node);
@ -404,7 +404,7 @@ export class EntitiesHierarchyWidgetComponent extends PageComponent implements O
map(entity => {
if (entity !== null) {
const node: HierarchyNavTreeNode = {
id: (++this.nodeIdCounter)+''
id: (++this.nodeIdCounter) + ''
};
this.nodesMap[node.id] = node;
datasource.nodeId = node.id;

10
ui-ngx/src/app/modules/home/components/widget/lib/entities-hierarchy-widget.models.ts

@ -44,7 +44,7 @@ export interface HierarchyNavTreeNode extends NavTreeNode {
datasource: HierarchyNodeDatasource;
nodeCtx: HierarchyNodeContext;
searchText?: string;
}
};
}
export interface HierarchyNodeDatasource extends Datasource {
@ -64,7 +64,7 @@ export type NodeOpenedFunction = (nodeCtx: HierarchyNodeContext) => boolean;
export type NodeHasChildrenFunction = (nodeCtx: HierarchyNodeContext) => boolean;
export type NodesSortFunction = (nodeCtx1: HierarchyNodeContext, nodeCtx2: HierarchyNodeContext) => number;
export function loadNodeCtxFunction<F extends Function>(functionBody: string, argNames: string, ...args: any[]): F {
export function loadNodeCtxFunction<F extends (...args: any[]) => any>(functionBody: string, argNames: string, ...args: any[]): F {
let nodeCtxFunction: F = null;
if (isDefined(functionBody) && functionBody.length) {
try {
@ -81,11 +81,11 @@ export function loadNodeCtxFunction<F extends Function>(functionBody: string, ar
}
export function materialIconHtml(materialIcon: string): string {
return '<mat-icon class="node-icon material-icons" role="img" aria-hidden="false">'+materialIcon+'</mat-icon>';
return '<mat-icon class="node-icon material-icons" role="img" aria-hidden="false">' + materialIcon + '</mat-icon>';
}
export function iconUrlHtml(iconUrl: string): string {
return '<div class="node-icon" style="background-image: url('+iconUrl+');">&nbsp;</div>';
return '<div class="node-icon" style="background-image: url(' + iconUrl + ');">&nbsp;</div>';
}
export const defaultNodeRelationQueryFunction: NodeRelationQueryFunction = nodeCtx => {
@ -100,7 +100,7 @@ export const defaultNodeRelationQueryFunction: NodeRelationQueryFunction = nodeC
},
filters: [
{
relationType: "Contains",
relationType: 'Contains',
entityTypes: []
}
]

2
ui-ngx/src/app/modules/home/components/widget/lib/entities-table-widget.component.html

@ -39,7 +39,7 @@
</mat-toolbar>
<div fxFlex class="table-container">
<mat-table [dataSource]="entityDatasource"
matSort [matSortActive]="sortOrderProperty" [matSortDirection]="(pageLink.sortOrder.direction + '').toLowerCase()" matSortDisableClear>
matSort [matSortActive]="sortOrderProperty" [matSortDirection]="pageLink.sortDirection()" matSortDisableClear>
<ng-container [matColumnDef]="column.def" *ngFor="let column of columns; trackBy: trackByColumnDef;">
<mat-header-cell [ngStyle]="headerStyle(column)" *matHeaderCellDef mat-sort-header> {{ column.title }} </mat-header-cell>
<mat-cell *matCellDef="let entity;"

27
ui-ngx/src/app/modules/home/components/widget/lib/entities-table-widget.component.ts

@ -85,9 +85,6 @@ interface EntitiesTableWidgetSettings extends TableWidgetSettings {
displayEntityType: boolean;
}
interface EntitiesTableDataKeySettings extends TableWidgetDataKeySettings {
}
@Component({
selector: 'tb-entities-table-widget',
templateUrl: './entities-table-widget.component.html',
@ -221,7 +218,7 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni
if (isDefined(pageSize) && isNumber(pageSize) && pageSize > 0) {
this.defaultPageSize = pageSize;
}
this.pageSizeOptions = [this.defaultPageSize, this.defaultPageSize*2, this.defaultPageSize*3];
this.pageSizeOptions = [this.defaultPageSize, this.defaultPageSize * 2, this.defaultPageSize * 3];
this.pageLink.pageSize = this.displayPagination ? this.defaultPageSize : Number.POSITIVE_INFINITY;
const cssString = constructTableCssString(this.widgetConfig);
@ -253,13 +250,13 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni
title: entityNameColumnTitle
} as EntityColumn
);
this.contentsInfo['entityName'] = {
this.contentsInfo.entityName = {
useCellContentFunction: false
};
this.stylesInfo['entityName'] = {
this.stylesInfo.entityName = {
useCellStyleFunction: false
};
this.columnWidth['entityName'] = '0px';
this.columnWidth.entityName = '0px';
}
if (displayEntityType) {
this.columns.push(
@ -270,13 +267,13 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni
title: this.translate.instant('entity.entity-type'),
} as EntityColumn
);
this.contentsInfo['entityType'] = {
this.contentsInfo.entityType = {
useCellContentFunction: false
};
this.stylesInfo['entityType'] = {
this.stylesInfo.entityType = {
useCellStyleFunction: false
};
this.columnWidth['entityType'] = '0px';
this.columnWidth.entityType = '0px';
}
const dataKeys: Array<DataKey> = [];
@ -284,8 +281,8 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni
const datasource = this.subscription.datasources[0];
if (datasource) {
datasource.dataKeys.forEach((_dataKey) => {
const dataKey: EntityColumn = deepClone(_dataKey) as EntityColumn;
datasource.dataKeys.forEach((entityDataKey) => {
const dataKey: EntityColumn = deepClone(entityDataKey) as EntityColumn;
if (dataKey.type === DataKeyType.function) {
dataKey.name = dataKey.label;
}
@ -293,7 +290,7 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni
dataKey.title = this.utils.customTranslation(dataKey.label, dataKey.label);
dataKey.def = 'def' + this.columns.length;
const keySettings: EntitiesTableDataKeySettings = dataKey.settings;
const keySettings: TableWidgetDataKeySettings = dataKey.settings;
this.stylesInfo[dataKey.def] = getCellStyleInfo(keySettings);
this.contentsInfo[dataKey.def] = getCellContentInfo(keySettings, 'value, entity, ctx');
@ -345,7 +342,7 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni
title: column.title,
def: column.def,
display: this.displayedColumns.indexOf(column.def) > -1
}
};
});
const injectionTokens = new WeakMap<any, any>([
@ -407,7 +404,7 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni
const columnWidth = this.columnWidth[key.def];
return {
width: columnWidth
}
};
}
public cellStyle(entity: EntityData, key: EntityColumn): any {

3
ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.models.ts

@ -398,8 +398,7 @@ export function flotSettingsSchema(chartType: ChartType): JsonSettingsSchema {
return schema;
}
export const flotPieSettingsSchema: JsonSettingsSchema =
{
export const flotPieSettingsSchema: JsonSettingsSchema = {
schema: {
type: 'object',
title: 'Settings',

22
ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.ts

@ -51,23 +51,23 @@ export class TbFlot {
private settings: TbFlotSettings;
private tooltip: JQuery<any>;
private readonly tooltip: JQuery<any>;
private yAxisTickFormatter: TbFlotTicksFormatterFunction;
private readonly yAxisTickFormatter: TbFlotTicksFormatterFunction;
private ticksFormatterFunction: TbFlotTicksFormatterFunction;
private yaxis: TbFlotAxisOptions;
private readonly yaxis: TbFlotAxisOptions;
private yaxes: Array<TbFlotAxisOptions>;
private options: JQueryPlotOptions;
private readonly options: JQueryPlotOptions;
private subscription: IWidgetSubscription;
private $element: JQuery<any>;
private trackUnits: string;
private trackDecimals: number;
private tooltipIndividual: boolean;
private tooltipCumulative: boolean;
private readonly trackUnits: string;
private readonly trackDecimals: number;
private readonly tooltipIndividual: boolean;
private readonly tooltipCumulative: boolean;
private defaultBarWidth: number;
private readonly defaultBarWidth: number;
private plotInited = false;
private plot: JQueryPlot;
@ -85,7 +85,7 @@ export class TbFlot {
private mouseupHandler = this.onFlotMouseUp.bind(this);
private mouseleaveHandler = this.onFlotMouseLeave.bind(this);
private animatedPie: boolean;
private readonly animatedPie: boolean;
private pieDataAnimationDuration: number;
private pieData: DatasourceData[];
private pieRenderedData: any[];
@ -110,7 +110,7 @@ export class TbFlot {
return flotDatakeySettingsSchema(defaultShowLines);
}
constructor(private ctx: WidgetContext, private chartType: ChartType) {
constructor(private ctx: WidgetContext, private readonly chartType: ChartType) {
this.chartType = this.chartType || 'line';
this.settings = ctx.settings as TbFlotSettings;
this.tooltip = $('#flot-series-tooltip');

180
ui-ngx/src/app/modules/home/components/widget/lib/table-widget.models.ts

@ -56,21 +56,25 @@ export interface DisplayColumn {
display: boolean;
}
export type CellContentFunction = (...args: any[]) => string;
export interface CellContentInfo {
useCellContentFunction: boolean;
cellContentFunction?: Function;
cellContentFunction?: CellContentFunction;
units?: string;
decimals?: number;
}
export type CellStyleFunction = (value: any) => any;
export interface CellStyleInfo {
useCellStyleFunction: boolean;
cellStyleFunction?: Function;
cellStyleFunction?: CellStyleFunction;
}
export function findColumnProperty(searchProperty: string, searchValue: string, columnProperty: string, columns: EntityColumn[]): string {
let res = searchValue;
const column = columns.find(column => column[searchProperty] === searchValue);
const column = columns.find(theColumn => theColumn[searchProperty] === searchValue);
if (column) {
res = column[columnProperty];
}
@ -107,13 +111,13 @@ export function getAlarmValue(alarm: AlarmInfo, key: EntityColumn) {
}
export function getCellStyleInfo(keySettings: TableWidgetDataKeySettings): CellStyleInfo {
let cellStyleFunction: Function = null;
let cellStyleFunction: CellStyleFunction = null;
let useCellStyleFunction = false;
if (keySettings.useCellStyleFunction === true) {
if (isDefined(keySettings.cellStyleFunction) && keySettings.cellStyleFunction.length > 0) {
try {
cellStyleFunction = new Function('value', keySettings.cellStyleFunction);
cellStyleFunction = new Function('value', keySettings.cellStyleFunction) as CellStyleFunction;
useCellStyleFunction = true;
} catch (e) {
cellStyleFunction = null;
@ -128,13 +132,13 @@ export function getCellStyleInfo(keySettings: TableWidgetDataKeySettings): CellS
}
export function getCellContentInfo(keySettings: TableWidgetDataKeySettings, ...args: string[]): CellContentInfo {
let cellContentFunction: Function = null;
let cellContentFunction: CellContentFunction = null;
let useCellContentFunction = false;
if (keySettings.useCellContentFunction === true) {
if (isDefined(keySettings.cellContentFunction) && keySettings.cellContentFunction.length > 0) {
try {
cellContentFunction = new Function(...args, keySettings.cellContentFunction);
cellContentFunction = new Function(...args, keySettings.cellContentFunction) as CellContentFunction;
useCellContentFunction = true;
} catch (e) {
cellContentFunction = null;
@ -173,94 +177,94 @@ export function constructTableCssString(widgetConfig: WidgetConfig): string {
const cssString =
'.mat-input-element::placeholder {\n' +
' color: ' + mdDarkSecondary + ';\n'+
' color: ' + mdDarkSecondary + ';\n' +
'}\n' +
'.mat-input-element::-moz-placeholder {\n' +
' color: ' + mdDarkSecondary + ';\n'+
' color: ' + mdDarkSecondary + ';\n' +
'}\n' +
'.mat-input-element::-webkit-input-placeholder {\n' +
' color: ' + mdDarkSecondary + ';\n'+
' color: ' + mdDarkSecondary + ';\n' +
'}\n' +
'.mat-input-element:-ms-input-placeholder {\n' +
' color: ' + mdDarkSecondary + ';\n'+
' color: ' + mdDarkSecondary + ';\n' +
'}\n' +
'mat-toolbar.mat-table-toolbar {\n' +
'color: ' + mdDark + ';\n' +
'}\n' +
'mat-toolbar.mat-table-toolbar:not([color="primary"]) button.mat-icon-button mat-icon {\n' +
'color: ' + mdDarkSecondary + ';\n' +
'}\n' +
'.mat-tab-label {\n' +
'color: ' + mdDark + ';\n' +
'}\n' +
'.mat-tab-header-pagination-chevron {\n' +
'border-color: ' + mdDark + ';\n' +
'}\n' +
'.mat-tab-header-pagination-disabled .mat-tab-header-pagination-chevron {\n' +
'border-color: ' + mdDarkDisabled2 + ';\n' +
'}\n' +
'.mat-table .mat-header-row {\n' +
'background-color: ' + origBackgroundColor + ';\n' +
'}\n' +
'.mat-table .mat-header-cell {\n' +
'color: ' + mdDarkSecondary + ';\n' +
'}\n' +
'.mat-table .mat-header-cell .mat-sort-header-arrow {\n' +
'color: ' + mdDarkDisabled + ';\n' +
'}\n' +
'.mat-table .mat-cell, .mat-table .mat-header-cell {\n' +
'border-bottom-color: ' + mdDarkDivider + ';\n' +
'}\n' +
'.mat-table .mat-cell .mat-checkbox-frame, .mat-table .mat-header-cell .mat-checkbox-frame {\n' +
'border-color: ' + mdDarkSecondary + ';\n' +
'}\n' +
'.mat-table .mat-row .mat-cell.mat-table-sticky {\n' +
'transition: background-color .2s;\n' +
'}\n' +
'.mat-table .mat-row.tb-current-entity {\n' +
'background-color: ' + currentEntityColor + ';\n' +
'}\n' +
'.mat-table .mat-row.tb-current-entity .mat-cell.mat-table-sticky {\n' +
'background-color: ' + currentEntityStickyColor + ';\n' +
'}\n' +
'.mat-table .mat-row:hover:not(.tb-current-entity) {\n' +
'background-color: ' + hoverColor + ';\n' +
'}\n' +
'.mat-table .mat-row:hover:not(.tb-current-entity) .mat-cell.mat-table-sticky {\n' +
'background-color: ' + hoverStickyColor + ';\n' +
'}\n' +
'.mat-table .mat-row.mat-row-select.mat-selected:not(.tb-current-entity) {\n' +
'background-color: ' + selectedColor + ';\n' +
'}\n' +
'.mat-table .mat-row.mat-row-select.mat-selected:not(.tb-current-entity) .mat-cell.mat-table-sticky {\n' +
'background-color: ' + selectedStickyColor + ';\n' +
'}\n' +
'.mat-table .mat-row .mat-cell.mat-table-sticky, .mat-table .mat-header-cell.mat-table-sticky {\n' +
'background-color: ' + origBackgroundColor + ';\n' +
'}\n' +
'.mat-table .mat-cell {\n' +
'color: ' + mdDark + ';\n' +
'}\n' +
'.mat-table .mat-cell button.mat-icon-button mat-icon {\n' +
'color: ' + mdDarkSecondary + ';\n' +
'}\n' +
'.mat-table .mat-cell button.mat-icon-button[disabled][disabled] mat-icon {\n' +
'color: ' + mdDarkDisabled + ';\n' +
'}\n' +
'.mat-divider {\n' +
'border-top-color: ' + mdDarkDivider + ';\n' +
'}\n' +
'.mat-paginator {\n' +
'color: ' + mdDarkSecondary + ';\n' +
'}\n' +
'.mat-paginator button.mat-icon-button {\n' +
'color: ' + mdDarkSecondary + ';\n' +
'}\n' +
'.mat-paginator button.mat-icon-button[disabled][disabled] {\n' +
'color: ' + mdDarkDisabled + ';\n' +
'}\n' +
'mat-toolbar.mat-table-toolbar {\n'+
'color: ' + mdDark + ';\n'+
'}\n'+
'mat-toolbar.mat-table-toolbar:not([color="primary"]) button.mat-icon-button mat-icon {\n'+
'color: ' + mdDarkSecondary + ';\n'+
'}\n'+
'.mat-tab-label {\n'+
'color: ' + mdDark + ';\n'+
'}\n'+
'.mat-tab-header-pagination-chevron {\n'+
'border-color: ' + mdDark + ';\n'+
'}\n'+
'.mat-tab-header-pagination-disabled .mat-tab-header-pagination-chevron {\n'+
'border-color: ' + mdDarkDisabled2 + ';\n'+
'}\n'+
'.mat-table .mat-header-row {\n'+
'background-color: ' + origBackgroundColor + ';\n'+
'}\n'+
'.mat-table .mat-header-cell {\n'+
'color: ' + mdDarkSecondary + ';\n'+
'}\n'+
'.mat-table .mat-header-cell .mat-sort-header-arrow {\n'+
'color: ' + mdDarkDisabled + ';\n'+
'}\n'+
'.mat-table .mat-cell, .mat-table .mat-header-cell {\n'+
'border-bottom-color: '+mdDarkDivider+';\n'+
'}\n'+
'.mat-table .mat-cell .mat-checkbox-frame, .mat-table .mat-header-cell .mat-checkbox-frame {\n'+
'border-color: '+mdDarkSecondary+';\n'+
'}\n'+
'.mat-table .mat-row .mat-cell.mat-table-sticky {\n'+
'transition: background-color .2s;\n'+
'}\n'+
'.mat-table .mat-row.tb-current-entity {\n'+
'background-color: ' + currentEntityColor + ';\n'+
'}\n'+
'.mat-table .mat-row.tb-current-entity .mat-cell.mat-table-sticky {\n'+
'background-color: ' + currentEntityStickyColor + ';\n'+
'}\n'+
'.mat-table .mat-row:hover:not(.tb-current-entity) {\n'+
'background-color: ' + hoverColor + ';\n'+
'}\n'+
'.mat-table .mat-row:hover:not(.tb-current-entity) .mat-cell.mat-table-sticky {\n'+
'background-color: ' + hoverStickyColor + ';\n'+
'}\n'+
'.mat-table .mat-row.mat-row-select.mat-selected:not(.tb-current-entity) {\n'+
'background-color: ' + selectedColor + ';\n'+
'}\n'+
'.mat-table .mat-row.mat-row-select.mat-selected:not(.tb-current-entity) .mat-cell.mat-table-sticky {\n'+
'background-color: ' + selectedStickyColor + ';\n'+
'}\n'+
'.mat-table .mat-row .mat-cell.mat-table-sticky, .mat-table .mat-header-cell.mat-table-sticky {\n'+
'background-color: ' + origBackgroundColor + ';\n'+
'}\n'+
'.mat-table .mat-cell {\n'+
'color: ' + mdDark + ';\n'+
'}\n'+
'.mat-table .mat-cell button.mat-icon-button mat-icon {\n'+
'color: ' + mdDarkSecondary + ';\n'+
'}\n'+
'.mat-table .mat-cell button.mat-icon-button[disabled][disabled] mat-icon {\n'+
'color: ' + mdDarkDisabled + ';\n'+
'}\n'+
'.mat-divider {\n'+
'border-top-color: ' + mdDarkDivider + ';\n'+
'}\n'+
'.mat-paginator {\n'+
'color: ' + mdDarkSecondary + ';\n'+
'}\n'+
'.mat-paginator button.mat-icon-button {\n'+
'color: ' + mdDarkSecondary + ';\n'+
'}\n'+
'.mat-paginator button.mat-icon-button[disabled][disabled] {\n'+
'color: ' + mdDarkDisabled + ';\n'+
'}\n'+
'.mat-paginator .mat-select-value {\n'+
'color: ' + mdDarkSecondary + ';\n'+
'.mat-paginator .mat-select-value {\n' +
'color: ' + mdDarkSecondary + ';\n' +
'}';
return cssString;
}

2
ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.html

@ -42,7 +42,7 @@
<mat-tab *ngFor="let source of sources" label="{{ source.datasource.name }}">
<div fxFlex class="table-container">
<mat-table [dataSource]="source.timeseriesDatasource" [trackBy]="trackByRowIndex"
matSort [matSortActive]="source.pageLink.sortOrder.property" [matSortDirection]="(source.pageLink.sortOrder.direction + '').toLowerCase()" matSortDisableClear>
matSort [matSortActive]="source.pageLink.sortOrder.property" [matSortDirection]="source.pageLink.sortDirection()" matSortDisableClear>
<ng-container *ngIf="showTimestamp" [matColumnDef]="'0'">
<mat-header-cell *matHeaderCellDef mat-sort-header>Timestamp</mat-header-cell>
<mat-cell *matCellDef="let row;"

50
ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts

@ -72,9 +72,6 @@ interface TimeseriesTableWidgetSettings {
hideEmptyLines: boolean;
}
interface TimeseriesTableDataKeySettings extends TableWidgetDataKeySettings {
}
interface TimeseriesRow {
[col: number]: any;
formattedTs: string;
@ -94,10 +91,10 @@ interface TimeseriesTableSource {
pageLink: PageLink;
displayedColumns: string[];
timeseriesDatasource: TimeseriesDatasource;
header: TimeseriesHeader[],
stylesInfo: CellStyleInfo[],
contentsInfo: CellContentInfo[],
rowDataTemplate: {[key: string]: any}
header: TimeseriesHeader[];
stylesInfo: CellStyleInfo[];
contentsInfo: CellContentInfo[];
rowDataTemplate: {[key: string]: any};
}
@Component({
@ -223,13 +220,13 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI
if (isDefined(pageSize) && isNumber(pageSize) && pageSize > 0) {
this.defaultPageSize = pageSize;
}
this.pageSizeOptions = [this.defaultPageSize, this.defaultPageSize*2, this.defaultPageSize*3];
this.pageSizeOptions = [this.defaultPageSize, this.defaultPageSize * 2, this.defaultPageSize * 3];
let cssString = constructTableCssString(this.widgetConfig);
const origBackgroundColor = this.widgetConfig.backgroundColor || 'rgb(255, 255, 255)';
cssString += '.tb-table-widget mat-toolbar.mat-table-toolbar:not([color=primary]) {\n'+
'background-color: ' + origBackgroundColor + ' !important;\n'+
cssString += '.tb-table-widget mat-toolbar.mat-table-toolbar:not([color=primary]) {\n' +
'background-color: ' + origBackgroundColor + ' !important;\n' +
'}\n';
const cssParser = new cssjs();
@ -262,13 +259,13 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI
source.stylesInfo = [];
source.contentsInfo = [];
source.rowDataTemplate = {};
source.rowDataTemplate['Timestamp'] = null;
source.rowDataTemplate.Timestamp = null;
if (this.showTimestamp) {
source.displayedColumns.push('0');
}
for (let a = 0; a < datasource.dataKeys.length; a++ ) {
const dataKey = datasource.dataKeys[a];
const keySettings: TimeseriesTableDataKeySettings = dataKey.settings;
const keySettings: TableWidgetDataKeySettings = dataKey.settings;
const index = a + 1;
source.header.push({
index,
@ -371,14 +368,14 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI
return header.index;
}
public trackByRowIndex(index: number, row: TimeseriesRow) {
public trackByRowIndex(index: number) {
return index;
}
public cellStyle(source: TimeseriesTableSource, index: number, value: any): any {
let style: any = {};
if (index > 0) {
const styleInfo = source.stylesInfo[index-1];
const styleInfo = source.stylesInfo[index - 1];
if (styleInfo.useCellStyleFunction && styleInfo.cellStyleFunction) {
try {
style = styleInfo.cellStyleFunction(value);
@ -394,16 +391,15 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI
if (index === 0) {
return row.formattedTs;
} else {
let content = '';
const contentInfo = source.contentsInfo[index-1];
let content;
const contentInfo = source.contentsInfo[index - 1];
if (contentInfo.useCellContentFunction && contentInfo.cellContentFunction) {
try {
const rowData = source.rowDataTemplate;
rowData['Timestamp'] = row[0];
for (let h=0; h < source.header.length; h++) {
const headerInfo = source.header[h];
rowData.Timestamp = row[0];
source.header.forEach((headerInfo) => {
rowData[headerInfo.dataKey.name] = row[headerInfo.index];
}
});
content = contentInfo.cellContentFunction(value, rowData, this.ctx);
} catch (e) {
content = '' + value;
@ -498,8 +494,7 @@ class TimeseriesDatasource implements DataSource<TimeseriesRow> {
const rowsMap: {[timestamp: number]: TimeseriesRow} = {};
for (let d = 0; d < data.length; d++) {
const columnData = data[d].data;
for (let i = 0; i < columnData.length; i++) {
const cellData = columnData[i];
columnData.forEach((cellData) => {
const timestamp = cellData[0];
let row = rowsMap[timestamp];
if (!row) {
@ -508,20 +503,21 @@ class TimeseriesDatasource implements DataSource<TimeseriesRow> {
};
row[0] = timestamp;
for (let c = 0; c < data.length; c++) {
row[c+1] = undefined;
row[c + 1] = undefined;
}
rowsMap[timestamp] = row;
}
row[d+1] = cellData[1];
}
row[d + 1] = cellData[1];
});
}
const rows: TimeseriesRow[] = [];
for (const t of Object.keys(rowsMap)) {
if (this.hideEmptyLines) {
let hideLine = true;
for (let _c = 0; (_c < data.length) && hideLine; _c++) {
if (rowsMap[t][_c+1])
for (let c = 0; (c < data.length) && hideLine; c++) {
if (rowsMap[t][c + 1]) {
hideLine = false;
}
}
if (!hideLine) {
rows.push(rowsMap[t]);

4
ui-ngx/src/app/modules/home/components/widget/widget-config.component.ts

@ -58,7 +58,7 @@ import { MatDialog } from '@angular/material/dialog';
import { EntityService } from '@core/http/entity.service';
import { JsonFormComponentData } from '@shared/components/json-form/json-form-component.models';
import { WidgetActionsData } from './action/manage-widget-actions.component.models';
import { Dashboard } from '@shared/models/dashboard.models';
import { Dashboard, DashboardState } from '@shared/models/dashboard.models';
const emptySettingsSchema = {
type: 'object',
@ -107,7 +107,7 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, Cont
functionsOnly: boolean;
@Input()
dashboardStates: Array<string>;
dashboardStates: {[id: string]: DashboardState };
@Input() disabled: boolean;

6
ui-ngx/src/app/modules/home/home.component.html

@ -50,9 +50,9 @@
(click)="closeSearch()">
<mat-icon class="material-icons">arrow_back</mat-icon>
</button>
<div [fxShow]="!displaySearchMode()"
fxFlex tb-breadcrumb [activeComponent]="activeComponent" class="mat-toolbar-tools">
</div>
<tb-breadcrumb [fxShow]="!displaySearchMode()"
fxFlex [activeComponent]="activeComponent" class="mat-toolbar-tools">
</tb-breadcrumb>
<div [fxShow]="displaySearchMode()" fxFlex fxLayout="row" class="tb-dark">
<mat-form-field fxFlex floatLabel="always">
<mat-label></mat-label>

2
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');

10
ui-ngx/src/app/modules/home/models/dashboard-component.models.ts

@ -134,11 +134,10 @@ export class DashboardWidgets implements Iterable<DashboardWidget> {
}
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<DashboardWidget> {
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;

56
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 {

4
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 = [
{

2
ui-ngx/src/app/modules/home/pages/dashboard/states/manage-dashboard-states-dialog.component.html

@ -76,7 +76,7 @@
</mat-toolbar>
<div class="table-container">
<mat-table [dataSource]="dataSource"
matSort [matSortActive]="pageLink.sortOrder.property" [matSortDirection]="(pageLink.sortOrder.direction + '').toLowerCase()" matSortDisableClear>
matSort [matSortActive]="pageLink.sortOrder.property" [matSortDirection]="pageLink.sortDirection()" matSortDisableClear>
<ng-container matColumnDef="name">
<mat-header-cell *matHeaderCellDef mat-sort-header> {{ 'dashboard.state-name' | translate }} </mat-header-cell>
<mat-cell *matCellDef="let state">

8
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 {

1
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 {

2
ui-ngx/src/app/modules/home/pages/device/device-credentials-dialog.component.html

@ -35,7 +35,7 @@
<mat-select matInput formControlName="credentialsType"
(ngModelChange)="credentialsTypeChanged()">
<mat-option *ngFor="let credentialsType of credentialsTypes" [value]="credentialsType">
{{ credentialTypeNamesMap.get(credentialsType) }}
{{ credentialTypeNamesMap.get(deviceCredentialsType[credentialsType]) }}
</mat-option>
</mat-select>
</mat-form-field>

30
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;

3
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<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot):
Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
if (this.itembuffer.hasRuleChainImport()) {
return true;
} else {

1
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']

2
ui-ngx/src/app/modules/home/pages/user/add-user-dialog.component.html

@ -35,7 +35,7 @@
<mat-label translate>user.activation-method</mat-label>
<mat-select matInput [ngModelOptions]="{standalone: true}" [(ngModel)]="activationMethod">
<mat-option *ngFor="let activationMethod of activationMethods" [value]="activationMethod">
{{ activationMethodTranslations.get(activationMethod) | translate }}
{{ activationMethodTranslations.get(activationMethodEnum[activationMethod]) | translate }}
</mat-option>
</mat-select>
</mat-form-field>

1
ui-ngx/src/app/modules/home/pages/user/add-user-dialog.component.ts

@ -50,6 +50,7 @@ export class AddUserDialogComponent extends DialogComponent<AddUserDialogCompone
user: User;
activationMethods = Object.keys(ActivationMethod);
activationMethodEnum = ActivationMethod;
activationMethodTranslations = activationMethodTranslations;

10
ui-ngx/src/app/modules/home/pages/widget/select-widget-type-dialog.component.html

@ -33,15 +33,15 @@
<div fxLayout="column" fxLayoutGap="16px" fxLayout.gt-sm="row" fxLayoutAlign="center center">
<button *ngFor="let type of allWidgetTypes;" class="tb-card-button" mat-button mat-raised-button color="primary"
type="button"
(click)="typeSelected(type)">
<mat-icon *ngIf="!widgetTypesDataMap.get(type).isMdiIcon; else mdiIconBlock" class="tb-mat-96">
{{ widgetTypesDataMap.get(type).icon }}
(click)="typeSelected(widgetTypes[type])">
<mat-icon *ngIf="!widgetTypesDataMap.get(widgetTypes[type]).isMdiIcon; else mdiIconBlock" class="tb-mat-96">
{{ widgetTypesDataMap.get(widgetTypes[type]).icon }}
</mat-icon>
<ng-template #mdiIconBlock>
<mat-icon class="tb-mat-96" [svgIcon]="widgetTypesDataMap.get(type).icon">
<mat-icon class="tb-mat-96" [svgIcon]="widgetTypesDataMap.get(widgetTypes[type]).icon">
</mat-icon>
</ng-template>
<span translate>{{ widgetTypesDataMap.get(type).name }}</span>
<span translate>{{ widgetTypesDataMap.get(widgetTypes[type]).name }}</span>
</button>
</div>
</fieldset>

2
ui-ngx/src/app/modules/home/pages/widget/widget-editor.component.html

@ -29,7 +29,7 @@
<mat-select [disabled]="isReadOnly" matInput placeholder="{{ 'widget.type' | translate }}"
[(ngModel)]="widget.type" (ngModelChange)="widetTypeChanged()">
<mat-option *ngFor="let type of allWidgetTypes" [value]="type">
{{ widgetTypesDataMap.get(type).name | translate }}
{{ widgetTypesDataMap.get(widgetTypes[type]).name | translate }}
</mat-option>
</mat-select>
</mat-form-field>

3
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;

4
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';

12
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',

7
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';

7
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';

10
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',

2
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']
})

6
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();
});

2
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) => { };

2
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) => { };

2
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',

3
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'],

1
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'
})

33
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>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 = <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>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>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);
}
}

2
ui-ngx/src/app/shared/components/js-func.component.ts

@ -66,7 +66,7 @@ export class JsFuncComponent implements OnInit, OnDestroy, ControlValueAccessor,
@Input() functionArgs: Array<string>;
@Input() validationArgs: Array<string>;
@Input() validationArgs: Array<any>;
@Input() resultType: string;

2
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<JsonFormProps, any> {
private hasConditions: boolean;
private mapper: {[type: string]: any};
private readonly mapper: {[type: string]: any};
constructor(props) {
super(props);

2
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;

6
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']));
});
}

4
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';

2
ui-ngx/src/app/shared/components/time/timewindow-panel.component.html

@ -63,7 +63,7 @@
<mat-label translate>aggregation.function</mat-label>
<mat-select matInput formControlName="type" style="min-width: 150px;">
<mat-option *ngFor="let aggregation of aggregations" [value]="aggregation">
{{ aggregationTypesTranslations.get(aggregation) | translate }}
{{ aggregationTypesTranslations.get(aggregationTypes[aggregation]) | translate }}
</mat-option>
</mat-select>
</mat-form-field>

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save