2019-10-31 10:06:57 +02:00
|
|
|
<!--
|
|
|
|
|
|
2023-01-31 10:43:56 +02:00
|
|
|
Copyright © 2016-2023 The Thingsboard Authors
|
2019-10-31 10:06:57 +02:00
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
|
limitations under the License.
|
|
|
|
|
|
|
|
|
|
-->
|
2023-09-28 18:16:20 +03:00
|
|
|
<div class="tb-dashboard-widget-select">
|
2023-09-04 18:04:20 +03:00
|
|
|
<ng-container *ngIf="selectWidgetMode === 'bundles'; else allWidgets">
|
2023-09-28 18:16:20 +03:00
|
|
|
<ng-container *ngIf="widgetsBundle; else bundles">
|
|
|
|
|
<ng-container *ngTemplateOutlet="widgets; context:{ fetchFunction: widgetsFetchFunction, filter: widgetsFilter }"></ng-container>
|
|
|
|
|
</ng-container>
|
2023-09-04 18:04:20 +03:00
|
|
|
</ng-container>
|
|
|
|
|
<ng-template #allWidgets>
|
2023-09-28 18:16:20 +03:00
|
|
|
<ng-container *ngTemplateOutlet="widgets; context:{ fetchFunction: allWidgetsFetchFunction, filter: allWidgetsFilter }"></ng-container>
|
2023-09-04 18:04:20 +03:00
|
|
|
</ng-template>
|
2023-09-28 18:16:20 +03:00
|
|
|
<ng-template #widgets let-fetchFunction="fetchFunction" let-filter="filter">
|
|
|
|
|
<tb-scroll-grid
|
|
|
|
|
[columns]="columns"
|
|
|
|
|
[fetchFunction]="fetchFunction"
|
|
|
|
|
[filter]="filter"
|
|
|
|
|
[itemCard]="widgetCard"
|
|
|
|
|
[loadingCell]="widgetLoadingCard"
|
|
|
|
|
[dataLoading]="loadingWidgets"
|
|
|
|
|
[noData]="noWidgets">
|
|
|
|
|
</tb-scroll-grid>
|
|
|
|
|
<ng-template #widgetCard let-item="item">
|
|
|
|
|
<mat-card class="tb-widget-preview-card" appearance="raised" fxFlexFill fxLayout="row" fxLayoutGap="16px" (click)="onWidgetClicked($event, item)">
|
|
|
|
|
<div class="preview-container" fxFlex="45">
|
|
|
|
|
<img class="preview" [src]="getPreviewImage(item.image)" alt="{{ item.title }}">
|
|
|
|
|
</div>
|
|
|
|
|
<div fxFlex fxLayout="column">
|
|
|
|
|
<mat-card-title>{{item.name}}<div *ngIf="item.deprecated" class="tb-deprecated" translate>widget.deprecated</div></mat-card-title>
|
|
|
|
|
<mat-card-subtitle>{{ 'widget.' + item.widgetType | translate }}</mat-card-subtitle>
|
|
|
|
|
<mat-card-content *ngIf="item.description">
|
|
|
|
|
{{ item.description }}
|
|
|
|
|
</mat-card-content>
|
|
|
|
|
</div>
|
|
|
|
|
</mat-card>
|
|
|
|
|
</ng-template>
|
|
|
|
|
<ng-template #loadingWidgets>
|
|
|
|
|
<div fxLayout="column"
|
|
|
|
|
fxLayoutAlign="center center" class="tb-absolute-fill">
|
2023-02-17 19:24:01 +02:00
|
|
|
<span class="mat-headline-5" style="padding-bottom: 20px;">
|
2021-03-11 14:54:35 +02:00
|
|
|
{{ 'widget.loading-widgets' | translate }}
|
|
|
|
|
</span>
|
2023-09-28 18:16:20 +03:00
|
|
|
<mat-spinner color="accent" strokeWidth="5"></mat-spinner>
|
|
|
|
|
</div>
|
|
|
|
|
</ng-template>
|
|
|
|
|
<ng-template #noWidgets>
|
|
|
|
|
<span style="display: flex;"
|
2021-03-11 14:54:35 +02:00
|
|
|
fxLayoutAlign="center center"
|
2023-09-04 18:04:20 +03:00
|
|
|
class="mat-headline-5 tb-absolute-fill">{{(selectWidgetMode === 'bundles' ? 'widgets-bundle.empty' : 'widget.no-widgets-text') | translate}}</span>
|
2023-09-28 18:16:20 +03:00
|
|
|
</ng-template>
|
2023-09-04 18:04:20 +03:00
|
|
|
</ng-template>
|
2023-09-28 18:16:20 +03:00
|
|
|
|
2021-03-03 18:41:01 +02:00
|
|
|
<ng-template #bundles>
|
2023-09-28 18:16:20 +03:00
|
|
|
<tb-scroll-grid
|
|
|
|
|
[columns]="columns"
|
|
|
|
|
[fetchFunction]="widgetBundlesFetchFunction"
|
|
|
|
|
[filter]="widgetsBundleFilter"
|
|
|
|
|
[itemCard]="widgetsBundleCard"
|
|
|
|
|
[loadingCell]="widgetLoadingCard"
|
|
|
|
|
[dataLoading]="loadingWidgetBundles"
|
|
|
|
|
[noData]="noWidgetBundles">
|
|
|
|
|
</tb-scroll-grid>
|
|
|
|
|
<ng-template #widgetsBundleCard let-item="item">
|
|
|
|
|
<mat-card class="tb-widget-preview-card" appearance="raised" fxFlexFill fxLayout="row" fxLayoutGap="16px" (click)="selectBundle($event, item)">
|
|
|
|
|
<div class="preview-container" fxFlex="45">
|
|
|
|
|
<img class="preview" [src]=getPreviewImage(item.image) alt="{{ item.title }}">
|
|
|
|
|
</div>
|
|
|
|
|
<div fxFlex fxLayout="column">
|
|
|
|
|
<mat-card-title>{{ item.title }}</mat-card-title>
|
|
|
|
|
<mat-card-subtitle *ngIf="isSystem(item)" translate>widgets-bundle.system</mat-card-subtitle>
|
|
|
|
|
<mat-card-content *ngIf="item.description">
|
|
|
|
|
{{ item.description }}
|
|
|
|
|
</mat-card-content>
|
|
|
|
|
</div>
|
|
|
|
|
</mat-card>
|
|
|
|
|
</ng-template>
|
2021-03-11 14:54:35 +02:00
|
|
|
<ng-template #loadingWidgetBundles>
|
2023-09-28 18:16:20 +03:00
|
|
|
<div fxLayout="column"
|
2021-03-11 14:54:35 +02:00
|
|
|
fxLayoutAlign="center center" class="tb-absolute-fill">
|
2023-02-17 19:24:01 +02:00
|
|
|
<span class="mat-headline-5" style="padding-bottom: 20px;">
|
2021-03-11 14:54:35 +02:00
|
|
|
{{ 'widgets-bundle.loading-widgets-bundles' | translate }}
|
|
|
|
|
</span>
|
|
|
|
|
<mat-spinner strokeWidth="5"></mat-spinner>
|
|
|
|
|
</div>
|
2023-09-28 18:16:20 +03:00
|
|
|
</ng-template>
|
|
|
|
|
<ng-template #noWidgetBundles>
|
2021-03-11 14:54:35 +02:00
|
|
|
<span translate
|
|
|
|
|
style="display: flex;"
|
|
|
|
|
fxLayoutAlign="center center"
|
2023-02-17 19:24:01 +02:00
|
|
|
class="mat-headline-5 tb-absolute-fill">widgets-bundle.no-widgets-bundles-text</span>
|
2021-03-11 14:54:35 +02:00
|
|
|
</ng-template>
|
2021-03-03 18:41:01 +02:00
|
|
|
</ng-template>
|
2023-09-28 18:16:20 +03:00
|
|
|
<ng-template #widgetLoadingCard>
|
|
|
|
|
<mat-card class="tb-widget-preview-card loading-cell" appearance="raised" fxLayout="row" fxLayoutGap="16px">
|
|
|
|
|
<div class="preview-container" fxFlex="45">
|
|
|
|
|
</div>
|
|
|
|
|
<div fxFlex fxLayout="column">
|
|
|
|
|
<mat-card-title>
|
|
|
|
|
</mat-card-title>
|
|
|
|
|
<mat-card-content>
|
|
|
|
|
</mat-card-content>
|
|
|
|
|
</div>
|
|
|
|
|
</mat-card>
|
|
|
|
|
</ng-template>
|
2019-10-31 10:06:57 +02:00
|
|
|
</div>
|