-
dashboard.no-image
-
![]()
+
+
dashboard.no-image
+
-
diff --git a/ui-ngx/src/app/shared/components/image-input.component.scss b/ui-ngx/src/app/shared/components/image-input.component.scss
index 83e67510ca..d4601f81ec 100644
--- a/ui-ngx/src/app/shared/components/image-input.component.scss
+++ b/ui-ngx/src/app/shared/components/image-input.component.scss
@@ -35,9 +35,9 @@ $previewSize: 100px !default;
.tb-image-preview {
width: auto;
- max-width: $previewSize;
+ max-width: $previewSize - 2;
height: auto;
- max-height: $previewSize;
+ max-height: $previewSize - 2;
}
.tb-image-preview-container {
diff --git a/ui-ngx/src/app/shared/components/image-input.component.ts b/ui-ngx/src/app/shared/components/image-input.component.ts
index b069903654..a9e73323e3 100644
--- a/ui-ngx/src/app/shared/components/image-input.component.ts
+++ b/ui-ngx/src/app/shared/components/image-input.component.ts
@@ -14,34 +14,16 @@
/// limitations under the License.
///
-import { Component, ElementRef, forwardRef, Input, OnInit, ViewChild, AfterViewInit, OnDestroy } from '@angular/core';
+import { AfterViewInit, Component, forwardRef, Input, OnDestroy, ViewChild } from '@angular/core';
import { PageComponent } from '@shared/components/page.component';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
-import { DataKey, DatasourceType } from '@shared/models/widget.models';
-import {
- ControlValueAccessor,
- FormBuilder,
- FormControl,
- FormGroup,
- NG_VALIDATORS,
- NG_VALUE_ACCESSOR,
- Validator,
- Validators
-} from '@angular/forms';
-import { UtilsService } from '@core/services/utils.service';
-import { TranslateService } from '@ngx-translate/core';
-import { MatDialog } from '@angular/material/dialog';
-import { EntityService } from '@core/http/entity.service';
-import { DataKeysCallbacks } from '@home/components/widget/data-keys.component.models';
-import { DataKeyType } from '@shared/models/telemetry/telemetry.models';
-import { Observable, of, Subscription } from 'rxjs';
-import { map, mergeMap, tap } from 'rxjs/operators';
-import { alarmFields } from '@shared/models/alarm.models';
+import { ControlValueAccessor, NG_VALUE_ACCESSOR, } from '@angular/forms';
+import { Subscription } from 'rxjs';
import { coerceBooleanProperty } from '@angular/cdk/coercion';
-import { DialogService } from '@core/services/dialog.service';
import { FlowDirective } from '@flowjs/ngx-flow';
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
+import { UtilsService } from '@core/services/utils.service';
@Component({
selector: 'tb-image-input',
@@ -61,9 +43,11 @@ export class ImageInputComponent extends PageComponent implements AfterViewInit,
label: string;
private requiredValue: boolean;
+
get required(): boolean {
return this.requiredValue;
}
+
@Input()
set required(value: boolean) {
const newVal = coerceBooleanProperty(value);
@@ -75,6 +59,15 @@ export class ImageInputComponent extends PageComponent implements AfterViewInit,
@Input()
disabled: boolean;
+ @Input()
+ showClearButton = true;
+
+ @Input()
+ showPreview = true;
+
+ @Input()
+ inputId = this.utils.guid();
+
imageUrl: string;
safeImageUrl: SafeUrl;
@@ -86,6 +79,7 @@ export class ImageInputComponent extends PageComponent implements AfterViewInit,
private propagateChange = null;
constructor(protected store: Store
,
+ private utils: UtilsService,
private sanitizer: DomSanitizer) {
super(store);
}
diff --git a/ui-ngx/src/polyfills.ts b/ui-ngx/src/polyfills.ts
index b95206c725..88f93cac56 100644
--- a/ui-ngx/src/polyfills.ts
+++ b/ui-ngx/src/polyfills.ts
@@ -75,6 +75,7 @@
import './zone-flags';
import 'zone.js/dist/zone'; // Included with Angular CLI.
import 'core-js/es/array';
+import moment from 'moment';
/***************************************************************************************************
* APPLICATION IMPORTS
@@ -99,6 +100,7 @@ const tinycolor = tinycolor_;
(window as any).tinycolor = tinycolor;
(window as any).cssjs = cssjs;
+(window as any).moment = moment;
(window as any).TbFlot = TbFlot;
(window as any).TbAnalogueCompass = TbAnalogueCompass;
(window as any).TbAnalogueRadialGauge = TbAnalogueRadialGauge;