UI: Fixed - widgets showed two errors at the same time.
This commit is contained in:
parent
bf3a88752c
commit
6b7c95c040
@ -122,7 +122,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tb-multiple-input__errors" fxLayout="column" fxLayoutAlign="center center" style="height: 100%;"
|
<div class="tb-multiple-input__errors" fxLayout="column" fxLayoutAlign="center center" style="height: 100%;"
|
||||||
*ngIf="!entityDetected || !isAllParametersValid">
|
*ngIf="(!entityDetected || !isAllParametersValid) && datasourceDetected">
|
||||||
<div style="text-align: center; font-size: 18px; color: #a0a0a0;" [fxHide]="entityDetected">
|
<div style="text-align: center; font-size: 18px; color: #a0a0a0;" [fxHide]="entityDetected">
|
||||||
{{ 'widgets.input-widgets.no-entity-selected' | translate }}
|
{{ 'widgets.input-widgets.no-entity-selected' | translate }}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -117,6 +117,7 @@ export class MultipleInputWidgetComponent extends PageComponent implements OnIni
|
|||||||
resetButtonLabel: string;
|
resetButtonLabel: string;
|
||||||
|
|
||||||
entityDetected = false;
|
entityDetected = false;
|
||||||
|
datasourceDetected = false;
|
||||||
isAllParametersValid = true;
|
isAllParametersValid = true;
|
||||||
|
|
||||||
multipleInputFormGroup: FormGroup;
|
multipleInputFormGroup: FormGroup;
|
||||||
@ -203,7 +204,8 @@ export class MultipleInputWidgetComponent extends PageComponent implements OnIni
|
|||||||
}
|
}
|
||||||
|
|
||||||
private updateDatasources() {
|
private updateDatasources() {
|
||||||
if (this.datasources && this.datasources.length) {
|
this.datasourceDetected = this.datasources?.length !== 0;
|
||||||
|
if (this.datasourceDetected) {
|
||||||
this.entityDetected = true;
|
this.entityDetected = true;
|
||||||
let keyIndex = 0;
|
let keyIndex = 0;
|
||||||
this.datasources.forEach((datasource) => {
|
this.datasources.forEach((datasource) => {
|
||||||
|
|||||||
@ -17,6 +17,8 @@
|
|||||||
-->
|
-->
|
||||||
<div fxLayout="column" fxLayoutAlign="center center" style="width: 100%; height: 100%;">
|
<div fxLayout="column" fxLayoutAlign="center center" style="width: 100%; height: 100%;">
|
||||||
<canvas fxFlex #canvas [ngStyle]="{display: qrCodeText && !invalidQrCodeText ? 'block' : 'none'}"></canvas>
|
<canvas fxFlex #canvas [ngStyle]="{display: qrCodeText && !invalidQrCodeText ? 'block' : 'none'}"></canvas>
|
||||||
<div *ngIf="!qrCodeText && !invalidQrCodeText" translate>entity.no-data</div>
|
<div *ngIf="datasourceDetected">
|
||||||
<div *ngIf="invalidQrCodeText" translate>widgets.invalid-qr-code-text</div>
|
<div *ngIf="!qrCodeText && !invalidQrCodeText" style="text-align: center" translate>entity.no-data</div>
|
||||||
|
<div *ngIf="invalidQrCodeText" style="text-align: center" translate>widgets.invalid-qr-code-text</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -54,6 +54,7 @@ export class QrCodeWidgetComponent extends PageComponent implements OnInit, Afte
|
|||||||
|
|
||||||
qrCodeText: string;
|
qrCodeText: string;
|
||||||
invalidQrCodeText = false;
|
invalidQrCodeText = false;
|
||||||
|
datasourceDetected = false;
|
||||||
|
|
||||||
private viewInited: boolean;
|
private viewInited: boolean;
|
||||||
private scheduleUpdateCanvas: boolean;
|
private scheduleUpdateCanvas: boolean;
|
||||||
@ -95,6 +96,8 @@ export class QrCodeWidgetComponent extends PageComponent implements OnInit, Afte
|
|||||||
data: []
|
data: []
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
} else {
|
||||||
|
this.datasourceDetected = false;
|
||||||
}
|
}
|
||||||
if (initialData) {
|
if (initialData) {
|
||||||
const data = parseData(initialData);
|
const data = parseData(initialData);
|
||||||
@ -103,6 +106,7 @@ export class QrCodeWidgetComponent extends PageComponent implements OnInit, Afte
|
|||||||
safeExecute(this.qrCodeTextFunction, [dataSourceData]) : this.settings.qrCodeTextPattern;
|
safeExecute(this.qrCodeTextFunction, [dataSourceData]) : this.settings.qrCodeTextPattern;
|
||||||
const replaceInfo = processPattern(pattern, dataSourceData);
|
const replaceInfo = processPattern(pattern, dataSourceData);
|
||||||
qrCodeText = fillPattern(pattern, replaceInfo, dataSourceData);
|
qrCodeText = fillPattern(pattern, replaceInfo, dataSourceData);
|
||||||
|
this.datasourceDetected = true;
|
||||||
}
|
}
|
||||||
this.updateQrCodeText(qrCodeText);
|
this.updateQrCodeText(qrCodeText);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,6 +45,7 @@ $error-height: 14px !default;
|
|||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #757575;
|
color: #757575;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
z-index: 1;
|
||||||
|
|
||||||
.off-label {
|
.off-label {
|
||||||
color: #b7b5b5;
|
color: #b7b5b5;
|
||||||
@ -86,6 +87,8 @@ $error-height: 14px !default;
|
|||||||
:host ::ng-deep {
|
:host ::ng-deep {
|
||||||
.tb-switch {
|
.tb-switch {
|
||||||
.switch {
|
.switch {
|
||||||
|
z-index: 1;
|
||||||
|
|
||||||
mat-slide-toggle {
|
mat-slide-toggle {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user