Commit 6b7c95c0405d33a72eeebcb4bdde756d548b683e
1 parent
bf3a8875
UI: Fixed - widgets showed two errors at the same time.
Showing
5 changed files
with
15 additions
and
4 deletions
@@ -122,7 +122,7 @@ | @@ -122,7 +122,7 @@ | ||
122 | </div> | 122 | </div> |
123 | </div> | 123 | </div> |
124 | <div class="tb-multiple-input__errors" fxLayout="column" fxLayoutAlign="center center" style="height: 100%;" | 124 | <div class="tb-multiple-input__errors" fxLayout="column" fxLayoutAlign="center center" style="height: 100%;" |
125 | - *ngIf="!entityDetected || !isAllParametersValid"> | 125 | + *ngIf="(!entityDetected || !isAllParametersValid) && datasourceDetected"> |
126 | <div style="text-align: center; font-size: 18px; color: #a0a0a0;" [fxHide]="entityDetected"> | 126 | <div style="text-align: center; font-size: 18px; color: #a0a0a0;" [fxHide]="entityDetected"> |
127 | {{ 'widgets.input-widgets.no-entity-selected' | translate }} | 127 | {{ 'widgets.input-widgets.no-entity-selected' | translate }} |
128 | </div> | 128 | </div> |
@@ -117,6 +117,7 @@ export class MultipleInputWidgetComponent extends PageComponent implements OnIni | @@ -117,6 +117,7 @@ export class MultipleInputWidgetComponent extends PageComponent implements OnIni | ||
117 | resetButtonLabel: string; | 117 | resetButtonLabel: string; |
118 | 118 | ||
119 | entityDetected = false; | 119 | entityDetected = false; |
120 | + datasourceDetected = false; | ||
120 | isAllParametersValid = true; | 121 | isAllParametersValid = true; |
121 | 122 | ||
122 | multipleInputFormGroup: FormGroup; | 123 | multipleInputFormGroup: FormGroup; |
@@ -203,7 +204,8 @@ export class MultipleInputWidgetComponent extends PageComponent implements OnIni | @@ -203,7 +204,8 @@ export class MultipleInputWidgetComponent extends PageComponent implements OnIni | ||
203 | } | 204 | } |
204 | 205 | ||
205 | private updateDatasources() { | 206 | private updateDatasources() { |
206 | - if (this.datasources && this.datasources.length) { | 207 | + this.datasourceDetected = this.datasources?.length !== 0; |
208 | + if (this.datasourceDetected) { | ||
207 | this.entityDetected = true; | 209 | this.entityDetected = true; |
208 | let keyIndex = 0; | 210 | let keyIndex = 0; |
209 | this.datasources.forEach((datasource) => { | 211 | this.datasources.forEach((datasource) => { |
@@ -17,6 +17,8 @@ | @@ -17,6 +17,8 @@ | ||
17 | --> | 17 | --> |
18 | <div fxLayout="column" fxLayoutAlign="center center" style="width: 100%; height: 100%;"> | 18 | <div fxLayout="column" fxLayoutAlign="center center" style="width: 100%; height: 100%;"> |
19 | <canvas fxFlex #canvas [ngStyle]="{display: qrCodeText && !invalidQrCodeText ? 'block' : 'none'}"></canvas> | 19 | <canvas fxFlex #canvas [ngStyle]="{display: qrCodeText && !invalidQrCodeText ? 'block' : 'none'}"></canvas> |
20 | - <div *ngIf="!qrCodeText && !invalidQrCodeText" translate>entity.no-data</div> | ||
21 | - <div *ngIf="invalidQrCodeText" translate>widgets.invalid-qr-code-text</div> | 20 | + <div *ngIf="datasourceDetected"> |
21 | + <div *ngIf="!qrCodeText && !invalidQrCodeText" style="text-align: center" translate>entity.no-data</div> | ||
22 | + <div *ngIf="invalidQrCodeText" style="text-align: center" translate>widgets.invalid-qr-code-text</div> | ||
23 | + </div> | ||
22 | </div> | 24 | </div> |
@@ -54,6 +54,7 @@ export class QrCodeWidgetComponent extends PageComponent implements OnInit, Afte | @@ -54,6 +54,7 @@ export class QrCodeWidgetComponent extends PageComponent implements OnInit, Afte | ||
54 | 54 | ||
55 | qrCodeText: string; | 55 | qrCodeText: string; |
56 | invalidQrCodeText = false; | 56 | invalidQrCodeText = false; |
57 | + datasourceDetected = false; | ||
57 | 58 | ||
58 | private viewInited: boolean; | 59 | private viewInited: boolean; |
59 | private scheduleUpdateCanvas: boolean; | 60 | private scheduleUpdateCanvas: boolean; |
@@ -95,6 +96,8 @@ export class QrCodeWidgetComponent extends PageComponent implements OnInit, Afte | @@ -95,6 +96,8 @@ export class QrCodeWidgetComponent extends PageComponent implements OnInit, Afte | ||
95 | data: [] | 96 | data: [] |
96 | } | 97 | } |
97 | ]; | 98 | ]; |
99 | + } else { | ||
100 | + this.datasourceDetected = false; | ||
98 | } | 101 | } |
99 | if (initialData) { | 102 | if (initialData) { |
100 | const data = parseData(initialData); | 103 | const data = parseData(initialData); |
@@ -103,6 +106,7 @@ export class QrCodeWidgetComponent extends PageComponent implements OnInit, Afte | @@ -103,6 +106,7 @@ export class QrCodeWidgetComponent extends PageComponent implements OnInit, Afte | ||
103 | safeExecute(this.qrCodeTextFunction, [dataSourceData]) : this.settings.qrCodeTextPattern; | 106 | safeExecute(this.qrCodeTextFunction, [dataSourceData]) : this.settings.qrCodeTextPattern; |
104 | const replaceInfo = processPattern(pattern, dataSourceData); | 107 | const replaceInfo = processPattern(pattern, dataSourceData); |
105 | qrCodeText = fillPattern(pattern, replaceInfo, dataSourceData); | 108 | qrCodeText = fillPattern(pattern, replaceInfo, dataSourceData); |
109 | + this.datasourceDetected = true; | ||
106 | } | 110 | } |
107 | this.updateQrCodeText(qrCodeText); | 111 | this.updateQrCodeText(qrCodeText); |
108 | } | 112 | } |
@@ -45,6 +45,7 @@ $error-height: 14px !default; | @@ -45,6 +45,7 @@ $error-height: 14px !default; | ||
45 | font-weight: 500; | 45 | font-weight: 500; |
46 | color: #757575; | 46 | color: #757575; |
47 | white-space: nowrap; | 47 | white-space: nowrap; |
48 | + z-index: 1; | ||
48 | 49 | ||
49 | .off-label { | 50 | .off-label { |
50 | color: #b7b5b5; | 51 | color: #b7b5b5; |
@@ -86,6 +87,8 @@ $error-height: 14px !default; | @@ -86,6 +87,8 @@ $error-height: 14px !default; | ||
86 | :host ::ng-deep { | 87 | :host ::ng-deep { |
87 | .tb-switch { | 88 | .tb-switch { |
88 | .switch { | 89 | .switch { |
90 | + z-index: 1; | ||
91 | + | ||
89 | mat-slide-toggle { | 92 | mat-slide-toggle { |
90 | position: absolute; | 93 | position: absolute; |
91 | top: 0; | 94 | top: 0; |