Skip to content

Commit

Permalink
Updated Chirpstack from V3 to V4 (#152)
Browse files Browse the repository at this point in the history
* Fixed routing of gateway list + fixed memory leak by unsubscribing properly from gateway fetches

* Fixed routing errors in gateway list

* Changed mqtt datatarget topic placeholder + added tooltip

* Added additional text changes from Product Owner

* Removed maxLenght from device AND gateway EUI, now removes non-hex digits on submit

* Gateway upgrades to get data from v4.

* Added sticky to name column on gateway status table

* Implemented application table column selection

* Removed unused controller name from select

* Moved column selector to own component + implemented column selection on iot-device table

* Changed datastructure of gateway to match database + Column administration on gateway-status-table

* Changed column selector for a cog icon button

* Chirpstack updates.

* small fixes after merge

* Spinner for device profiles

* changed printhWidth to match backend

* fresh package-lock

* updated to node-version 18 on github

* First set of pr changes

* some PR changes before merge

* PR changes and added prettier from backend so it can match with frontend (both are nodejs, so shouldn't it be the same?)

* Updated package-lock and bumped monaco-editor down to 0.33

* Fixes

* da.json addition

---------

Co-authored-by: Frederik Christ Vestergaard <[email protected]>
Co-authored-by: August Andersen <[email protected]>
  • Loading branch information
3 people authored Dec 15, 2023
1 parent a9603f3 commit c4cafb1
Show file tree
Hide file tree
Showing 58 changed files with 1,398 additions and 1,984 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/on-push-pr.action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- uses: actions/setup-node@v3
name: Set NodeJS version
with:
node-version: 14
node-version: 18
- name: Install packages
run: "npm ci"
- name: Build source
Expand Down
4 changes: 0 additions & 4 deletions .prettierrc

This file was deleted.

11 changes: 11 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
trailingComma: "es5",
tabWidth: 4,
printWidth: 120,
semi: true,
singleQuote: false,
useTabs: false,
bracketSpacing: true,
arrowParens: "avoid",
endOfLine: "auto",
};
575 changes: 278 additions & 297 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"jwt-decode": "^3.1.2",
"leaflet": "^1.7.1",
"moment": "^2.29.4",
"monaco-editor": "^0.44.0",
"monaco-editor": "^0.33.0",
"ng": "0.0.0",
"ng-inline-svg": "^11.0.0",
"ngx-monaco-editor-v2": "^14.0.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<table mat-table [dataSource]="data" class="example-table" matSort matSortActive="name" matSortDisableClear
matSortDirection="asc">

<!-- Name Column -->
<ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef mat-sort-header class="col-2">
{{ 'APPLICATION-TABLE.NAME' | translate }}
Expand Down Expand Up @@ -45,7 +44,6 @@
</td>
</ng-container>

<!-- Devices Column -->
<ng-container matColumnDef="devices">
<th mat-header-cell *matHeaderCellDef mat-sort-header class="col-2">
{{ 'APPLICATION-TABLE.IOT-DEVICES' | translate }}</th>
Expand Down Expand Up @@ -136,7 +134,6 @@
</td>
</ng-container>

<!-- Menu Column -->
<ng-container matColumnDef="menu">
<th mat-header-cell *matHeaderCellDef class="col-1"></th>
<td mat-cell *matCellDef="let element">
Expand Down
3 changes: 0 additions & 3 deletions src/app/applications/bulk-import/bulk-mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ export class BulkMapping {
applicationSessionKey: data.applicationSessionKey
? data.applicationSessionKey
: undefined,
serviceProfileID: data.serviceProfileID
? data.serviceProfileID
: undefined,
deviceProfileID: data.deviceProfileID ? data.deviceProfileID : undefined,
fCntUp: data.fCntUp ? +data.fCntUp : undefined,
nFCntDown: data.nFCntDown ? +data.nFCntDown : undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class DownlinkComponent implements OnInit {
if (error?.error?.chirpstackError?.error == "f_port must be > 0") {
this.errorMessages = ["port must be > 0"]
return;
}
}
this.errorMessages = this.errorMessageService.handleErrorMessage(error);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<p><strong>{{ 'IOTDEVICE.LORA.DEVEUI' | translate }}</strong>{{device.lorawanSettings.devEUI}}</p>
<p><strong>{{ 'IOTDEVICE.LORA.SERVICEPROFILE' | translate }}</strong>{{serviceProfileName}}</p>
<p><strong>{{ 'IOTDEVICE.LORA.DEVICEPROFILE' | translate }}</strong>{{deviceProfileName}}</p>
<ng-container *ngIf="OTAA">
<p><strong>{{ 'IOTDEVICE.LORA.OTAAAPPLICATIONKEY' | translate }}</strong>{{device.lorawanSettings?.OTAAapplicationKey}}
Expand All @@ -15,4 +14,4 @@
<p><strong>{{ 'IOTDEVICE.LORA.NFCNTDOWN' | translate }}</strong>{{device.lorawanSettings?.nFCntDown }}</p>
</ng-container>
<p><strong>{{ 'IOTDEVICE.LORA.SKIPFCNTCHECK' | translate }}</strong>{{device.lorawanSettings?.skipFCntCheck | yesNo}}
</p>
</p>
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { Component, Input, OnInit } from '@angular/core';
import { IotDevice } from '@applications/iot-devices/iot-device.model';
import { DeviceProfileService } from '@profiles/device-profiles/device-profile.service';
import { ServiceProfileResponseOne } from '@profiles/service-profiles/service-profile.model';
import { ServiceProfileService } from '@profiles/service-profiles/service-profile.service';
import { Subscribable, Subscription } from 'rxjs';
import { Subscription } from 'rxjs';

@Component({
selector: 'app-iot-device-detail-lorawan',
Expand All @@ -16,16 +14,13 @@ export class IotDeviceDetailLorawanComponent implements OnInit {
deviceProfileSubscription: Subscription;
public OTAA: boolean;
public deviceProfileName: string;
public serviceProfileName: string;

constructor(
private deviceProfileService: DeviceProfileService,
private serviceProfileService: ServiceProfileService
) { }

ngOnInit(): void {
this.getDeviceProfil();
this.getServiceProfil();
}

getDeviceProfil() {
Expand All @@ -35,12 +30,4 @@ export class IotDeviceDetailLorawanComponent implements OnInit {
this.deviceProfileName = response.deviceProfile.name;
});
}

getServiceProfil() {
this.deviceProfileSubscription = this.serviceProfileService.getOne(this.device.lorawanSettings?.serviceProfileID)
.subscribe((response: ServiceProfileResponseOne) => {
this.serviceProfileName = response.serviceProfile.name;
});
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,6 @@ <h3>{{'IOTDEVICE.LORAWANSETUP' | translate}}</h3>
[ngClass]="{'is-invalid' : formFailedSubmit && errorFields.includes('devEUI'), 'is-valid' : formFailedSubmit && !errorFields.includes('devEUI')}">
</div>

<ng-container *ngIf="iotDevice.lorawanSettings.serviceProfileID || serviceProfiles">
<div class="form-group mt-3 col-12">
<label class="form-label" for="serviceProfileID">{{'QUESTION.CHOOSE-SERVICEPROFILE' | translate}}</label>*
<select id="serviceProfileID" class="form-select" name="serviceProfileID"
[(ngModel)]="iotDevice.lorawanSettings.serviceProfileID" required
[value]="iotDevice.lorawanSettings.serviceProfileID" [disabled]="editmode"
[ngClass]="{'is-invalid' : formFailedSubmit && errorFields.includes('serviceProfileID'), 'is-valid' : formFailedSubmit && !errorFields.includes('serviceProfileID')}">
<option *ngFor="let serviceProfile of serviceProfiles" [value]="serviceProfile.id"
[selected]="serviceProfile.id === iotDevice.lorawanSettings.serviceProfileID">
{{serviceProfile.name}}
</option>
</select>
</div>
</ng-container>
<ng-container *ngIf="iotDevice.lorawanSettings.deviceProfileID || deviceProfiles">
<div class="form-group mt-3 col-12">
<label class="form-label" for="deviceProfileID">{{'QUESTION.CHOOSE-DEVICE' | translate}}</label>*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ import { DeviceModel } from '@app/device-model/device.model';
import { TranslateService } from '@ngx-translate/core';
import { DeviceProfile } from '@profiles/device-profiles/device-profile.model';
import { DeviceProfileService } from '@profiles/device-profiles/device-profile.service';
import {
ServiceProfile,
ServiceProfileResponseMany,
} from '@profiles/service-profiles/service-profile.model';
import { ServiceProfileService } from '@profiles/service-profiles/service-profile.service';
import { ActivationType } from '@shared/enums/activation-type';
import { DeviceType } from '@shared/enums/device-type';
import { ErrorMessageService } from '@shared/error-message.service';
Expand Down Expand Up @@ -42,7 +37,6 @@ export class IotDeviceEditComponent implements OnInit, OnDestroy {
public disableChoseApplication = true;
public loraDevice = DeviceType.LORAWAN;
public sigfoxDevice = DeviceType.SIGFOX;
public serviceProfiles: ServiceProfile[];
public deviceProfiles: DeviceProfile[];
public deviceModels: DeviceModel[];
iotDevice = new IotDevice();
Expand All @@ -52,7 +46,6 @@ export class IotDeviceEditComponent implements OnInit, OnDestroy {
errorMetadataFieldId: string | undefined;
public deviceSubscription: Subscription;
private applicationsSubscription: Subscription;
private serviceProfilesSubscription: Subscription;
private deviceProfileSubscription: Subscription;
private devicesProfileSubscription: Subscription;
canEdit: boolean;
Expand All @@ -61,7 +54,6 @@ export class IotDeviceEditComponent implements OnInit, OnDestroy {
private route: ActivatedRoute,
public translate: TranslateService,
private router: Router,
private serviceProfileService: ServiceProfileService,
private deviceProfileService: DeviceProfileService,
private applicationService: ApplicationService,
private iotDeviceService: IoTDeviceService,
Expand Down Expand Up @@ -90,7 +82,6 @@ export class IotDeviceEditComponent implements OnInit, OnDestroy {
});

this.getApplication();
this.getServiceProfiles();
this.getDeviceProfiles();
this.getDeviceModels();
this.canEdit = this.meService.hasAccessToTargetOrganization(
Expand Down Expand Up @@ -177,16 +168,6 @@ export class IotDeviceEditComponent implements OnInit, OnDestroy {
});
}

getServiceProfiles() {
this.serviceProfilesSubscription = this.serviceProfileService
.getMultiple()
.subscribe((result: ServiceProfileResponseMany) => {
this.serviceProfiles = result.result.sort((a, b) =>
a.name.localeCompare(b.name, 'en', { numeric: true })
);
});
}

getDeviceProfiles() {
this.devicesProfileSubscription = this.deviceProfileService
.getMultiple()
Expand Down Expand Up @@ -403,8 +384,5 @@ export class IotDeviceEditComponent implements OnInit, OnDestroy {
if (this.devicesProfileSubscription) {
this.devicesProfileSubscription.unsubscribe();
}
if (this.serviceProfilesSubscription) {
this.serviceProfilesSubscription.unsubscribe();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class MulticastDetailComponent implements OnInit, OnDestroy {
this.multicastService
.multicastGet(this.multicast.id)
.subscribe((response: any) => {
if (response.totalCount > 0) {
if (response.deviceQueueItems.length > 0) {
this.openDownlinkDialog();
} else {
this.startDownlink();
Expand Down
6 changes: 3 additions & 3 deletions src/app/gateway/gateway-detail/gateway-detail.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<div class="col-md-6 d-flex align-items-stretch">
<div class="jumbotron jumbotron--m-right jumbotron--full-width">
<h3>{{ 'GATEWAY.DETAILS' | translate }}</h3>
<p><strong>{{ 'GATEWAY.ID' | translate }}</strong>{{gateway.id}}</p>
<p><strong>{{ 'GATEWAY.ORGANIZATION' | translate }}</strong>{{gateway.internalOrganizationName}}</p>
<p><strong>{{ 'GATEWAY.ID' | translate }}</strong>{{gateway.gatewayId}}</p>
<p><strong>{{ 'GATEWAY.ORGANIZATION' | translate }}</strong>{{gateway.organizationName}}</p>
<app-general-details [data]="gateway"></app-general-details>
<p><strong>{{ 'GATEWAY.TAGS' | translate }}</strong>{{gateway.tagsString}}</p>
<p *ngIf="gateway.description">
Expand Down Expand Up @@ -50,7 +50,7 @@ <h3>{{ 'GATEWAY.LOCATION' | translate }}</h3>
<div class="row">
<div class="col-12">
<div class="jumbotron">
<app-gateway-status [isVisibleSubject]="isGatewayStatusVisibleSubject" [gatewayId]="id" paginatorClass="d-none"
<app-gateway-status [isVisibleSubject]="isGatewayStatusVisibleSubject" [gatewayId]="gatewayId" paginatorClass="d-none"
[shouldLinkToDetails]="false" [title]="'GATEWAY.ONLINE-STATUS' | translate">
</app-gateway-status>
</div>
Expand Down
Loading

0 comments on commit c4cafb1

Please sign in to comment.