From e02d4196f0af7cc457e4c43423cfa977cc7e110a Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Fri, 23 Jul 2021 16:26:22 +0300 Subject: [PATCH] UI: added validation qr code text --- .../home/components/widget/lib/qrcode-widget.component.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/qrcode-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/qrcode-widget.component.ts index 6b4bc29ee6..6c1f148de5 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/qrcode-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/qrcode-widget.component.ts @@ -29,7 +29,7 @@ import { import { FormattedData } from '@home/components/widget/lib/maps/map-models'; import { DatasourceData } from '@shared/models/widget.models'; import { DataKeyType } from '@shared/models/telemetry/telemetry.models'; -import { isString } from '@core/utils'; +import { isNumber, isObject } from '@core/utils'; interface QrCodeWidgetSettings { qrCodeTextPattern: string; @@ -110,12 +110,11 @@ export class QrCodeWidgetComponent extends PageComponent implements OnInit, Afte private updateQrCodeText(newQrCodeText: string): void { if (this.qrCodeText !== newQrCodeText) { this.qrCodeText = newQrCodeText; - if (isString(newQrCodeText)) { + if (!(isObject(newQrCodeText) || isNumber(newQrCodeText))) { this.invalidQrCodeText = false; if (this.qrCodeText) { this.updateCanvas(); } - this.cd.detectChanges(); } else { this.invalidQrCodeText = true; }