Add no data display message to entities and alarm tables

This commit is contained in:
ArtemDzhereleiko 2021-10-13 12:47:47 +03:00
parent 9c38756eb3
commit dd29490dd7
4 changed files with 14 additions and 4 deletions

View File

@ -136,7 +136,7 @@
</table> </table>
<span [fxShow]="(alarmsDatasource.isEmpty() | async) && !alarmsDatasource.dataLoading" <span [fxShow]="(alarmsDatasource.isEmpty() | async) && !alarmsDatasource.dataLoading"
fxLayoutAlign="center center" fxLayoutAlign="center center"
class="no-data-found" translate>alarm.no-alarms-prompt</span> class="no-data-found">{{ noDataDisplayMessageText }}</span>
<span [fxShow]="alarmsDatasource.dataLoading" <span [fxShow]="alarmsDatasource.dataLoading"
fxLayoutAlign="center center" fxLayoutAlign="center center"
class="no-data-found">{{ 'common.loading' | translate }}</span> class="no-data-found">{{ 'common.loading' | translate }}</span>

View File

@ -39,7 +39,7 @@ import {
createLabelFromDatasource, createLabelFromDatasource,
deepClone, deepClone,
hashCode, hashCode,
isDefined, isDefined, isNotEmptyStr,
isNumber, isNumber,
isObject, isObject,
isUndefined isUndefined
@ -265,6 +265,11 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit,
} }
} }
get noDataDisplayMessageText() {
const noDataDisplayMessage = isNotEmptyStr(this.ctx.widgetConfig.noDataDisplayMessage) ? this.ctx.widgetConfig.noDataDisplayMessage : '{i18n:alarm.no-alarms-prompt}';
return this.utils.customTranslation(noDataDisplayMessage, noDataDisplayMessage);
}
ngAfterViewInit(): void { ngAfterViewInit(): void {
fromEvent(this.searchInputField.nativeElement, 'keyup') fromEvent(this.searchInputField.nativeElement, 'keyup')
.pipe( .pipe(

View File

@ -95,7 +95,7 @@
</table> </table>
<span [fxShow]="(entityDatasource.isEmpty() | async) && !entityDatasource.dataLoading" <span [fxShow]="(entityDatasource.isEmpty() | async) && !entityDatasource.dataLoading"
fxLayoutAlign="center center" fxLayoutAlign="center center"
class="no-data-found" translate>entity.no-entities-prompt</span> class="no-data-found">{{ noDataDisplayMessageText }}</span>
<span [fxShow]="entityDatasource.dataLoading" <span [fxShow]="entityDatasource.dataLoading"
fxLayoutAlign="center center" fxLayoutAlign="center center"
class="no-data-found">{{ 'common.loading' | translate }}</span> class="no-data-found">{{ 'common.loading' | translate }}</span>

View File

@ -44,7 +44,7 @@ import {
createLabelFromDatasource, createLabelFromDatasource,
deepClone, deepClone,
hashCode, hashCode,
isDefined, isDefined, isNotEmptyStr,
isNumber, isNumber,
isObject, isObject,
isUndefined isUndefined
@ -211,6 +211,11 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni
this.ctx.updateWidgetParams(); this.ctx.updateWidgetParams();
} }
get noDataDisplayMessageText() {
const noDataDisplayMessage = isNotEmptyStr(this.ctx.widgetConfig.noDataDisplayMessage) ? this.ctx.widgetConfig.noDataDisplayMessage : '{i18n:entity.no-entities-prompt}';
return this.utils.customTranslation(noDataDisplayMessage, noDataDisplayMessage);
}
ngAfterViewInit(): void { ngAfterViewInit(): void {
fromEvent(this.searchInputField.nativeElement, 'keyup') fromEvent(this.searchInputField.nativeElement, 'keyup')
.pipe( .pipe(