Storage
|
-
+ |
{{formatBytes(getUsage(device)?.bytes || 0)}}
|
diff --git a/src/app/modules/devices/device-instances/device-instances.component.ts b/src/app/modules/devices/device-instances/device-instances.component.ts
index 166168a9..e45e0b68 100644
--- a/src/app/modules/devices/device-instances/device-instances.component.ts
+++ b/src/app/modules/devices/device-instances/device-instances.component.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import {AfterViewInit, Component, OnInit, ViewChild} from '@angular/core';
+import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core';
import {DeviceInstancesService} from './shared/device-instances.service';
import {DeviceConnectionState, DeviceInstancesModel, DeviceInstancesTotalModel, FilterSelection, SelectedTag} from './shared/device-instances.model';
@@ -39,7 +39,6 @@ import { SearchbarService } from 'src/app/core/components/searchbar/shared/searc
import { DeviceInstancesFilterDialogComponent } from './dialogs/device-instances-filter-dialog/device-instances-filter-dialog.component';
import { MatDialog } from '@angular/material/dialog';
import { ExportDataService } from 'src/app/widgets/shared/export-data.service';
-
export interface DeviceInstancesRouterState {
type: DeviceInstancesRouterStateTypesEnum | undefined | null;
tab: DeviceInstancesRouterStateTabEnum | undefined | null;
@@ -90,10 +89,11 @@ export class DeviceInstancesComponent implements OnInit, AfterViewInit {
offset = 0;
ready = false;
searchText = '';
- usage : {
+ usage: {
deviceId: string;
updateAt: Date;
bytes: number;
+ bytesPerDay: number;
}[] = [];
@ViewChild('paginator', { static: false }) paginator!: MatPaginator;
@@ -106,8 +106,8 @@ export class DeviceInstancesComponent implements OnInit, AfterViewInit {
private searchSub: Subscription = new Subscription();
sortBy: string = "display_name"
- sortDirection: SortDirection = "asc"
-
+ sortDirection: SortDirection = "asc"
+
userHasUpdateAuthorization: boolean = false
userHasDeleteAuthorization: boolean = false
@@ -117,7 +117,7 @@ export class DeviceInstancesComponent implements OnInit, AfterViewInit {
}
ngAfterViewInit(): void {
- this.paginator.page.subscribe(()=>{
+ this.paginator.page.subscribe(() => {
this.pageSize = this.paginator.pageSize;
this.offset = this.paginator.pageSize * this.paginator.pageIndex;
this.load().subscribe();
@@ -125,25 +125,25 @@ export class DeviceInstancesComponent implements OnInit, AfterViewInit {
}
checkAuthorization() {
- if (this.exportDataService.userHasUsageAuthroization()){
+ if (this.exportDataService.userHasUsageAuthroization()) {
this.displayedColumns.splice(4, 0, 'usage')
}
- this.userHasUpdateAuthorization = this.deviceInstancesService.userHasUpdateAuthorization()
- if(this.userHasUpdateAuthorization) {
+ this.userHasUpdateAuthorization = this.deviceInstancesService.userHasUpdateAuthorization()
+ if (this.userHasUpdateAuthorization) {
this.displayedColumns.push("edit")
}
-
+
this.userHasDeleteAuthorization = this.deviceInstancesService.userHasDeleteAuthorization()
- if(this.userHasDeleteAuthorization) {
+ if (this.userHasDeleteAuthorization) {
this.displayedColumns.push("delete")
}
-
- if(this.deviceTypesService.userHasReadAuthorization()) {
+
+ if (this.deviceTypesService.userHasReadAuthorization()) {
this.displayedColumns.splice(4, 0, 'device_type')
}
- if(this.deviceInstancesService.userHasCreateAuthorization()) {
+ if (this.deviceInstancesService.userHasCreateAuthorization()) {
this.displayedColumns.push("duplicate")
}
}
@@ -156,9 +156,9 @@ export class DeviceInstancesComponent implements OnInit, AfterViewInit {
}
matSortChange($event: Sort) {
- this.sortBy = $event.active
+ this.sortBy = $event.active
- if(this.sortBy == 'log_state') {
+ if (this.sortBy == 'log_state') {
this.sortBy = "annotations.connected"
}
this.sortDirection = $event.direction;
@@ -167,7 +167,7 @@ export class DeviceInstancesComponent implements OnInit, AfterViewInit {
private loadDevicesByIds(): Observable