- {{element.name}}
+ {{element.name}}
+ {{element.name}}
|
{{'GEN.DATE' | translate}}
diff --git a/src/app/gateway/gateway-status/gateway-status.component.scss b/src/app/gateway/gateway-status/gateway-status.component.scss
index ed89726e2..18ded2fbf 100644
--- a/src/app/gateway/gateway-status/gateway-status.component.scss
+++ b/src/app/gateway/gateway-status/gateway-status.component.scss
@@ -99,3 +99,7 @@ $cellFontSize: 0.9rem;
width: 180px;
font-size: $cellFontSize;
}
+
+.title {
+ margin-bottom: 0 !important;
+}
diff --git a/src/app/gateway/gateway-status/gateway-status.component.ts b/src/app/gateway/gateway-status/gateway-status.component.ts
index f66f0bcf3..f569027db 100644
--- a/src/app/gateway/gateway-status/gateway-status.component.ts
+++ b/src/app/gateway/gateway-status/gateway-status.component.ts
@@ -15,7 +15,8 @@ import { LoRaWANGatewayService } from '@shared/services/lorawan-gateway.service'
import * as moment from 'moment';
import { Observable, Subject, Subscription } from 'rxjs';
import { GatewayStatusInterval } from '../enums/gateway-status-interval.enum';
-import { GatewayStatus, GatewayStatusResponse } from '../gateway.model';
+import { GatewayStatus, AllGatewayStatusResponse } from '../gateway.model';
+import { map } from 'rxjs/operators';
interface TimeColumn {
exactTimestamp: string;
@@ -34,6 +35,8 @@ export class GatewayStatusComponent implements AfterContentInit, OnDestroy {
@Input() isVisibleSubject: Subject;
@Input() paginatorClass: string;
@Input() title: string;
+ @Input() gatewayId: string;
+ @Input() shouldLinkToDetails = true;
private gatewayStatusSubscription: Subscription;
private readonly columnGatewayName = 'gatewayName';
@@ -95,7 +98,7 @@ export class GatewayStatusComponent implements AfterContentInit, OnDestroy {
private getGatewayStatus(
organizationId = this.organizationId,
timeInterval = this.selectedStatusInterval
- ): Observable {
+ ): Observable {
const params: Record = {
timeInterval,
// Paginator is only avaiable in ngAfterViewInit
@@ -107,7 +110,16 @@ export class GatewayStatusComponent implements AfterContentInit, OnDestroy {
params.organizationId = organizationId;
}
- return this.lorawanGatewayService.getAllStatus(params);
+ return !this.gatewayId
+ ? this.lorawanGatewayService.getAllStatus(params)
+ : this.lorawanGatewayService
+ .getStatus(this.gatewayId, { timeInterval })
+ .pipe(
+ map(
+ (response) =>
+ ({ data: [response], count: 1 } as AllGatewayStatusResponse)
+ )
+ );
}
private subscribeToGetAllGatewayStatus(
@@ -128,7 +140,7 @@ export class GatewayStatusComponent implements AfterContentInit, OnDestroy {
});
}
- private handleStatusResponse(response: GatewayStatusResponse) {
+ private handleStatusResponse(response: AllGatewayStatusResponse) {
this.resultsLength = response.count;
const gatewaysWithLatestTimestampsPerHour = this.takeLatestTimestampInHour(
response.data
diff --git a/src/app/gateway/gateway.model.ts b/src/app/gateway/gateway.model.ts
index 1da46e785..56efa7d94 100644
--- a/src/app/gateway/gateway.model.ts
+++ b/src/app/gateway/gateway.model.ts
@@ -59,7 +59,7 @@ export interface GatewayStats {
txPacketsEmitted: number;
}
-export interface GetGatewayStatusParameters {
+export interface GetAllGatewayStatusParameters {
limit?: number;
offset?: number;
organizationId?: number;
@@ -71,13 +71,17 @@ export interface StatusTimestamp {
wasOnline: boolean;
}
+export interface GetGatewayStatusParameters {
+ timeInterval?: GatewayStatusInterval;
+}
+
export interface GatewayStatus {
id: string;
name: string;
statusTimestamps: StatusTimestamp[];
}
-export interface GatewayStatusResponse {
+export interface AllGatewayStatusResponse {
data: GatewayStatus[];
count: number;
}
diff --git a/src/app/gateway/gateway.module.ts b/src/app/gateway/gateway.module.ts
index cf8d06dc1..4f6c01562 100644
--- a/src/app/gateway/gateway.module.ts
+++ b/src/app/gateway/gateway.module.ts
@@ -14,6 +14,7 @@ import { FormModule } from '@shared/components/forms/form.module';
import { SharedModule } from '@shared/shared.module';
import { PipesModule } from '@shared/pipes/pipes.module';
import { GatewayStatusComponent } from './gateway-status/gateway-status.component';
+import { GraphModule } from '@app/graph/graph.module';
const gatewayRoutes: Routes = [
{
@@ -49,6 +50,7 @@ const gatewayRoutes: Routes = [
RouterModule.forChild(gatewayRoutes),
SharedModule,
PipesModule,
+ GraphModule,
],
exports: [
GatewayTableComponent,
diff --git a/src/app/graph/graph.component.html b/src/app/graph/graph.component.html
index 0e724195c..1c8030cf3 100644
--- a/src/app/graph/graph.component.html
+++ b/src/app/graph/graph.component.html
@@ -1,12 +1,12 @@
-
-
+
+
{{title}}
- {{ 'GEN.NO-DATA' | translate }}
+ {{ 'GEN.NO-DATA' | translate }}
diff --git a/src/app/graph/graph.component.ts b/src/app/graph/graph.component.ts
index 2710eca4b..e1d0d478d 100644
--- a/src/app/graph/graph.component.ts
+++ b/src/app/graph/graph.component.ts
@@ -19,9 +19,19 @@ export class GraphComponent implements OnChanges {
@Input() data: ChartConfiguration['data'];
@Input() type: ChartConfiguration['type'];
@Input() options: ChartConfiguration['options'] = {
+ plugins: { legend: { display: false } },
responsive: true,
+ layout: {
+ padding: {
+ top: 15,
+ left: 10,
+ right: 10,
+ },
+ },
};
@Input() title: string;
+ @Input() graphCardClass: string;
+ @Input() graphHeaderClass: string;
chartInstance: Chart = null;
isGraphEmpty: boolean;
@@ -72,13 +82,13 @@ export class GraphComponent implements OnChanges {
? {
...options,
scales: {
- ...options.scales,
+ ...options?.scales,
x: {
- ...options.scales.x,
+ ...options?.scales?.x,
display: false,
},
y: {
- ...options.scales.y,
+ ...options?.scales?.y,
display: false,
},
},
diff --git a/src/app/shared/constants/color-constants.ts b/src/app/shared/constants/color-constants.ts
new file mode 100644
index 000000000..19b9b6c5a
--- /dev/null
+++ b/src/app/shared/constants/color-constants.ts
@@ -0,0 +1 @@
+export const ColorGraphBlue1 = '#03AEEF';
diff --git a/src/app/shared/services/lorawan-gateway.service.ts b/src/app/shared/services/lorawan-gateway.service.ts
index c07d193b5..21b0afb87 100644
--- a/src/app/shared/services/lorawan-gateway.service.ts
+++ b/src/app/shared/services/lorawan-gateway.service.ts
@@ -1,7 +1,9 @@
import { Injectable } from '@angular/core';
import {
- GatewayStatusResponse,
+ AllGatewayStatusResponse,
+ GetAllGatewayStatusParameters,
GetGatewayStatusParameters,
+ GatewayStatus,
} from '@app/gateway/gateway.model';
import { Observable } from 'rxjs';
import { RestService } from './rest.service';
@@ -15,8 +17,19 @@ export class LoRaWANGatewayService {
constructor(private restService: RestService) {}
public getAllStatus(
- params: GetGatewayStatusParameters
- ): Observable {
+ params: GetAllGatewayStatusParameters
+ ): Observable {
return this.restService.get(`${this.baseUrl}/status`, params);
}
+
+ public getStatus(
+ id: string,
+ params: GetGatewayStatusParameters
+ ): Observable {
+ return this.restService.get(
+ `${this.baseUrl}/status`,
+ params,
+ id
+ );
+ }
}
diff --git a/src/assets/i18n/da.json b/src/assets/i18n/da.json
index 273a64c6f..1a2708dc0 100644
--- a/src/assets/i18n/da.json
+++ b/src/assets/i18n/da.json
@@ -13,7 +13,12 @@
"VALUE": "Værdi",
"NAME": "Navn",
"DESCRIPTION": "Beskrivelse",
- "to": "til"
+ "to": "til",
+ "ONLINE": "Online",
+ "OFFLINE": "Offline",
+ "NEVER-SEEN": "Aldrig set",
+ "DATE": "Dato",
+ "NO-DATA": "Der er ingen data at vise"
},
"NAV": {
"APPLICATIONS": "Applikationer",
@@ -160,13 +165,15 @@
"NAME": "Gatewayens navn",
"STATS": "Statistik",
"STATS-RXPACKETSRECEIVED": "Pakker modtaget",
- "STATS-TXPACKETSEMITTED": "Pakker Sendt",
+ "STATS-TXPACKETSEMITTED": "Pakker sendt",
"STATS-TIMESTAMP": "Tidspunkt",
"TABEL-TAB": "Listevisning",
"DROPDOWNFILTER": "Organisationsfilter",
"DROPDOWNDEFAULT": "Alle",
"MAP-TAB": "Kort",
- "ORGANIZATION": "Organisation"
+ "ORGANIZATION": "Organisation",
+ "ONLINE-STATUS": "Online status",
+ "DATA-PACKETS": "Datapakker"
},
"IOT-DEVICE": {
"CREATE": "Gem IoT enhed",
@@ -301,6 +308,15 @@
"STATUS": "Status",
"ORGANIZATION": "Organisation"
},
+ "LORA-GATEWAY-STATUS": {
+ "TITLE": "LoRaWAN online status historik",
+ "TIMESTAMP": "Tidspunkt",
+ "INTERVAL": {
+ "DAY": "Seneste døgn",
+ "WEEK": "Seneste uge",
+ "MONTH": "Seneste måned"
+ }
+ },
"DEVICE-MODEL": {
"DELETE-FAILED":"Slet Fejlede",
"HEADLINE":"Detaljer",
@@ -1069,8 +1085,5 @@
"GIVE-DATATARGET-CONTEXT-INFO": "hvis tom, skal den angives i 'payload'",
"GIVE-DATATARGET-CONTEXT-PLACEHOLDER": "https://os2iot/context-file.json"
}
- },
- "GRAPH": {
- "NO-DATA": "Der er ingen data at vise"
}
}
diff --git a/src/styles.scss b/src/styles.scss
index 09fd330b2..7c28ffbd2 100644
--- a/src/styles.scss
+++ b/src/styles.scss
@@ -94,6 +94,10 @@ body {
white-space: pre-line;
}
+.mat-card-header-text-ml-0 .mat-card-header-text {
+ margin-left: 0;
+}
+
.welcome-screen .mat-dialog-container {
background-color: #55b156;
}
|