159 lines
7.8 KiB
HTML
Raw Normal View History

2019-09-03 19:31:16 +03:00
<!--
Copyright © 2016-2019 The Thingsboard Authors
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.
-->
<div fxFlex fxLayout="column" class="tb-progress-cover" fxLayoutAlign="center center"
[ngStyle]="dashboardStyle"
[fxShow]="(((isLoading$ | async) && !this.ignoreLoading) || this.dashboardLoading) && !isEdit">
2019-09-03 19:31:16 +03:00
<mat-spinner color="warn" mode="indeterminate" diameter="100">
</mat-spinner>
</div>
<div id="gridster-parent"
fxFlex class="tb-dashboard-content layout-wrap" [ngStyle]="{overflowY: isAutofillHeight() ? 'hidden' : 'auto'}"
(contextmenu)="openDashboardContextMenu($event)">
2019-09-25 19:37:29 +03:00
<div #dashboardMenuTrigger="matMenuTrigger" style="visibility: hidden; position: fixed"
[style.left]="dashboardMenuPosition.x"
[style.top]="dashboardMenuPosition.y"
[matMenuTriggerFor]="dashboardMenu">
</div>
<mat-menu #dashboardMenu="matMenu">
<ng-template matMenuContent let-items="items">
<div class="tb-dashboard-context-menu-items">
<button mat-menu-item *ngFor="let item of items;"
[disabled]="!item.enabled"
(click)="item.action(dashboardContextMenuEvent)">
<span *ngIf="item.shortcut" class="tb-alt-text"> {{ item.shortcut | keyboardShortcut }}</span>
<mat-icon *ngIf="item.icon">{{item.icon}}</mat-icon>
<span translate>{{item.value}}</span>
</button>
</div>
</ng-template>
</mat-menu>
<div #widgetMenuTrigger="matMenuTrigger" style="visibility: hidden; position: fixed"
[style.left]="widgetMenuPosition.x"
[style.top]="widgetMenuPosition.y"
[matMenuTriggerFor]="widgetMenu">
</div>
<mat-menu #widgetMenu="matMenu">
<ng-template matMenuContent let-items="items" let-widget="widget">
<div class="tb-dashboard-context-menu-items">
<button mat-menu-item *ngFor="let item of items;"
[disabled]="!item.enabled"
(click)="item.action(widgetContextMenuEvent, widget)">
<span *ngIf="item.shortcut" class="tb-alt-text"> {{ item.shortcut | keyboardShortcut }}</span>
<mat-icon *ngIf="item.icon">{{item.icon}}</mat-icon>
<span translate>{{item.value}}</span>
</button>
</div>
</ng-template>
</mat-menu>
<div [ngClass]="dashboardClass" id="gridster-background" style="height: auto; min-height: 100%; display: inline;">
2019-09-03 19:31:16 +03:00
<gridster #gridster id="gridster-child" [options]="gridsterOpts">
<gridster-item [item]="widget" class="tb-noselect" *ngFor="let widget of dashboardWidgets">
2019-09-03 19:31:16 +03:00
<div tb-fullscreen [fullscreen]="widget.isFullscreen" (fullscreenChanged)="onWidgetFullscreenChanged($event, widget)"
fxLayout="column"
class="tb-widget"
[ngClass]="{
'tb-highlighted': isHighlighted(widget),
'tb-not-highlighted': isNotHighlighted(widget),
'mat-elevation-z4': widget.dropShadow,
'tb-has-timewindow': widget.hasTimewindow
}"
[ngStyle]="widget.style"
(mousedown)="widgetMouseDown($event, widget)"
(click)="widgetClicked($event, widget)"
(contextmenu)="openWidgetContextMenu($event, widget)">
<div fxLayout="row" fxLayoutAlign="space-between start">
<div class="tb-widget-title" fxLayout="column" fxLayoutAlign="center start" [fxShow]="widget.showWidgetTitlePanel">
<div *ngIf="widget.hasWidgetTitleTemplate">
TODO:
</div>
<span [fxShow]="widget.showTitle" [ngStyle]="widget.titleStyle" class="mat-subheading-2 title">
<mat-icon *ngIf="widget.showTitleIcon" [ngStyle]="widget.titleIconStyle">{{widget.titleIcon}}</mat-icon>
{{widget.title}}
</span>
2019-09-10 15:12:10 +03:00
<tb-timewindow *ngIf="widget.hasTimewindow"
2019-09-13 13:10:24 +03:00
#timewindowComponent
2019-09-10 15:12:10 +03:00
aggregation="{{widget.hasAggregation}}"
2019-10-24 19:52:19 +03:00
[ngModel]="widgetComponent.widget.config.timewindow"
2019-09-10 15:12:10 +03:00
(ngModelChange)="widgetComponent.onTimewindowChanged($event)">
</tb-timewindow>
2019-09-03 19:31:16 +03:00
</div>
<div [fxShow]="widget.showWidgetActions"
class="tb-widget-actions"
[ngClass]="{'tb-widget-actions-absolute': !(widget.showWidgetTitlePanel&&(widget.hasWidgetTitleTemplate||widget.showTitle||widget.hasAggregation))}"
fxLayout="row"
fxLayoutAlign="start center"
(mousedown)="$event.stopPropagation()">
<button mat-button mat-icon-button *ngFor="let action of widget.customHeaderActions"
[fxShow]="!isEdit"
2019-09-03 19:31:16 +03:00
(click)="action.onAction($event)"
matTooltip="{{ action.displayName }}"
matTooltipPosition="above">
<mat-icon>{{ action.icon }}</mat-icon>
</button>
<button mat-button mat-icon-button *ngFor="let action of widget.widgetActions"
[fxShow]="!isEdit && action.show"
2019-09-03 19:31:16 +03:00
(click)="action.onAction($event)"
matTooltip="{{ action.name | translate }}"
matTooltipPosition="above">
<mat-icon>{{ action.icon }}</mat-icon>
</button>
<button mat-button mat-icon-button
[fxShow]="!isEdit && widget.enableFullscreen"
2019-09-03 19:31:16 +03:00
(click)="widget.isFullscreen = !widget.isFullscreen"
matTooltip="{{(widget.isFullscreen ? 'fullscreen.exit' : 'fullscreen.expand') | translate}}"
matTooltipPosition="above">
<mat-icon>{{ widget.isFullscreen ? 'fullscreen_exit' : 'fullscreen' }}</mat-icon>
</button>
<button mat-button mat-icon-button
[fxShow]="isEditActionEnabled && !widget.isFullscreen"
2019-09-03 19:31:16 +03:00
(click)="editWidget($event, widget)"
matTooltip="{{ 'widget.edit' | translate }}"
matTooltipPosition="above">
<mat-icon>edit</mat-icon>
</button>
<button mat-button mat-icon-button
[fxShow]="isExportActionEnabled && !widget.isFullscreen"
2019-09-03 19:31:16 +03:00
(click)="exportWidget($event, widget)"
matTooltip="{{ 'widget.export' | translate }}"
matTooltipPosition="above">
<mat-icon>file_download</mat-icon>
</button>
<button mat-button mat-icon-button
[fxShow]="isRemoveActionEnabled && !widget.isFullscreen"
2019-09-13 13:10:24 +03:00
(click)="removeWidget($event, widget);"
2019-09-03 19:31:16 +03:00
matTooltip="{{ 'widget.remove' | translate }}"
matTooltipPosition="above">
<mat-icon>close</mat-icon>
</button>
</div>
</div>
<div fxFlex fxLayout="column" class="tb-widget-content">
<tb-widget fxFlex
2019-09-10 15:12:10 +03:00
#widgetComponent
[dashboardWidget]="widget"
[isEdit]="isEdit"
[isMobile]="isMobileSize"
[dashboard]="this">
</tb-widget>
2019-09-03 19:31:16 +03:00
</div>
</div>
</gridster-item>
</gridster>
</div>
</div>