Browse Source
Merge pull request #5373 from ArtemDzhereleiko/bug-fix/photo-camera-input/empty-datasource
[3.3.2] UI: Fixed Photo Camera input widget has error if entity is empty
pull/5422/head
Igor Kulikov
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
10 additions and
7 deletions
-
ui-ngx/src/app/modules/home/components/widget/lib/photo-camera-input.component.ts
|
|
|
@ -117,6 +117,7 @@ export class PhotoCameraInputWidgetComponent extends PageComponent implements On |
|
|
|
updatePhoto = false; |
|
|
|
previewPhoto: SafeUrl; |
|
|
|
lastPhoto: SafeUrl; |
|
|
|
datasourceDetected = false; |
|
|
|
|
|
|
|
private static hasGetUserMedia(): boolean { |
|
|
|
return !!(window.navigator.mediaDevices && window.navigator.mediaDevices.getUserMedia); |
|
|
|
@ -148,14 +149,16 @@ export class PhotoCameraInputWidgetComponent extends PageComponent implements On |
|
|
|
|
|
|
|
this.width = this.settings.maxWidth ? this.settings.maxWidth : 640; |
|
|
|
this.height = this.settings.maxHeight ? this.settings.maxWidth : 480; |
|
|
|
|
|
|
|
if (this.datasource.type === DatasourceType.entity) { |
|
|
|
if (this.datasource.entityType && this.datasource.entityId) { |
|
|
|
this.isEntityDetected = true; |
|
|
|
this.datasourceDetected = this.ctx.datasources?.length !== 0; |
|
|
|
if (this.datasourceDetected) { |
|
|
|
if (this.datasource.type === DatasourceType.entity) { |
|
|
|
if (this.datasource.entityType && this.datasource.entityId) { |
|
|
|
this.isEntityDetected = true; |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.datasource.dataKeys.length) { |
|
|
|
this.dataKeyDetected = true; |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.datasource.dataKeys.length) { |
|
|
|
this.dataKeyDetected = true; |
|
|
|
} |
|
|
|
this.detectAvailableDevices(); |
|
|
|
} |
|
|
|
|