Commit 0289b0c1a2b9bec66cc5261c3c862a855d01d140
1 parent
3d71a5ba
UI: Get rid of 'multiple directives with 'exportAs' set to ngForm'
Showing
57 changed files
with
86 additions
and
97 deletions
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<form #entityAliasForm="ngForm" [formGroup]="entityAliasFormGroup" (ngSubmit)="save()" style="min-width: 480px;"> | 18 | +<form [formGroup]="entityAliasFormGroup" (ngSubmit)="save()" style="min-width: 480px;"> |
19 | <mat-toolbar color="primary"> | 19 | <mat-toolbar color="primary"> |
20 | <h2>{{ (isAdd ? 'alias.add' : 'alias.edit') | translate }}</h2> | 20 | <h2>{{ (isAdd ? 'alias.add' : 'alias.edit') | translate }}</h2> |
21 | <span fxFlex></span> | 21 | <span fxFlex></span> |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<form #entityAliasesForm="ngForm" [formGroup]="entityAliasesFormGroup" (ngSubmit)="save()" style="width: 700px;"> | 18 | +<form [formGroup]="entityAliasesFormGroup" (ngSubmit)="save()" style="width: 700px;"> |
19 | <mat-toolbar color="primary"> | 19 | <mat-toolbar color="primary"> |
20 | <h2>{{ title | translate }}</h2> | 20 | <h2>{{ title | translate }}</h2> |
21 | <span fxFlex></span> | 21 | <span fxFlex></span> |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<form #addWidgetForm="ngForm" [formGroup]="addWidgetFormGroup" (ngSubmit)="add()" style="min-width: 400px;"> | 18 | +<form [formGroup]="addWidgetFormGroup" (ngSubmit)="add()" style="min-width: 400px;"> |
19 | <mat-toolbar color="primary"> | 19 | <mat-toolbar color="primary"> |
20 | <h2 translate>attribute.add-widget-to-dashboard</h2> | 20 | <h2 translate>attribute.add-widget-to-dashboard</h2> |
21 | <span fxFlex></span> | 21 | <span fxFlex></span> |
@@ -15,8 +15,7 @@ | @@ -15,8 +15,7 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<form #attributeForm="ngForm" | ||
19 | - class="mat-elevation-z1" | 18 | +<form class="mat-elevation-z1" |
20 | [formGroup]="attributeFormGroup" (ngSubmit)="update()" style="width: 400px; padding: 5px;"> | 19 | [formGroup]="attributeFormGroup" (ngSubmit)="update()" style="width: 400px; padding: 5px;"> |
21 | <fieldset [disabled]="isLoading$ | async"> | 20 | <fieldset [disabled]="isLoading$ | async"> |
22 | <tb-value-input | 21 | <tb-value-input |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<form #widgetForm="ngForm"> | 18 | +<form> |
19 | <mat-toolbar color="primary"> | 19 | <mat-toolbar color="primary"> |
20 | <h2 translate>layout.select</h2> | 20 | <h2 translate>layout.select</h2> |
21 | <span fxFlex></span> | 21 | <span fxFlex></span> |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<form #stateForm="ngForm" [formGroup]="stateFormGroup" (ngSubmit)="save()"> | 18 | +<form [formGroup]="stateFormGroup" (ngSubmit)="save()"> |
19 | <mat-toolbar color="primary"> | 19 | <mat-toolbar color="primary"> |
20 | <h2 translate>dashboard.select-state</h2> | 20 | <h2 translate>dashboard.select-state</h2> |
21 | <span fxFlex></span> | 21 | <span fxFlex></span> |
@@ -18,7 +18,7 @@ import { Component, EventEmitter, Input, Output } from '@angular/core'; | @@ -18,7 +18,7 @@ import { Component, EventEmitter, Input, Output } from '@angular/core'; | ||
18 | import { PageComponent } from '@shared/components/page.component'; | 18 | import { PageComponent } from '@shared/components/page.component'; |
19 | import { Store } from '@ngrx/store'; | 19 | import { Store } from '@ngrx/store'; |
20 | import { AppState } from '@core/core.state'; | 20 | import { AppState } from '@core/core.state'; |
21 | -import { NgForm } from '@angular/forms'; | 21 | +import { FormGroup, NgForm } from '@angular/forms'; |
22 | 22 | ||
23 | @Component({ | 23 | @Component({ |
24 | selector: 'tb-details-panel', | 24 | selector: 'tb-details-panel', |
@@ -33,14 +33,14 @@ export class DetailsPanelComponent extends PageComponent { | @@ -33,14 +33,14 @@ export class DetailsPanelComponent extends PageComponent { | ||
33 | @Input() isReadOnly = false; | 33 | @Input() isReadOnly = false; |
34 | @Input() isAlwaysEdit = false; | 34 | @Input() isAlwaysEdit = false; |
35 | 35 | ||
36 | - theFormValue: NgForm; | 36 | + theFormValue: FormGroup; |
37 | 37 | ||
38 | @Input() | 38 | @Input() |
39 | - set theForm(value: NgForm) { | 39 | + set theForm(value: FormGroup) { |
40 | this.theFormValue = value; | 40 | this.theFormValue = value; |
41 | } | 41 | } |
42 | 42 | ||
43 | - get theForm(): NgForm { | 43 | + get theForm(): FormGroup { |
44 | return this.theFormValue; | 44 | return this.theFormValue; |
45 | } | 45 | } |
46 | 46 |
@@ -19,7 +19,7 @@ import { ErrorStateMatcher } from '@angular/material/core'; | @@ -19,7 +19,7 @@ import { ErrorStateMatcher } from '@angular/material/core'; | ||
19 | import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; | 19 | import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; |
20 | import { Store } from '@ngrx/store'; | 20 | import { Store } from '@ngrx/store'; |
21 | import { AppState } from '@core/core.state'; | 21 | import { AppState } from '@core/core.state'; |
22 | -import { FormControl, FormGroupDirective, NgForm } from '@angular/forms'; | 22 | +import { FormControl, FormGroup, FormGroupDirective, NgForm } from '@angular/forms'; |
23 | import { EntityTypeResource, EntityTypeTranslation } from '@shared/models/entity-type.models'; | 23 | import { EntityTypeResource, EntityTypeTranslation } from '@shared/models/entity-type.models'; |
24 | import { BaseData, HasId } from '@shared/models/base-data'; | 24 | import { BaseData, HasId } from '@shared/models/base-data'; |
25 | import { EntityId } from '@shared/models/id/entity-id'; | 25 | import { EntityId } from '@shared/models/id/entity-id'; |
@@ -40,7 +40,7 @@ export class AddEntityDialogComponent extends | @@ -40,7 +40,7 @@ export class AddEntityDialogComponent extends | ||
40 | DialogComponent<AddEntityDialogComponent, BaseData<HasId>> implements OnInit, ErrorStateMatcher { | 40 | DialogComponent<AddEntityDialogComponent, BaseData<HasId>> implements OnInit, ErrorStateMatcher { |
41 | 41 | ||
42 | entityComponent: EntityComponent<BaseData<HasId>>; | 42 | entityComponent: EntityComponent<BaseData<HasId>>; |
43 | - detailsForm: NgForm; | 43 | + detailsForm: FormGroup; |
44 | 44 | ||
45 | entitiesTableConfig: EntityTableConfig<BaseData<HasId>>; | 45 | entitiesTableConfig: EntityTableConfig<BaseData<HasId>>; |
46 | translations: EntityTypeTranslation; | 46 | translations: EntityTypeTranslation; |
@@ -87,7 +87,7 @@ export class AddEntityDialogComponent extends | @@ -87,7 +87,7 @@ export class AddEntityDialogComponent extends | ||
87 | const componentRef = viewContainerRef.createComponent(componentFactory, 0, injector); | 87 | const componentRef = viewContainerRef.createComponent(componentFactory, 0, injector); |
88 | this.entityComponent = componentRef.instance; | 88 | this.entityComponent = componentRef.instance; |
89 | this.entityComponent.isEdit = true; | 89 | this.entityComponent.isEdit = true; |
90 | - this.detailsForm = this.entityComponent.entityNgForm; | 90 | + this.detailsForm = this.entityComponent.entityForm; |
91 | } | 91 | } |
92 | 92 | ||
93 | helpLinkId(): string { | 93 | helpLinkId(): string { |
@@ -37,7 +37,7 @@ import { AppState } from '@core/core.state'; | @@ -37,7 +37,7 @@ import { AppState } from '@core/core.state'; | ||
37 | import { EntityTableConfig } from '@home/models/entity/entities-table-config.models'; | 37 | import { EntityTableConfig } from '@home/models/entity/entities-table-config.models'; |
38 | import { BaseData, HasId } from '@shared/models/base-data'; | 38 | import { BaseData, HasId } from '@shared/models/base-data'; |
39 | import { EntityType, EntityTypeResource, EntityTypeTranslation } from '@shared/models/entity-type.models'; | 39 | import { EntityType, EntityTypeResource, EntityTypeTranslation } from '@shared/models/entity-type.models'; |
40 | -import { NgForm } from '@angular/forms'; | 40 | +import { FormGroup, NgForm } from '@angular/forms'; |
41 | import { EntityComponent } from './entity.component'; | 41 | import { EntityComponent } from './entity.component'; |
42 | import { TbAnchorComponent } from '@shared/components/tb-anchor.component'; | 42 | import { TbAnchorComponent } from '@shared/components/tb-anchor.component'; |
43 | import { EntityAction } from '@home/models/entity/entity-component.models'; | 43 | import { EntityAction } from '@home/models/entity/entity-component.models'; |
@@ -68,7 +68,7 @@ export class EntityDetailsPanelComponent extends PageComponent implements OnInit | @@ -68,7 +68,7 @@ export class EntityDetailsPanelComponent extends PageComponent implements OnInit | ||
68 | 68 | ||
69 | entityTabsComponentRef: ComponentRef<EntityTabsComponent<BaseData<HasId>>>; | 69 | entityTabsComponentRef: ComponentRef<EntityTabsComponent<BaseData<HasId>>>; |
70 | entityTabsComponent: EntityTabsComponent<BaseData<HasId>>; | 70 | entityTabsComponent: EntityTabsComponent<BaseData<HasId>>; |
71 | - detailsForm: NgForm; | 71 | + detailsForm: FormGroup; |
72 | 72 | ||
73 | entitiesTableConfigValue: EntityTableConfig<BaseData<HasId>>; | 73 | entitiesTableConfigValue: EntityTableConfig<BaseData<HasId>>; |
74 | isEditValue = false; | 74 | isEditValue = false; |
@@ -189,7 +189,7 @@ export class EntityDetailsPanelComponent extends PageComponent implements OnInit | @@ -189,7 +189,7 @@ export class EntityDetailsPanelComponent extends PageComponent implements OnInit | ||
189 | this.entityComponentRef = viewContainerRef.createComponent(componentFactory, 0, injector); | 189 | this.entityComponentRef = viewContainerRef.createComponent(componentFactory, 0, injector); |
190 | this.entityComponent = this.entityComponentRef.instance; | 190 | this.entityComponent = this.entityComponentRef.instance; |
191 | this.entityComponent.isEdit = this.isEdit; | 191 | this.entityComponent.isEdit = this.isEdit; |
192 | - this.detailsForm = this.entityComponent.entityNgForm; | 192 | + this.detailsForm = this.entityComponent.entityForm; |
193 | this.subscriptions.push(this.entityComponent.entityAction.subscribe((action) => { | 193 | this.subscriptions.push(this.entityComponent.entityAction.subscribe((action) => { |
194 | this.entityAction.emit(action); | 194 | this.entityAction.emit(action); |
195 | })); | 195 | })); |
@@ -30,7 +30,7 @@ import { AuditLogMode } from '@shared/models/audit-log.models'; | @@ -30,7 +30,7 @@ import { AuditLogMode } from '@shared/models/audit-log.models'; | ||
30 | import { DebugEventType, EventType } from '@shared/models/event.models'; | 30 | import { DebugEventType, EventType } from '@shared/models/event.models'; |
31 | import { AttributeScope, LatestTelemetry } from '@shared/models/telemetry/telemetry.models'; | 31 | import { AttributeScope, LatestTelemetry } from '@shared/models/telemetry/telemetry.models'; |
32 | import { NULL_UUID } from '@shared/models/id/has-uuid'; | 32 | import { NULL_UUID } from '@shared/models/id/has-uuid'; |
33 | -import { NgForm } from '@angular/forms'; | 33 | +import { FormGroup, NgForm } from '@angular/forms'; |
34 | import { PageLink } from '@shared/models/page/page-link'; | 34 | import { PageLink } from '@shared/models/page/page-link'; |
35 | 35 | ||
36 | @Directive() | 36 | @Directive() |
@@ -94,7 +94,7 @@ export abstract class EntityTabsComponent<T extends BaseData<HasId>, | @@ -94,7 +94,7 @@ export abstract class EntityTabsComponent<T extends BaseData<HasId>, | ||
94 | } | 94 | } |
95 | 95 | ||
96 | @Input() | 96 | @Input() |
97 | - detailsForm: NgForm; | 97 | + detailsForm: FormGroup; |
98 | 98 | ||
99 | private entityTabsSubject = new BehaviorSubject<Array<MatTab>>(null); | 99 | private entityTabsSubject = new BehaviorSubject<Array<MatTab>>(null); |
100 | 100 |
@@ -35,8 +35,6 @@ export abstract class EntityComponent<T extends BaseData<HasId>, | @@ -35,8 +35,6 @@ export abstract class EntityComponent<T extends BaseData<HasId>, | ||
35 | 35 | ||
36 | entityForm: FormGroup; | 36 | entityForm: FormGroup; |
37 | 37 | ||
38 | - @ViewChild('entityNgForm', {static: true}) entityNgForm: NgForm; | ||
39 | - | ||
40 | isEditValue: boolean; | 38 | isEditValue: boolean; |
41 | 39 | ||
42 | @Input() | 40 | @Input() |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<form #importForm="ngForm" [formGroup]="importFormGroup" (ngSubmit)="importFromJson()"> | 18 | +<form [formGroup]="importFormGroup" (ngSubmit)="importFromJson()"> |
19 | <mat-toolbar color="primary"> | 19 | <mat-toolbar color="primary"> |
20 | <h2 translate>{{ importTitle }}</h2> | 20 | <h2 translate>{{ importTitle }}</h2> |
21 | <span fxFlex></span> | 21 | <span fxFlex></span> |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<form #relationForm="ngForm" [formGroup]="relationFormGroup" (ngSubmit)="save()" style="min-width: 600px;"> | 18 | +<form [formGroup]="relationFormGroup" (ngSubmit)="save()" style="min-width: 600px;"> |
19 | <mat-toolbar fxLayout="row" color="primary"> | 19 | <mat-toolbar fxLayout="row" color="primary"> |
20 | <h2>{{ (isAdd ? 'relation.add' : 'relation.edit' ) | translate }}</h2> | 20 | <h2>{{ (isAdd ? 'relation.add' : 'relation.edit' ) | translate }}</h2> |
21 | <span fxFlex></span> | 21 | <span fxFlex></span> |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<form #widgetActionForm="ngForm" [formGroup]="widgetActionFormGroup" (ngSubmit)="save()" style="min-width: 480px;"> | 18 | +<form [formGroup]="widgetActionFormGroup" (ngSubmit)="save()" style="min-width: 480px;"> |
19 | <mat-toolbar color="primary"> | 19 | <mat-toolbar color="primary"> |
20 | <h2>{{ (isAdd ? 'widget-config.add-action' : 'widget-config.edit-action' ) | translate }}</h2> | 20 | <h2>{{ (isAdd ? 'widget-config.add-action' : 'widget-config.edit-action' ) | translate }}</h2> |
21 | <span fxFlex></span> | 21 | <span fxFlex></span> |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<form #dataKeyForm="ngForm" [formGroup]="dataKeyFormGroup" (ngSubmit)="save()" style="min-width: 480px;"> | 18 | +<form [formGroup]="dataKeyFormGroup" (ngSubmit)="save()" style="min-width: 480px;"> |
19 | <mat-toolbar color="primary"> | 19 | <mat-toolbar color="primary"> |
20 | <h2>{{ 'datakey.configuration' | translate }}</h2> | 20 | <h2>{{ 'datakey.configuration' | translate }}</h2> |
21 | <span fxFlex></span> | 21 | <span fxFlex></span> |
@@ -39,7 +39,7 @@ | @@ -39,7 +39,7 @@ | ||
39 | <div mat-dialog-actions fxLayoutAlign="end center"> | 39 | <div mat-dialog-actions fxLayoutAlign="end center"> |
40 | <button mat-raised-button color="primary" | 40 | <button mat-raised-button color="primary" |
41 | type="submit" | 41 | type="submit" |
42 | - [disabled]="(isLoading$ | async) || dataKeyForm.invalid || !dataKeyForm.dirty"> | 42 | + [disabled]="(isLoading$ | async) || dataKeyFormGroup.invalid || !dataKeyFormGroup.dirty"> |
43 | {{ 'action.save' | translate }} | 43 | {{ 'action.save' | translate }} |
44 | </button> | 44 | </button> |
45 | <button mat-button color="primary" | 45 | <button mat-button color="primary" |
@@ -16,7 +16,6 @@ | @@ -16,7 +16,6 @@ | ||
16 | 16 | ||
17 | --> | 17 | --> |
18 | <form #formContainer class="tb-multiple-input" | 18 | <form #formContainer class="tb-multiple-input" |
19 | - #multipleInputForm="ngForm" | ||
20 | [formGroup]="multipleInputFormGroup" | 19 | [formGroup]="multipleInputFormGroup" |
21 | tb-toast toastTarget="{{ toastTargetId }}" | 20 | tb-toast toastTarget="{{ toastTargetId }}" |
22 | (ngSubmit)="save()" novalidate autocomplete="off"> | 21 | (ngSubmit)="save()" novalidate autocomplete="off"> |
@@ -103,12 +102,12 @@ | @@ -103,12 +102,12 @@ | ||
103 | *ngIf="entityDetected && settings.showActionButtons"> | 102 | *ngIf="entityDetected && settings.showActionButtons"> |
104 | <button mat-button color="primary" type="button" | 103 | <button mat-button color="primary" type="button" |
105 | (click)="discardAll()" style="max-height: 50px; margin-right:20px;" | 104 | (click)="discardAll()" style="max-height: 50px; margin-right:20px;" |
106 | - [disabled]="!multipleInputForm.dirty"> | 105 | + [disabled]="!multipleInputFormGroup.dirty"> |
107 | {{ 'action.undo' | translate }} | 106 | {{ 'action.undo' | translate }} |
108 | </button> | 107 | </button> |
109 | <button mat-button mat-raised-button color="primary" type="submit" | 108 | <button mat-button mat-raised-button color="primary" type="submit" |
110 | style="max-height: 50px; margin-right:20px;" | 109 | style="max-height: 50px; margin-right:20px;" |
111 | - [disabled]="!multipleInputForm.dirty || multipleInputForm.invalid"> | 110 | + [disabled]="!multipleInputFormGroup.dirty || multipleInputFormGroup.invalid"> |
112 | {{ 'action.save' | translate }} | 111 | {{ 'action.save' | translate }} |
113 | </button> | 112 | </button> |
114 | </div> | 113 | </div> |
@@ -27,7 +27,7 @@ import { IWidgetSubscription } from '@core/api/widget-api.models'; | @@ -27,7 +27,7 @@ import { IWidgetSubscription } from '@core/api/widget-api.models'; | ||
27 | import { isDefined, isEqual, isUndefined } from '@core/utils'; | 27 | import { isDefined, isEqual, isUndefined } from '@core/utils'; |
28 | import { EntityType } from '@shared/models/entity-type.models'; | 28 | import { EntityType } from '@shared/models/entity-type.models'; |
29 | import * as _moment from 'moment'; | 29 | import * as _moment from 'moment'; |
30 | -import { FormBuilder, FormGroup, NgForm, ValidatorFn, Validators } from '@angular/forms'; | 30 | +import { FormBuilder, FormGroup, ValidatorFn, Validators } from '@angular/forms'; |
31 | import { RequestConfig } from '@core/http/http-utils'; | 31 | import { RequestConfig } from '@core/http/http-utils'; |
32 | import { AttributeService } from '@core/http/attribute.service'; | 32 | import { AttributeService } from '@core/http/attribute.service'; |
33 | import { AttributeData, AttributeScope, LatestTelemetry } from '@shared/models/telemetry/telemetry.models'; | 33 | import { AttributeData, AttributeScope, LatestTelemetry } from '@shared/models/telemetry/telemetry.models'; |
@@ -90,7 +90,6 @@ interface MultipleInputWidgetSource { | @@ -90,7 +90,6 @@ interface MultipleInputWidgetSource { | ||
90 | export class MultipleInputWidgetComponent extends PageComponent implements OnInit, OnDestroy { | 90 | export class MultipleInputWidgetComponent extends PageComponent implements OnInit, OnDestroy { |
91 | 91 | ||
92 | @ViewChild('formContainer', {static: true}) formContainerRef: ElementRef<HTMLElement>; | 92 | @ViewChild('formContainer', {static: true}) formContainerRef: ElementRef<HTMLElement>; |
93 | - @ViewChild('multipleInputForm', {static: true}) multipleInputForm: NgForm; | ||
94 | 93 | ||
95 | @Input() | 94 | @Input() |
96 | ctx: WidgetContext; | 95 | ctx: WidgetContext; |
@@ -453,7 +452,7 @@ export class MultipleInputWidgetComponent extends PageComponent implements OnIni | @@ -453,7 +452,7 @@ export class MultipleInputWidgetComponent extends PageComponent implements OnIni | ||
453 | if (tasks.length) { | 452 | if (tasks.length) { |
454 | forkJoin(tasks).subscribe( | 453 | forkJoin(tasks).subscribe( |
455 | () => { | 454 | () => { |
456 | - this.multipleInputForm.resetForm(); | 455 | + this.multipleInputFormGroup.reset(undefined, {emitEvent: false}); |
457 | this.multipleInputFormGroup.markAsPristine(); | 456 | this.multipleInputFormGroup.markAsPristine(); |
458 | if (this.settings.showResultMessage) { | 457 | if (this.settings.showResultMessage) { |
459 | this.ctx.showSuccessToast(this.translate.instant('widgets.input-widgets.update-successful'), | 458 | this.ctx.showSuccessToast(this.translate.instant('widgets.input-widgets.update-successful'), |
@@ -467,13 +466,13 @@ export class MultipleInputWidgetComponent extends PageComponent implements OnIni | @@ -467,13 +466,13 @@ export class MultipleInputWidgetComponent extends PageComponent implements OnIni | ||
467 | } | 466 | } |
468 | }); | 467 | }); |
469 | } else { | 468 | } else { |
470 | - this.multipleInputForm.resetForm(); | 469 | + this.multipleInputFormGroup.reset(undefined, {emitEvent: false}); |
471 | this.multipleInputFormGroup.markAsPristine(); | 470 | this.multipleInputFormGroup.markAsPristine(); |
472 | } | 471 | } |
473 | } | 472 | } |
474 | 473 | ||
475 | public discardAll() { | 474 | public discardAll() { |
476 | - this.multipleInputForm.resetForm(); | 475 | + this.multipleInputFormGroup.reset(undefined, {emitEvent: false}); |
477 | this.sources.forEach((source) => { | 476 | this.sources.forEach((source) => { |
478 | for (const key of this.visibleKeys(source)) { | 477 | for (const key of this.visibleKeys(source)) { |
479 | this.multipleInputFormGroup.get(key.formId).patchValue(key.value, {emitEvent: false}); | 478 | this.multipleInputFormGroup.get(key.formId).patchValue(key.value, {emitEvent: false}); |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<form #addEntitiesToCustomerForm="ngForm" [formGroup]="addEntitiesToCustomerFormGroup" (ngSubmit)="assign()"> | 18 | +<form [formGroup]="addEntitiesToCustomerFormGroup" (ngSubmit)="assign()"> |
19 | <mat-toolbar color="primary"> | 19 | <mat-toolbar color="primary"> |
20 | <h2>{{ assignToCustomerTitle | translate }}</h2> | 20 | <h2>{{ assignToCustomerTitle | translate }}</h2> |
21 | <span fxFlex></span> | 21 | <span fxFlex></span> |
@@ -42,8 +42,8 @@ | @@ -42,8 +42,8 @@ | ||
42 | <div mat-dialog-actions fxLayoutAlign="end center"> | 42 | <div mat-dialog-actions fxLayoutAlign="end center"> |
43 | <button mat-raised-button color="primary" | 43 | <button mat-raised-button color="primary" |
44 | type="submit" | 44 | type="submit" |
45 | - [disabled]="(isLoading$ | async) || addEntitiesToCustomerForm.invalid | ||
46 | - || !addEntitiesToCustomerForm.dirty"> | 45 | + [disabled]="(isLoading$ | async) || addEntitiesToCustomerFormGroup.invalid |
46 | + || !addEntitiesToCustomerFormGroup.dirty"> | ||
47 | {{ 'action.assign' | translate }} | 47 | {{ 'action.assign' | translate }} |
48 | </button> | 48 | </button> |
49 | <button mat-button color="primary" | 49 | <button mat-button color="primary" |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<form #assignToCustomerForm="ngForm" [formGroup]="assignToCustomerFormGroup" (ngSubmit)="assign()"> | 18 | +<form [formGroup]="assignToCustomerFormGroup" (ngSubmit)="assign()"> |
19 | <mat-toolbar color="primary"> | 19 | <mat-toolbar color="primary"> |
20 | <h2>{{ assignToCustomerTitle | translate }}</h2> | 20 | <h2>{{ assignToCustomerTitle | translate }}</h2> |
21 | <span fxFlex></span> | 21 | <span fxFlex></span> |
@@ -41,8 +41,8 @@ | @@ -41,8 +41,8 @@ | ||
41 | <div mat-dialog-actions fxLayout="row" fxLayoutAlign="end center"> | 41 | <div mat-dialog-actions fxLayout="row" fxLayoutAlign="end center"> |
42 | <button mat-raised-button color="primary" | 42 | <button mat-raised-button color="primary" |
43 | type="submit" | 43 | type="submit" |
44 | - [disabled]="(isLoading$ | async) || assignToCustomerForm.invalid | ||
45 | - || !assignToCustomerForm.dirty"> | 44 | + [disabled]="(isLoading$ | async) || assignToCustomerFormGroup.invalid |
45 | + || !assignToCustomerFormGroup.dirty"> | ||
46 | {{ 'action.assign' | translate }} | 46 | {{ 'action.assign' | translate }} |
47 | </button> | 47 | </button> |
48 | <button mat-button color="primary" | 48 | <button mat-button color="primary" |
@@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
26 | </mat-progress-bar> | 26 | </mat-progress-bar> |
27 | <div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div> | 27 | <div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div> |
28 | <mat-card-content style="padding-top: 16px;"> | 28 | <mat-card-content style="padding-top: 16px;"> |
29 | - <form #generalSettingsForm="ngForm" [formGroup]="generalSettings" (ngSubmit)="save()"> | 29 | + <form [formGroup]="generalSettings" (ngSubmit)="save()"> |
30 | <fieldset [disabled]="isLoading$ | async"> | 30 | <fieldset [disabled]="isLoading$ | async"> |
31 | <mat-form-field class="mat-block"> | 31 | <mat-form-field class="mat-block"> |
32 | <mat-label translate>admin.base-url</mat-label> | 32 | <mat-label translate>admin.base-url</mat-label> |
@@ -36,7 +36,7 @@ | @@ -36,7 +36,7 @@ | ||
36 | </mat-error> | 36 | </mat-error> |
37 | </mat-form-field> | 37 | </mat-form-field> |
38 | <div fxLayout="row" fxLayoutAlign="end center" style="width: 100%;" class="layout-wrap"> | 38 | <div fxLayout="row" fxLayoutAlign="end center" style="width: 100%;" class="layout-wrap"> |
39 | - <button mat-button mat-raised-button color="primary" [disabled]="(isLoading$ | async) || generalSettingsForm.invalid || !generalSettingsForm.dirty" | 39 | + <button mat-button mat-raised-button color="primary" [disabled]="(isLoading$ | async) || generalSettings.invalid || !generalSettings.dirty" |
40 | type="submit">{{'action.save' | translate}} | 40 | type="submit">{{'action.save' | translate}} |
41 | </button> | 41 | </button> |
42 | </div> | 42 | </div> |
@@ -28,7 +28,7 @@ | @@ -28,7 +28,7 @@ | ||
28 | </mat-progress-bar> | 28 | </mat-progress-bar> |
29 | <div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div> | 29 | <div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div> |
30 | <mat-card-content style="padding-top: 16px;"> | 30 | <mat-card-content style="padding-top: 16px;"> |
31 | - <form #mailSettingsForm="ngForm" [formGroup]="mailSettings" (ngSubmit)="save()"> | 31 | + <form [formGroup]="mailSettings" (ngSubmit)="save()"> |
32 | <fieldset [disabled]="isLoading$ | async"> | 32 | <fieldset [disabled]="isLoading$ | async"> |
33 | <mat-form-field class="mat-block"> | 33 | <mat-form-field class="mat-block"> |
34 | <mat-label translate>admin.mail-from</mat-label> | 34 | <mat-label translate>admin.mail-from</mat-label> |
@@ -97,10 +97,10 @@ | @@ -97,10 +97,10 @@ | ||
97 | </mat-form-field> | 97 | </mat-form-field> |
98 | <div fxLayout="row" fxLayoutAlign="end center" fxLayout.xs="column" fxLayoutAlign.xs="end" fxLayoutGap="16px"> | 98 | <div fxLayout="row" fxLayoutAlign="end center" fxLayout.xs="column" fxLayoutAlign.xs="end" fxLayoutGap="16px"> |
99 | <button mat-raised-button type="button" | 99 | <button mat-raised-button type="button" |
100 | - [disabled]="(isLoading$ | async) || mailSettingsForm.invalid" (click)="sendTestMail()"> | 100 | + [disabled]="(isLoading$ | async) || mailSettings.invalid" (click)="sendTestMail()"> |
101 | {{'admin.send-test-mail' | translate}} | 101 | {{'admin.send-test-mail' | translate}} |
102 | </button> | 102 | </button> |
103 | - <button mat-raised-button color="primary" [disabled]="(isLoading$ | async) || mailSettingsForm.invalid || !mailSettingsForm.dirty" | 103 | + <button mat-raised-button color="primary" [disabled]="(isLoading$ | async) || mailSettings.invalid || !mailSettings.dirty" |
104 | type="submit">{{'action.save' | translate}} | 104 | type="submit">{{'action.save' | translate}} |
105 | </button> | 105 | </button> |
106 | </div> | 106 | </div> |
@@ -28,7 +28,7 @@ | @@ -28,7 +28,7 @@ | ||
28 | </mat-progress-bar> | 28 | </mat-progress-bar> |
29 | <div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div> | 29 | <div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div> |
30 | <mat-card-content style="padding-top: 16px;"> | 30 | <mat-card-content style="padding-top: 16px;"> |
31 | - <form #securitySettingsForm="ngForm" [formGroup]="securitySettingsFormGroup" (ngSubmit)="save()"> | 31 | + <form [formGroup]="securitySettingsFormGroup" (ngSubmit)="save()"> |
32 | <fieldset [disabled]="isLoading$ | async"> | 32 | <fieldset [disabled]="isLoading$ | async"> |
33 | <mat-expansion-panel [expanded]="true"> | 33 | <mat-expansion-panel [expanded]="true"> |
34 | <mat-expansion-panel-header> | 34 | <mat-expansion-panel-header> |
@@ -140,7 +140,7 @@ | @@ -140,7 +140,7 @@ | ||
140 | </section> | 140 | </section> |
141 | </mat-expansion-panel> | 141 | </mat-expansion-panel> |
142 | <div fxLayout="row" fxLayoutAlign="end center" style="width: 100%;" class="layout-wrap"> | 142 | <div fxLayout="row" fxLayoutAlign="end center" style="width: 100%;" class="layout-wrap"> |
143 | - <button mat-button mat-raised-button color="primary" [disabled]="(isLoading$ | async) || securitySettingsForm.invalid || !securitySettingsForm.dirty" | 143 | + <button mat-button mat-raised-button color="primary" [disabled]="(isLoading$ | async) || securitySettingsFormGroup.invalid || !securitySettingsFormGroup.dirty" |
144 | type="submit">{{'action.save' | translate}} | 144 | type="submit">{{'action.save' | translate}} |
145 | </button> | 145 | </button> |
146 | </div> | 146 | </div> |
@@ -62,7 +62,7 @@ | @@ -62,7 +62,7 @@ | ||
62 | [fxShow]="!isEdit && entity?.customerIsPublic && (assetScope === 'customer' || assetScope === 'tenant')"> | 62 | [fxShow]="!isEdit && entity?.customerIsPublic && (assetScope === 'customer' || assetScope === 'tenant')"> |
63 | {{ 'asset.asset-public' | translate }} | 63 | {{ 'asset.asset-public' | translate }} |
64 | </div> | 64 | </div> |
65 | - <form #entityNgForm="ngForm" [formGroup]="entityForm"> | 65 | + <form [formGroup]="entityForm"> |
66 | <fieldset [disabled]="(isLoading$ | async) || !isEdit"> | 66 | <fieldset [disabled]="(isLoading$ | async) || !isEdit"> |
67 | <mat-form-field class="mat-block"> | 67 | <mat-form-field class="mat-block"> |
68 | <mat-label translate>asset.name</mat-label> | 68 | <mat-label translate>asset.name</mat-label> |
@@ -58,7 +58,7 @@ | @@ -58,7 +58,7 @@ | ||
58 | </div> | 58 | </div> |
59 | </div> | 59 | </div> |
60 | <div class="mat-padding" fxLayout="column"> | 60 | <div class="mat-padding" fxLayout="column"> |
61 | - <form #entityNgForm="ngForm" [formGroup]="entityForm"> | 61 | + <form [formGroup]="entityForm"> |
62 | <fieldset [fxShow]="!isPublic" [disabled]="(isLoading$ | async) || !isEdit"> | 62 | <fieldset [fxShow]="!isPublic" [disabled]="(isLoading$ | async) || !isEdit"> |
63 | <mat-form-field class="mat-block"> | 63 | <mat-form-field class="mat-block"> |
64 | <mat-label translate>customer.title</mat-label> | 64 | <mat-label translate>customer.title</mat-label> |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<form #widgetForm="ngForm" [formGroup]="widgetFormGroup" (ngSubmit)="add()" style="width: 900px;"> | 18 | +<form [formGroup]="widgetFormGroup" (ngSubmit)="add()" style="width: 900px;"> |
19 | <mat-toolbar color="primary"> | 19 | <mat-toolbar color="primary"> |
20 | <h2 translate>widget.add</h2> | 20 | <h2 translate>widget.add</h2> |
21 | <span fxFlex></span> | 21 | <span fxFlex></span> |
@@ -90,7 +90,7 @@ | @@ -90,7 +90,7 @@ | ||
90 | </button> | 90 | </button> |
91 | </div> | 91 | </div> |
92 | </div> | 92 | </div> |
93 | - <form #entityNgForm="ngForm" [formGroup]="entityForm"> | 93 | + <form [formGroup]="entityForm"> |
94 | <fieldset [disabled]="(isLoading$ | async) || !isEdit"> | 94 | <fieldset [disabled]="(isLoading$ | async) || !isEdit"> |
95 | <mat-form-field class="mat-block"> | 95 | <mat-form-field class="mat-block"> |
96 | <mat-label translate>dashboard.title</mat-label> | 96 | <mat-label translate>dashboard.title</mat-label> |
@@ -216,7 +216,7 @@ | @@ -216,7 +216,7 @@ | ||
216 | (closeDetails)="onEditWidgetClosed()" | 216 | (closeDetails)="onEditWidgetClosed()" |
217 | (toggleDetailsEditMode)="onRevertWidgetEdit()" | 217 | (toggleDetailsEditMode)="onRevertWidgetEdit()" |
218 | (applyDetails)="saveWidget()" | 218 | (applyDetails)="saveWidget()" |
219 | - [theForm]="tbEditWidget.widgetForm"> | 219 | + [theForm]="tbEditWidget.widgetFormGroup"> |
220 | <div class="details-buttons"> | 220 | <div class="details-buttons"> |
221 | <div [tb-help]="helpLinkIdForWidgetType()"></div> | 221 | <div [tb-help]="helpLinkIdForWidgetType()"></div> |
222 | </div> | 222 | </div> |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<form #settingsForm="ngForm" (ngSubmit)="save()"> | 18 | +<form (ngSubmit)="save()"> |
19 | <mat-toolbar color="primary"> | 19 | <mat-toolbar color="primary"> |
20 | <h2 translate>{{settings ? 'dashboard.settings' : 'layout.settings'}}</h2> | 20 | <h2 translate>{{settings ? 'dashboard.settings' : 'layout.settings'}}</h2> |
21 | <span fxFlex></span> | 21 | <span fxFlex></span> |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<form #widgetForm="ngForm" [formGroup]="widgetFormGroup"> | 18 | +<form [formGroup]="widgetFormGroup"> |
19 | <fieldset [disabled]="isLoading$ | async"> | 19 | <fieldset [disabled]="isLoading$ | async"> |
20 | <tb-widget-config | 20 | <tb-widget-config |
21 | [aliasController]="aliasController" | 21 | [aliasController]="aliasController" |
@@ -49,8 +49,6 @@ export class EditWidgetComponent extends PageComponent implements OnInit, OnChan | @@ -49,8 +49,6 @@ export class EditWidgetComponent extends PageComponent implements OnInit, OnChan | ||
49 | @Input() | 49 | @Input() |
50 | widgetLayout: WidgetLayout; | 50 | widgetLayout: WidgetLayout; |
51 | 51 | ||
52 | - @ViewChild('widgetForm', {static: true}) widgetForm: NgForm; | ||
53 | - | ||
54 | widgetFormGroup: FormGroup; | 52 | widgetFormGroup: FormGroup; |
55 | 53 | ||
56 | widgetConfig: WidgetConfigComponentData; | 54 | widgetConfig: WidgetConfigComponentData; |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<form #widgetForm="ngForm" [formGroup]="layoutsFormGroup" (ngSubmit)="save()"> | 18 | +<form [formGroup]="layoutsFormGroup" (ngSubmit)="save()"> |
19 | <mat-toolbar color="primary"> | 19 | <mat-toolbar color="primary"> |
20 | <h2 translate>layout.manage</h2> | 20 | <h2 translate>layout.manage</h2> |
21 | <span fxFlex></span> | 21 | <span fxFlex></span> |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<form #dashboardCustomersForm="ngForm" style="width: 600px;" | 18 | +<form style="width: 600px;" |
19 | [formGroup]="dashboardCustomersFormGroup" (ngSubmit)="submit()"> | 19 | [formGroup]="dashboardCustomersFormGroup" (ngSubmit)="submit()"> |
20 | <mat-toolbar fxLayout="row" color="primary"> | 20 | <mat-toolbar fxLayout="row" color="primary"> |
21 | <h2>{{ titleText | translate }}</h2> | 21 | <h2>{{ titleText | translate }}</h2> |
@@ -43,8 +43,8 @@ | @@ -43,8 +43,8 @@ | ||
43 | <span fxFlex></span> | 43 | <span fxFlex></span> |
44 | <button mat-button mat-raised-button color="primary" | 44 | <button mat-button mat-raised-button color="primary" |
45 | type="submit" | 45 | type="submit" |
46 | - [disabled]="(isLoading$ | async) || dashboardCustomersForm.invalid | ||
47 | - || !dashboardCustomersForm.dirty"> | 46 | + [disabled]="(isLoading$ | async) || dashboardCustomersFormGroup.invalid |
47 | + || !dashboardCustomersFormGroup.dirty"> | ||
48 | {{ actionName | translate }} | 48 | {{ actionName | translate }} |
49 | </button> | 49 | </button> |
50 | <button mat-button color="primary" | 50 | <button mat-button color="primary" |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<form #stateForm="ngForm" [formGroup]="stateFormGroup" (ngSubmit)="save()" style="min-width: 480px;"> | 18 | +<form [formGroup]="stateFormGroup" (ngSubmit)="save()" style="min-width: 480px;"> |
19 | <mat-toolbar color="primary"> | 19 | <mat-toolbar color="primary"> |
20 | <h2 translate>{{ isAdd ? 'dashboard.add-state' : 'dashboard.edit-state' }}</h2> | 20 | <h2 translate>{{ isAdd ? 'dashboard.add-state' : 'dashboard.edit-state' }}</h2> |
21 | <span fxFlex></span> | 21 | <span fxFlex></span> |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<form #statesForm="ngForm" [formGroup]="statesFormGroup" (ngSubmit)="save()" style="min-width: 480px;"> | 18 | +<form [formGroup]="statesFormGroup" (ngSubmit)="save()" style="min-width: 480px;"> |
19 | <mat-toolbar color="primary"> | 19 | <mat-toolbar color="primary"> |
20 | <h2 translate>dashboard.manage-states</h2> | 20 | <h2 translate>dashboard.manage-states</h2> |
21 | <span fxFlex></span> | 21 | <span fxFlex></span> |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<form #deviceCredentialsForm="ngForm" [formGroup]="deviceCredentialsFormGroup" (ngSubmit)="save()" style="min-width: 350px;"> | 18 | +<form [formGroup]="deviceCredentialsFormGroup" (ngSubmit)="save()" style="min-width: 350px;"> |
19 | <mat-toolbar color="primary"> | 19 | <mat-toolbar color="primary"> |
20 | <h2 translate>device.device-credentials</h2> | 20 | <h2 translate>device.device-credentials</h2> |
21 | <span fxFlex></span> | 21 | <span fxFlex></span> |
@@ -63,8 +63,8 @@ | @@ -63,8 +63,8 @@ | ||
63 | <div mat-dialog-actions fxLayoutAlign="end center"> | 63 | <div mat-dialog-actions fxLayoutAlign="end center"> |
64 | <button *ngIf="!isReadOnly" mat-raised-button color="primary" | 64 | <button *ngIf="!isReadOnly" mat-raised-button color="primary" |
65 | type="submit" | 65 | type="submit" |
66 | - [disabled]="(isLoading$ | async) || deviceCredentialsForm.invalid | ||
67 | - || !deviceCredentialsForm.dirty"> | 66 | + [disabled]="(isLoading$ | async) || deviceCredentialsFormGroup.invalid |
67 | + || !deviceCredentialsFormGroup.dirty"> | ||
68 | {{ 'action.save' | translate }} | 68 | {{ 'action.save' | translate }} |
69 | </button> | 69 | </button> |
70 | <button mat-button color="primary" | 70 | <button mat-button color="primary" |
@@ -74,7 +74,7 @@ | @@ -74,7 +74,7 @@ | ||
74 | [fxShow]="!isEdit && entity?.customerIsPublic && (deviceScope === 'customer' || deviceScope === 'tenant')"> | 74 | [fxShow]="!isEdit && entity?.customerIsPublic && (deviceScope === 'customer' || deviceScope === 'tenant')"> |
75 | {{ 'device.device-public' | translate }} | 75 | {{ 'device.device-public' | translate }} |
76 | </div> | 76 | </div> |
77 | - <form #entityNgForm="ngForm" [formGroup]="entityForm"> | 77 | + <form [formGroup]="entityForm"> |
78 | <fieldset [disabled]="(isLoading$ | async) || !isEdit"> | 78 | <fieldset [disabled]="(isLoading$ | async) || !isEdit"> |
79 | <mat-form-field class="mat-block"> | 79 | <mat-form-field class="mat-block"> |
80 | <mat-label translate>device.name</mat-label> | 80 | <mat-label translate>device.name</mat-label> |
@@ -62,7 +62,7 @@ | @@ -62,7 +62,7 @@ | ||
62 | [fxShow]="!isEdit && entity?.customerIsPublic && (entityViewScope === 'customer' || entityViewScope === 'tenant')"> | 62 | [fxShow]="!isEdit && entity?.customerIsPublic && (entityViewScope === 'customer' || entityViewScope === 'tenant')"> |
63 | {{ 'entity-view.entity-view-public' | translate }} | 63 | {{ 'entity-view.entity-view-public' | translate }} |
64 | </div> | 64 | </div> |
65 | - <form #entityNgForm="ngForm" [formGroup]="entityForm"> | 65 | + <form [formGroup]="entityForm"> |
66 | <fieldset [disabled]="(isLoading$ | async) || !isEdit"> | 66 | <fieldset [disabled]="(isLoading$ | async) || !isEdit"> |
67 | <mat-form-field class="mat-block"> | 67 | <mat-form-field class="mat-block"> |
68 | <mat-label translate>entity-view.name</mat-label> | 68 | <mat-label translate>entity-view.name</mat-label> |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<form #changePasswordForm="ngForm" [formGroup]="changePassword" (ngSubmit)="onChangePassword()"> | 18 | +<form [formGroup]="changePassword" (ngSubmit)="onChangePassword()"> |
19 | <mat-toolbar fxLayout="row" color="primary"> | 19 | <mat-toolbar fxLayout="row" color="primary"> |
20 | <h2 translate>profile.change-password</h2> | 20 | <h2 translate>profile.change-password</h2> |
21 | <span fxFlex></span> | 21 | <span fxFlex></span> |
@@ -48,7 +48,7 @@ | @@ -48,7 +48,7 @@ | ||
48 | <div mat-dialog-actions fxLayout="row" fxLayoutAlign="end center"> | 48 | <div mat-dialog-actions fxLayout="row" fxLayoutAlign="end center"> |
49 | <button mat-raised-button color="primary" | 49 | <button mat-raised-button color="primary" |
50 | type="submit" | 50 | type="submit" |
51 | - [disabled]="(isLoading$ | async) || changePasswordForm.invalid"> | 51 | + [disabled]="(isLoading$ | async) || changePassword.invalid"> |
52 | {{ 'profile.change-password' | translate }} | 52 | {{ 'profile.change-password' | translate }} |
53 | </button> | 53 | </button> |
54 | <button mat-button color="primary" | 54 | <button mat-button color="primary" |
@@ -35,7 +35,7 @@ | @@ -35,7 +35,7 @@ | ||
35 | </mat-progress-bar> | 35 | </mat-progress-bar> |
36 | <div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div> | 36 | <div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div> |
37 | <mat-card-content style="padding-top: 16px;"> | 37 | <mat-card-content style="padding-top: 16px;"> |
38 | - <form #profileForm="ngForm" [formGroup]="profile" (ngSubmit)="save()"> | 38 | + <form [formGroup]="profile" (ngSubmit)="save()"> |
39 | <fieldset [disabled]="isLoading$ | async"> | 39 | <fieldset [disabled]="isLoading$ | async"> |
40 | <mat-form-field class="mat-block"> | 40 | <mat-form-field class="mat-block"> |
41 | <mat-label translate>user.email</mat-label> | 41 | <mat-label translate>user.email</mat-label> |
@@ -74,7 +74,7 @@ | @@ -74,7 +74,7 @@ | ||
74 | <span fxFlex></span> | 74 | <span fxFlex></span> |
75 | <button mat-button mat-raised-button color="primary" | 75 | <button mat-button mat-raised-button color="primary" |
76 | type="submit" | 76 | type="submit" |
77 | - [disabled]="(isLoading$ | async) || profileForm.invalid || !profileForm.dirty"> | 77 | + [disabled]="(isLoading$ | async) || profile.invalid || !profile.dirty"> |
78 | {{ 'action.save' | translate }} | 78 | {{ 'action.save' | translate }} |
79 | </button> | 79 | </button> |
80 | </div> | 80 | </div> |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<form #ruleNodeForm="ngForm" (ngSubmit)="add()" style="min-width: 650px;"> | 18 | +<form (ngSubmit)="add()" style="min-width: 650px;"> |
19 | <mat-toolbar fxLayout="row" color="primary"> | 19 | <mat-toolbar fxLayout="row" color="primary"> |
20 | <h2 translate>rulenode.add</h2> | 20 | <h2 translate>rulenode.add</h2> |
21 | <span fxFlex></span> | 21 | <span fxFlex></span> |
@@ -42,7 +42,7 @@ | @@ -42,7 +42,7 @@ | ||
42 | <span fxFlex></span> | 42 | <span fxFlex></span> |
43 | <button mat-button mat-raised-button color="primary" | 43 | <button mat-button mat-raised-button color="primary" |
44 | type="submit" | 44 | type="submit" |
45 | - [disabled]="(isLoading$ | async) || tbRuleNode.ruleNodeForm.invalid || !tbRuleNode.ruleNodeForm.dirty"> | 45 | + [disabled]="(isLoading$ | async) || tbRuleNode.ruleNodeFormGroup.invalid || !tbRuleNode.ruleNodeFormGroup.dirty"> |
46 | {{ 'action.add' | translate }} | 46 | {{ 'action.add' | translate }} |
47 | </button> | 47 | </button> |
48 | <button mat-button color="primary" | 48 | <button mat-button color="primary" |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<form #ruleNodeLinkForm="ngForm" [formGroup]="ruleNodeLinkFormGroup" (ngSubmit)="add()" style="width: 900px;"> | 18 | +<form [formGroup]="ruleNodeLinkFormGroup" (ngSubmit)="add()" style="width: 900px;"> |
19 | <mat-toolbar fxLayout="row" color="primary"> | 19 | <mat-toolbar fxLayout="row" color="primary"> |
20 | <h2 translate>rulenode.add-link</h2> | 20 | <h2 translate>rulenode.add-link</h2> |
21 | <span fxFlex></span> | 21 | <span fxFlex></span> |
@@ -16,7 +16,7 @@ | @@ -16,7 +16,7 @@ | ||
16 | 16 | ||
17 | --> | 17 | --> |
18 | <div class="mat-padding" fxLayout="column"> | 18 | <div class="mat-padding" fxLayout="column"> |
19 | - <form #ruleNodeForm="ngForm" [formGroup]="ruleNodeFormGroup"> | 19 | + <form [formGroup]="ruleNodeFormGroup"> |
20 | <fieldset [disabled]="(isLoading$ | async) || !isEdit || isReadOnly"> | 20 | <fieldset [disabled]="(isLoading$ | async) || !isEdit || isReadOnly"> |
21 | <section *ngIf="ruleNode.component.type !== ruleNodeType.RULE_CHAIN"> | 21 | <section *ngIf="ruleNode.component.type !== ruleNodeType.RULE_CHAIN"> |
22 | <section fxLayout="column" fxLayout.gt-sm="row"> | 22 | <section fxLayout="column" fxLayout.gt-sm="row"> |
@@ -32,8 +32,6 @@ import { RuleNodeConfigComponent } from './rule-node-config.component'; | @@ -32,8 +32,6 @@ import { RuleNodeConfigComponent } from './rule-node-config.component'; | ||
32 | }) | 32 | }) |
33 | export class RuleNodeDetailsComponent extends PageComponent implements OnInit, OnChanges { | 33 | export class RuleNodeDetailsComponent extends PageComponent implements OnInit, OnChanges { |
34 | 34 | ||
35 | - @ViewChild('ruleNodeForm', {static: true}) ruleNodeForm: NgForm; | ||
36 | - | ||
37 | @ViewChild('ruleNodeConfigComponent') ruleNodeConfigComponent: RuleNodeConfigComponent; | 35 | @ViewChild('ruleNodeConfigComponent') ruleNodeConfigComponent: RuleNodeConfigComponent; |
38 | 36 | ||
39 | @Input() | 37 | @Input() |
@@ -16,7 +16,7 @@ | @@ -16,7 +16,7 @@ | ||
16 | 16 | ||
17 | --> | 17 | --> |
18 | <div class="mat-padding" fxLayout="column"> | 18 | <div class="mat-padding" fxLayout="column"> |
19 | - <form #ruleNodeLinkForm="ngForm" [formGroup]="ruleNodeLinkFormGroup"> | 19 | + <form [formGroup]="ruleNodeLinkFormGroup"> |
20 | <tb-link-labels | 20 | <tb-link-labels |
21 | required | 21 | required |
22 | formControlName="labels" | 22 | formControlName="labels" |
@@ -33,8 +33,6 @@ import { TranslateService } from '@ngx-translate/core'; | @@ -33,8 +33,6 @@ import { TranslateService } from '@ngx-translate/core'; | ||
33 | }) | 33 | }) |
34 | export class RuleNodeLinkComponent implements ControlValueAccessor, OnInit { | 34 | export class RuleNodeLinkComponent implements ControlValueAccessor, OnInit { |
35 | 35 | ||
36 | - @ViewChild('ruleNodeLinkForm', {static: true}) ruleNodeLinkForm: NgForm; | ||
37 | - | ||
38 | private requiredValue: boolean; | 36 | private requiredValue: boolean; |
39 | get required(): boolean { | 37 | get required(): boolean { |
40 | return this.requiredValue; | 38 | return this.requiredValue; |
@@ -107,7 +107,7 @@ | @@ -107,7 +107,7 @@ | ||
107 | (closeDetails)="onEditRuleNodeClosed()" | 107 | (closeDetails)="onEditRuleNodeClosed()" |
108 | (toggleDetailsEditMode)="onRevertRuleNodeEdit()" | 108 | (toggleDetailsEditMode)="onRevertRuleNodeEdit()" |
109 | (applyDetails)="saveRuleNode()" | 109 | (applyDetails)="saveRuleNode()" |
110 | - [theForm]="tbRuleNode.ruleNodeForm"> | 110 | + [theForm]="tbRuleNode.ruleNodeFormGroup"> |
111 | <div class="details-buttons"> | 111 | <div class="details-buttons"> |
112 | <div [tb-help]="helpLinkIdForRuleNodeType()"></div> | 112 | <div [tb-help]="helpLinkIdForRuleNodeType()"></div> |
113 | </div> | 113 | </div> |
@@ -148,7 +148,7 @@ | @@ -148,7 +148,7 @@ | ||
148 | (closeDetails)="onEditRuleNodeLinkClosed()" | 148 | (closeDetails)="onEditRuleNodeLinkClosed()" |
149 | (toggleDetailsEditMode)="onRevertRuleNodeLinkEdit()" | 149 | (toggleDetailsEditMode)="onRevertRuleNodeLinkEdit()" |
150 | (applyDetails)="saveRuleNodeLink()" | 150 | (applyDetails)="saveRuleNodeLink()" |
151 | - [theForm]="tbRuleNodeLink.ruleNodeLinkForm"> | 151 | + [theForm]="tbRuleNodeLink.ruleNodeLinkFormGroup"> |
152 | <div class="details-buttons"> | 152 | <div class="details-buttons"> |
153 | <div [tb-help]="'ruleEngine'"></div> | 153 | <div [tb-help]="'ruleEngine'"></div> |
154 | </div> | 154 | </div> |
@@ -52,7 +52,7 @@ | @@ -52,7 +52,7 @@ | ||
52 | </div> | 52 | </div> |
53 | </div> | 53 | </div> |
54 | <div class="mat-padding" fxLayout="column"> | 54 | <div class="mat-padding" fxLayout="column"> |
55 | - <form #entityNgForm="ngForm" [formGroup]="entityForm"> | 55 | + <form [formGroup]="entityForm"> |
56 | <fieldset [disabled]="(isLoading$ | async) || !isEdit"> | 56 | <fieldset [disabled]="(isLoading$ | async) || !isEdit"> |
57 | <mat-form-field class="mat-block"> | 57 | <mat-form-field class="mat-block"> |
58 | <mat-label translate>rulechain.name</mat-label> | 58 | <mat-label translate>rulechain.name</mat-label> |
@@ -40,7 +40,7 @@ | @@ -40,7 +40,7 @@ | ||
40 | </div> | 40 | </div> |
41 | </div> | 41 | </div> |
42 | <div class="mat-padding" fxLayout="column"> | 42 | <div class="mat-padding" fxLayout="column"> |
43 | - <form #entityNgForm="ngForm" [formGroup]="entityForm"> | 43 | + <form [formGroup]="entityForm"> |
44 | <fieldset [disabled]="(isLoading$ | async) || !isEdit"> | 44 | <fieldset [disabled]="(isLoading$ | async) || !isEdit"> |
45 | <mat-form-field class="mat-block"> | 45 | <mat-form-field class="mat-block"> |
46 | <mat-label translate>tenant.title</mat-label> | 46 | <mat-label translate>tenant.title</mat-label> |
@@ -18,7 +18,7 @@ import { Component, Inject, OnInit, ViewChild } from '@angular/core'; | @@ -18,7 +18,7 @@ import { Component, Inject, OnInit, ViewChild } from '@angular/core'; | ||
18 | import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog'; | 18 | import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog'; |
19 | import { Store } from '@ngrx/store'; | 19 | import { Store } from '@ngrx/store'; |
20 | import { AppState } from '@core/core.state'; | 20 | import { AppState } from '@core/core.state'; |
21 | -import { NgForm } from '@angular/forms'; | 21 | +import { FormGroup, NgForm } from '@angular/forms'; |
22 | import { UserComponent } from '@modules/home/pages/user/user.component'; | 22 | import { UserComponent } from '@modules/home/pages/user/user.component'; |
23 | import { Authority } from '@shared/models/authority.enum'; | 23 | import { Authority } from '@shared/models/authority.enum'; |
24 | import { ActivationMethod, activationMethodTranslations, User } from '@shared/models/user.model'; | 24 | import { ActivationMethod, activationMethodTranslations, User } from '@shared/models/user.model'; |
@@ -46,7 +46,7 @@ export interface AddUserDialogData { | @@ -46,7 +46,7 @@ export interface AddUserDialogData { | ||
46 | }) | 46 | }) |
47 | export class AddUserDialogComponent extends DialogComponent<AddUserDialogComponent, User> implements OnInit { | 47 | export class AddUserDialogComponent extends DialogComponent<AddUserDialogComponent, User> implements OnInit { |
48 | 48 | ||
49 | - detailsForm: NgForm; | 49 | + detailsForm: FormGroup; |
50 | user: User; | 50 | user: User; |
51 | 51 | ||
52 | activationMethods = Object.keys(ActivationMethod); | 52 | activationMethods = Object.keys(ActivationMethod); |
@@ -71,7 +71,7 @@ export class AddUserDialogComponent extends DialogComponent<AddUserDialogCompone | @@ -71,7 +71,7 @@ export class AddUserDialogComponent extends DialogComponent<AddUserDialogCompone | ||
71 | this.user = {} as User; | 71 | this.user = {} as User; |
72 | this.userComponent.isEdit = true; | 72 | this.userComponent.isEdit = true; |
73 | this.userComponent.entity = this.user; | 73 | this.userComponent.entity = this.user; |
74 | - this.detailsForm = this.userComponent.entityNgForm; | 74 | + this.detailsForm = this.userComponent.entityForm; |
75 | } | 75 | } |
76 | 76 | ||
77 | cancel(): void { | 77 | cancel(): void { |
@@ -55,7 +55,7 @@ | @@ -55,7 +55,7 @@ | ||
55 | </button> | 55 | </button> |
56 | </div> | 56 | </div> |
57 | <div class="mat-padding" fxLayout="column"> | 57 | <div class="mat-padding" fxLayout="column"> |
58 | - <form #entityNgForm="ngForm" [formGroup]="entityForm"> | 58 | + <form [formGroup]="entityForm"> |
59 | <fieldset [disabled]="(isLoading$ | async) || !isEdit"> | 59 | <fieldset [disabled]="(isLoading$ | async) || !isEdit"> |
60 | <mat-form-field class="mat-block"> | 60 | <mat-form-field class="mat-block"> |
61 | <mat-label translate>user.email</mat-label> | 61 | <mat-label translate>user.email</mat-label> |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<form #saveWidgetTypeAsForm="ngForm" [formGroup]="saveWidgetTypeAsFormGroup" (ngSubmit)="saveAs()"> | 18 | +<form [formGroup]="saveWidgetTypeAsFormGroup" (ngSubmit)="saveAs()"> |
19 | <mat-toolbar color="primary"> | 19 | <mat-toolbar color="primary"> |
20 | <h2 translate>widget.save-widget-type-as</h2> | 20 | <h2 translate>widget.save-widget-type-as</h2> |
21 | <span fxFlex></span> | 21 | <span fxFlex></span> |
@@ -48,8 +48,8 @@ | @@ -48,8 +48,8 @@ | ||
48 | <div mat-dialog-actions fxLayoutAlign="end center"> | 48 | <div mat-dialog-actions fxLayoutAlign="end center"> |
49 | <button mat-raised-button color="primary" | 49 | <button mat-raised-button color="primary" |
50 | type="submit" | 50 | type="submit" |
51 | - [disabled]="(isLoading$ | async) || saveWidgetTypeAsForm.invalid | ||
52 | - || !saveWidgetTypeAsForm.dirty"> | 51 | + [disabled]="(isLoading$ | async) || saveWidgetTypeAsFormGroup.invalid |
52 | + || !saveWidgetTypeAsFormGroup.dirty"> | ||
53 | {{ 'action.saveAs' | translate }} | 53 | {{ 'action.saveAs' | translate }} |
54 | </button> | 54 | </button> |
55 | <button mat-button color="primary" | 55 | <button mat-button color="primary" |
@@ -36,7 +36,7 @@ | @@ -36,7 +36,7 @@ | ||
36 | </button> | 36 | </button> |
37 | </div> | 37 | </div> |
38 | <div class="mat-padding" fxLayout="column"> | 38 | <div class="mat-padding" fxLayout="column"> |
39 | - <form #entityNgForm="ngForm" [formGroup]="entityForm"> | 39 | + <form [formGroup]="entityForm"> |
40 | <fieldset [disabled]="(isLoading$ | async) || !isEdit"> | 40 | <fieldset [disabled]="(isLoading$ | async) || !isEdit"> |
41 | <mat-form-field class="mat-block"> | 41 | <mat-form-field class="mat-block"> |
42 | <mat-label translate>widgets-bundle.title</mat-label> | 42 | <mat-label translate>widgets-bundle.title</mat-label> |
@@ -24,7 +24,7 @@ | @@ -24,7 +24,7 @@ | ||
24 | </mat-progress-bar> | 24 | </mat-progress-bar> |
25 | <span style="height: 4px;" *ngIf="!(isLoading$ | async)"></span> | 25 | <span style="height: 4px;" *ngIf="!(isLoading$ | async)"></span> |
26 | <mat-card-content> | 26 | <mat-card-content> |
27 | - <form #createPasswordForm="ngForm" [formGroup]="createPassword" (ngSubmit)="onCreatePassword()"> | 27 | + <form [formGroup]="createPassword" (ngSubmit)="onCreatePassword()"> |
28 | <fieldset [disabled]="isLoading$ | async"> | 28 | <fieldset [disabled]="isLoading$ | async"> |
29 | <div tb-toast fxLayout="column" class="layout-padding"> | 29 | <div tb-toast fxLayout="column" class="layout-padding"> |
30 | <span style="height: 50px;"></span> | 30 | <span style="height: 50px;"></span> |
@@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
18 | <div class="tb-login-content mat-app-background tb-dark" fxFlex fxLayoutAlign="center center"> | 18 | <div class="tb-login-content mat-app-background tb-dark" fxFlex fxLayoutAlign="center center"> |
19 | <mat-card style="height: 100%; max-height: 525px; overflow-y: auto;"> | 19 | <mat-card style="height: 100%; max-height: 525px; overflow-y: auto;"> |
20 | <mat-card-content> | 20 | <mat-card-content> |
21 | - <form #loginForm="ngForm" class="tb-login-form" [formGroup]="loginFormGroup" (ngSubmit)="login()"> | 21 | + <form class="tb-login-form" [formGroup]="loginFormGroup" (ngSubmit)="login()"> |
22 | <fieldset [disabled]="isLoading$ | async" fxLayout="column"> | 22 | <fieldset [disabled]="isLoading$ | async" fxLayout="column"> |
23 | <div fxLayout="column" fxLayoutAlign="start center" style="padding: 15px 0;"> | 23 | <div fxLayout="column" fxLayoutAlign="start center" style="padding: 15px 0;"> |
24 | <tb-logo class="login-logo"></tb-logo> | 24 | <tb-logo class="login-logo"></tb-logo> |
@@ -24,7 +24,7 @@ | @@ -24,7 +24,7 @@ | ||
24 | </mat-progress-bar> | 24 | </mat-progress-bar> |
25 | <span style="height: 4px;" *ngIf="!(isLoading$ | async)"></span> | 25 | <span style="height: 4px;" *ngIf="!(isLoading$ | async)"></span> |
26 | <mat-card-content> | 26 | <mat-card-content> |
27 | - <form #requestPasswordResetForm="ngForm" [formGroup]="requestPasswordRequest" (ngSubmit)="sendResetPasswordLink()"> | 27 | + <form [formGroup]="requestPasswordRequest" (ngSubmit)="sendResetPasswordLink()"> |
28 | <fieldset [disabled]="isLoading$ | async"> | 28 | <fieldset [disabled]="isLoading$ | async"> |
29 | <div tb-toast fxLayout="column" class="layout-padding"> | 29 | <div tb-toast fxLayout="column" class="layout-padding"> |
30 | <span style="height: 50px;"></span> | 30 | <span style="height: 50px;"></span> |
@@ -27,7 +27,7 @@ | @@ -27,7 +27,7 @@ | ||
27 | </mat-progress-bar> | 27 | </mat-progress-bar> |
28 | <span style="height: 4px;" *ngIf="!(isLoading$ | async)"></span> | 28 | <span style="height: 4px;" *ngIf="!(isLoading$ | async)"></span> |
29 | <mat-card-content> | 29 | <mat-card-content> |
30 | - <form #resetPasswordForm="ngForm" [formGroup]="resetPassword" (ngSubmit)="onResetPassword()"> | 30 | + <form [formGroup]="resetPassword" (ngSubmit)="onResetPassword()"> |
31 | <fieldset [disabled]="isLoading$ | async"> | 31 | <fieldset [disabled]="isLoading$ | async"> |
32 | <div tb-toast fxLayout="column" class="layout-padding"> | 32 | <div tb-toast fxLayout="column" class="layout-padding"> |
33 | <span style="height: 50px;"></span> | 33 | <span style="height: 50px;"></span> |
@@ -16,7 +16,7 @@ | @@ -16,7 +16,7 @@ | ||
16 | 16 | ||
17 | --> | 17 | --> |
18 | <form class="tb-node-script-test-dialog" | 18 | <form class="tb-node-script-test-dialog" |
19 | - #nodeScriptTestForm="ngForm" [formGroup]="nodeScriptTestFormGroup" (ngSubmit)="save()"> | 19 | + [formGroup]="nodeScriptTestFormGroup" (ngSubmit)="save()"> |
20 | <mat-toolbar fxLayout="row" color="primary"> | 20 | <mat-toolbar fxLayout="row" color="primary"> |
21 | <h2>{{ 'rulenode.test-script-function' | translate }}</h2> | 21 | <h2>{{ 'rulenode.test-script-function' | translate }}</h2> |
22 | <span fxFlex></span> | 22 | <span fxFlex></span> |