Browse Source

merged with develop/3.5

pull/8051/head
dashevchenko 3 years ago
parent
commit
e9fb6fb97e
  1. 6
      application/src/main/java/org/thingsboard/server/install/ThingsboardInstallService.java
  2. 2
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/DisableUIListeners.java
  3. 2
      msa/tb/pom.xml
  4. 4
      pom.xml
  5. 2
      rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/filter/TbAssetTypeSwitchNode.java
  6. 2
      rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/filter/TbCheckAlarmStatusNode.java
  7. 9
      rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/filter/TbCheckMessageNode.java
  8. 7
      rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/filter/TbCheckRelationNode.java
  9. 2
      rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/filter/TbDeviceTypeSwitchNode.java
  10. 7
      rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/filter/TbJsFilterNode.java
  11. 4
      rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/filter/TbJsSwitchNode.java
  12. 4
      rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/filter/TbOriginatorTypeFilterNode.java
  13. 27
      rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/TbGpsGeofencingFilterNode.java
  14. 2
      rule-engine/rule-engine-components/src/main/resources/public/static/rulenode/rulenode-core-config.js
  15. 67
      ui-ngx/.eslintrc.json
  16. 1
      ui-ngx/.gitignore
  17. 36
      ui-ngx/angular.json
  18. 17
      ui-ngx/extra-webpack.config.js
  19. 138
      ui-ngx/package.json
  20. 127
      ui-ngx/src/app/core/api/widget-subscription.ts
  21. 2
      ui-ngx/src/app/core/auth/auth.selectors.ts
  22. 4
      ui-ngx/src/app/core/guards/confirm-on-exit.guard.ts
  23. 2
      ui-ngx/src/app/core/http/entity.service.ts
  24. 16
      ui-ngx/src/app/core/http/widget.service.ts
  25. 2
      ui-ngx/src/app/core/interceptors/load.selectors.ts
  26. 14
      ui-ngx/src/app/core/notification/notification.effects.ts
  27. 4
      ui-ngx/src/app/core/services/raf.service.ts
  28. 4
      ui-ngx/src/app/core/services/resources.service.ts
  29. 2
      ui-ngx/src/app/core/services/utils.service.ts
  30. 26
      ui-ngx/src/app/core/settings/settings.effects.ts
  31. 2
      ui-ngx/src/app/core/settings/settings.selectors.ts
  32. 4
      ui-ngx/src/app/core/translate/translate-default-parser.ts
  33. 4
      ui-ngx/src/app/core/utils.ts
  34. 4
      ui-ngx/src/app/modules/common/modules-map.ts
  35. 6
      ui-ngx/src/app/modules/home/components/alarm/alarm-details-dialog.component.ts
  36. 6
      ui-ngx/src/app/modules/home/components/alias/aliases-entity-autocomplete.component.ts
  37. 14
      ui-ngx/src/app/modules/home/components/alias/entity-alias-dialog.component.ts
  38. 12
      ui-ngx/src/app/modules/home/components/alias/entity-alias-select.component.ts
  39. 24
      ui-ngx/src/app/modules/home/components/alias/entity-aliases-dialog.component.ts
  40. 8
      ui-ngx/src/app/modules/home/components/attribute/add-attribute-dialog.component.ts
  41. 8
      ui-ngx/src/app/modules/home/components/attribute/add-widget-to-dashboard-dialog.component.ts
  42. 8
      ui-ngx/src/app/modules/home/components/attribute/edit-attribute-value-panel.component.ts
  43. 8
      ui-ngx/src/app/modules/home/components/dashboard-page/add-widget-dialog.component.ts
  44. 8
      ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-image-dialog.component.ts
  45. 4
      ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts
  46. 10
      ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-settings-dialog.component.ts
  47. 6
      ui-ngx/src/app/modules/home/components/dashboard-page/edit-widget.component.ts
  48. 2
      ui-ngx/src/app/modules/home/components/dashboard-page/layout/manage-dashboard-layouts-dialog.component.scss
  49. 12
      ui-ngx/src/app/modules/home/components/dashboard-page/layout/manage-dashboard-layouts-dialog.component.ts
  50. 14
      ui-ngx/src/app/modules/home/components/dashboard-page/states/dashboard-state-dialog.component.ts
  51. 8
      ui-ngx/src/app/modules/home/components/dashboard-page/states/manage-dashboard-states-dialog.component.ts
  52. 2
      ui-ngx/src/app/modules/home/components/dashboard-page/states/states-component.directive.ts
  53. 8
      ui-ngx/src/app/modules/home/components/dashboard/select-target-state-dialog.component.ts
  54. 8
      ui-ngx/src/app/modules/home/components/details-panel.component.ts
  55. 12
      ui-ngx/src/app/modules/home/components/device/device-credentials-lwm2m-server.component.ts
  56. 12
      ui-ngx/src/app/modules/home/components/device/device-credentials-lwm2m.component.ts
  57. 12
      ui-ngx/src/app/modules/home/components/device/device-credentials-mqtt-basic.component.ts
  58. 14
      ui-ngx/src/app/modules/home/components/device/device-credentials.component.ts
  59. 6
      ui-ngx/src/app/modules/home/components/entity/add-entity-dialog.component.ts
  60. 8
      ui-ngx/src/app/modules/home/components/entity/contact-based.component.ts
  61. 4
      ui-ngx/src/app/modules/home/components/entity/entity-details-page.component.ts
  62. 4
      ui-ngx/src/app/modules/home/components/entity/entity-details-panel.component.ts
  63. 8
      ui-ngx/src/app/modules/home/components/entity/entity-filter.component.ts
  64. 2
      ui-ngx/src/app/modules/home/components/entity/entity-table-header.component.ts
  65. 6
      ui-ngx/src/app/modules/home/components/entity/entity-tabs.component.ts
  66. 10
      ui-ngx/src/app/modules/home/components/entity/entity.component.ts
  67. 6
      ui-ngx/src/app/modules/home/components/event/event-filter-panel.component.ts
  68. 8
      ui-ngx/src/app/modules/home/components/filter/boolean-filter-predicate.component.ts
  69. 8
      ui-ngx/src/app/modules/home/components/filter/complex-filter-predicate-dialog.component.ts
  70. 14
      ui-ngx/src/app/modules/home/components/filter/filter-dialog.component.ts
  71. 18
      ui-ngx/src/app/modules/home/components/filter/filter-predicate-list.component.ts
  72. 8
      ui-ngx/src/app/modules/home/components/filter/filter-predicate-value.component.ts
  73. 8
      ui-ngx/src/app/modules/home/components/filter/filter-predicate.component.ts
  74. 12
      ui-ngx/src/app/modules/home/components/filter/filter-select.component.ts
  75. 4
      ui-ngx/src/app/modules/home/components/filter/filter-text.component.ts
  76. 8
      ui-ngx/src/app/modules/home/components/filter/filter-user-info-dialog.component.ts
  77. 24
      ui-ngx/src/app/modules/home/components/filter/filters-dialog.component.ts
  78. 10
      ui-ngx/src/app/modules/home/components/filter/key-filter-dialog.component.ts
  79. 26
      ui-ngx/src/app/modules/home/components/filter/key-filter-list.component.ts
  80. 8
      ui-ngx/src/app/modules/home/components/filter/numeric-filter-predicate.component.ts
  81. 8
      ui-ngx/src/app/modules/home/components/filter/string-filter-predicate.component.ts
  82. 18
      ui-ngx/src/app/modules/home/components/filter/user-filter-dialog.component.ts
  83. 14
      ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.ts
  84. 8
      ui-ngx/src/app/modules/home/components/import-export/import-dialog.component.ts
  85. 4
      ui-ngx/src/app/modules/home/components/import-export/table-columns-assignment.component.ts
  86. 18
      ui-ngx/src/app/modules/home/components/profile/add-device-profile-dialog.component.ts
  87. 6
      ui-ngx/src/app/modules/home/components/profile/alarm/alarm-duration-predicate-value.component.ts
  88. 8
      ui-ngx/src/app/modules/home/components/profile/alarm/alarm-dynamic-value.component.ts
  89. 8
      ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule-condition-dialog.component.ts
  90. 12
      ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule-condition.component.ts
  91. 12
      ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule.component.ts
  92. 8
      ui-ngx/src/app/modules/home/components/profile/alarm/alarm-schedule-dialog.component.ts
  93. 26
      ui-ngx/src/app/modules/home/components/profile/alarm/alarm-schedule.component.ts
  94. 22
      ui-ngx/src/app/modules/home/components/profile/alarm/create-alarm-rules.component.ts
  95. 14
      ui-ngx/src/app/modules/home/components/profile/alarm/device-profile-alarm.component.ts
  96. 22
      ui-ngx/src/app/modules/home/components/profile/alarm/device-profile-alarms.component.ts
  97. 8
      ui-ngx/src/app/modules/home/components/profile/alarm/edit-alarm-details-dialog.component.ts
  98. 6
      ui-ngx/src/app/modules/home/components/profile/asset-profile-autocomplete.component.ts
  99. 4
      ui-ngx/src/app/modules/home/components/profile/asset-profile-dialog.component.ts
  100. 6
      ui-ngx/src/app/modules/home/components/profile/asset-profile.component.ts

6
application/src/main/java/org/thingsboard/server/install/ThingsboardInstallService.java

@ -233,15 +233,17 @@ public class ThingsboardInstallService {
log.info("Upgrading ThingsBoard from version 3.4.1 to 3.4.2 ...");
databaseEntitiesUpgradeService.upgradeDatabase("3.4.1");
dataUpdateService.updateData("3.4.1");
case "3.4.2":
log.info("Upgrading ThingsBoard from version 3.4.2 to 3.4.3 ...");
case "3.4.3":
log.info("Upgrading ThingsBoard from version 3.4.3 to 3.4.4 ...");
case "3.4.4":
log.info("Upgrading ThingsBoard from version 3.4.4 to 3.5.0 ...");
databaseEntitiesUpgradeService.upgradeDatabase("3.4.4");
log.info("Updating system data...");
systemDataLoaderService.updateSystemWidgets();
break;
//TODO update CacheCleanupService on the next version upgrade
default:
throw new RuntimeException("Unable to upgrade ThingsBoard, unsupported fromVersion: " + upgradeFromVersion);

2
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/DisableUIListeners.java

@ -16,10 +16,12 @@
package org.thingsboard.server.msa;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
public @interface DisableUIListeners {

2
msa/tb/pom.xml

@ -38,7 +38,7 @@
<tb-postgres.docker.name>tb-postgres</tb-postgres.docker.name>
<tb-cassandra.docker.name>tb-cassandra</tb-cassandra.docker.name>
<pkg.installFolder>/usr/share/${pkg.name}</pkg.installFolder>
<pkg.upgradeVersion>3.4.3</pkg.upgradeVersion>
<pkg.upgradeVersion>3.4.4</pkg.upgradeVersion>
</properties>
<dependencies>

4
pom.xml

@ -818,8 +818,10 @@
<exclude>docker/haproxy/**</exclude>
<exclude>docker/tb-node/**</exclude>
<exclude>ui/**</exclude>
<exclude>src/.browserslistrc</exclude>
<exclude>**/.browserslistrc</exclude>
<exclude>**/yarn.lock</exclude>
<exclude>**/.yarnrc</exclude>
<exclude>**/.angular/**</exclude>
<exclude>**/*.raw</exclude>
<exclude>**/*.patch</exclude>
<exclude>**/apache/cassandra/io/**</exclude>

2
rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/filter/TbAssetTypeSwitchNode.java

@ -29,7 +29,7 @@ import org.thingsboard.server.common.data.plugin.ComponentType;
@Slf4j
@RuleNode(
type = ComponentType.FILTER,
name = "asset type switch",
name = "asset profile switch",
customRelations = true,
relationTypes = {},
configClazz = EmptyNodeConfiguration.class,

2
rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/filter/TbCheckAlarmStatusNode.java

@ -42,7 +42,7 @@ import java.io.IOException;
configClazz = TbCheckAlarmStatusNodeConfig.class,
relationTypes = {"True", "False"},
nodeDescription = "Checks alarm status.",
nodeDetails = "If the alarm status matches the specified one - msg is success if does not match - msg is failure.",
nodeDetails = "Checks the alarm status to match one of the specified statuses.",
uiResources = {"static/rulenode/rulenode-core-config.js"},
configDirective = "tbFilterNodeCheckAlarmStatusConfig")
public class TbCheckAlarmStatusNode implements TbNode {

9
rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/filter/TbCheckMessageNode.java

@ -32,12 +32,13 @@ import java.util.Map;
@Slf4j
@RuleNode(
type = ComponentType.FILTER,
name = "check existence fields",
name = "check fields presence",
relationTypes = {"True", "False"},
configClazz = TbCheckMessageNodeConfiguration.class,
nodeDescription = "Checks the existence of the selected keys from message data and metadata.",
nodeDetails = "If selected checkbox 'Check that all selected keys are present'\" and all keys in message data and metadata are exist - send Message via <b>True</b> chain, otherwise <b>False</b> chain is used.\n" +
"Else if the checkbox is not selected, and at least one of the keys from data or metadata of the message exists - send Message via <b>True</b> chain, otherwise, <b>False</b> chain is used. ",
nodeDescription = "Checks the presence of the specified fields in the message and/or metadata.",
nodeDetails = "Checks the presence of the specified fields in the message and/or metadata. " +
"By default, the rule node checks that all specified fields need to be present. " +
"Uncheck the 'Check that all specified fields are present' if the presence of at least one field is sufficient.",
uiResources = {"static/rulenode/rulenode-core-config.js"},
configDirective = "tbFilterNodeCheckMessageConfig")
public class TbCheckMessageNode implements TbNode {

7
rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/filter/TbCheckRelationNode.java

@ -46,10 +46,9 @@ import static org.thingsboard.common.util.DonAsynchron.withCallback;
name = "check relation",
configClazz = TbCheckRelationNodeConfiguration.class,
relationTypes = {"True", "False"},
nodeDescription = "Checks the relation from the selected entity to the originator of the message by type and direction" +
" if 'Check for single entity' is set to true, otherwise rule node will check if exist" +
" any relation to the originator of the message by type and direction.",
nodeDetails = "If at least one relation exists - send Message via <b>True</b> chain, otherwise <b>False</b> chain is used.",
nodeDescription = "Checks the presence of the relation between the originator of the message and other entities.",
nodeDetails = "If 'check relation to specific entity' is selected, one must specify a related entity. " +
"Otherwise, the rule node checks the presence of a relation to any entity that matches the direction and relation type criteria.",
uiResources = {"static/rulenode/rulenode-core-config.js"},
configDirective = "tbFilterNodeCheckRelationConfig")
public class TbCheckRelationNode implements TbNode {

2
rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/filter/TbDeviceTypeSwitchNode.java

@ -29,7 +29,7 @@ import org.thingsboard.server.common.data.plugin.ComponentType;
@Slf4j
@RuleNode(
type = ComponentType.FILTER,
name = "device type switch",
name = "device profile switch",
customRelations = true,
relationTypes = {"default"},
configClazz = EmptyNodeConfiguration.class,

7
rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/filter/TbJsFilterNode.java

@ -34,9 +34,10 @@ import static org.thingsboard.common.util.DonAsynchron.withCallback;
type = ComponentType.FILTER,
name = "script", relationTypes = {"True", "False"},
configClazz = TbJsFilterNodeConfiguration.class,
nodeDescription = "Filter incoming messages using JS script",
nodeDetails = "Evaluate incoming Message with configured JS condition. " +
"If <b>True</b> - send Message via <b>True</b> chain, otherwise <b>False</b> chain is used." +
nodeDescription = "Filter incoming messages using TBEL or JS script",
nodeDetails = "Evaluates boolean function using incoming message. " +
"The function may be written using TBEL or plain JavaScript. " +
"Script function should return boolean value and accepts three parameters: <br/>" +
"Message payload can be accessed via <code>msg</code> property. For example <code>msg.temperature < 10;</code><br/>" +
"Message metadata can be accessed via <code>metadata</code> property. For example <code>metadata.customerName === 'John';</code><br/>" +
"Message type can be accessed via <code>msgType</code> property.",

4
rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/filter/TbJsSwitchNode.java

@ -39,8 +39,8 @@ import java.util.Set;
name = "switch", customRelations = true,
relationTypes = {},
configClazz = TbJsSwitchNodeConfiguration.class,
nodeDescription = "Route incoming Message to one or multiple output chains",
nodeDetails = "Node executes configured JS script. Script should return array of next Chain names where Message should be routed. " +
nodeDescription = "Routes incoming message to one OR multiple output connections.",
nodeDetails = "Node executes configured TBEL(recommended) or JavaScript function that returns array of strings (connection names). " +
"If Array is empty - message not routed to next Node. " +
"Message payload can be accessed via <code>msg</code> property. For example <code>msg.temperature < 10;</code><br/>" +
"Message metadata can be accessed via <code>metadata</code> property. For example <code>metadata.customerName === 'John';</code><br/>" +

4
rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/filter/TbOriginatorTypeFilterNode.java

@ -32,8 +32,8 @@ import org.thingsboard.server.common.msg.TbMsg;
name = "entity type",
configClazz = TbOriginatorTypeFilterNodeConfiguration.class,
relationTypes = {"True", "False"},
nodeDescription = "Filter incoming messages by message Originator Type",
nodeDetails = "If the entity type of the incoming message originator is expected - send Message via <b>True</b> chain, otherwise <b>False</b> chain is used.",
nodeDescription = "Filter incoming messages by the type of message originator entity",
nodeDetails = "Checks that the entity type of the incoming message originator matches one of the values specified in the filter.",
uiResources = {"static/rulenode/rulenode-core-config.js"},
configDirective = "tbFilterNodeOriginatorTypeConfig")
public class TbOriginatorTypeFilterNode implements TbNode {

27
rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/TbGpsGeofencingFilterNode.java

@ -32,7 +32,32 @@ import org.thingsboard.server.common.msg.TbMsg;
configClazz = TbGpsGeofencingFilterNodeConfiguration.class,
relationTypes = {"True", "False"},
nodeDescription = "Filter incoming messages by GPS based geofencing",
nodeDetails = "Extracts latitude and longitude parameters from incoming message and returns 'True' if they are inside configured perimeters, 'False' otherwise.",
nodeDetails = "Extracts latitude and longitude parameters from the incoming message and checks them according to configured perimeter. </br>" +
"Configuration:</br></br>" +
"<ul>" +
"<li>Latitude key name - name of the message field that contains location latitude;</li>" +
"<li>Longitude key name - name of the message field that contains location longitude;</li>" +
"<li>Perimeter type - Polygon or Circle;</li>" +
"<li>Fetch perimeter from message metadata - checkbox to load perimeter from message metadata; " +
" Enable if your perimeter is specific to device/asset and you store it as device/asset attribute;</li>" +
"<li>Perimeter key name - name of the metadata key that stores perimeter information;</li>" +
"<li>For Polygon perimeter type: <ul>" +
" <li>Polygon definition - string that contains array of coordinates in the following format: [[lat1, lon1],[lat2, lon2],[lat3, lon3], ... , [latN, lonN]]</li>" +
"</ul></li>" +
"<li>For Circle perimeter type: <ul>" +
" <li>Center latitude - latitude of the circle perimeter center;</li>" +
" <li>Center longitude - longitude of the circle perimeter center;</li>" +
" <li>Range - value of the circle perimeter range, double-precision floating-point value;</li>" +
" <li>Range units - one of: Meter, Kilometer, Foot, Mile, Nautical Mile;</li>" +
"</ul></li></ul></br>" +
"Rule node will use default metadata key names, if the \"Fetch perimeter from message metadata\" is enabled and \"Perimeter key name\" is not configured. " +
"Default metadata key names for polygon perimeter type is \"perimeter\". Default metadata key names for circle perimeter are: \"centerLatitude\", \"centerLongitude\", \"range\", \"rangeUnit\"." +
"</br></br>" +
"Structure of the circle perimeter definition (stored in server-side attribute, for example):" +
"</br></br>" +
"{\"latitude\": 48.198618758582384, \"longitude\": 24.65322245153503, \"radius\": 100.0, \"radiusUnit\": \"METER\" }" +
"</br></br>" +
"Available radius units: METER, KILOMETER, FOOT, MILE, NAUTICAL_MILE;",
uiResources = {"static/rulenode/rulenode-core-config.js"},
configDirective = "tbFilterNodeGpsGeofencingConfig")
public class TbGpsGeofencingFilterNode extends AbstractGeofencingNode<TbGpsGeofencingFilterNodeConfiguration> {

2
rule-engine/rule-engine-components/src/main/resources/public/static/rulenode/rulenode-core-config.js

File diff suppressed because one or more lines are too long

67
ui-ngx/.eslintrc.json

@ -0,0 +1,67 @@
{
"root": true,
"ignorePatterns": [
"projects/**/*"
],
"overrides": [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"tsconfig.json",
"e2e/tsconfig.json"
],
"createDefaultProgram": true
},
"extends": [
"plugin:@angular-eslint/ng-cli-compat",
"plugin:@angular-eslint/ng-cli-compat--formatting-add-on",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"@typescript-eslint/explicit-member-accessibility": [
"off",
{
"accessibility": "explicit"
}
],
"arrow-parens": [
"off",
"always"
],
"@angular-eslint/component-selector": [
"error",
{
"prefix": [ "tb" ]
}
],
"id-blacklist": [
"error",
"any",
"Number",
"String",
"string",
"Boolean",
"boolean",
"Undefined",
"undefined"
],
"import/order": "off",
"@typescript-eslint/member-ordering": "off",
"no-underscore-dangle": "off",
"@typescript-eslint/naming-convention": "off"
}
},
{
"files": [
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"rules": {}
}
]
}

1
ui-ngx/.gitignore

@ -32,6 +32,7 @@ speed-measure-plugin.json
.history/*
# misc
/.angular/cache
/.sass-cache
/connect.lock
/coverage

36
ui-ngx/angular.json

@ -132,7 +132,15 @@
"qrcode",
"wcwidth",
"leaflet-polylinedecorator",
"ace-diff"
"ace-diff",
"messageformat-parser",
"html2canvas",
"jszip",
"moment",
"ace",
"ace-builds",
"diff-match-patch",
"tv4"
]
},
"configurations": {
@ -222,14 +230,11 @@
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"builder": "@angular-eslint/builder:lint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
}
}
@ -251,22 +256,15 @@
"devServerTarget": "thingsboard:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "thingsboard",
"cli": {
"packageManager": "yarn",
"analytics": false
"analytics": false,
"schematicCollections": [
"@angular-eslint/schematics"
]
}
}

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

@ -29,6 +29,11 @@ dirTree("./src/assets/locale/", {extensions: /\.json$/}, (item) => {
});
module.exports = (config, options) => {
config.ignoreWarnings.push(/Usage of '~' in imports is deprecated/);
config.ignoreWarnings.push(/Did you mean "left" instead?/);
config.ignoreWarnings.push(/autoprefixer/);
config.plugins.push(
new webpack.DefinePlugin({
TB_VERSION: JSON.stringify(require("./package.json").version),
@ -59,20 +64,20 @@ module.exports = (config, options) => {
})
);
const index = config.plugins.findIndex(p => p instanceof ngWebpack.ivy.AngularWebpackPlugin || p instanceof ngWebpack.AngularWebpackPlugin);
config.module.rules[2].use[0].options.aot = false;
const index = config.plugins.findIndex(p => p instanceof ngWebpack.AngularWebpackPlugin);
let angularWebpackPlugin = config.plugins[index];
if (config.mode === 'production') {
const angularCompilerOptions = angularWebpackPlugin.pluginOptions;
angularCompilerOptions.emitClassMetadata = true;
angularCompilerOptions.emitNgModuleScope = true;
config.plugins.splice(index, 1);
angularWebpackPlugin = new ngWebpack.ivy.AngularWebpackPlugin(angularCompilerOptions);
angularWebpackPlugin = new ngWebpack.AngularWebpackPlugin(angularCompilerOptions);
config.plugins.push(angularWebpackPlugin);
const javascriptOptimizerOptions = config.optimization.minimizer[1].options;
const javascriptOptimizerOptions = config.optimization.minimizer[0].options;
delete javascriptOptimizerOptions.define.ngJitMode;
config.optimization.minimizer.splice(1, 1);
config.optimization.minimizer.push(new JavaScriptOptimizerPlugin(javascriptOptimizerOptions));
config.optimization.minimizer.splice(0, 1);
config.optimization.minimizer.unshift(new JavaScriptOptimizerPlugin(javascriptOptimizerOptions));
}
addTransformerToAngularWebpackPlugin(angularWebpackPlugin, keysTransformer);

138
ui-ngx/package.json

@ -14,50 +14,52 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^12.2.16",
"@angular/cdk": "^12.2.13",
"@angular/common": "^12.2.16",
"@angular/compiler": "^12.2.16",
"@angular/core": "^12.2.16",
"@angular/flex-layout": "^12.0.0-beta.35",
"@angular/forms": "^12.2.16",
"@angular/material": "^12.2.13",
"@angular/platform-browser": "^12.2.16",
"@angular/platform-browser-dynamic": "^12.2.16",
"@angular/router": "^12.2.16",
"@auth0/angular-jwt": "^5.0.2",
"@date-io/date-fns": "^2.11.0",
"@angular/animations": "^14.2.12",
"@angular/cdk": "^14.2.7",
"@angular/common": "^14.2.12",
"@angular/compiler": "^14.2.12",
"@angular/core": "^14.2.12",
"@angular/flex-layout": "^14.0.0-beta.41",
"@angular/forms": "^14.2.12",
"@angular/material": "^14.2.7",
"@angular/platform-browser": "^14.2.12",
"@angular/platform-browser-dynamic": "^14.2.12",
"@angular/router": "^14.2.12",
"@auth0/angular-jwt": "^5.1.2",
"@date-io/core": "1.3.7",
"@date-io/date-fns": "1.3.7",
"@flowjs/flow.js": "^2.14.1",
"@flowjs/ngx-flow": "~0.4.6",
"@flowjs/ngx-flow": "~0.6.0",
"@geoman-io/leaflet-geoman-free": "^2.13.0",
"@juggle/resize-observer": "^3.3.1",
"@mat-datetimepicker/core": "~7.0.1",
"@mat-datetimepicker/core": "~10.1.1",
"@material-ui/core": "4.12.3",
"@material-ui/icons": "4.11.2",
"@material-ui/pickers": "3.3.10",
"@ngrx/effects": "^12.5.1",
"@ngrx/store": "^12.5.1",
"@ngrx/store-devtools": "^12.5.1",
"@ngx-translate/core": "^13.0.0",
"@ngx-translate/http-loader": "^6.0.0",
"@ngrx/effects": "^14.3.3",
"@ngrx/store": "^14.3.3",
"@ngrx/store-devtools": "^14.3.3",
"@ngx-translate/core": "^14.0.0",
"@ngx-translate/http-loader": "^7.0.0",
"ace-builds": "1.4.13",
"ace-diff": "^3.0.3",
"angular-gridster2": "~12.1.1",
"angular2-hotkeys": "^2.4.0",
"angular-gridster2": "~14.1.4",
"angular2-hotkeys": "^13.1.0",
"canvas-gauges": "^2.1.7",
"core-js": "^3.19.2",
"date-fns": "^2.26.0",
"core-js": "^3.26.1",
"date-fns": "2.0.0-alpha.27",
"dayjs": "1.11.4",
"flot": "https://github.com/thingsboard/flot.git#0.9-work",
"flot.curvedlines": "https://github.com/MichaelZinsmaier/CurvedLines.git#master",
"font-awesome": "^4.7.0",
"html2canvas": "^1.3.3",
"html2canvas": "^1.4.1",
"jquery": "^3.6.0",
"jquery.terminal": "^2.29.4",
"js-beautify": "^1.14.0",
"json-schema-defaults": "^0.4.0",
"jstree": "^3.3.12",
"jstree-bootstrap-theme": "^1.0.1",
"jszip": "^3.7.1",
"jszip": "^3.10.1",
"leaflet": "~1.8.0",
"leaflet-polylinedecorator": "^1.6.0",
"leaflet-providers": "^1.13.0",
@ -66,20 +68,20 @@
"libphonenumber-js": "^1.10.4",
"messageformat": "^2.3.0",
"moment": "^2.29.1",
"moment-timezone": "^0.5.34",
"ngx-clipboard": "^14.0.2",
"ngx-color-picker": "^11.0.0",
"ngx-daterangepicker-material": "^5.0.1",
"ngx-drag-drop": "^2.0.0",
"ngx-flowchart": "https://github.com/thingsboard/ngx-flowchart.git#release/1.0.0",
"ngx-hm-carousel": "^2.0.1",
"ngx-markdown": "^12.1.0",
"ngx-sharebuttons": "^9.0.0",
"ngx-translate-messageformat-compiler": "^4.11.0",
"moment-timezone": "^0.5.40",
"ngx-clipboard": "^15.1.0",
"ngx-color-picker": "^13.0.0",
"ngx-daterangepicker-material": "^6.0.4",
"ngx-drag-drop": "^14.0.0",
"ngx-flowchart": "https://github.com/thingsboard/ngx-flowchart.git#release/2.0.0",
"ngx-hm-carousel": "^3.0.0",
"ngx-markdown": "^14.0.1",
"ngx-sharebuttons": "^11.0.0",
"ngx-translate-messageformat-compiler": "^5.1.0",
"objectpath": "^2.0.0",
"prettier": "^2.5.0",
"prop-types": "^15.7.2",
"qrcode": "^1.5.0",
"prettier": "^2.8.3",
"prop-types": "^15.8.1",
"qrcode": "^1.5.1",
"raphael": "^2.3.0",
"rc-select": "13.2.1",
"react": "17.0.2",
@ -87,29 +89,35 @@
"react-dom": "17.0.2",
"react-dropzone": "^11.4.2",
"reactcss": "^1.2.3",
"rxjs": "~6.6.7",
"schema-inspector": "^2.0.1",
"screenfull": "^6.0.0",
"split.js": "^1.6.4",
"rxjs": "~7.8.0",
"schema-inspector": "^2.0.2",
"screenfull": "^6.0.2",
"split.js": "^1.6.5",
"systemjs": "6.11.0",
"tinycolor2": "^1.4.2",
"tinycolor2": "~1.4.2",
"tooltipster": "^4.2.8",
"ts-transformer-keys": "^0.4.3",
"tslib": "^2.3.1",
"ts-transformer-keys": "^0.4.4",
"tslib": "^2.4.1",
"tv4": "^1.3.0",
"typeface-roboto": "^1.1.13",
"zone.js": "~0.11.4"
"zone.js": "~0.11.8"
},
"devDependencies": {
"@angular-builders/custom-webpack": "~12.1.3",
"@angular-devkit/build-angular": "^12.2.17",
"@angular/cli": "^12.2.17",
"@angular/compiler-cli": "^12.2.16",
"@angular/language-service": "^12.2.16",
"@ngtools/webpack": "^12.2.17",
"@angular-builders/custom-webpack": "~14.1.0",
"@angular-devkit/build-angular": "^14.2.10",
"@angular-eslint/builder": "14.4.0",
"@angular-eslint/eslint-plugin": "14.4.0",
"@angular-eslint/eslint-plugin-template": "14.4.0",
"@angular-eslint/schematics": "14.4.0",
"@angular-eslint/template-parser": "14.4.0",
"@angular/cli": "^14.2.10",
"@angular/compiler-cli": "^14.2.12",
"@angular/language-service": "^14.2.12",
"@ngtools/webpack": "^14.2.10",
"@types/ace-diff": "^2.1.1",
"@types/canvas-gauges": "^2.1.4",
"@types/flot": "^0.0.32",
"@types/flowjs": "^2.13.9",
"@types/jasmine": "~3.10.2",
"@types/jasminewd2": "^2.0.10",
"@types/jquery": "^3.5.9",
@ -130,9 +138,14 @@
"@types/systemjs": "6.1.1",
"@types/tinycolor2": "^1.4.3",
"@types/tooltipster": "^0.0.31",
"codelyzer": "^6.0.2",
"compression-webpack-plugin": "^9.0.1",
"directory-tree": "^3.0.1",
"@typescript-eslint/eslint-plugin": "5.43.0",
"@typescript-eslint/parser": "5.43.0",
"compression-webpack-plugin": "^10.0.0",
"directory-tree": "^3.5.1",
"eslint": "^8.28.0",
"eslint-plugin-import": "latest",
"eslint-plugin-jsdoc": "latest",
"eslint-plugin-prefer-arrow": "latest",
"jasmine-core": "~3.10.1",
"jasmine-spec-reporter": "~7.0.0",
"karma": "~6.3.9",
@ -141,18 +154,17 @@
"karma-jasmine": "~4.0.1",
"karma-jasmine-html-reporter": "^1.7.0",
"ngrx-store-freeze": "^0.2.4",
"patch-package": "^6.4.7",
"patch-package": "^6.5.1",
"postinstall-prepare": "^2.0.0",
"protractor": "~7.0.0",
"raw-loader": "^4.0.2",
"ts-node": "^10.4.0",
"tslint": "~6.1.3",
"typescript": "~4.3.5",
"webpack": "^5.64.4"
"ts-node": "^10.9.1",
"typescript": "~4.6.4",
"webpack": "^5.75.0"
},
"resolutions": {
"lodash": "~4.17.21",
"@types/react": "17.0.37",
"ace-builds": "1.4.13"
"ace-builds": "1.4.13",
"@date-io/core": "1.3.7"
}
}

127
ui-ngx/src/app/core/api/widget-subscription.ts

@ -83,6 +83,59 @@ import { RpcStatus } from '@shared/models/rpc.models';
const moment = moment_;
const calculateMin = (data: DataSet): number => {
if (data.length > 0) {
let result = Number(data[0][1]);
for (let i = 1; i < data.length; i++) {
result = Math.min(result, Number(data[i][1]));
}
return result;
} else {
return null;
}
};
const calculateMax = (data: DataSet): number => {
if (data.length > 0) {
let result = Number(data[0][1]);
for (let i = 1; i < data.length; i++) {
result = Math.max(result, Number(data[i][1]));
}
return result;
} else {
return null;
}
};
const calculateTotal = (data: DataSet): number => {
if (data.length > 0) {
let result = 0;
data.forEach((dataRow) => {
result += Number(dataRow[1]);
});
return result;
} else {
return null;
}
};
const calculateAvg = (data: DataSet): number => {
if (data.length > 0) {
return calculateTotal(data) / data.length;
} else {
return null;
}
};
const calculateLatest = (data: DataSet): number => {
if (data.length > 0) {
return Number(data[data.length - 1][1]);
} else {
return null;
}
};
export class WidgetSubscription implements IWidgetSubscription {
id: string;
@ -151,7 +204,7 @@ export class WidgetSubscription implements IWidgetSubscription {
targetDeviceAliasId: string;
targetDeviceId: string;
targetDeviceName: string;
executingSubjects: Array<Subject<any>>;
executingSubjects: Array<Subject<void>>;
subscribed = false;
hasLatestData = false;
@ -305,7 +358,7 @@ export class WidgetSubscription implements IWidgetSubscription {
}
private initRpc(): Observable<any> {
const initRpcSubject = new ReplaySubject();
const initRpcSubject = new ReplaySubject<void>();
if (this.targetDeviceAliasIds && this.targetDeviceAliasIds.length > 0) {
this.targetDeviceAliasId = this.targetDeviceAliasIds[0];
this.ctx.aliasController.resolveSingleEntityInfo(this.targetDeviceAliasId).subscribe(
@ -354,7 +407,7 @@ export class WidgetSubscription implements IWidgetSubscription {
}
private initAlarmSubscription(): Observable<any> {
const initAlarmSubscriptionSubject = new ReplaySubject(1);
const initAlarmSubscriptionSubject = new ReplaySubject<void>(1);
this.loadStDiff().subscribe(() => {
if (!this.ctx.aliasController) {
this.hasResolvedData = true;
@ -387,7 +440,7 @@ export class WidgetSubscription implements IWidgetSubscription {
private initDataSubscription(): Observable<any> {
this.notifyDataLoading();
const initDataSubscriptionSubject = new ReplaySubject(1);
const initDataSubscriptionSubject = new ReplaySubject<void>(1);
this.loadStDiff().subscribe(() => {
if (!this.ctx.aliasController) {
this.configuredDatasources = deepClone(this.configuredDatasources);
@ -459,9 +512,7 @@ export class WidgetSubscription implements IWidgetSubscription {
initialPageDataChanged: this.initialPageDataChanged.bind(this),
forceReInit: this.forceReInit.bind(this),
dataUpdated: this.dataUpdated.bind(this),
updateRealtimeSubscription: () => {
return this.updateRealtimeSubscription();
},
updateRealtimeSubscription: () => this.updateRealtimeSubscription(),
setRealtimeSubscription: (subscriptionTimewindow) => {
this.updateRealtimeSubscription(deepClone(subscriptionTimewindow));
}
@ -762,7 +813,7 @@ export class WidgetSubscription implements IWidgetSubscription {
if (timeout && timeout > 0) {
requestBody.timeout = timeout;
}
const rpcSubject: Subject<any> = new Subject<any>();
const rpcSubject: Subject<any | void> = oneWayElseTwoWay ? new Subject<void>() : new Subject<any>();
this.executingRpcRequest = true;
this.callbacks.rpcStateChanged(this);
if (this.ctx.utils.widgetEditMode) {
@ -770,7 +821,7 @@ export class WidgetSubscription implements IWidgetSubscription {
this.executingRpcRequest = false;
this.callbacks.rpcStateChanged(this);
if (oneWayElseTwoWay) {
rpcSubject.next();
(rpcSubject as Subject<void>).next();
rpcSubject.complete();
} else {
rpcSubject.next(requestBody);
@ -911,9 +962,7 @@ export class WidgetSubscription implements IWidgetSubscription {
this.dataLoaded(pageData, data1, datasourceIndex1, pageLink1, true);
},
dataUpdated: this.dataUpdated.bind(this),
updateRealtimeSubscription: () => {
return this.updateRealtimeSubscription();
},
updateRealtimeSubscription: () => this.updateRealtimeSubscription(),
setRealtimeSubscription: (subscriptionTimewindow) => {
this.updateRealtimeSubscription(deepClone(subscriptionTimewindow));
}
@ -1560,7 +1609,7 @@ export class WidgetSubscription implements IWidgetSubscription {
}
private loadStDiff(): Observable<any> {
const loadSubject = new ReplaySubject(1);
const loadSubject = new ReplaySubject<void>(1);
if (this.ctx.getServerTimeDiff && this.timeWindow) {
this.ctx.getServerTimeDiff().subscribe(
(stDiff) => {
@ -1584,55 +1633,3 @@ export class WidgetSubscription implements IWidgetSubscription {
return loadSubject.asObservable();
}
}
function calculateMin(data: DataSet): number {
if (data.length > 0) {
let result = Number(data[0][1]);
for (let i = 1; i < data.length; i++) {
result = Math.min(result, Number(data[i][1]));
}
return result;
} else {
return null;
}
}
function calculateMax(data: DataSet): number {
if (data.length > 0) {
let result = Number(data[0][1]);
for (let i = 1; i < data.length; i++) {
result = Math.max(result, Number(data[i][1]));
}
return result;
} else {
return null;
}
}
function calculateAvg(data: DataSet): number {
if (data.length > 0) {
return calculateTotal(data) / data.length;
} else {
return null;
}
}
function calculateTotal(data: DataSet): number {
if (data.length > 0) {
let result = 0;
data.forEach((dataRow) => {
result += Number(dataRow[1]);
});
return result;
} else {
return null;
}
}
function calculateLatest(data: DataSet): number {
if (data.length > 0) {
return Number(data[data.length - 1][1]);
} else {
return null;
}
}

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

@ -21,7 +21,7 @@ import { AuthState } from './auth.models';
import { take } from 'rxjs/operators';
import { AuthUser } from '@shared/models/user.model';
export const selectAuthState = createFeatureSelector<AppState, AuthState>(
export const selectAuthState = createFeatureSelector< AuthState>(
'auth'
);

4
ui-ngx/src/app/core/guards/confirm-on-exit.guard.ts

@ -16,7 +16,7 @@
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, CanDeactivate, RouterStateSnapshot } from '@angular/router';
import { FormGroup } from '@angular/forms';
import { UntypedFormGroup } from '@angular/forms';
import { select, Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { AuthState } from '@core/auth/auth.models';
@ -27,7 +27,7 @@ import { TranslateService } from '@ngx-translate/core';
import { isDefined } from '../utils';
export interface HasConfirmForm {
confirmForm(): FormGroup;
confirmForm(): UntypedFormGroup;
}
export interface HasDirtyFlag {

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

@ -876,7 +876,7 @@ export class EntityService {
if (result.entityParamName && result.entityParamName.length) {
targetParams = stateParams[result.entityParamName];
}
if (targetParams && targetParams.entityId) {
if (targetParams && targetParams.entityId && targetParams.entityName) {
currentEntity = {
id: targetParams.entityId.id,
entityType: targetParams.entityId.entityType as EntityType,

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

@ -51,7 +51,7 @@ export class WidgetService {
private widgetsInfoInMemoryCache = new Map<string, WidgetInfo>();
private loadWidgetsBundleCacheSubject: ReplaySubject<any>;
private loadWidgetsBundleCacheSubject: ReplaySubject<void>;
constructor(
private http: HttpClient,
@ -111,15 +111,13 @@ export class WidgetService {
public deleteWidgetsBundle(widgetsBundleId: string, config?: RequestConfig) {
return this.getWidgetsBundle(widgetsBundleId, config).pipe(
mergeMap((widgetsBundle) => {
return this.http.delete(`/api/widgetsBundle/${widgetsBundleId}`,
mergeMap((widgetsBundle) => this.http.delete(`/api/widgetsBundle/${widgetsBundleId}`,
defaultHttpOptionsFromConfig(config)).pipe(
tap(() => {
this.invalidateWidgetsBundleCache();
this.widgetsBundleDeleted(widgetsBundle);
})
);
}
)
));
}
@ -232,14 +230,12 @@ export class WidgetService {
public deleteWidgetType(bundleAlias: string, widgetTypeAlias: string, isSystem: boolean,
config?: RequestConfig) {
return this.getWidgetType(bundleAlias, widgetTypeAlias, isSystem, config).pipe(
mergeMap((widgetTypeInstance) => {
return this.http.delete(`/api/widgetType/${widgetTypeInstance.id.id}`,
mergeMap((widgetTypeInstance) => this.http.delete(`/api/widgetType/${widgetTypeInstance.id.id}`,
defaultHttpOptionsFromConfig(config)).pipe(
tap(() => {
this.widgetTypeUpdated(widgetTypeInstance);
})
);
}
)
));
}
@ -301,7 +297,7 @@ export class WidgetService {
private loadWidgetsBundleCache(config?: RequestConfig): Observable<any> {
if (!this.allWidgetsBundles) {
if (!this.loadWidgetsBundleCacheSubject) {
this.loadWidgetsBundleCacheSubject = new ReplaySubject();
this.loadWidgetsBundleCacheSubject = new ReplaySubject<void>();
this.http.get<Array<WidgetsBundle>>('/api/widgetsBundles',
defaultHttpOptionsFromConfig(config)).subscribe(
(allWidgetsBundles) => {

2
ui-ngx/src/app/core/interceptors/load.selectors.ts

@ -20,7 +20,7 @@ import { AppState } from '../core.state';
import { LoadState } from './load.models';
import { take } from 'rxjs/operators';
export const selectLoadState = createFeatureSelector<AppState, LoadState>(
export const selectLoadState = createFeatureSelector< LoadState>(
'load'
);

14
ui-ngx/src/app/core/notification/notification.effects.ts

@ -15,7 +15,7 @@
///
import { Injectable } from '@angular/core';
import { Actions, Effect, ofType } from '@ngrx/effects';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import { map } from 'rxjs/operators';
import { NotificationActions, NotificationActionTypes } from '@app/core/notification/notification.actions';
@ -29,23 +29,23 @@ export class NotificationEffects {
) {
}
@Effect({dispatch: false})
dispatchNotification = this.actions$.pipe(
dispatchNotification = createEffect(() => this.actions$.pipe(
ofType(
NotificationActionTypes.SHOW_NOTIFICATION,
),
map(({ notification }) => {
this.notificationService.dispatchNotification(notification);
})
);
), {dispatch: false});
@Effect({dispatch: false})
hideNotification = this.actions$.pipe(
hideNotification = createEffect(() => this.actions$.pipe(
ofType(
NotificationActionTypes.HIDE_NOTIFICATION,
),
map(({ hideNotification }) => {
this.notificationService.hideNotification(hideNotification);
})
);
), {dispatch: false});
}

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

@ -33,9 +33,9 @@ export class RafService {
private ngZone: NgZone
) {
const requestAnimationFrame: (frameCallback: () => void) => number = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame;
(window as any).webkitRequestAnimationFrame;
const cancelAnimationFrame = window.cancelAnimationFrame ||
window.webkitCancelAnimationFrame ||
(window as any).webkitCancelAnimationFrame ||
// @ts-ignore
window.webkitCancelRequestAnimationFrame;

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

@ -40,7 +40,7 @@ export interface ModulesWithFactories {
})
export class ResourcesService {
private loadedResources: { [url: string]: ReplaySubject<any> } = {};
private loadedResources: { [url: string]: ReplaySubject<void> } = {};
private loadedModules: { [url: string]: ReplaySubject<Type<any>[]> } = {};
private loadedModulesAndFactories: { [url: string]: ReplaySubject<ModulesWithFactories> } = {};
@ -214,7 +214,7 @@ export class ResourcesService {
}
private loadResourceByType(type: 'css' | 'js', url: string): Observable<any> {
const subject = new ReplaySubject();
const subject = new ReplaySubject<void>();
this.loadedResources[url] = subject;
let el;
let loaded = false;

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

@ -14,7 +14,7 @@
/// limitations under the License.
///
// tslint:disable-next-line:no-reference
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
/// <reference path="../../../../src/typings/rawloader.typings.d.ts" />
import { Inject, Injectable, NgZone } from '@angular/core';

26
ui-ngx/src/app/core/settings/settings.effects.ts

@ -17,7 +17,7 @@
import { ActivationEnd, Router } from '@angular/router';
import { Injectable } from '@angular/core';
import { select, Store } from '@ngrx/store';
import { Actions, Effect, ofType } from '@ngrx/effects';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import { TranslateService } from '@ngx-translate/core';
import { merge } from 'rxjs';
import { distinctUntilChanged, filter, map, tap, withLatestFrom } from 'rxjs/operators';
@ -49,8 +49,8 @@ export class SettingsEffects {
) {
}
@Effect({dispatch: false})
persistSettings = this.actions$.pipe(
persistSettings = createEffect(() => this.actions$.pipe(
ofType(
SettingsActionTypes.CHANGE_LANGUAGE,
),
@ -58,18 +58,18 @@ export class SettingsEffects {
tap(([action, settings]) =>
this.localStorageService.setItem(SETTINGS_KEY, settings)
)
);
), {dispatch: false});
@Effect({dispatch: false})
setTranslateServiceLanguage = this.store.pipe(
setTranslateServiceLanguage = createEffect(() => this.store.pipe(
select(selectSettingsState),
map(settings => settings.userLang),
distinctUntilChanged(),
tap(userLang => updateUserLang(this.translate, userLang))
);
), {dispatch: false});
@Effect({dispatch: false})
setTitle = merge(
setTitle = createEffect(() => merge(
this.actions$.pipe(ofType(SettingsActionTypes.CHANGE_LANGUAGE)),
this.router.events.pipe(filter(event => event instanceof ActivationEnd))
).pipe(
@ -79,10 +79,10 @@ export class SettingsEffects {
this.translate
);
})
);
), {dispatch: false});
@Effect({dispatch: false})
setPublicId = merge(
setPublicId = createEffect(() => merge(
this.router.events.pipe(filter(event => event instanceof ActivationEnd))
).pipe(
tap((event) => {
@ -95,5 +95,5 @@ export class SettingsEffects {
{ lastPublicDashboardId: snapshot.params.dashboardId}));
}
})
);
), {dispatch: false});
}

2
ui-ngx/src/app/core/settings/settings.selectors.ts

@ -19,7 +19,7 @@ import { createFeatureSelector, createSelector } from '@ngrx/store';
import { SettingsState } from './settings.models';
import { AppState } from '@app/core/core.state';
export const selectSettingsState = createFeatureSelector<AppState, SettingsState>(
export const selectSettingsState = createFeatureSelector< SettingsState>(
'settings'
);

4
ui-ngx/src/app/core/translate/translate-default-parser.ts

@ -22,7 +22,7 @@ import { isDefinedAndNotNull } from '@core/utils';
export class TranslateDefaultParser extends TranslateParser {
templateMatcher: RegExp = /{{\s?([^{}\s]*)\s?}}/g;
// tslint:disable-next-line:ban-types
// eslint-disable-next-line @typescript-eslint/ban-types
public interpolate(expr: string | Function, params?: any): string {
let result: string;
@ -58,7 +58,7 @@ export class TranslateDefaultParser extends TranslateParser {
return target;
}
// tslint:disable-next-line:ban-types
// eslint-disable-next-line @typescript-eslint/ban-types
private interpolateFunction(fn: Function, params?: any) {
return fn(params);
}

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

@ -258,9 +258,9 @@ export function hashCode(str: string): number {
}
for (i = 0; i < str.length; i++) {
char = str.charCodeAt(i);
// tslint:disable-next-line:no-bitwise
// eslint-disable-next-line no-bitwise
hash = ((hash << 5) - hash) + char;
// tslint:disable-next-line:no-bitwise
// eslint-disable-next-line no-bitwise
hash = hash & hash; // Convert to 32bit integer
}
return hash;

4
ui-ngx/src/app/modules/common/modules-map.ts

@ -241,7 +241,7 @@ import * as FilterPredicateValueComponent from '@home/components/filter/filter-p
import * as TenantProfileComponent from '@home/components/profile/tenant-profile.component';
import * as TenantProfileDialogComponent from '@home/components/profile/tenant-profile-dialog.component';
import * as TenantProfileDataComponent from '@home/components/profile/tenant-profile-data.component';
// tslint:disable-next-line:max-line-length
// eslint-disable-next-line max-len
import * as DefaultDeviceProfileConfigurationComponent from '@home/components/profile/device/default-device-profile-configuration.component';
import * as DeviceProfileConfigurationComponent from '@home/components/profile/device/device-profile-configuration.component';
import * as DeviceProfileComponent from '@home/components/profile/device-profile.component';
@ -266,7 +266,7 @@ import * as AlarmScheduleInfoComponent from '@home/components/profile/alarm/alar
import * as AlarmScheduleDialogComponent from '@home/components/profile/alarm/alarm-schedule-dialog.component';
import * as EditAlarmDetailsDialogComponent from '@home/components/profile/alarm/edit-alarm-details-dialog.component';
import * as AlarmRuleConditionDialogComponent from '@home/components/profile/alarm/alarm-rule-condition-dialog.component';
// tslint:disable-next-line:max-line-length
// eslint-disable-next-line max-len
import * as DefaultTenantProfileConfigurationComponent from '@home/components/profile/tenant/default-tenant-profile-configuration.component';
import * as TenantProfileConfigurationComponent from '@home/components/profile/tenant/tenant-profile-configuration.component';
import * as SmsProviderConfigurationComponent from '@home/components/sms/sms-provider-configuration.component';

6
ui-ngx/src/app/modules/home/components/alarm/alarm-details-dialog.component.ts

@ -18,7 +18,7 @@ import { Component, Inject, OnInit } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormBuilder, FormGroup } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { Observable, ReplaySubject } from 'rxjs';
import { Router } from '@angular/router';
import { DialogComponent } from '@app/shared/components/dialog.component';
@ -50,7 +50,7 @@ export interface AlarmDetailsDialogData {
export class AlarmDetailsDialogComponent extends DialogComponent<AlarmDetailsDialogComponent, boolean> implements OnInit {
alarmId: string;
alarmFormGroup: FormGroup;
alarmFormGroup: UntypedFormGroup;
allowAcknowledgment: boolean;
allowClear: boolean;
@ -73,7 +73,7 @@ export class AlarmDetailsDialogComponent extends DialogComponent<AlarmDetailsDia
@Inject(MAT_DIALOG_DATA) public data: AlarmDetailsDialogData,
private alarmService: AlarmService,
public dialogRef: MatDialogRef<AlarmDetailsDialogComponent, boolean>,
public fb: FormBuilder) {
public fb: UntypedFormBuilder) {
super(store, router, dialogRef);
this.allowAcknowledgment = data.allowAcknowledgment;

6
ui-ngx/src/app/modules/home/components/alias/aliases-entity-autocomplete.component.ts

@ -15,7 +15,7 @@
///
import { AfterViewInit, Component, ElementRef, forwardRef, Input, OnInit, ViewChild } from '@angular/core';
import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR } from '@angular/forms';
import { ControlValueAccessor, UntypedFormBuilder, UntypedFormGroup, NG_VALUE_ACCESSOR } from '@angular/forms';
import { Observable, of } from 'rxjs';
import { catchError, debounceTime, distinctUntilChanged, map, share, switchMap, tap } from 'rxjs/operators';
import { emptyPageData, PageData } from '@shared/models/page/page-data';
@ -40,7 +40,7 @@ import { isDefinedAndNotNull } from '@core/utils';
})
export class AliasesEntityAutocompleteComponent implements ControlValueAccessor, OnInit, AfterViewInit {
selectEntityInfoFormGroup: FormGroup;
selectEntityInfoFormGroup: UntypedFormGroup;
modelValue: EntityInfo | null;
@ -73,7 +73,7 @@ export class AliasesEntityAutocompleteComponent implements ControlValueAccessor,
constructor(private store: Store<AppState>,
public translate: TranslateService,
private entityService: EntityService,
private fb: FormBuilder) {
private fb: UntypedFormBuilder) {
this.selectEntityInfoFormGroup = this.fb.group({
entityInfo: [null]
});

14
ui-ngx/src/app/modules/home/components/alias/entity-alias-dialog.component.ts

@ -20,9 +20,9 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import {
FormBuilder,
FormControl,
FormGroup,
UntypedFormBuilder,
UntypedFormControl,
UntypedFormGroup,
FormGroupDirective,
NgForm,
ValidatorFn,
@ -59,7 +59,7 @@ export class EntityAliasDialogComponent extends DialogComponent<EntityAliasDialo
alias: EntityAlias;
entityAliasFormGroup: FormGroup;
entityAliasFormGroup: UntypedFormGroup;
submitted = false;
@ -68,7 +68,7 @@ export class EntityAliasDialogComponent extends DialogComponent<EntityAliasDialo
@Inject(MAT_DIALOG_DATA) public data: EntityAliasDialogData,
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
public dialogRef: MatDialogRef<EntityAliasDialogComponent, EntityAlias>,
private fb: FormBuilder,
private fb: UntypedFormBuilder,
private utils: UtilsService,
public translate: TranslateService,
private entityService: EntityService) {
@ -103,7 +103,7 @@ export class EntityAliasDialogComponent extends DialogComponent<EntityAliasDialo
}
validateDuplicateAliasName(): ValidatorFn {
return (c: FormControl) => {
return (c: UntypedFormControl) => {
const newAlias = c.value.trim();
const found = this.entityAliases.find((entityAlias) => entityAlias.alias === newAlias);
if (found) {
@ -122,7 +122,7 @@ export class EntityAliasDialogComponent extends DialogComponent<EntityAliasDialo
ngOnInit(): void {
}
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const originalErrorState = this.errorStateMatcher.isErrorState(control, form);
const customErrorState = !!(control && control.invalid && this.submitted);
return originalErrorState || customErrorState;

12
ui-ngx/src/app/modules/home/components/alias/entity-alias-select.component.ts

@ -17,9 +17,9 @@
import { AfterViewInit, Component, ElementRef, forwardRef, Input, OnInit, SkipSelf, ViewChild } from '@angular/core';
import {
ControlValueAccessor,
FormBuilder,
FormControl,
FormGroup,
UntypedFormBuilder,
UntypedFormControl,
UntypedFormGroup,
FormGroupDirective,
NG_VALUE_ACCESSOR,
NgForm
@ -56,7 +56,7 @@ import { ErrorStateMatcher } from '@angular/material/core';
})
export class EntityAliasSelectComponent implements ControlValueAccessor, OnInit, AfterViewInit, ErrorStateMatcher {
selectEntityAliasFormGroup: FormGroup;
selectEntityAliasFormGroup: UntypedFormGroup;
modelValue: string | null;
@ -107,7 +107,7 @@ export class EntityAliasSelectComponent implements ControlValueAccessor, OnInit,
private entityService: EntityService,
public translate: TranslateService,
public truncate: TruncatePipe,
private fb: FormBuilder) {
private fb: UntypedFormBuilder) {
this.selectEntityAliasFormGroup = this.fb.group({
entityAlias: [null]
});
@ -151,7 +151,7 @@ export class EntityAliasSelectComponent implements ControlValueAccessor, OnInit,
);
}
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const originalErrorState = this.errorStateMatcher.isErrorState(control, form);
const customErrorState = this.tbRequired && !this.modelValue;
return originalErrorState || customErrorState;

24
ui-ngx/src/app/modules/home/components/alias/entity-aliases-dialog.component.ts

@ -21,10 +21,10 @@ import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import {
AbstractControl,
FormArray,
FormBuilder,
FormControl,
FormGroup,
UntypedFormArray,
UntypedFormBuilder,
UntypedFormControl,
UntypedFormGroup,
FormGroupDirective,
NgForm,
Validators
@ -67,7 +67,7 @@ export class EntityAliasesDialogComponent extends DialogComponent<EntityAliasesD
aliasToWidgetsMap: {[aliasId: string]: Array<string>} = {};
entityAliasesFormGroup: FormGroup;
entityAliasesFormGroup: UntypedFormGroup;
submitted = false;
@ -76,7 +76,7 @@ export class EntityAliasesDialogComponent extends DialogComponent<EntityAliasesD
@Inject(MAT_DIALOG_DATA) public data: EntityAliasesDialogData,
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
public dialogRef: MatDialogRef<EntityAliasesDialogComponent, EntityAliases>,
private fb: FormBuilder,
private fb: UntypedFormBuilder,
private utils: UtilsService,
private translate: TranslateService,
private dialogs: DialogService,
@ -157,14 +157,14 @@ export class EntityAliasesDialogComponent extends DialogComponent<EntityAliasesD
}
entityAliasesFormArray(): FormArray {
return this.entityAliasesFormGroup.get('entityAliases') as FormArray;
entityAliasesFormArray(): UntypedFormArray {
return this.entityAliasesFormGroup.get('entityAliases') as UntypedFormArray;
}
ngOnInit(): void {
}
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const originalErrorState = this.errorStateMatcher.isErrorState(control, form);
const customErrorState = !!(control && control.invalid && this.submitted);
return originalErrorState || customErrorState;
@ -183,7 +183,7 @@ export class EntityAliasesDialogComponent extends DialogComponent<EntityAliasesD
this.dialogs.alert(this.translate.instant('entity.unable-delete-entity-alias-title'),
message, this.translate.instant('action.close'), true);
} else {
(this.entityAliasesFormGroup.get('entityAliases') as FormArray).removeAt(index);
(this.entityAliasesFormGroup.get('entityAliases') as UntypedFormArray).removeAt(index);
this.entityAliasesFormGroup.markAsDirty();
}
}
@ -216,10 +216,10 @@ export class EntityAliasesDialogComponent extends DialogComponent<EntityAliasesD
}).afterClosed().subscribe((entityAlias) => {
if (entityAlias) {
if (isAdd) {
(this.entityAliasesFormGroup.get('entityAliases') as FormArray)
(this.entityAliasesFormGroup.get('entityAliases') as UntypedFormArray)
.push(this.createEntityAliasFormControl(entityAlias.id, entityAlias));
} else {
const aliasFormControl = (this.entityAliasesFormGroup.get('entityAliases') as FormArray).at(index);
const aliasFormControl = (this.entityAliasesFormGroup.get('entityAliases') as UntypedFormArray).at(index);
aliasFormControl.get('alias').patchValue(entityAlias.alias);
aliasFormControl.get('filter').patchValue(entityAlias.filter);
aliasFormControl.get('resolveMultiple').patchValue(entityAlias.filter.resolveMultiple);

8
ui-ngx/src/app/modules/home/components/attribute/add-attribute-dialog.component.ts

@ -19,7 +19,7 @@ import { ErrorStateMatcher } from '@angular/material/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormBuilder, FormControl, FormGroup, FormGroupDirective, NgForm, Validators } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, FormGroupDirective, NgForm, Validators } from '@angular/forms';
import { EntityId } from '@shared/models/id/entity-id';
import { Router } from '@angular/router';
import { DialogComponent } from '@app/shared/components/dialog.component';
@ -40,7 +40,7 @@ export interface AddAttributeDialogData {
export class AddAttributeDialogComponent extends DialogComponent<AddAttributeDialogComponent, boolean>
implements OnInit, ErrorStateMatcher {
attributeFormGroup: FormGroup;
attributeFormGroup: UntypedFormGroup;
submitted = false;
@ -50,7 +50,7 @@ export class AddAttributeDialogComponent extends DialogComponent<AddAttributeDia
private attributeService: AttributeService,
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
public dialogRef: MatDialogRef<AddAttributeDialogComponent, boolean>,
public fb: FormBuilder) {
public fb: UntypedFormBuilder) {
super(store, router, dialogRef);
}
@ -61,7 +61,7 @@ export class AddAttributeDialogComponent extends DialogComponent<AddAttributeDia
});
}
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const originalErrorState = this.errorStateMatcher.isErrorState(control, form);
const customErrorState = !!(control && control.invalid && this.submitted);
return originalErrorState || customErrorState;

8
ui-ngx/src/app/modules/home/components/attribute/add-widget-to-dashboard-dialog.component.ts

@ -19,7 +19,7 @@ import { ErrorStateMatcher } from '@angular/material/core';
import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormBuilder, FormControl, FormGroup, FormGroupDirective, NgForm, Validators } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, FormGroupDirective, NgForm, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { DialogComponent } from '@app/shared/components/dialog.component';
import { UtilsService } from '@core/services/utils.service';
@ -57,7 +57,7 @@ export class AddWidgetToDashboardDialogComponent extends
DialogComponent<AddWidgetToDashboardDialogComponent, void>
implements OnInit, ErrorStateMatcher {
addWidgetFormGroup: FormGroup;
addWidgetFormGroup: UntypedFormGroup;
submitted = false;
@ -66,7 +66,7 @@ export class AddWidgetToDashboardDialogComponent extends
@Inject(MAT_DIALOG_DATA) public data: AddWidgetToDashboardDialogData,
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
public dialogRef: MatDialogRef<AddWidgetToDashboardDialogComponent, void>,
private fb: FormBuilder,
private fb: UntypedFormBuilder,
private utils: UtilsService,
private dashboardUtils: DashboardUtilsService,
private dashboardService: DashboardService,
@ -107,7 +107,7 @@ export class AddWidgetToDashboardDialogComponent extends
ngOnInit(): void {
}
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const originalErrorState = this.errorStateMatcher.isErrorState(control, form);
const customErrorState = !!(control && control.invalid && this.submitted);
return originalErrorState || customErrorState;

8
ui-ngx/src/app/modules/home/components/attribute/edit-attribute-value-panel.component.ts

@ -18,7 +18,7 @@ import { Component, Inject, InjectionToken, OnInit, SkipSelf } from '@angular/co
import { ErrorStateMatcher } from '@angular/material/core';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormBuilder, FormControl, FormGroup, FormGroupDirective, NgForm, Validators } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, FormGroupDirective, NgForm, Validators } from '@angular/forms';
import { PageComponent } from '@shared/components/page.component';
import { OverlayRef } from '@angular/cdk/overlay';
@ -36,7 +36,7 @@ export interface EditAttributeValuePanelData {
})
export class EditAttributeValuePanelComponent extends PageComponent implements OnInit, ErrorStateMatcher {
attributeFormGroup: FormGroup;
attributeFormGroup: UntypedFormGroup;
result: any = null;
@ -46,7 +46,7 @@ export class EditAttributeValuePanelComponent extends PageComponent implements O
@Inject(EDIT_ATTRIBUTE_VALUE_PANEL_DATA) public data: EditAttributeValuePanelData,
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
public overlayRef: OverlayRef,
public fb: FormBuilder) {
public fb: UntypedFormBuilder) {
super(store);
}
@ -56,7 +56,7 @@ export class EditAttributeValuePanelComponent extends PageComponent implements O
});
}
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const originalErrorState = this.errorStateMatcher.isErrorState(control, form);
const customErrorState = !!(control && control.invalid && this.submitted);
return originalErrorState || customErrorState;

8
ui-ngx/src/app/modules/home/components/dashboard-page/add-widget-dialog.component.ts

@ -19,7 +19,7 @@ import { ErrorStateMatcher } from '@angular/material/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormBuilder, FormControl, FormGroup, FormGroupDirective, NgForm } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, FormGroupDirective, NgForm } from '@angular/forms';
import { Router } from '@angular/router';
import { DialogComponent } from '@app/shared/components/dialog.component';
import { Widget, widgetTypesData } from '@shared/models/widget.models';
@ -44,7 +44,7 @@ export interface AddWidgetDialogData {
export class AddWidgetDialogComponent extends DialogComponent<AddWidgetDialogComponent, Widget>
implements OnInit, ErrorStateMatcher {
widgetFormGroup: FormGroup;
widgetFormGroup: UntypedFormGroup;
dashboard: Dashboard;
aliasController: IAliasController;
@ -57,7 +57,7 @@ export class AddWidgetDialogComponent extends DialogComponent<AddWidgetDialogCom
@Inject(MAT_DIALOG_DATA) public data: AddWidgetDialogData,
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
public dialogRef: MatDialogRef<AddWidgetDialogComponent, Widget>,
private fb: FormBuilder) {
private fb: UntypedFormBuilder) {
super(store, router, dialogRef);
this.dashboard = this.data.dashboard;
@ -115,7 +115,7 @@ export class AddWidgetDialogComponent extends DialogComponent<AddWidgetDialogCom
ngOnInit(): void {
}
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const originalErrorState = this.errorStateMatcher.isErrorState(control, form);
const customErrorState = !!(control && control.invalid && this.submitted);
return originalErrorState || customErrorState;

8
ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-image-dialog.component.ts

@ -18,7 +18,7 @@ import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { DialogComponent } from '@app/shared/components/dialog.component';
import { DashboardId } from '@shared/models/id/dashboard-id';
@ -56,8 +56,8 @@ export class DashboardImageDialogComponent extends DialogComponent<DashboardImag
safeImageUrl?: SafeUrl;
dashboardElement: HTMLElement;
dashboardRectFormGroup: FormGroup;
dashboardImageFormGroup: FormGroup;
dashboardRectFormGroup: UntypedFormGroup;
dashboardImageFormGroup: UntypedFormGroup;
constructor(protected store: Store<AppState>,
protected router: Router,
@ -65,7 +65,7 @@ export class DashboardImageDialogComponent extends DialogComponent<DashboardImag
public dialogRef: MatDialogRef<DashboardImageDialogComponent, DashboardImageDialogResult>,
private dashboardService: DashboardService,
private sanitizer: DomSanitizer,
private fb: FormBuilder) {
private fb: UntypedFormBuilder) {
super(store, router, dialogRef);
this.dashboardId = this.data.dashboardId;

4
ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts

@ -94,7 +94,7 @@ import {
WidgetContextMenuItem
} from '../../models/dashboard-component.models';
import { WidgetComponentService } from '../../components/widget/widget-component.service';
import { FormBuilder } from '@angular/forms';
import { UntypedFormBuilder } from '@angular/forms';
import { ItemBufferService } from '@core/services/item-buffer.service';
import { MatDialog } from '@angular/material/dialog';
import {
@ -352,7 +352,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
private itembuffer: ItemBufferService,
private importExport: ImportExportService,
private mobileService: MobileService,
private fb: FormBuilder,
private fb: UntypedFormBuilder,
private dialog: MatDialog,
private translate: TranslateService,
private popoverService: TbPopoverService,

10
ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-settings-dialog.component.ts

@ -19,7 +19,7 @@ import { ErrorStateMatcher } from '@angular/material/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormBuilder, FormControl, FormGroup, FormGroupDirective, NgForm, Validators } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, FormGroupDirective, NgForm, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { DialogComponent } from '@app/shared/components/dialog.component';
import { UtilsService } from '@core/services/utils.service';
@ -46,8 +46,8 @@ export class DashboardSettingsDialogComponent extends DialogComponent<DashboardS
settings: DashboardSettings;
gridSettings: GridSettings;
settingsFormGroup: FormGroup;
gridSettingsFormGroup: FormGroup;
settingsFormGroup: UntypedFormGroup;
gridSettingsFormGroup: UntypedFormGroup;
stateControllerIds: string[];
@ -58,7 +58,7 @@ export class DashboardSettingsDialogComponent extends DialogComponent<DashboardS
@Inject(MAT_DIALOG_DATA) public data: DashboardSettingsDialogData,
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
public dialogRef: MatDialogRef<DashboardSettingsDialogComponent, DashboardSettingsDialogData>,
private fb: FormBuilder,
private fb: UntypedFormBuilder,
private utils: UtilsService,
private dashboardUtils: DashboardUtilsService,
private translate: TranslateService,
@ -181,7 +181,7 @@ export class DashboardSettingsDialogComponent extends DialogComponent<DashboardS
ngOnInit(): void {
}
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const originalErrorState = this.errorStateMatcher.isErrorState(control, form);
const customErrorState = !!(control && control.invalid && this.submitted);
return originalErrorState || customErrorState;

6
ui-ngx/src/app/modules/home/components/dashboard-page/edit-widget.component.ts

@ -25,7 +25,7 @@ import { Widget } from '@shared/models/widget.models';
import { WidgetComponentService } from '@home/components/widget/widget-component.service';
import { WidgetConfigComponentData } from '../../models/widget-component.models';
import { isDefined, isString } from '@core/utils';
import { FormBuilder, FormGroup } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
@Component({
selector: 'tb-edit-widget',
@ -49,13 +49,13 @@ export class EditWidgetComponent extends PageComponent implements OnInit, OnChan
@Input()
widgetLayout: WidgetLayout;
widgetFormGroup: FormGroup;
widgetFormGroup: UntypedFormGroup;
widgetConfig: WidgetConfigComponentData;
constructor(protected store: Store<AppState>,
private dialog: MatDialog,
private fb: FormBuilder,
private fb: UntypedFormBuilder,
private widgetComponentService: WidgetComponentService) {
super(store);
this.widgetFormGroup = this.fb.group({

2
ui-ngx/src/app/modules/home/components/dashboard-page/layout/manage-dashboard-layouts-dialog.component.scss

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@use '~@angular/material' as mat;
@use '@angular/material' as mat;
@import '../theme.scss';
$tb-warn: mat.get-color-from-palette(map-get($tb-theme, warn), text);

12
ui-ngx/src/app/modules/home/components/dashboard-page/layout/manage-dashboard-layouts-dialog.component.ts

@ -21,9 +21,9 @@ import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import {
AbstractControl,
FormBuilder,
FormControl,
FormGroup,
UntypedFormBuilder,
UntypedFormControl,
UntypedFormGroup,
FormGroupDirective,
NgForm,
Validators
@ -62,7 +62,7 @@ export class ManageDashboardLayoutsDialogComponent extends DialogComponent<Manag
@ViewChild('tooltip', {static: true}) tooltip: MatTooltip;
layoutsFormGroup: FormGroup;
layoutsFormGroup: UntypedFormGroup;
layoutWidthType = LayoutWidthType;
@ -81,7 +81,7 @@ export class ManageDashboardLayoutsDialogComponent extends DialogComponent<Manag
@Inject(MAT_DIALOG_DATA) private data: ManageDashboardLayoutsDialogData,
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
protected dialogRef: MatDialogRef<ManageDashboardLayoutsDialogComponent, DashboardStateLayouts>,
private fb: FormBuilder,
private fb: UntypedFormBuilder,
private utils: UtilsService,
private dashboardUtils: DashboardUtilsService,
private translate: TranslateService,
@ -203,7 +203,7 @@ export class ManageDashboardLayoutsDialogComponent extends DialogComponent<Manag
}
}
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const originalErrorState = this.errorStateMatcher.isErrorState(control, form);
const customErrorState = !!(control && control.invalid && this.submitted);
return originalErrorState || customErrorState;

14
ui-ngx/src/app/modules/home/components/dashboard-page/states/dashboard-state-dialog.component.ts

@ -20,9 +20,9 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import {
FormBuilder,
FormControl,
FormGroup,
UntypedFormBuilder,
UntypedFormControl,
UntypedFormGroup,
FormGroupDirective,
NgForm,
ValidatorFn,
@ -51,7 +51,7 @@ export class DashboardStateDialogComponent extends
DialogComponent<DashboardStateDialogComponent, DashboardStateInfo>
implements OnInit, ErrorStateMatcher {
stateFormGroup: FormGroup;
stateFormGroup: UntypedFormGroup;
states: {[id: string]: DashboardState };
state: DashboardStateInfo;
@ -68,7 +68,7 @@ export class DashboardStateDialogComponent extends
@Inject(MAT_DIALOG_DATA) public data: DashboardStateDialogData,
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
public dialogRef: MatDialogRef<DashboardStateDialogComponent, DashboardStateInfo>,
private fb: FormBuilder,
private fb: UntypedFormBuilder,
private translate: TranslateService,
private dashboardUtils: DashboardUtilsService) {
super(store, router, dialogRef);
@ -108,7 +108,7 @@ export class DashboardStateDialogComponent extends
}
private validateDuplicateStateId(): ValidatorFn {
return (c: FormControl) => {
return (c: UntypedFormControl) => {
const newStateId: string = c.value;
if (newStateId) {
const existing = this.states[newStateId];
@ -125,7 +125,7 @@ export class DashboardStateDialogComponent extends
ngOnInit(): void {
}
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const originalErrorState = this.errorStateMatcher.isErrorState(control, form);
const customErrorState = !!(control && control.invalid && this.submitted);
return originalErrorState || customErrorState;

8
ui-ngx/src/app/modules/home/components/dashboard-page/states/manage-dashboard-states-dialog.component.ts

@ -19,7 +19,7 @@ import { ErrorStateMatcher } from '@angular/material/core';
import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormBuilder, FormControl, FormGroup, FormGroupDirective, NgForm } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, FormGroupDirective, NgForm } from '@angular/forms';
import { Router } from '@angular/router';
import { DialogComponent } from '@app/shared/components/dialog.component';
import { DashboardState } from '@app/shared/models/dashboard.models';
@ -55,7 +55,7 @@ export class ManageDashboardStatesDialogComponent extends
DialogComponent<ManageDashboardStatesDialogComponent, {[id: string]: DashboardState }>
implements OnInit, ErrorStateMatcher, AfterViewInit {
statesFormGroup: FormGroup;
statesFormGroup: UntypedFormGroup;
states: {[id: string]: DashboardState };
@ -76,7 +76,7 @@ export class ManageDashboardStatesDialogComponent extends
@Inject(MAT_DIALOG_DATA) public data: ManageDashboardStatesDialogData,
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
public dialogRef: MatDialogRef<ManageDashboardStatesDialogComponent, {[id: string]: DashboardState }>,
private fb: FormBuilder,
private fb: UntypedFormBuilder,
private translate: TranslateService,
private dialogs: DialogService,
private dialog: MatDialog) {
@ -233,7 +233,7 @@ export class ManageDashboardStatesDialogComponent extends
this.updateData(true);
}
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const originalErrorState = this.errorStateMatcher.isErrorState(control, form);
const customErrorState = !!(control && control.invalid && this.submitted);
return originalErrorState || customErrorState;

2
ui-ngx/src/app/modules/home/components/dashboard-page/states/states-component.directive.ts

@ -31,7 +31,7 @@ import { IStateControllerComponent } from '@home/components/dashboard-page/state
import { Subject } from 'rxjs';
@Directive({
// tslint:disable-next-line:directive-selector
// eslint-disable-next-line @angular-eslint/directive-selector
selector: 'tb-states-component'
})
export class StatesComponentDirective implements OnInit, OnDestroy, OnChanges {

8
ui-ngx/src/app/modules/home/components/dashboard/select-target-state-dialog.component.ts

@ -19,7 +19,7 @@ import { ErrorStateMatcher } from '@angular/material/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormBuilder, FormControl, FormGroup, FormGroupDirective, NgForm, Validators } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, FormGroupDirective, NgForm, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { DialogComponent } from '@app/shared/components/dialog.component';
import { DashboardState } from '@app/shared/models/dashboard.models';
@ -40,7 +40,7 @@ export class SelectTargetStateDialogComponent extends
implements OnInit, ErrorStateMatcher {
states: {[id: string]: DashboardState };
stateFormGroup: FormGroup;
stateFormGroup: UntypedFormGroup;
submitted = false;
@ -49,7 +49,7 @@ export class SelectTargetStateDialogComponent extends
@Inject(MAT_DIALOG_DATA) public data: SelectTargetStateDialogData,
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
public dialogRef: MatDialogRef<SelectTargetStateDialogComponent, string>,
private fb: FormBuilder,
private fb: UntypedFormBuilder,
private dashboardUtils: DashboardUtilsService) {
super(store, router, dialogRef);
@ -65,7 +65,7 @@ export class SelectTargetStateDialogComponent extends
ngOnInit(): void {
}
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const originalErrorState = this.errorStateMatcher.isErrorState(control, form);
const customErrorState = !!(control && control.invalid && this.submitted);
return originalErrorState || customErrorState;

8
ui-ngx/src/app/modules/home/components/details-panel.component.ts

@ -18,7 +18,7 @@ import { ChangeDetectorRef, Component, EventEmitter, Input, OnDestroy, Output }
import { PageComponent } from '@shared/components/page.component';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormGroup } from '@angular/forms';
import { UntypedFormGroup } from '@angular/forms';
import { Subscription } from 'rxjs';
@Component({
@ -36,11 +36,11 @@ export class DetailsPanelComponent extends PageComponent implements OnDestroy {
@Input() isShowSearch = false;
@Input() backgroundColor = '#FFF';
private theFormValue: FormGroup;
private theFormValue: UntypedFormGroup;
private formSubscription: Subscription = null;
@Input()
set theForm(value: FormGroup) {
set theForm(value: UntypedFormGroup) {
if (this.theFormValue !== value) {
if (this.formSubscription !== null) {
this.formSubscription.unsubscribe();
@ -53,7 +53,7 @@ export class DetailsPanelComponent extends PageComponent implements OnDestroy {
}
}
get theForm(): FormGroup {
get theForm(): UntypedFormGroup {
return this.theFormValue;
}

12
ui-ngx/src/app/modules/home/components/device/device-credentials-lwm2m-server.component.ts

@ -17,8 +17,8 @@
import { Component, forwardRef, OnDestroy } from '@angular/core';
import {
ControlValueAccessor,
FormBuilder,
FormGroup,
UntypedFormBuilder,
UntypedFormGroup,
NG_VALIDATORS,
NG_VALUE_ACCESSOR,
ValidationErrors,
@ -55,17 +55,17 @@ import { Subject } from 'rxjs';
export class DeviceCredentialsLwm2mServerComponent implements OnDestroy, ControlValueAccessor, Validator {
serverFormGroup: FormGroup;
serverFormGroup: UntypedFormGroup;
securityConfigLwM2MType = Lwm2mSecurityType;
securityConfigLwM2MTypes = Object.values(Lwm2mSecurityType);
lwm2mSecurityTypeTranslationMap = Lwm2mSecurityTypeTranslationMap;
publicKeyOrIdTooltipNamesMap = Lwm2mPublicKeyOrIdTooltipTranslationsMap;
clientSecretKeyTooltipNamesMap = Lwm2mClientSecretKeyTooltipTranslationsMap;
private destroy$ = new Subject();
private destroy$ = new Subject<void>();
private propagateChange = (v: any) => {};
constructor(private fb: FormBuilder) {
constructor(private fb: UntypedFormBuilder) {
this.serverFormGroup = this.fb.group({
securityMode: [Lwm2mSecurityType.NO_SEC],
clientPublicKeyOrId: [''],
@ -148,5 +148,5 @@ export class DeviceCredentialsLwm2mServerComponent implements OnDestroy, Control
this.serverFormGroup.get('clientPublicKeyOrId').enable({emitEvent: false});
this.serverFormGroup.get('clientSecretKey').enable();
}
};
}

12
ui-ngx/src/app/modules/home/components/device/device-credentials-lwm2m.component.ts

@ -17,8 +17,8 @@
import { Component, forwardRef, OnDestroy } from '@angular/core';
import {
ControlValueAccessor,
FormBuilder,
FormGroup,
UntypedFormBuilder,
UntypedFormGroup,
NG_VALIDATORS,
NG_VALUE_ACCESSOR,
ValidationErrors,
@ -56,16 +56,16 @@ import { isDefinedAndNotNull } from '@core/utils';
export class DeviceCredentialsLwm2mComponent implements ControlValueAccessor, Validator, OnDestroy {
lwm2mConfigFormGroup: FormGroup;
lwm2mConfigFormGroup: UntypedFormGroup;
securityConfigLwM2MType = Lwm2mSecurityType;
securityConfigLwM2MTypes = Object.keys(Lwm2mSecurityType);
credentialTypeLwM2MNamesMap = Lwm2mSecurityTypeTranslationMap;
clientKeyTooltipNamesMap = Lwm2mClientKeyTooltipTranslationsMap;
private destroy$ = new Subject();
private destroy$ = new Subject<void>();
private propagateChange = (v: any) => {};
constructor(private fb: FormBuilder) {
constructor(private fb: UntypedFormBuilder) {
this.lwm2mConfigFormGroup = this.initLwm2mConfigForm();
}
@ -161,7 +161,7 @@ export class DeviceCredentialsLwm2mComponent implements ControlValueAccessor, Va
this.lwm2mConfigFormGroup.get('client.cert').disable({emitEvent: false});
}
private initLwm2mConfigForm = (): FormGroup => {
private initLwm2mConfigForm = (): UntypedFormGroup => {
const formGroup = this.fb.group({
client: this.fb.group({
endpoint: ['', Validators.required],

12
ui-ngx/src/app/modules/home/components/device/device-credentials-mqtt-basic.component.ts

@ -17,8 +17,8 @@
import { Component, forwardRef, Input, OnDestroy } from '@angular/core';
import {
ControlValueAccessor,
FormBuilder,
FormGroup,
UntypedFormBuilder,
UntypedFormGroup,
NG_VALIDATORS,
NG_VALUE_ACCESSOR,
ValidationErrors,
@ -52,12 +52,12 @@ export class DeviceCredentialsMqttBasicComponent implements ControlValueAccessor
@Input()
disabled: boolean;
deviceCredentialsMqttFormGroup: FormGroup;
deviceCredentialsMqttFormGroup: UntypedFormGroup;
private destroy$ = new Subject();
private destroy$ = new Subject<void>();
private propagateChange = (v: any) => {};
constructor(public fb: FormBuilder) {
constructor(public fb: UntypedFormBuilder) {
this.deviceCredentialsMqttFormGroup = this.fb.group({
clientId: [null],
userName: [null],
@ -119,7 +119,7 @@ export class DeviceCredentialsMqttBasicComponent implements ControlValueAccessor
}
private atLeastOne(validator: ValidatorFn, controls: string[] = null) {
return (group: FormGroup): ValidationErrors | null => {
return (group: UntypedFormGroup): ValidationErrors | null => {
if (!controls) {
controls = Object.keys(group.controls);
}

14
ui-ngx/src/app/modules/home/components/device/device-credentials.component.ts

@ -17,9 +17,9 @@
import { Component, forwardRef, Input, OnDestroy, OnInit } from '@angular/core';
import {
ControlValueAccessor,
FormBuilder,
FormControl,
FormGroup,
UntypedFormBuilder,
UntypedFormControl,
UntypedFormGroup,
NG_VALIDATORS,
NG_VALUE_ACCESSOR,
Validator,
@ -73,9 +73,9 @@ export class DeviceCredentialsComponent implements ControlValueAccessor, OnInit,
}
}
private destroy$ = new Subject();
private destroy$ = new Subject<void>();
deviceCredentialsFormGroup: FormGroup;
deviceCredentialsFormGroup: UntypedFormGroup;
deviceCredentialsType = DeviceCredentialsType;
@ -85,7 +85,7 @@ export class DeviceCredentialsComponent implements ControlValueAccessor, OnInit,
private propagateChange = (v: any) => {};
constructor(public fb: FormBuilder) {
constructor(public fb: UntypedFormBuilder) {
this.deviceCredentialsFormGroup = this.fb.group({
credentialsType: [DeviceCredentialsType.ACCESS_TOKEN],
credentialsId: [null],
@ -148,7 +148,7 @@ export class DeviceCredentialsComponent implements ControlValueAccessor, OnInit,
}
}
public validate(c: FormControl) {
public validate(c: UntypedFormControl) {
return this.deviceCredentialsFormGroup.valid ? null : {
deviceCredentials: {
valid: false,

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

@ -19,7 +19,7 @@ import { ErrorStateMatcher } from '@angular/material/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormControl, FormGroup, FormGroupDirective, NgForm } from '@angular/forms';
import { UntypedFormControl, UntypedFormGroup, FormGroupDirective, NgForm } from '@angular/forms';
import { EntityTypeResource, EntityTypeTranslation } from '@shared/models/entity-type.models';
import { BaseData, HasId } from '@shared/models/base-data';
import { EntityId } from '@shared/models/id/entity-id';
@ -40,7 +40,7 @@ export class AddEntityDialogComponent extends
DialogComponent<AddEntityDialogComponent, BaseData<HasId>> implements OnInit, ErrorStateMatcher {
entityComponent: EntityComponent<BaseData<HasId>>;
detailsForm: FormGroup;
detailsForm: UntypedFormGroup;
entitiesTableConfig: EntityTableConfig<BaseData<HasId>>;
translations: EntityTypeTranslation;
@ -98,7 +98,7 @@ export class AddEntityDialogComponent extends
}
}
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const originalErrorState = this.errorStateMatcher.isErrorState(control, form);
const customErrorState = !!(control && control.invalid && this.submitted);
return originalErrorState || customErrorState;

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

@ -16,7 +16,7 @@
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormBuilder, FormGroup, ValidatorFn, Validators } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormGroup, ValidatorFn, Validators } from '@angular/forms';
import { ContactBased } from '@shared/models/contact-based.model';
import { AfterViewInit, ChangeDetectorRef, Directive } from '@angular/core';
import { POSTAL_CODE_PATTERNS } from '@home/models/contact.models';
@ -28,14 +28,14 @@ import { EntityTableConfig } from '@home/models/entity/entities-table-config.mod
export abstract class ContactBasedComponent<T extends ContactBased<HasId>> extends EntityComponent<T> implements AfterViewInit {
protected constructor(protected store: Store<AppState>,
protected fb: FormBuilder,
protected fb: UntypedFormBuilder,
protected entityValue: T,
protected entitiesTableConfigValue: EntityTableConfig<T>,
protected cd: ChangeDetectorRef) {
super(store, fb, entityValue, entitiesTableConfigValue, cd);
}
buildForm(entity: T): FormGroup {
buildForm(entity: T): UntypedFormGroup {
const entityForm = this.buildEntityForm(entity);
entityForm.addControl('country', this.fb.control(entity ? entity.country : '', [Validators.maxLength(255)]));
entityForm.addControl('city', this.fb.control(entity ? entity.city : '', [Validators.maxLength(255)]));
@ -82,7 +82,7 @@ export abstract class ContactBasedComponent<T extends ContactBased<HasId>> exten
return zipValidators;
}
abstract buildEntityForm(entity: T): FormGroup;
abstract buildEntityForm(entity: T): UntypedFormGroup;
abstract updateEntityForm(entity: T);

4
ui-ngx/src/app/modules/home/components/entity/entity-details-page.component.ts

@ -29,7 +29,7 @@ import { AppState } from '@core/core.state';
import { EntityTableConfig } from '@home/models/entity/entities-table-config.models';
import { BaseData, HasId } from '@shared/models/base-data';
import { ActivatedRoute, Router } from '@angular/router';
import { FormGroup } from '@angular/forms';
import { UntypedFormGroup } from '@angular/forms';
import { AssetId } from '@shared/models/id/asset-id';
import { TranslateService } from '@ngx-translate/core';
import { deepClone } from '@core/utils';
@ -140,7 +140,7 @@ export class EntityDetailsPageComponent extends EntityDetailsPanelComponent impl
});
}
confirmForm(): FormGroup {
confirmForm(): UntypedFormGroup {
return this.detailsForm;
}

4
ui-ngx/src/app/modules/home/components/entity/entity-details-panel.component.ts

@ -36,7 +36,7 @@ import { AppState } from '@core/core.state';
import { EntityTableConfig } from '@home/models/entity/entities-table-config.models';
import { BaseData, HasId, hasIdEquals } from '@shared/models/base-data';
import { EntityType, EntityTypeResource, EntityTypeTranslation } from '@shared/models/entity-type.models';
import { FormGroup } from '@angular/forms';
import { UntypedFormGroup } from '@angular/forms';
import { EntityComponent } from './entity.component';
import { TbAnchorComponent } from '@shared/components/tb-anchor.component';
import { EntityAction } from '@home/models/entity/entity-component.models';
@ -68,7 +68,7 @@ export class EntityDetailsPanelComponent extends PageComponent implements AfterV
entityTabsComponentRef: ComponentRef<EntityTabsComponent<BaseData<HasId>>>;
entityTabsComponent: EntityTabsComponent<BaseData<HasId>>;
detailsForm: FormGroup;
detailsForm: UntypedFormGroup;
entitiesTableConfigValue: EntityTableConfig<BaseData<HasId>>;
isEditValue = false;

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

@ -15,7 +15,7 @@
///
import { Component, EventEmitter, forwardRef, Input, OnInit, Output } from '@angular/core';
import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR, Validators } from '@angular/forms';
import { ControlValueAccessor, UntypedFormBuilder, UntypedFormGroup, NG_VALUE_ACCESSOR, Validators } from '@angular/forms';
import { AliasFilterType, aliasFilterTypeTranslationMap, EntityAliasFilter } from '@shared/models/alias.models';
import { AliasEntityType, EntityType } from '@shared/models/entity-type.models';
import { TranslateService } from '@ngx-translate/core';
@ -44,8 +44,8 @@ export class EntityFilterComponent implements ControlValueAccessor, OnInit {
@Output() resolveMultipleChanged: EventEmitter<boolean> = new EventEmitter<boolean>();
entityFilterFormGroup: FormGroup;
filterFormGroup: FormGroup;
entityFilterFormGroup: UntypedFormGroup;
filterFormGroup: UntypedFormGroup;
aliasFilterTypes: Array<AliasFilterType>;
@ -61,7 +61,7 @@ export class EntityFilterComponent implements ControlValueAccessor, OnInit {
constructor(private translate: TranslateService,
private entityService: EntityService,
private fb: FormBuilder) {
private fb: UntypedFormBuilder) {
}
ngOnInit(): void {

2
ui-ngx/src/app/modules/home/components/entity/entity-table-header.component.ts

@ -23,7 +23,7 @@ import { EntityTableConfig } from '@home/models/entity/entities-table-config.mod
import { PageLink } from '@shared/models/page/page-link';
@Directive()
// tslint:disable-next-line:directive-class-suffix
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export abstract class EntityTableHeaderComponent<T extends BaseData<HasId>,
P extends PageLink = PageLink,
L extends BaseData<HasId> = T,

6
ui-ngx/src/app/modules/home/components/entity/entity-tabs.component.ts

@ -30,11 +30,11 @@ import { AuditLogMode } from '@shared/models/audit-log.models';
import { DebugEventType, EventType } from '@shared/models/event.models';
import { AttributeScope, LatestTelemetry } from '@shared/models/telemetry/telemetry.models';
import { NULL_UUID } from '@shared/models/id/has-uuid';
import { FormGroup } from '@angular/forms';
import { UntypedFormGroup } from '@angular/forms';
import { PageLink } from '@shared/models/page/page-link';
@Directive()
// tslint:disable-next-line:directive-class-suffix
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export abstract class EntityTabsComponent<T extends BaseData<HasId>,
P extends PageLink = PageLink,
L extends BaseData<HasId> = T,
@ -94,7 +94,7 @@ export abstract class EntityTabsComponent<T extends BaseData<HasId>,
}
@Input()
detailsForm: FormGroup;
detailsForm: UntypedFormGroup;
private entityTabsSubject = new BehaviorSubject<Array<MatTab>>(null);

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

@ -15,7 +15,7 @@
///
import { BaseData, HasId } from '@shared/models/base-data';
import { FormBuilder, FormGroup } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { PageComponent } from '@shared/components/page.component';
import { ChangeDetectorRef, Directive, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { Store } from '@ngrx/store';
@ -27,14 +27,14 @@ import { deepTrim } from '@core/utils';
// @dynamic
@Directive()
// tslint:disable-next-line:directive-class-suffix
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export abstract class EntityComponent<T extends BaseData<HasId>,
P extends PageLink = PageLink,
L extends BaseData<HasId> = T,
C extends EntityTableConfig<T, P, L> = EntityTableConfig<T, P, L>>
extends PageComponent implements OnInit {
entityForm: FormGroup;
entityForm: UntypedFormGroup;
isEditValue: boolean;
@ -81,7 +81,7 @@ export abstract class EntityComponent<T extends BaseData<HasId>,
entityAction = new EventEmitter<EntityAction<T>>();
protected constructor(protected store: Store<AppState>,
protected fb: FormBuilder,
protected fb: UntypedFormBuilder,
protected entityValue: T,
protected entitiesTableConfigValue: C,
protected cd: ChangeDetectorRef) {
@ -126,7 +126,7 @@ export abstract class EntityComponent<T extends BaseData<HasId>,
this.entitiesTableConfigValue = entitiesTableConfig;
}
abstract buildForm(entity: T): FormGroup;
abstract buildForm(entity: T): UntypedFormGroup;
abstract updateForm(entity: T);

6
ui-ngx/src/app/modules/home/components/event/event-filter-panel.component.ts

@ -15,7 +15,7 @@
///
import { Component, Inject, InjectionToken } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
import { OverlayRef } from '@angular/cdk/overlay';
import { EntityType } from '@shared/models/entity-type.models';
import { FilterEventBody } from '@shared/models/event.models';
@ -41,7 +41,7 @@ export interface FilterEntityColumn {
})
export class EventFilterPanelComponent {
eventFilterFormGroup: FormGroup;
eventFilterFormGroup: UntypedFormGroup;
result: EventFilterPanelData;
private conditionError = false;
@ -55,7 +55,7 @@ export class EventFilterPanelComponent {
constructor(@Inject(EVENT_FILTER_PANEL_DATA)
public data: EventFilterPanelData,
public overlayRef: OverlayRef,
private fb: FormBuilder) {
private fb: UntypedFormBuilder) {
this.eventFilterFormGroup = this.fb.group({});
this.data.columns.forEach((column) => {
this.showColumns.push(column);

8
ui-ngx/src/app/modules/home/components/filter/boolean-filter-predicate.component.ts

@ -17,8 +17,8 @@
import { Component, forwardRef, Input, OnInit } from '@angular/core';
import {
ControlValueAccessor,
FormBuilder,
FormGroup,
UntypedFormBuilder,
UntypedFormGroup,
NG_VALIDATORS,
NG_VALUE_ACCESSOR,
ValidationErrors,
@ -60,7 +60,7 @@ export class BooleanFilterPredicateComponent implements ControlValueAccessor, Va
valueTypeEnum = EntityKeyValueType;
booleanFilterPredicateFormGroup: FormGroup;
booleanFilterPredicateFormGroup: UntypedFormGroup;
booleanOperations = Object.keys(BooleanOperation);
booleanOperationEnum = BooleanOperation;
@ -68,7 +68,7 @@ export class BooleanFilterPredicateComponent implements ControlValueAccessor, Va
private propagateChange = null;
constructor(private fb: FormBuilder) {
constructor(private fb: UntypedFormBuilder) {
}
ngOnInit(): void {

8
ui-ngx/src/app/modules/home/components/filter/complex-filter-predicate-dialog.component.ts

@ -19,7 +19,7 @@ import { ErrorStateMatcher } from '@angular/material/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormBuilder, FormControl, FormGroup, FormGroupDirective, NgForm, Validators } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, FormGroupDirective, NgForm, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { DialogComponent } from '@app/shared/components/dialog.component';
import {
@ -40,7 +40,7 @@ export class ComplexFilterPredicateDialogComponent extends
DialogComponent<ComplexFilterPredicateDialogComponent, ComplexFilterPredicateInfo>
implements OnInit, ErrorStateMatcher {
complexFilterFormGroup: FormGroup;
complexFilterFormGroup: UntypedFormGroup;
complexOperations = Object.keys(ComplexOperation);
complexOperationEnum = ComplexOperation;
@ -55,7 +55,7 @@ export class ComplexFilterPredicateDialogComponent extends
@Inject(MAT_DIALOG_DATA) public data: ComplexFilterPredicateDialogData,
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
public dialogRef: MatDialogRef<ComplexFilterPredicateDialogComponent, ComplexFilterPredicateInfo>,
private fb: FormBuilder) {
private fb: UntypedFormBuilder) {
super(store, router, dialogRef);
this.isAdd = this.data.isAdd;
@ -74,7 +74,7 @@ export class ComplexFilterPredicateDialogComponent extends
ngOnInit(): void {
}
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const originalErrorState = this.errorStateMatcher.isErrorState(control, form);
const customErrorState = !!(control && control.invalid && this.submitted);
return originalErrorState || customErrorState;

14
ui-ngx/src/app/modules/home/components/filter/filter-dialog.component.ts

@ -20,9 +20,9 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import {
FormBuilder,
FormControl,
FormGroup,
UntypedFormBuilder,
UntypedFormControl,
UntypedFormGroup,
FormGroupDirective,
NgForm,
ValidatorFn,
@ -54,7 +54,7 @@ export class FilterDialogComponent extends DialogComponent<FilterDialogComponent
filter: Filter;
filterFormGroup: FormGroup;
filterFormGroup: UntypedFormGroup;
submitted = false;
@ -63,7 +63,7 @@ export class FilterDialogComponent extends DialogComponent<FilterDialogComponent
@Inject(MAT_DIALOG_DATA) public data: FilterDialogData,
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
public dialogRef: MatDialogRef<FilterDialogComponent, Filter>,
private fb: FormBuilder,
private fb: UntypedFormBuilder,
private utils: UtilsService,
public translate: TranslateService) {
super(store, router, dialogRef);
@ -95,7 +95,7 @@ export class FilterDialogComponent extends DialogComponent<FilterDialogComponent
}
validateDuplicateFilterName(): ValidatorFn {
return (c: FormControl) => {
return (c: UntypedFormControl) => {
const newFilter = c.value.trim();
const found = this.filters.find((filter) => filter.filter === newFilter);
if (found) {
@ -114,7 +114,7 @@ export class FilterDialogComponent extends DialogComponent<FilterDialogComponent
ngOnInit(): void {
}
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const originalErrorState = this.errorStateMatcher.isErrorState(control, form);
const customErrorState = !!(control && control.invalid && this.submitted);
return originalErrorState || customErrorState;

18
ui-ngx/src/app/modules/home/components/filter/filter-predicate-list.component.ts

@ -18,9 +18,9 @@ import { Component, forwardRef, Inject, Input, OnInit } from '@angular/core';
import {
AbstractControl,
ControlValueAccessor,
FormArray,
FormBuilder,
FormGroup,
UntypedFormArray,
UntypedFormBuilder,
UntypedFormGroup,
NG_VALIDATORS,
NG_VALUE_ACCESSOR,
ValidationErrors,
@ -75,7 +75,7 @@ export class FilterPredicateListComponent implements ControlValueAccessor, Valid
@Input() onlyUserDynamicSource = false;
filterListFormGroup: FormGroup;
filterListFormGroup: UntypedFormGroup;
valueTypeEnum = EntityKeyValueType;
@ -85,7 +85,7 @@ export class FilterPredicateListComponent implements ControlValueAccessor, Valid
private valueChangeSubscription: Subscription = null;
constructor(private fb: FormBuilder,
constructor(private fb: UntypedFormBuilder,
@Inject(COMPLEX_FILTER_PREDICATE_DIALOG_COMPONENT_TOKEN) private complexFilterPredicateDialogComponent: ComponentType<any>,
private dialog: MatDialog) {
}
@ -96,8 +96,8 @@ export class FilterPredicateListComponent implements ControlValueAccessor, Valid
this.fb.array([]));
}
predicatesFormArray(): FormArray {
return this.filterListFormGroup.get('predicates') as FormArray;
predicatesFormArray(): UntypedFormArray {
return this.filterListFormGroup.get('predicates') as UntypedFormArray;
}
registerOnChange(fn: any): void {
@ -144,11 +144,11 @@ export class FilterPredicateListComponent implements ControlValueAccessor, Valid
}
public removePredicate(index: number) {
(this.filterListFormGroup.get('predicates') as FormArray).removeAt(index);
(this.filterListFormGroup.get('predicates') as UntypedFormArray).removeAt(index);
}
public addPredicate(complex: boolean) {
const predicatesFormArray = this.filterListFormGroup.get('predicates') as FormArray;
const predicatesFormArray = this.filterListFormGroup.get('predicates') as UntypedFormArray;
const predicate = createDefaultFilterPredicateInfo(this.valueType, complex);
let observable: Observable<KeyFilterPredicateInfo>;
if (complex) {

8
ui-ngx/src/app/modules/home/components/filter/filter-predicate-value.component.ts

@ -17,8 +17,8 @@
import { Component, forwardRef, Input, OnInit } from '@angular/core';
import {
ControlValueAccessor,
FormBuilder,
FormGroup,
UntypedFormBuilder,
UntypedFormGroup,
NG_VALIDATORS,
NG_VALUE_ACCESSOR,
ValidationErrors,
@ -92,7 +92,7 @@ export class FilterPredicateValueComponent implements ControlValueAccessor, Vali
dynamicValueSourceTypeTranslations = dynamicValueSourceTypeTranslationMap;
filterPredicateValueFormGroup: FormGroup;
filterPredicateValueFormGroup: UntypedFormGroup;
dynamicMode = false;
@ -101,7 +101,7 @@ export class FilterPredicateValueComponent implements ControlValueAccessor, Vali
private propagateChange = null;
private propagateChangePending = false;
constructor(private fb: FormBuilder) {
constructor(private fb: UntypedFormBuilder) {
}
ngOnInit(): void {

8
ui-ngx/src/app/modules/home/components/filter/filter-predicate.component.ts

@ -17,8 +17,8 @@
import { Component, forwardRef, Input, OnInit } from '@angular/core';
import {
ControlValueAccessor,
FormBuilder,
FormGroup,
UntypedFormBuilder,
UntypedFormGroup,
NG_VALIDATORS,
NG_VALUE_ACCESSOR,
ValidationErrors,
@ -58,7 +58,7 @@ export class FilterPredicateComponent implements ControlValueAccessor, Validator
@Input() onlyUserDynamicSource = false;
filterPredicateFormGroup: FormGroup;
filterPredicateFormGroup: UntypedFormGroup;
type: FilterPredicateType;
@ -66,7 +66,7 @@ export class FilterPredicateComponent implements ControlValueAccessor, Validator
private propagateChange = null;
constructor(private fb: FormBuilder) {
constructor(private fb: UntypedFormBuilder) {
}
ngOnInit(): void {

12
ui-ngx/src/app/modules/home/components/filter/filter-select.component.ts

@ -17,9 +17,9 @@
import { AfterViewInit, Component, ElementRef, forwardRef, Input, OnInit, SkipSelf, ViewChild } from '@angular/core';
import {
ControlValueAccessor,
FormBuilder,
FormControl,
FormGroup,
UntypedFormBuilder,
UntypedFormControl,
UntypedFormGroup,
FormGroupDirective,
NG_VALUE_ACCESSOR,
NgForm
@ -54,7 +54,7 @@ import { Filter } from '@shared/models/query/query.models';
})
export class FilterSelectComponent implements ControlValueAccessor, OnInit, AfterViewInit, ErrorStateMatcher {
selectFilterFormGroup: FormGroup;
selectFilterFormGroup: UntypedFormGroup;
modelValue: string | null;
@ -101,7 +101,7 @@ export class FilterSelectComponent implements ControlValueAccessor, OnInit, Afte
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
public translate: TranslateService,
public truncate: TruncatePipe,
private fb: FormBuilder) {
private fb: UntypedFormBuilder) {
this.selectFilterFormGroup = this.fb.group({
filter: [null]
});
@ -140,7 +140,7 @@ export class FilterSelectComponent implements ControlValueAccessor, OnInit, Afte
);
}
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const originalErrorState = this.errorStateMatcher.isErrorState(control, form);
const customErrorState = this.tbRequired && !this.modelValue;
return originalErrorState || customErrorState;

4
ui-ngx/src/app/modules/home/components/filter/filter-text.component.ts

@ -15,7 +15,7 @@
///
import { Component, forwardRef, Input, OnInit } from '@angular/core';
import { ControlValueAccessor, FormBuilder, NG_VALUE_ACCESSOR } from '@angular/forms';
import { ControlValueAccessor, UntypedFormBuilder, NG_VALUE_ACCESSOR } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { KeyFilter, keyFiltersToText } from '@shared/models/query/query.models';
import { TranslateService } from '@ngx-translate/core';
@ -64,7 +64,7 @@ export class FilterTextComponent implements ControlValueAccessor, OnInit {
private propagateChange = (v: any) => { };
constructor(private dialog: MatDialog,
private fb: FormBuilder,
private fb: UntypedFormBuilder,
private translate: TranslateService,
private datePipe: DatePipe) {
}

8
ui-ngx/src/app/modules/home/components/filter/filter-user-info-dialog.component.ts

@ -19,7 +19,7 @@ import { ErrorStateMatcher } from '@angular/material/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormBuilder, FormControl, FormGroup, FormGroupDirective, NgForm, Validators } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, FormGroupDirective, NgForm, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { DialogComponent } from '@app/shared/components/dialog.component';
import {
@ -48,7 +48,7 @@ export class FilterUserInfoDialogComponent extends
DialogComponent<FilterUserInfoDialogComponent, KeyFilterPredicateUserInfo>
implements OnInit, ErrorStateMatcher {
filterUserInfoFormGroup: FormGroup;
filterUserInfoFormGroup: UntypedFormGroup;
submitted = false;
@ -57,7 +57,7 @@ export class FilterUserInfoDialogComponent extends
@Inject(MAT_DIALOG_DATA) public data: FilterUserInfoDialogData,
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
public dialogRef: MatDialogRef<FilterUserInfoDialogComponent, KeyFilterPredicateUserInfo>,
private fb: FormBuilder,
private fb: UntypedFormBuilder,
private translate: TranslateService) {
super(store, router, dialogRef);
@ -95,7 +95,7 @@ export class FilterUserInfoDialogComponent extends
ngOnInit(): void {
}
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const originalErrorState = this.errorStateMatcher.isErrorState(control, form);
const customErrorState = !!(control && control.invalid && this.submitted);
return originalErrorState || customErrorState;

24
ui-ngx/src/app/modules/home/components/filter/filters-dialog.component.ts

@ -21,10 +21,10 @@ import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import {
AbstractControl,
FormArray,
FormBuilder,
FormControl,
FormGroup,
UntypedFormArray,
UntypedFormBuilder,
UntypedFormControl,
UntypedFormGroup,
FormGroupDirective,
NgForm,
Validators
@ -64,7 +64,7 @@ export class FiltersDialogComponent extends DialogComponent<FiltersDialogCompone
filterToWidgetsMap: {[filterId: string]: Array<string>} = {};
filtersFormGroup: FormGroup;
filtersFormGroup: UntypedFormGroup;
submitted = false;
@ -73,7 +73,7 @@ export class FiltersDialogComponent extends DialogComponent<FiltersDialogCompone
@Inject(MAT_DIALOG_DATA) public data: FiltersDialogData,
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
public dialogRef: MatDialogRef<FiltersDialogComponent, Filters>,
private fb: FormBuilder,
private fb: UntypedFormBuilder,
private utils: UtilsService,
private translate: TranslateService,
private dialogs: DialogService,
@ -131,14 +131,14 @@ export class FiltersDialogComponent extends DialogComponent<FiltersDialogCompone
}
filtersFormArray(): FormArray {
return this.filtersFormGroup.get('filters') as FormArray;
filtersFormArray(): UntypedFormArray {
return this.filtersFormGroup.get('filters') as UntypedFormArray;
}
ngOnInit(): void {
}
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const originalErrorState = this.errorStateMatcher.isErrorState(control, form);
const customErrorState = !!(control && control.invalid && this.submitted);
return originalErrorState || customErrorState;
@ -157,7 +157,7 @@ export class FiltersDialogComponent extends DialogComponent<FiltersDialogCompone
this.dialogs.alert(this.translate.instant('filter.unable-delete-filter-title'),
message, this.translate.instant('action.close'), true);
} else {
(this.filtersFormGroup.get('filters') as FormArray).removeAt(index);
(this.filtersFormGroup.get('filters') as UntypedFormArray).removeAt(index);
this.filtersFormGroup.markAsDirty();
}
}
@ -189,10 +189,10 @@ export class FiltersDialogComponent extends DialogComponent<FiltersDialogCompone
}).afterClosed().subscribe((result) => {
if (result) {
if (isAdd) {
(this.filtersFormGroup.get('filters') as FormArray)
(this.filtersFormGroup.get('filters') as UntypedFormArray)
.push(this.createFilterFormControl(result.id, result));
} else {
const filterFormControl = (this.filtersFormGroup.get('filters') as FormArray).at(index);
const filterFormControl = (this.filtersFormGroup.get('filters') as UntypedFormArray).at(index);
filterFormControl.get('filter').patchValue(result.filter);
filterFormControl.get('editable').patchValue(result.editable);
filterFormControl.get('keyFilters').patchValue(result.keyFilters);

10
ui-ngx/src/app/modules/home/components/filter/key-filter-dialog.component.ts

@ -19,7 +19,7 @@ import { ErrorStateMatcher } from '@angular/material/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormBuilder, FormControl, FormGroup, FormGroupDirective, NgForm, Validators } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, FormGroupDirective, NgForm, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { DialogComponent } from '@app/shared/components/dialog.component';
import {
@ -63,9 +63,9 @@ export class KeyFilterDialogComponent extends
private dirty = false;
private entityKeysName: Observable<Array<string>>;
private destroy$ = new Subject();
private destroy$ = new Subject<void>();
keyFilterFormGroup: FormGroup;
keyFilterFormGroup: UntypedFormGroup;
entityKeyTypes =
this.data.telemetryKeysOnly ?
@ -96,7 +96,7 @@ export class KeyFilterDialogComponent extends
private deviceProfileService: DeviceProfileService,
private dialogs: DialogService,
private translate: TranslateService,
private fb: FormBuilder) {
private fb: UntypedFormBuilder) {
super(store, router, dialogRef);
this.keyFilterFormGroup = this.fb.group(
@ -191,7 +191,7 @@ export class KeyFilterDialogComponent extends
this.destroy$.complete();
}
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const originalErrorState = this.errorStateMatcher.isErrorState(control, form);
const customErrorState = !!(control && control.invalid && this.submitted);
return originalErrorState || customErrorState;

26
ui-ngx/src/app/modules/home/components/filter/key-filter-list.component.ts

@ -18,10 +18,10 @@ import { Component, forwardRef, Input, OnInit } from '@angular/core';
import {
AbstractControl,
ControlValueAccessor,
FormArray,
FormBuilder,
FormControl,
FormGroup,
UntypedFormArray,
UntypedFormBuilder,
UntypedFormControl,
UntypedFormGroup,
NG_VALIDATORS,
NG_VALUE_ACCESSOR,
ValidationErrors,
@ -69,17 +69,17 @@ export class KeyFilterListComponent implements ControlValueAccessor, Validator,
@Input() entityId: EntityId;
keyFilterListFormGroup: FormGroup;
keyFilterListFormGroup: UntypedFormGroup;
entityKeyTypeTranslations = entityKeyTypeTranslationMap;
keyFiltersControl: FormControl;
keyFiltersControl: UntypedFormControl;
private propagateChange = null;
private valueChangeSubscription: Subscription = null;
constructor(private fb: FormBuilder,
constructor(private fb: UntypedFormBuilder,
private dialog: MatDialog) {
}
@ -90,8 +90,8 @@ export class KeyFilterListComponent implements ControlValueAccessor, Validator,
this.keyFiltersControl = this.fb.control(null);
}
keyFiltersFormArray(): FormArray {
return this.keyFilterListFormGroup.get('keyFilters') as FormArray;
keyFiltersFormArray(): UntypedFormArray {
return this.keyFilterListFormGroup.get('keyFilters') as UntypedFormArray;
}
registerOnChange(fn: any): void {
@ -142,11 +142,11 @@ export class KeyFilterListComponent implements ControlValueAccessor, Validator,
}
public removeKeyFilter(index: number) {
(this.keyFilterListFormGroup.get('keyFilters') as FormArray).removeAt(index);
(this.keyFilterListFormGroup.get('keyFilters') as UntypedFormArray).removeAt(index);
}
public addKeyFilter() {
const keyFiltersFormArray = this.keyFilterListFormGroup.get('keyFilters') as FormArray;
const keyFiltersFormArray = this.keyFilterListFormGroup.get('keyFilters') as UntypedFormArray;
this.openKeyFilterDialog(null).subscribe((result) => {
if (result) {
keyFiltersFormArray.push(this.fb.control(result, [Validators.required]));
@ -156,11 +156,11 @@ export class KeyFilterListComponent implements ControlValueAccessor, Validator,
public editKeyFilter(index: number) {
const keyFilter: KeyFilterInfo =
(this.keyFilterListFormGroup.get('keyFilters') as FormArray).at(index).value;
(this.keyFilterListFormGroup.get('keyFilters') as UntypedFormArray).at(index).value;
this.openKeyFilterDialog(keyFilter).subscribe(
(result) => {
if (result) {
(this.keyFilterListFormGroup.get('keyFilters') as FormArray).at(index).patchValue(result);
(this.keyFilterListFormGroup.get('keyFilters') as UntypedFormArray).at(index).patchValue(result);
}
}
);

8
ui-ngx/src/app/modules/home/components/filter/numeric-filter-predicate.component.ts

@ -17,8 +17,8 @@
import { Component, forwardRef, Input, OnInit } from '@angular/core';
import {
ControlValueAccessor,
FormBuilder,
FormGroup,
UntypedFormBuilder,
UntypedFormGroup,
NG_VALIDATORS,
NG_VALUE_ACCESSOR,
ValidationErrors,
@ -60,7 +60,7 @@ export class NumericFilterPredicateComponent implements ControlValueAccessor, Va
@Input() valueType: EntityKeyValueType;
numericFilterPredicateFormGroup: FormGroup;
numericFilterPredicateFormGroup: UntypedFormGroup;
valueTypeEnum = EntityKeyValueType;
@ -70,7 +70,7 @@ export class NumericFilterPredicateComponent implements ControlValueAccessor, Va
private propagateChange = null;
constructor(private fb: FormBuilder) {
constructor(private fb: UntypedFormBuilder) {
}
ngOnInit(): void {

8
ui-ngx/src/app/modules/home/components/filter/string-filter-predicate.component.ts

@ -17,8 +17,8 @@
import { Component, forwardRef, Input, OnInit } from '@angular/core';
import {
ControlValueAccessor,
FormBuilder,
FormGroup,
UntypedFormBuilder,
UntypedFormGroup,
NG_VALIDATORS,
NG_VALUE_ACCESSOR,
ValidationErrors,
@ -60,7 +60,7 @@ export class StringFilterPredicateComponent implements ControlValueAccessor, Val
valueTypeEnum = EntityKeyValueType;
stringFilterPredicateFormGroup: FormGroup;
stringFilterPredicateFormGroup: UntypedFormGroup;
stringOperations = Object.keys(StringOperation);
stringOperationEnum = StringOperation;
@ -68,7 +68,7 @@ export class StringFilterPredicateComponent implements ControlValueAccessor, Val
private propagateChange = null;
constructor(private fb: FormBuilder) {
constructor(private fb: UntypedFormBuilder) {
}
ngOnInit(): void {

18
ui-ngx/src/app/modules/home/components/filter/user-filter-dialog.component.ts

@ -20,10 +20,10 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import {
AbstractControl, FormArray,
FormBuilder,
FormControl,
FormGroup,
AbstractControl, UntypedFormArray,
UntypedFormBuilder,
UntypedFormControl,
UntypedFormGroup,
FormGroupDirective,
NgForm,
Validators
@ -54,7 +54,7 @@ export class UserFilterDialogComponent extends DialogComponent<UserFilterDialogC
filter: Filter;
userFilterFormGroup: FormGroup;
userFilterFormGroup: UntypedFormGroup;
valueTypeEnum = EntityKeyValueType;
@ -65,7 +65,7 @@ export class UserFilterDialogComponent extends DialogComponent<UserFilterDialogC
@Inject(MAT_DIALOG_DATA) public data: UserFilterDialogData,
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
public dialogRef: MatDialogRef<UserFilterDialogComponent, Filter>,
private fb: FormBuilder,
private fb: UntypedFormBuilder,
public translate: TranslateService) {
super(store, router, dialogRef);
this.filter = data.filter;
@ -97,14 +97,14 @@ export class UserFilterDialogComponent extends DialogComponent<UserFilterDialogC
return userInputControl;
}
userInputsFormArray(): FormArray {
return this.userFilterFormGroup.get('userInputs') as FormArray;
userInputsFormArray(): UntypedFormArray {
return this.userFilterFormGroup.get('userInputs') as UntypedFormArray;
}
ngOnInit(): void {
}
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const originalErrorState = this.errorStateMatcher.isErrorState(control, form);
const customErrorState = !!(control && control.invalid && this.submitted);
return originalErrorState || customErrorState;

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

@ -18,13 +18,13 @@ import { AfterViewInit, Component, ElementRef, Inject, OnDestroy, Renderer2, Vie
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { DialogComponent } from '@app/shared/components/dialog.component';
import { EntityType } from '@shared/models/entity-type.models';
import { TranslateService } from '@ngx-translate/core';
import { ActionNotificationShow } from '@core/notification/notification.actions';
import { MatVerticalStepper } from '@angular/material/stepper';
import { MatStepper } from '@angular/material/stepper';
import {
BulkImportRequest,
BulkImportResult,
@ -56,7 +56,7 @@ export interface ImportDialogCsvData {
export class ImportDialogCsvComponent extends DialogComponent<ImportDialogCsvComponent, boolean>
implements AfterViewInit, OnDestroy {
@ViewChild('importStepper', {static: true}) importStepper: MatVerticalStepper;
@ViewChild('importStepper', {static: true}) importStepper: MatStepper;
@ViewChild('columnsAssignmentComponent', {static: true})
columnsAssignmentComponent: TableColumnsAssignmentComponent;
@ -84,9 +84,9 @@ export class ImportDialogCsvComponent extends DialogComponent<ImportDialogCsvCom
selectedIndex = 0;
selectFileFormGroup: FormGroup;
importParametersFormGroup: FormGroup;
columnTypesFormGroup: FormGroup;
selectFileFormGroup: UntypedFormGroup;
importParametersFormGroup: UntypedFormGroup;
columnTypesFormGroup: UntypedFormGroup;
isImportData = false;
statistical: BulkImportResult;
@ -103,7 +103,7 @@ export class ImportDialogCsvComponent extends DialogComponent<ImportDialogCsvCom
public dialogRef: MatDialogRef<ImportDialogCsvComponent, boolean>,
public translate: TranslateService,
private importExport: ImportExportService,
private fb: FormBuilder,
private fb: UntypedFormBuilder,
private renderer: Renderer2) {
super(store, router, dialogRef);
this.entityType = data.entityType;

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

@ -19,7 +19,7 @@ import { ErrorStateMatcher } from '@angular/material/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormBuilder, FormControl, FormGroup, FormGroupDirective, NgForm, Validators } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, FormGroupDirective, NgForm, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { DialogComponent } from '@app/shared/components/dialog.component';
import { ActionNotificationShow } from '@core/notification/notification.actions';
@ -41,7 +41,7 @@ export class ImportDialogComponent extends DialogComponent<ImportDialogComponent
importTitle: string;
importFileLabel: string;
importFormGroup: FormGroup;
importFormGroup: UntypedFormGroup;
submitted = false;
@ -50,7 +50,7 @@ export class ImportDialogComponent extends DialogComponent<ImportDialogComponent
@Inject(MAT_DIALOG_DATA) public data: ImportDialogData,
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
public dialogRef: MatDialogRef<ImportDialogComponent>,
private fb: FormBuilder) {
private fb: UntypedFormBuilder) {
super(store, router, dialogRef);
this.importTitle = data.importTitle;
this.importFileLabel = data.importFileLabel;
@ -63,7 +63,7 @@ export class ImportDialogComponent extends DialogComponent<ImportDialogComponent
ngOnInit(): void {
}
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const originalErrorState = this.errorStateMatcher.isErrorState(control, form);
const customErrorState = !!(control && control.invalid && this.submitted);
return originalErrorState || customErrorState;

4
ui-ngx/src/app/modules/home/components/import-export/table-columns-assignment.component.ts

@ -15,7 +15,7 @@
///
import { Component, ElementRef, forwardRef, Input, OnInit } from '@angular/core';
import { ControlValueAccessor, FormControl, NG_VALIDATORS, NG_VALUE_ACCESSOR, Validator } from '@angular/forms';
import { ControlValueAccessor, UntypedFormControl, NG_VALIDATORS, NG_VALUE_ACCESSOR, Validator } from '@angular/forms';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { EntityType } from '@shared/models/entity-type.models';
@ -198,7 +198,7 @@ export class TableColumnsAssignmentComponent implements OnInit, ControlValueAcce
}
}
public validate(c: FormControl) {
public validate(c: UntypedFormControl) {
return (this.valid) ? null : {
columnsInvalid: true
};

18
ui-ngx/src/app/modules/home/components/profile/add-device-profile-dialog.component.ts

@ -27,7 +27,7 @@ import { ErrorStateMatcher } from '@angular/material/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
import { DialogComponent } from '@shared/components/dialog.component';
import { Router } from '@angular/router';
import {
@ -44,7 +44,7 @@ import {
} from '@shared/models/device.models';
import { DeviceProfileService } from '@core/http/device-profile.service';
import { EntityType } from '@shared/models/entity-type.models';
import { MatHorizontalStepper } from '@angular/material/stepper';
import { MatStepper } from '@angular/material/stepper';
import { RuleChainId } from '@shared/models/id/rule-chain-id';
import { StepperSelectionEvent } from '@angular/cdk/stepper';
import { deepTrim } from '@core/utils';
@ -66,7 +66,7 @@ export interface AddDeviceProfileDialogData {
export class AddDeviceProfileDialogComponent extends
DialogComponent<AddDeviceProfileDialogComponent, DeviceProfile> implements AfterViewInit {
@ViewChild('addDeviceProfileStepper', {static: true}) addDeviceProfileStepper: MatHorizontalStepper;
@ViewChild('addDeviceProfileStepper', {static: true}) addDeviceProfileStepper: MatStepper;
selectedIndex = 0;
@ -84,13 +84,13 @@ export class AddDeviceProfileDialogComponent extends
deviceTransportTypeTranslations = deviceTransportTypeTranslationMap;
deviceProfileDetailsFormGroup: FormGroup;
deviceProfileDetailsFormGroup: UntypedFormGroup;
transportConfigFormGroup: FormGroup;
transportConfigFormGroup: UntypedFormGroup;
alarmRulesFormGroup: FormGroup;
alarmRulesFormGroup: UntypedFormGroup;
provisionConfigFormGroup: FormGroup;
provisionConfigFormGroup: UntypedFormGroup;
serviceType = ServiceType.TB_RULE_ENGINE;
@ -104,7 +104,7 @@ export class AddDeviceProfileDialogComponent extends
private injector: Injector,
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
private deviceProfileService: DeviceProfileService,
private fb: FormBuilder) {
private fb: UntypedFormBuilder) {
super(store, router, dialogRef);
this.deviceProfileDetailsFormGroup = this.fb.group(
{
@ -169,7 +169,7 @@ export class AddDeviceProfileDialogComponent extends
}
}
selectedForm(): FormGroup {
selectedForm(): UntypedFormGroup {
switch (this.selectedIndex) {
case 0:
return this.deviceProfileDetailsFormGroup;

6
ui-ngx/src/app/modules/home/components/profile/alarm/alarm-duration-predicate-value.component.ts

@ -15,7 +15,7 @@
///
import { Component, forwardRef, Input, OnInit } from '@angular/core';
import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR, Validators } from '@angular/forms';
import { ControlValueAccessor, UntypedFormBuilder, UntypedFormGroup, NG_VALUE_ACCESSOR, Validators } from '@angular/forms';
import {
DynamicValueSourceType,
dynamicValueSourceTypeTranslationMap,
@ -68,7 +68,7 @@ export class AlarmDurationPredicateValueComponent implements ControlValueAccesso
dynamicValueSourceTypeTranslations = dynamicValueSourceTypeTranslationMap;
alarmDurationPredicateValueFormGroup: FormGroup;
alarmDurationPredicateValueFormGroup: UntypedFormGroup;
dynamicMode = false;
@ -76,7 +76,7 @@ export class AlarmDurationPredicateValueComponent implements ControlValueAccesso
private propagateChange = null;
constructor(private fb: FormBuilder) {
constructor(private fb: UntypedFormBuilder) {
}
ngOnInit(): void {

8
ui-ngx/src/app/modules/home/components/profile/alarm/alarm-dynamic-value.component.ts

@ -17,8 +17,8 @@
import { Component, forwardRef, Input, OnInit } from '@angular/core';
import {
ControlValueAccessor,
FormBuilder,
FormGroup,
UntypedFormBuilder,
UntypedFormGroup,
NG_VALUE_ACCESSOR,
} from '@angular/forms';
import {
@ -38,7 +38,7 @@ import {
})
export class AlarmDynamicValue implements ControlValueAccessor, OnInit{
public dynamicValue: FormGroup;
public dynamicValue: UntypedFormGroup;
public dynamicValueSourceTypes: DynamicValueSourceType[] = getDynamicSourcesForAllowUser(false);
public dynamicValueSourceTypeTranslations = dynamicValueSourceTypeTranslationMap;
private propagateChange = (v: any) => { };
@ -49,7 +49,7 @@ export class AlarmDynamicValue implements ControlValueAccessor, OnInit{
@Input()
disabled: boolean;
constructor(private fb: FormBuilder) {
constructor(private fb: UntypedFormBuilder) {
}
ngOnInit(): void {

8
ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule-condition-dialog.component.ts

@ -19,7 +19,7 @@ import { ErrorStateMatcher } from '@angular/material/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormBuilder, FormControl, FormGroup, FormGroupDirective, NgForm, Validators } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, FormGroupDirective, NgForm, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { DialogComponent } from '@app/shared/components/dialog.component';
import { TranslateService } from '@ngx-translate/core';
@ -52,7 +52,7 @@ export class AlarmRuleConditionDialogComponent extends DialogComponent<AlarmRule
condition = this.data.condition;
entityId = this.data.entityId;
conditionFormGroup: FormGroup;
conditionFormGroup: UntypedFormGroup;
submitted = false;
@ -61,7 +61,7 @@ export class AlarmRuleConditionDialogComponent extends DialogComponent<AlarmRule
@Inject(MAT_DIALOG_DATA) public data: AlarmRuleConditionDialogData,
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
public dialogRef: MatDialogRef<AlarmRuleConditionDialogComponent, AlarmCondition>,
private fb: FormBuilder,
private fb: UntypedFormBuilder,
public translate: TranslateService) {
super(store, router, dialogRef);
@ -87,7 +87,7 @@ export class AlarmRuleConditionDialogComponent extends DialogComponent<AlarmRule
ngOnInit(): void {
}
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const originalErrorState = this.errorStateMatcher.isErrorState(control, form);
const customErrorState = !!(control && control.invalid && this.submitted);
return originalErrorState || customErrorState;

12
ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule-condition.component.ts

@ -17,9 +17,9 @@
import { Component, forwardRef, Input, OnInit } from '@angular/core';
import {
ControlValueAccessor,
FormBuilder,
FormControl,
FormGroup,
UntypedFormBuilder,
UntypedFormControl,
UntypedFormGroup,
NG_VALIDATORS,
NG_VALUE_ACCESSOR,
Validator,
@ -62,7 +62,7 @@ export class AlarmRuleConditionComponent implements ControlValueAccessor, OnInit
@Input()
deviceProfileId: EntityId;
alarmRuleConditionFormGroup: FormGroup;
alarmRuleConditionFormGroup: UntypedFormGroup;
specText = '';
@ -71,7 +71,7 @@ export class AlarmRuleConditionComponent implements ControlValueAccessor, OnInit
private propagateChange = (v: any) => { };
constructor(private dialog: MatDialog,
private fb: FormBuilder,
private fb: UntypedFormBuilder,
private translate: TranslateService) {
}
@ -110,7 +110,7 @@ export class AlarmRuleConditionComponent implements ControlValueAccessor, OnInit
return this.modelValue && this.modelValue.condition.length;
}
public validate(c: FormControl) {
public validate(c: UntypedFormControl) {
return this.conditionSet() ? null : {
alarmRuleCondition: {
valid: false,

12
ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule.component.ts

@ -17,9 +17,9 @@
import { Component, forwardRef, Input, OnInit } from '@angular/core';
import {
ControlValueAccessor,
FormBuilder,
FormControl,
FormGroup,
UntypedFormBuilder,
UntypedFormControl,
UntypedFormGroup,
NG_VALIDATORS,
NG_VALUE_ACCESSOR,
Validator,
@ -73,7 +73,7 @@ export class AlarmRuleComponent implements ControlValueAccessor, OnInit, Validat
private modelValue: AlarmRule;
alarmRuleFormGroup: FormGroup;
alarmRuleFormGroup: UntypedFormGroup;
expandAlarmDetails = false;
@ -81,7 +81,7 @@ export class AlarmRuleComponent implements ControlValueAccessor, OnInit, Validat
constructor(private dialog: MatDialog,
private utils: UtilsService,
private fb: FormBuilder) {
private fb: UntypedFormBuilder) {
}
registerOnChange(fn: any): void {
@ -140,7 +140,7 @@ export class AlarmRuleComponent implements ControlValueAccessor, OnInit, Validat
});
}
public validate(c: FormControl) {
public validate(c: UntypedFormControl) {
return (!this.required && !this.modelValue || this.alarmRuleFormGroup.valid) ? null : {
alarmRule: {
valid: false,

8
ui-ngx/src/app/modules/home/components/profile/alarm/alarm-schedule-dialog.component.ts

@ -19,7 +19,7 @@ import { ErrorStateMatcher } from '@angular/material/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormBuilder, FormControl, FormGroup, FormGroupDirective, NgForm } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, FormGroupDirective, NgForm } from '@angular/forms';
import { Router } from '@angular/router';
import { DialogComponent } from '@app/shared/components/dialog.component';
import { UtilsService } from '@core/services/utils.service';
@ -43,7 +43,7 @@ export class AlarmScheduleDialogComponent extends DialogComponent<AlarmScheduleD
readonly = this.data.readonly;
alarmSchedule = this.data.alarmSchedule;
alarmScheduleFormGroup: FormGroup;
alarmScheduleFormGroup: UntypedFormGroup;
submitted = false;
@ -52,7 +52,7 @@ export class AlarmScheduleDialogComponent extends DialogComponent<AlarmScheduleD
@Inject(MAT_DIALOG_DATA) public data: AlarmScheduleDialogData,
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
public dialogRef: MatDialogRef<AlarmScheduleDialogComponent, AlarmSchedule>,
private fb: FormBuilder,
private fb: UntypedFormBuilder,
private utils: UtilsService,
public translate: TranslateService) {
super(store, router, dialogRef);
@ -68,7 +68,7 @@ export class AlarmScheduleDialogComponent extends DialogComponent<AlarmScheduleD
ngOnInit(): void {
}
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const originalErrorState = this.errorStateMatcher.isErrorState(control, form);
const customErrorState = !!(control && control.invalid && this.submitted);
return originalErrorState || customErrorState;

26
ui-ngx/src/app/modules/home/components/profile/alarm/alarm-schedule.component.ts

@ -18,10 +18,10 @@ import { Component, forwardRef, Input, OnInit } from '@angular/core';
import {
AbstractControl,
ControlValueAccessor,
FormArray,
FormBuilder,
FormControl,
FormGroup,
UntypedFormArray,
UntypedFormBuilder,
UntypedFormControl,
UntypedFormGroup,
NG_VALIDATORS,
NG_VALUE_ACCESSOR,
ValidationErrors,
@ -59,7 +59,7 @@ export class AlarmScheduleComponent implements ControlValueAccessor, Validator,
@Input()
disabled: boolean;
alarmScheduleForm: FormGroup;
alarmScheduleForm: UntypedFormGroup;
alarmScheduleTypes = Object.keys(AlarmScheduleType);
alarmScheduleType = AlarmScheduleType;
@ -80,7 +80,7 @@ export class AlarmScheduleComponent implements ControlValueAccessor, Validator,
private propagateChange = (v: any) => { };
constructor(private fb: FormBuilder) {
constructor(private fb: UntypedFormBuilder) {
}
ngOnInit(): void {
@ -190,7 +190,7 @@ export class AlarmScheduleComponent implements ControlValueAccessor, Validator,
this.updateValidators(this.modelValue.type);
}
validate(control: FormGroup): ValidationErrors | null {
validate(control: UntypedFormGroup): ValidationErrors | null {
return this.alarmScheduleForm.valid ? null : {
alarmScheduler: {
valid: false
@ -198,8 +198,8 @@ export class AlarmScheduleComponent implements ControlValueAccessor, Validator,
};
}
weeklyRepeatControl(index: number): FormControl {
return (this.alarmScheduleForm.get('daysOfWeek') as FormArray).at(index) as FormControl;
weeklyRepeatControl(index: number): UntypedFormControl {
return (this.alarmScheduleForm.get('daysOfWeek') as UntypedFormArray).at(index) as UntypedFormControl;
}
private updateValidators(type: AlarmScheduleType, changedType = false){
@ -256,7 +256,7 @@ export class AlarmScheduleComponent implements ControlValueAccessor, Validator,
}
private defaultItemsScheduler(index): FormGroup {
private defaultItemsScheduler(index): UntypedFormGroup {
return this.fb.group({
enabled: [true],
dayOfWeek: [index + 1],
@ -280,11 +280,11 @@ export class AlarmScheduleComponent implements ControlValueAccessor, Validator,
}
}
getSchedulerRangeText(control: FormGroup | AbstractControl): string {
getSchedulerRangeText(control: UntypedFormGroup | AbstractControl): string {
return getAlarmScheduleRangeText(control.get('startsOn').value, control.get('endsOn').value);
}
get itemsSchedulerForm(): FormArray {
return this.alarmScheduleForm.get('items') as FormArray;
get itemsSchedulerForm(): UntypedFormArray {
return this.alarmScheduleForm.get('items') as UntypedFormArray;
}
}

22
ui-ngx/src/app/modules/home/components/profile/alarm/create-alarm-rules.component.ts

@ -18,10 +18,10 @@ import { Component, forwardRef, Input, OnInit } from '@angular/core';
import {
AbstractControl,
ControlValueAccessor,
FormArray,
FormBuilder,
FormControl,
FormGroup,
UntypedFormArray,
UntypedFormBuilder,
UntypedFormControl,
UntypedFormGroup,
NG_VALIDATORS,
NG_VALUE_ACCESSOR, ValidationErrors,
Validator,
@ -63,7 +63,7 @@ export class CreateAlarmRulesComponent implements ControlValueAccessor, OnInit,
@Input()
deviceProfileId: EntityId;
createAlarmRulesFormGroup: FormGroup;
createAlarmRulesFormGroup: UntypedFormGroup;
private usedSeverities: AlarmSeverity[] = [];
@ -72,7 +72,7 @@ export class CreateAlarmRulesComponent implements ControlValueAccessor, OnInit,
private propagateChange = (v: any) => { };
constructor(private dialog: MatDialog,
private fb: FormBuilder) {
private fb: UntypedFormBuilder) {
}
registerOnChange(fn: any): void {
@ -88,8 +88,8 @@ export class CreateAlarmRulesComponent implements ControlValueAccessor, OnInit,
});
}
createAlarmRulesFormArray(): FormArray {
return this.createAlarmRulesFormGroup.get('createAlarmRules') as FormArray;
createAlarmRulesFormArray(): UntypedFormArray {
return this.createAlarmRulesFormGroup.get('createAlarmRules') as UntypedFormArray;
}
setDisabledState(isDisabled: boolean): void {
@ -134,7 +134,7 @@ export class CreateAlarmRulesComponent implements ControlValueAccessor, OnInit,
}
public removeCreateAlarmRule(index: number) {
(this.createAlarmRulesFormGroup.get('createAlarmRules') as FormArray).removeAt(index);
(this.createAlarmRulesFormGroup.get('createAlarmRules') as UntypedFormArray).removeAt(index);
}
public addCreateAlarmRule() {
@ -143,7 +143,7 @@ export class CreateAlarmRulesComponent implements ControlValueAccessor, OnInit,
condition: []
}
};
const createAlarmRulesArray = this.createAlarmRulesFormGroup.get('createAlarmRules') as FormArray;
const createAlarmRulesArray = this.createAlarmRulesFormGroup.get('createAlarmRules') as UntypedFormArray;
createAlarmRulesArray.push(this.fb.group({
severity: [this.getFirstUnusedSeverity(), Validators.required],
alarmRule: [createAlarmRule, alarmRuleValidator]
@ -164,7 +164,7 @@ export class CreateAlarmRulesComponent implements ControlValueAccessor, OnInit,
return null;
}
public validate(c: FormControl) {
public validate(c: UntypedFormControl) {
return (this.createAlarmRulesFormGroup.valid) ? null : {
createAlarmRules: {
valid: false,

14
ui-ngx/src/app/modules/home/components/profile/alarm/device-profile-alarm.component.ts

@ -17,9 +17,9 @@
import { Component, EventEmitter, forwardRef, Input, OnInit, Output } from '@angular/core';
import {
ControlValueAccessor,
FormBuilder,
FormControl,
FormGroup,
UntypedFormBuilder,
UntypedFormControl,
UntypedFormGroup,
NG_VALIDATORS,
NG_VALUE_ACCESSOR,
Validator,
@ -67,14 +67,14 @@ export class DeviceProfileAlarmComponent implements ControlValueAccessor, OnInit
private modelValue: DeviceProfileAlarm;
alarmFormGroup: FormGroup;
alarmFormGroup: UntypedFormGroup;
private propagateChange = null;
private propagateChangePending = false;
constructor(private dialog: MatDialog,
private utils: UtilsService,
private fb: FormBuilder) {
private fb: UntypedFormBuilder) {
}
registerOnChange(fn: any): void {
@ -140,7 +140,7 @@ export class DeviceProfileAlarmComponent implements ControlValueAccessor, OnInit
this.alarmFormGroup.patchValue({clearRule: null});
}
public validate(c: FormControl) {
public validate(c: UntypedFormControl) {
if (c.parent) {
const alarmType = c.value.alarmType;
const profileAlarmsType = [];
@ -171,7 +171,7 @@ export class DeviceProfileAlarmComponent implements ControlValueAccessor, OnInit
}
addRelationType(event: MatChipInputEvent): void {
const input = event.input;
const input = event.chipInput.inputElement;
let value = event.value;
if ((value || '').trim()) {
value = value.trim();

22
ui-ngx/src/app/modules/home/components/profile/alarm/device-profile-alarms.component.ts

@ -18,10 +18,10 @@ import { Component, forwardRef, Input, OnInit } from '@angular/core';
import {
AbstractControl,
ControlValueAccessor,
FormArray,
FormBuilder,
FormControl,
FormGroup,
UntypedFormArray,
UntypedFormBuilder,
UntypedFormControl,
UntypedFormGroup,
NG_VALIDATORS,
NG_VALUE_ACCESSOR,
Validator,
@ -55,7 +55,7 @@ import { EntityId } from '@shared/models/id/entity-id';
})
export class DeviceProfileAlarmsComponent implements ControlValueAccessor, OnInit, Validator {
deviceProfileAlarmsFormGroup: FormGroup;
deviceProfileAlarmsFormGroup: UntypedFormGroup;
private requiredValue: boolean;
get required(): boolean {
@ -77,7 +77,7 @@ export class DeviceProfileAlarmsComponent implements ControlValueAccessor, OnIni
private propagateChange = (v: any) => { };
constructor(private store: Store<AppState>,
private fb: FormBuilder,
private fb: UntypedFormBuilder,
private dialog: MatDialog) {
}
@ -94,8 +94,8 @@ export class DeviceProfileAlarmsComponent implements ControlValueAccessor, OnIni
});
}
alarmsFormArray(): FormArray {
return this.deviceProfileAlarmsFormGroup.get('alarms') as FormArray;
alarmsFormArray(): UntypedFormArray {
return this.deviceProfileAlarmsFormGroup.get('alarms') as UntypedFormArray;
}
setDisabledState(isDisabled: boolean): void {
@ -137,7 +137,7 @@ export class DeviceProfileAlarmsComponent implements ControlValueAccessor, OnIni
}
public removeAlarm(index: number) {
(this.deviceProfileAlarmsFormGroup.get('alarms') as FormArray).removeAt(index);
(this.deviceProfileAlarmsFormGroup.get('alarms') as UntypedFormArray).removeAt(index);
}
public addAlarm() {
@ -152,7 +152,7 @@ export class DeviceProfileAlarmsComponent implements ControlValueAccessor, OnIni
}
}
};
const alarmsArray = this.deviceProfileAlarmsFormGroup.get('alarms') as FormArray;
const alarmsArray = this.deviceProfileAlarmsFormGroup.get('alarms') as UntypedFormArray;
alarmsArray.push(this.fb.control(alarm, [deviceProfileAlarmValidator]));
this.deviceProfileAlarmsFormGroup.updateValueAndValidity();
if (!this.deviceProfileAlarmsFormGroup.valid) {
@ -160,7 +160,7 @@ export class DeviceProfileAlarmsComponent implements ControlValueAccessor, OnIni
}
}
public validate(c: FormControl) {
public validate(c: UntypedFormControl) {
return (this.deviceProfileAlarmsFormGroup.valid) ? null : {
alarms: {
valid: false,

8
ui-ngx/src/app/modules/home/components/profile/alarm/edit-alarm-details-dialog.component.ts

@ -19,7 +19,7 @@ import { ErrorStateMatcher } from '@angular/material/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormBuilder, FormControl, FormGroup, FormGroupDirective, NgForm } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, FormGroupDirective, NgForm } from '@angular/forms';
import { Router } from '@angular/router';
import { DialogComponent } from '@app/shared/components/dialog.component';
import { UtilsService } from '@core/services/utils.service';
@ -41,7 +41,7 @@ export class EditAlarmDetailsDialogComponent extends DialogComponent<EditAlarmDe
alarmDetails = this.data.alarmDetails;
editDetailsFormGroup: FormGroup;
editDetailsFormGroup: UntypedFormGroup;
submitted = false;
@ -50,7 +50,7 @@ export class EditAlarmDetailsDialogComponent extends DialogComponent<EditAlarmDe
@Inject(MAT_DIALOG_DATA) public data: EditAlarmDetailsDialogData,
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
public dialogRef: MatDialogRef<EditAlarmDetailsDialogComponent, string>,
private fb: FormBuilder,
private fb: UntypedFormBuilder,
private utils: UtilsService,
public translate: TranslateService) {
super(store, router, dialogRef);
@ -66,7 +66,7 @@ export class EditAlarmDetailsDialogComponent extends DialogComponent<EditAlarmDe
ngOnInit(): void {
}
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const originalErrorState = this.errorStateMatcher.isErrorState(control, form);
const customErrorState = !!(control && control.invalid && this.submitted);
return originalErrorState || customErrorState;

6
ui-ngx/src/app/modules/home/components/profile/asset-profile-autocomplete.component.ts

@ -25,7 +25,7 @@ import {
Output,
ViewChild
} from '@angular/core';
import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR } from '@angular/forms';
import { ControlValueAccessor, UntypedFormBuilder, UntypedFormGroup, NG_VALUE_ACCESSOR } from '@angular/forms';
import { Observable, of } from 'rxjs';
import { PageLink } from '@shared/models/page/page-link';
import { Direction } from '@shared/models/page/sort-order';
@ -58,7 +58,7 @@ import { AssetProfileDialogComponent, AssetProfileDialogData } from './asset-pro
})
export class AssetProfileAutocompleteComponent implements ControlValueAccessor, OnInit {
selectAssetProfileFormGroup: FormGroup;
selectAssetProfileFormGroup: UntypedFormGroup;
modelValue: AssetProfileId | null;
@ -125,7 +125,7 @@ export class AssetProfileAutocompleteComponent implements ControlValueAccessor,
public translate: TranslateService,
public truncate: TruncatePipe,
private assetProfileService: AssetProfileService,
private fb: FormBuilder,
private fb: UntypedFormBuilder,
private zone: NgZone,
private dialog: MatDialog) {
this.selectAssetProfileFormGroup = this.fb.group({

4
ui-ngx/src/app/modules/home/components/profile/asset-profile-dialog.component.ts

@ -27,7 +27,7 @@ import { ErrorStateMatcher } from '@angular/material/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormControl, FormGroupDirective, NgForm } from '@angular/forms';
import { UntypedFormControl, FormGroupDirective, NgForm } from '@angular/forms';
import { DialogComponent } from '@shared/components/dialog.component';
import { Router } from '@angular/router';
import { AssetProfile } from '@shared/models/asset.models';
@ -76,7 +76,7 @@ export class AssetProfileDialogComponent extends
}
}
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const originalErrorState = this.errorStateMatcher.isErrorState(control, form);
const customErrorState = !!(control && control.invalid && this.submitted);
return originalErrorState || customErrorState;

6
ui-ngx/src/app/modules/home/components/profile/asset-profile.component.ts

@ -17,7 +17,7 @@
import { ChangeDetectorRef, Component, Inject, Input, Optional } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
import { ActionNotificationShow } from '@app/core/notification/notification.actions';
import { TranslateService } from '@ngx-translate/core';
import { EntityTableConfig } from '@home/models/entity/entities-table-config.models';
@ -54,7 +54,7 @@ export class AssetProfileComponent extends EntityComponent<AssetProfile> {
protected translate: TranslateService,
@Optional() @Inject('entity') protected entityValue: AssetProfile,
@Optional() @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<AssetProfile>,
protected fb: FormBuilder,
protected fb: UntypedFormBuilder,
protected cd: ChangeDetectorRef) {
super(store, fb, entityValue, entitiesTableConfigValue, cd);
}
@ -67,7 +67,7 @@ export class AssetProfileComponent extends EntityComponent<AssetProfile> {
}
}
buildForm(entity: AssetProfile): FormGroup {
buildForm(entity: AssetProfile): UntypedFormGroup {
this.assetProfileId = entity?.id ? entity.id : null;
const form = this.fb.group(
{

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

Loading…
Cancel
Save