Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/iot 16 multicast frontend #60

Merged
merged 20 commits into from
Jan 6, 2022
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
456672f
Made the first additions to multicast in frontend. Will try to connec…
Nov 16, 2021
f73d376
Minor changes to make it work with backend.
Nov 17, 2021
6d8c989
Minor changes so detail page will show how updated/created the multicast
Nov 19, 2021
16038ff
Moved two buttons, multicast and datatargets, to a tab bar in applica…
Nov 23, 2021
473c763
minor typo fix
Nov 24, 2021
7fffca2
Finalized CRUD in frontend. Removed list maps from datatarget and mul…
Nov 25, 2021
976b6bd
Merge branch 'master' into feature/IOT-16_FrontendCRUD
Nov 25, 2021
cb783e3
changed division in db so the frontend will receive a different promi…
Nov 29, 2021
8c02051
First additions to "add device to multicast". A dropdown is made with…
Nov 29, 2021
a73a2b6
Made frontend functionality so you can add devices to a multicast whe…
Nov 30, 2021
513ddc7
made snack for fail to load on multicast edit page
Nov 30, 2021
e25152c
removed 2 console logs
Dec 1, 2021
2635888
Message to multicast. Made the form and service operations to send to…
Dec 2, 2021
5f88b68
Changed details page. Not splitted up in basic details, and lorawan d…
Dec 6, 2021
5780eae
PR changes plus search function for devices in multicast
Dec 14, 2021
e859ab1
PR changes - fixed pagination for multicast
Dec 15, 2021
144a650
Minor snack changes and check if devices is included before sending d…
Dec 16, 2021
44de7a5
PR Changes
Dec 22, 2021
7112f40
merge conflicting
Jan 6, 2022
75d5641
Merge branch 'stage' into feature/IOT-16_MulticastFrontend
Jan 6, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<div *ngIf="application">
<app-top-bar [data]="application" [backButton]="backButton" [subPage]="true"
[dtRouterLink]="['datatarget-list', application.name]" [dtLabel]="'APPLICATION.DATATARGET-SHOW' | translate"
[addDetailDowndown]="true" [dropDownButton]="dropdownButton" (deleteSelectedInDropdown)="onDeleteApplication()">
</app-top-bar>
<div class="container-fluid">
Expand All @@ -18,22 +17,68 @@ <h3>Detaljer</h3>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="jumbotron">
<div *ngIf="canEdit else readOnly">
<app-top-bar-table [component]="true" [title]="'APPLICATION.ATTACHED-IOT' | translate"
[ctaLabelPrimary]="'FORM.CREATE-NEW-IOT-DEVICE' | translate" [ctaRouterLinkPrimary]="'new-iot-device'"
[ctaLabelSecondary]="'APPLICATION.IMPORT-CSV' | translate" [ctaRouterLinkSecondary]="'bulk-import'">
</app-top-bar-table>
<mat-tab-group animationDuration="200ms">
<mat-tab label="{{'APPLICATION.IOT-DEVICES' | translate}}">
<div class="jumbotron--table">
<div class="row">
<div class="col-sm-12">
<div class="jumbotron">
<div *ngIf="canEdit else readOnly">
<app-top-bar-table [component]="true" [title]="'APPLICATION.ATTACHED-IOT' | translate"
[ctaLabelPrimary]="'FORM.CREATE-NEW-IOT-DEVICE' | translate" [ctaRouterLinkPrimary]="'new-iot-device'"
[ctaLabelSecondary]="'APPLICATION.IMPORT-CSV' | translate" [ctaRouterLinkSecondary]="'bulk-import'">
</app-top-bar-table>
</div>
<ng-template #readOnly>
<app-top-bar-table [component]="true" [title]="'APPLICATION.ATTACHED-IOT' | translate">
</app-top-bar-table>
</ng-template>
<app-iot-devices-table [applicationId]="id"></app-iot-devices-table>
</div>
</div>
</div>
<ng-template #readOnly>
<app-top-bar-table [component]="true" [title]="'APPLICATION.ATTACHED-IOT' | translate">
</app-top-bar-table>
</ng-template>
<app-iot-devices-table [applicationId]="id"></app-iot-devices-table>
</div>
</div>
</div>
</mat-tab>
<mat-tab label="{{'APPLICATION.MULTICAST-GROUPS' | translate}}">
<div class="jumbotron--table">
<div class="row">
<div class="col-sm-12">
<div class="jumbotron">
<div *ngIf="canEdit else readOnly">
<app-top-bar-table [component]="true" [title]="'APPLICATION.MULTICAST-SHOW' | translate"
[ctaLabelPrimary]="'FORM.CREATE-NEW-MULTICAST' | translate" [ctaRouterLinkPrimary]="'multicast-edit'">
</app-top-bar-table>
</div>
<ng-template #readOnly>
<app-top-bar-table [component]="true" [title]="'APPLICATION.ATTACHED-IOT' | translate">
</app-top-bar-table>
</ng-template>
<app-multicast-table></app-multicast-table>
</div>
</div>
</div>
</div>
</mat-tab>
<mat-tab label="{{'APPLICATION.DATATARGET-SHOW' | translate}}">
<div class="jumbotron--table">
<div class="row">
<div class="col-sm-12">
<div class="jumbotron">
<div *ngIf="canEdit else readOnly">
<app-top-bar-table [component]="true" [title]="'APPLICATION.DATATARGET-SHOW' | translate"
[ctaLabelPrimary]="'FORM.CREATE-NEW-DATATARGET' | translate" [ctaRouterLinkPrimary]="'datatarget-edit'">
</app-top-bar-table>
</div>
<ng-template #readOnly>
<app-top-bar-table [component]="true" [title]="'APPLICATION.ATTACHED-IOT' | translate">
</app-top-bar-table>
</ng-template>
<app-datatarget-table [pageLimit]="pageLimit"></app-datatarget-table>
</div>
</div>
</div>
</div>
</mat-tab>
</mat-tab-group>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Title } from '@angular/platform-browser';
import { ActivatedRoute, Router } from '@angular/router';
import { Application } from '@applications/application.model';
import { ApplicationService } from '@applications/application.service';
import { environment } from '@environments/environment';
import { TranslateService } from '@ngx-translate/core';
import { DeleteDialogService } from '@shared/components/delete-dialog/delete-dialog.service';
import { BackButton } from '@shared/models/back-button.model';
Expand All @@ -22,6 +23,7 @@ export class ApplicationDetailComponent implements OnInit, OnDestroy {
public application: Application;
public backButton: BackButton = { label: '', routerLink: '/applications' };
public id: number;
public pageLimit = environment.tablePageSize;
public dropdownButton: DropdownButton;
public errorMessage: string;
public canEdit = false;
Expand Down Expand Up @@ -86,6 +88,7 @@ export class ApplicationDetailComponent implements OnInit, OnDestroy {
return this.application.iotDevices?.length > 0;
}


bindApplication(id: number): void {
this.applicationsSubscription = this.applicationService.getApplication(id).subscribe((application) => {
this.application = application;
Expand Down
24 changes: 12 additions & 12 deletions src/app/applications/applications-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import { ApplicationsComponent } from './applications.component';
import { IoTDeviceDetailComponent } from './iot-devices/iot-device-detail/iot-device-detail.component';
import { IotDeviceEditComponent } from './iot-devices/iot-device-edit/iot-device-edit.component';
import { DatatargetEditComponent } from './datatarget/datatarget-edit/datatarget-edit.component';
import { DatatargetListComponent } from './datatarget/datatarget-list/datatarget-list.component';
import { DatatargetDetailComponent } from './datatarget/datatarget-detail/datatarget-detail.component';
import { BulkImportComponent } from './bulk-import/bulk-import.component';
import { MulticastEditComponent } from './multicast/multicast-edit/multicast-edit.component';
import { MulticastDetailComponent } from './multicast/multicast-detail/multicast-detail.component';


const applicationRoutes: Routes = [
Expand All @@ -26,18 +27,17 @@ const applicationRoutes: Routes = [
{ path: '', component: ApplicationDetailComponent },
{ path: 'new-iot-device', component: IotDeviceEditComponent, },
{ path: 'iot-device-edit/:deviceId', component: IotDeviceEditComponent, },
{ path: 'iot-device/:deviceId', component: IoTDeviceDetailComponent, },
{
path: 'datatarget-list/:name',
children: [
{ path: '', component: DatatargetListComponent },
{ path: 'datatarget-edit', component: DatatargetEditComponent },
{ path: 'datatarget-edit/:datatargetId', component: DatatargetEditComponent },
{ path: 'datatarget/:datatargetId', component: DatatargetDetailComponent }
]
{ path: 'iot-device/:deviceId', component: IoTDeviceDetailComponent, },

},
{ path: 'bulk-import', component: BulkImportComponent }
{ path: 'datatarget-edit', component: DatatargetEditComponent },
{ path: 'datatarget-edit/:datatargetId', component: DatatargetEditComponent },
{ path: 'datatarget/:datatargetId', component: DatatargetDetailComponent },

{ path: 'multicast-edit', component: MulticastEditComponent},
{ path: 'multicast-edit/:multicastId', component: MulticastEditComponent },
{ path: 'multicast/:multicastId', component: MulticastDetailComponent },

{ path: 'bulk-import', component: BulkImportComponent },
],
},

Expand Down
57 changes: 29 additions & 28 deletions src/app/applications/applications.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,35 @@ import { NGMaterialModule } from '@shared/Modules/materiale.module';
import { BulkImportComponent } from './bulk-import/bulk-import.component';
import { PipesModule } from '@shared/pipes/pipes.module';
import { ApplicationsTableComponent } from './applications-list/applications-table/applications-table.component';

import { MulticastModule } from './multicast/multicast.module';

@NgModule({
declarations: [
ApplicationsComponent,
ApplicationDetailComponent,
ApplicationEditComponent,
ApplicationsListComponent,
ApplicationsTableComponent,
BulkImportComponent,
],
exports: [
ApplicaitonsRoutingModule,
ApplicationsComponent,
ApplicationsTableComponent,
],
imports: [
CommonModule,
RouterModule,
TranslateModule,
IotDevicesModule,
DatatargetModule,
DirectivesModule,
FormModule,
SharedModule,
FontAwesomeModule,
NGMaterialModule,
PipesModule,
],
declarations: [
ApplicationsComponent,
ApplicationDetailComponent,
ApplicationEditComponent,
ApplicationsListComponent,
ApplicationsTableComponent,
BulkImportComponent,
],
exports: [
ApplicaitonsRoutingModule,
ApplicationsComponent,
ApplicationsTableComponent,
],
imports: [
CommonModule,
RouterModule,
TranslateModule,
IotDevicesModule,
DatatargetModule,
DirectivesModule,
FormModule,
SharedModule,
FontAwesomeModule,
NGMaterialModule,
PipesModule,
MulticastModule,
],
})
export class ApplicationsModule { }
export class ApplicationsModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { DeleteDialogService } from '@shared/components/delete-dialog/delete-dia
import { Datatarget } from '../datatarget.model';
import { DropdownButton } from '@shared/models/dropdown-button.model';
import { faArrowsAltH } from '@fortawesome/free-solid-svg-icons';
import { IotDevice } from '@applications/iot-devices/iot-device.model';

@Component({
selector: 'app-datatarget-detail',
Expand Down Expand Up @@ -65,7 +64,7 @@ export class DatatargetDetailComponent implements OnInit, OnDestroy {
}

private setBackButton(applicationId: number) {
this.backButton.routerLink = ['applications', applicationId.toString(), 'datatarget-list', this.applicationName ]
this.backButton.routerLink = ['applications', applicationId.toString()]
}

onDeleteDatatarget() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { DatatargetService } from '../datatarget.service';
import { ApplicationService } from '@applications/application.service';
import { PayloadDecoderService } from '@payload-decoder/payload-decoder.service';
import { PayloadDeviceDatatargetService } from '@payload-decoder/payload-device-datatarget.service';
import { SaveSnackService } from '@shared/services/save-snack.service';
import { SnackService } from '@shared/services/snack.service';
import { MatDialog } from '@angular/material/dialog';
import { HttpErrorResponse } from '@angular/common/http';
import { PayloadDecoderMappedResponse } from '@payload-decoder/payload-decoder.model';
Expand Down Expand Up @@ -44,7 +44,7 @@ export class DatatargetEditComponent implements OnInit, OnDestroy {
public formFailedSubmit = false;
public datatargetid: number;
private applicationId: number;
private applicationNane: string;
private applicationName: string;
public application: Application;
public devices: IotDevice[];
public payloadDecoders = [];
Expand All @@ -63,7 +63,7 @@ export class DatatargetEditComponent implements OnInit, OnDestroy {
private applicationService: ApplicationService,
private payloadDecoderService: PayloadDecoderService,
private payloadDeviceDataTargetService: PayloadDeviceDatatargetService,
private saveSnackService: SaveSnackService,
private saveSnackService: SnackService,
private dialog: MatDialog,
private errorMessageService: ErrorMessageService,
private opendatadkService: OpendatadkService,
Expand Down Expand Up @@ -94,7 +94,7 @@ export class DatatargetEditComponent implements OnInit, OnDestroy {

this.datatargetid = +this.route.snapshot.paramMap.get('datatargetId');
this.applicationId = +this.route.snapshot.paramMap.get('id');
this.applicationNane = this.route.snapshot.paramMap.get('name');
this.applicationName = this.route.snapshot.paramMap.get('name');
if (this.datatargetid !== 0) {
this.getDatatarget(this.datatargetid);
this.getPayloadDeviceDatatarget(this.datatargetid);
Expand Down Expand Up @@ -237,6 +237,7 @@ export class DatatargetEditComponent implements OnInit, OnDestroy {
this.datatarget.openDataDkDataset.acceptTerms = true;
}
this.showSavedSnack();
this.routeToDatatargets();
},
(error: HttpErrorResponse) => {
this.checkDataTargetModelOpendatadkdatasaet();
Expand Down Expand Up @@ -288,7 +289,7 @@ export class DatatargetEditComponent implements OnInit, OnDestroy {
}

routeToDatatargets(): void {
this.router.navigate(['applications',this.applicationId.toString(),'datatarget-list', this.applicationNane])
this.router.navigate(['applications',this.applicationId.toString()])
}

onCoordinateKey(event: any) {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</td>
</ng-container>

<!-- Devices Column -->
<!-- Type Column -->
<ng-container matColumnDef="type">
<th mat-header-cell *matHeaderCellDef mat-sort-header class="col-1">
{{ 'DATATARGET-TABLE.TYPE' | translate }}</th>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class DatatargetTableComponent implements OnInit, AfterViewInit, OnDestro
}

ngOnInit(): void {
this.applicationId = +Number(this.route.parent.parent.snapshot.paramMap.get('id'));
this.applicationId = +Number(this.route.parent.snapshot.paramMap.get('id'));
console.log(this.applicationId);
this.getDatatarget();
this.canEdit = this.meService.canWriteInTargetOrganization()
Expand Down
Loading