Commit 9c38756eb3c7109b9745a4195d5f28e2b81b56bb

Authored by ArtemDzhereleiko
1 parent c1823ff1

Add input field no data to display alternative message

... ... @@ -306,6 +306,12 @@
306 306 <input matInput formControlName="decimals" type="number" min="0" max="15" step="1">
307 307 </mat-form-field>
308 308 </div>
  309 + <div fxLayout="row">
  310 + <mat-form-field fxFlex>
  311 + <mat-label translate>widget-config.no-data-display-message</mat-label>
  312 + <input matInput formControlName="noDataDisplayMessage">
  313 + </mat-form-field>
  314 + </div>
309 315 </ng-template>
310 316 </mat-expansion-panel>
311 317 </mat-accordion>
... ...
... ... @@ -209,6 +209,7 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, Cont
209 209 titleStyle: [null, []],
210 210 units: [null, []],
211 211 decimals: [null, [Validators.min(0), Validators.max(15), Validators.pattern(/^\d*$/)]],
  212 + noDataDisplayMessage: [null, []],
212 213 showLegend: [null, []],
213 214 legendConfig: [null, []]
214 215 });
... ... @@ -411,6 +412,7 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, Cont
411 412 },
412 413 units: config.units,
413 414 decimals: config.decimals,
  415 + noDataDisplayMessage: isDefined(config.noDataDisplayMessage) ? config.noDataDisplayMessage : '',
414 416 showLegend: isDefined(config.showLegend) ? config.showLegend :
415 417 this.widgetType === widgetType.timeseries,
416 418 legendConfig: config.legendConfig || defaultLegendConfig(this.widgetType)
... ...
... ... @@ -39,8 +39,7 @@
39 39 <div class="tb-absolute-fill tb-widget-no-data" *ngIf="displayNoData">
40 40 <span fxLayoutAlign="center center"
41 41 style="display: flex;"
42   - class="tb-absolute-fill"
43   - translate>widget.no-data</span>
  42 + class="tb-absolute-fill">{{ noDataDisplayMessageText }}</span>
44 43 </div>
45 44 <div class="tb-absolute-fill tb-widget-loading" [fxShow]="loadingData" fxLayout="column" fxLayoutAlign="center center">
46 45 <mat-spinner color="accent" md-mode="indeterminate" diameter="40"></mat-spinner>
... ...
... ... @@ -361,6 +361,11 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
361 361 }, 0);
362 362 }
363 363
  364 + get noDataDisplayMessageText(): string {
  365 + const noDataDisplayMessage = isNotEmptyStr(this.widget.config.noDataDisplayMessage) ? this.widget.config.noDataDisplayMessage : '{i18n:widget.no-data}';
  366 + return this.utils.customTranslation(noDataDisplayMessage, noDataDisplayMessage);
  367 + }
  368 +
364 369 ngAfterViewInit(): void {
365 370 }
366 371
... ...
... ... @@ -323,6 +323,8 @@ export class DashboardWidget implements GridsterItem, IDashboardWidget {
323 323 dropShadow: boolean;
324 324 enableFullscreen: boolean;
325 325
  326 + noDataDisplayMessage: string;
  327 +
326 328 hasTimewindow: boolean;
327 329
328 330 hasAggregation: boolean;
... ... @@ -411,6 +413,7 @@ export class DashboardWidget implements GridsterItem, IDashboardWidget {
411 413
412 414 this.titleIcon = isDefined(this.widget.config.titleIcon) ? this.widget.config.titleIcon : '';
413 415 this.showTitleIcon = isDefined(this.widget.config.showTitleIcon) ? this.widget.config.showTitleIcon : false;
  416 + this.noDataDisplayMessage = isDefined(this.widget.config.noDataDisplayMessage) ? this.widget.config.noDataDisplayMessage : '';
414 417 this.titleIconStyle = {};
415 418 if (this.widget.config.iconColor) {
416 419 this.titleIconStyle.color = this.widget.config.iconColor;
... ...
... ... @@ -509,6 +509,7 @@ export interface WidgetConfig {
509 509 titleStyle?: {[klass: string]: any};
510 510 units?: string;
511 511 decimals?: number;
  512 + noDataDisplayMessage?: string;
512 513 actions?: {[actionSourceId: string]: Array<WidgetActionDescriptor>};
513 514 settings?: any;
514 515 alarmSource?: Datasource;
... ...
... ... @@ -3077,7 +3077,8 @@
3077 3077 "icon-color": "Icon color",
3078 3078 "icon-size": "Icon size",
3079 3079 "advanced-settings": "Advanced settings",
3080   - "data-settings": "Data settings"
  3080 + "data-settings": "Data settings",
  3081 + "no-data-display-message": "\"No data to display\" alternative message"
3081 3082 },
3082 3083 "widget-type": {
3083 3084 "import": "Import widget type",
... ...
... ... @@ -1679,7 +1679,8 @@
1679 1679 "icon-color": "Цвет иконки",
1680 1680 "icon-size": "Размер иконки",
1681 1681 "advanced-settings": "Расширенные настройки",
1682   - "data-settings": "Настройки данных"
  1682 + "data-settings": "Настройки данных",
  1683 + "no-data-display-message": "\"Нет данных для отображения\" альтернативный текст"
1683 1684 },
1684 1685 "widget-type": {
1685 1686 "import": "Импортировать тип виджета",
... ...
... ... @@ -2251,7 +2251,8 @@
2251 2251 "icon-color": "Колір іконки",
2252 2252 "icon-size": "Розмір іконки",
2253 2253 "advanced-settings": "Розширені налаштування",
2254   - "data-settings": "Налаштування даних"
  2254 + "data-settings": "Налаштування даних",
  2255 + "no-data-display-message": "\"Немає данних для відображення\" альтернативний текст"
2255 2256 },
2256 2257 "widget-type": {
2257 2258 "import": "Імпортувати тип віджета",
... ...