Skip to content

Commit

Permalink
angular17
Browse files Browse the repository at this point in the history
  • Loading branch information
ben33880 committed Mar 17, 2024
1 parent 218cf6f commit 09f87d6
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 72 deletions.
128 changes: 66 additions & 62 deletions src/app/dashboard/dashboard.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
[animations]="animations"
[gradient]="gradient"
[tooltipDisabled]="tooltipDisabled"
(select)="open('state', $event)"
(select)="open('state', $event, test)"
[scheme]="colorSchemeGBROG"
[label]="advancedPieStateLabel"
[percentageFormatting]="percentageFormatting">
Expand Down Expand Up @@ -99,7 +99,7 @@
[animations]="animations"
[gradient]="gradient"
[tooltipDisabled]="tooltipDisabled"
(select)="open('device', $event)"
(select)="open('device', $event, test)"
[scheme]="colorSchemePC"
[label]="advancedPieDeviceLabel"
[percentageFormatting]="percentageFormatting">
Expand All @@ -126,7 +126,7 @@
[animations]="animations"
[gradient]="gradient"
[tooltipDisabled]="tooltipDisabled"
(select)="open('battery', $event)"
(select)="open('battery', $event, test)"
[scheme]="colorSchemeROBG"
[label]="advancedPieBatteryLabel"
[percentageFormatting]="percentageFormatting">
Expand All @@ -153,7 +153,7 @@
[animations]="animations"
[gradient]="gradient"
[tooltipDisabled]="tooltipDisabled"
(select)="open('certified', $event)"
(select)="open('certified', $event, test)"
[scheme]="colorSchemeGO"
[label]="advancedCertifiedLabel"
[percentageFormatting]="percentageFormatting">
Expand All @@ -169,6 +169,8 @@
</div>
</div>

<div #test class="d-flex justify-content-center"></div>

<div class="consent-banner" *ngIf="showConsent">
<div class="consent-banner__inner">
<div class="consent-banner__copy">
Expand All @@ -181,62 +183,64 @@
</div>
</div>
</div>

<p-overlayPanel #op [style.width]="widthOverlay" [showCloseIcon]="true" appendTo="body">
<ng-template pTemplate="content">
<p-table
[rowHover]="true"
styleClass="p-datatable-sm"
responsiveLayout="scroll"
[showCurrentPageReport]="true"
currentPageReportTemplate="{{ 'TOTAL' | translate }}"
[rowsPerPageOptions]="[10, 25, 50]"
[value]="devicesToOverlay"
[rows]="10"
[paginator]="true"
[scrollable]="true">
<ng-template pTemplate="header" let-columns>
<tr>
<th style="width: 7rem" pSortableColumn="_NwkId">
{{ 'device.byname.shortid.column' | translate }}<p-sortIcon field="_NwkId"></p-sortIcon>
</th>
<th style="width: 5rem" pSortableColumn="IEEE">
{{ 'device.byname.ieee.column' | translate }}<p-sortIcon field="IEEE"></p-sortIcon>
</th>
<th style="width: 13rem" pSortableColumn="Model">
{{ 'device.byname.model.column' | translate }}<p-sortIcon field="Model"></p-sortIcon>
</th>
<th style="width: 20rem" pSortableColumn="ZDeviceName">
{{ 'device.byname.devicename.column' | translate }}<p-sortIcon field="ZDeviceName"></p-sortIcon>
</th>
<th style="width: 7rem" pSortableColumn="Status">
{{ 'device.byname.status.column' | translate }}<p-sortIcon field="Status"></p-sortIcon>
</th>
<th style="width: 7rem" pSortableColumn="Battery">
{{ 'device.byname.battery.column' | translate }}<p-sortIcon field="Battery"></p-sortIcon>
</th>
<th style="width: 6rem" pSortableColumn="Health">
{{ 'device.byname.health.column' | translate }}<p-sortIcon field="Health"></p-sortIcon>
</th>
</tr>
</ng-template>
<ng-template
pTemplate="body"
let-editing="editing"
let-row
let-rowIndex="rowIndex"
let-columns="columns"
let-expanded="expanded">
<tr>
<td>{{ row._NwkId }}</td>
<td>{{ row.IEEE }}</td>
<td>{{ row.Model }}</td>
<td>{{ row.ZDeviceName }}</td>
<td>{{ row.Status }}</td>
<td>{{ row.Battery }}</td>
<td>{{ row.Health }}</td>
</tr>
</ng-template>
</p-table>
<p-dialog header="Header" [(visible)]="visible" [position]="'bottom'" [style]="{ width: '75vw' }">
<ng-template pTemplate="header">
<div class="col-sm" translate="dashboard.popup.device.header"></div>
</ng-template>
</p-overlayPanel>
<h5 class="card-title" [innerHTML]="'dashboard.popup.device.subtitle' | translate"></h5>
<p-table
#dt1
[rowHover]="true"
styleClass="p-datatable-sm"
responsiveLayout="scroll"
[showCurrentPageReport]="true"
currentPageReportTemplate="{{ 'TOTAL' | translate }}"
[rowsPerPageOptions]="[10, 25, 50]"
[value]="devicesToOverlay"
[rows]="10"
[paginator]="true"
[scrollable]="true">
<ng-template pTemplate="header" let-columns>
<tr>
<th style="width: 7rem" pSortableColumn="_NwkId">
{{ 'device.byname.shortid.column' | translate }}<p-sortIcon field="_NwkId"></p-sortIcon>
</th>
<th style="width: 5rem" pSortableColumn="IEEE">
{{ 'device.byname.ieee.column' | translate }}<p-sortIcon field="IEEE"></p-sortIcon>
</th>
<th style="width: 13rem" pSortableColumn="Model">
{{ 'device.byname.model.column' | translate }}<p-sortIcon field="Model"></p-sortIcon>
</th>
<th style="width: 20rem" pSortableColumn="ZDeviceName">
{{ 'device.byname.devicename.column' | translate }}<p-sortIcon field="ZDeviceName"></p-sortIcon>
</th>
<th style="width: 7rem" pSortableColumn="Status">
{{ 'device.byname.status.column' | translate }}<p-sortIcon field="Status"></p-sortIcon>
</th>
<th style="width: 7rem" pSortableColumn="Battery">
{{ 'device.byname.battery.column' | translate }}<p-sortIcon field="Battery"></p-sortIcon>
</th>
<th style="width: 6rem" pSortableColumn="Health">
{{ 'device.byname.health.column' | translate }}<p-sortIcon field="Health"></p-sortIcon>
</th>
</tr>
</ng-template>
<ng-template
pTemplate="body"
let-editing="editing"
let-row
let-rowIndex="rowIndex"
let-columns="columns"
let-expanded="expanded">
<tr>
<td>{{ row._NwkId }}</td>
<td>{{ row.IEEE }}</td>
<td>{{ row.Model }}</td>
<td>{{ row.ZDeviceName }}</td>
<td>{{ row.Status }}</td>
<td>{{ row.Battery }}</td>
<td>{{ row.Health }}</td>
</tr>
</ng-template>
</p-table>
</p-dialog>
11 changes: 4 additions & 7 deletions src/app/dashboard/dashboard.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, HostListener, OnInit, ViewChild } from '@angular/core';
import { Component, ElementRef, HostListener, OnInit, ViewChild } from '@angular/core';
import { Logger } from '@app/core';
import { ApiService } from '@app/services/api.service';
import { HeaderService } from '@app/services/header-service';
Expand All @@ -24,8 +24,7 @@ const log = new Logger('DashboardComponent');
styleUrls: ['./dashboard.component.scss']
})
export class DashboardComponent extends UnsubscribeOnDestroyAdapter implements OnInit {
@ViewChild('op') overlay: OverlayPanel;

visible: boolean = false;
settingsToSave: Array<Setting> = [];
showConsent = false;

Expand All @@ -47,7 +46,6 @@ export class DashboardComponent extends UnsubscribeOnDestroyAdapter implements O
certifiedDevices: any;
notCertifiedDevices: any;
devicesToOverlay: any[];
widthOverlay: number;
battery1: any;
battery2: any;
battery3: any;
Expand Down Expand Up @@ -276,7 +274,7 @@ export class DashboardComponent extends UnsubscribeOnDestroyAdapter implements O
this.subs.add(this.chart.ref$.subscribe());
}

open(name: string, event: any) {
open(name: string, event: any, test: any) {
if (name === 'device') {
if (event.name === this.translateService.instant('dashboard.devices.routers')) {
this.devicesToOverlay = this.routers;
Expand Down Expand Up @@ -315,8 +313,7 @@ export class DashboardComponent extends UnsubscribeOnDestroyAdapter implements O

const width = (this.getScreenWidth * 80) / 100;
if (width > 768) {
this.widthOverlay = width;
this.overlay.toggle(event);
this.visible = true;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
<i
class="fas fa-cog"
style="cursor: pointer"
[style.color]="row.CheckParam ? 'red' : 'back'"
[style.color]="row.CheckParam ? 'orange' : 'green'"
(click)="rowParameter = row; editParameter(editContent)"></i>
</td>
</tr>
Expand Down
4 changes: 2 additions & 2 deletions src/app/shared/shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { nl2brPipe } from './utils/nl2br.pipe';
import { TableModule } from 'primeng/table';
import { ButtonModule } from 'primeng/button';
import { InputTextModule } from 'primeng/inputtext';
import { OverlayPanelModule } from 'primeng/overlaypanel';
import { DialogModule } from 'primeng/dialog';

@NgModule({
imports: [CommonModule, NgSelectModule, TranslateModule],
Expand All @@ -24,7 +24,7 @@ import { OverlayPanelModule } from 'primeng/overlaypanel';
NgSelectModule,
TranslateModule,
TableModule,
OverlayPanelModule,
DialogModule,
InputTextModule,
ButtonModule,
DatePipe,
Expand Down

0 comments on commit 09f87d6

Please sign in to comment.