diff --git a/frontend/src/app/app-routing.module.ts b/frontend/src/app/app-routing.module.ts deleted file mode 100644 index d425c6f..0000000 --- a/frontend/src/app/app-routing.module.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { NgModule } from '@angular/core'; -import { Routes, RouterModule } from '@angular/router'; - -const routes: Routes = []; - -@NgModule({ - imports: [RouterModule.forRoot(routes)], - exports: [RouterModule] -}) -export class AppRoutingModule { } diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index 8937ed1..f2a7639 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -1,43 +1,35 @@ import {BrowserModule} from '@angular/platform-browser'; import {NgModule} from '@angular/core'; - -import {AppRoutingModule} from './app-routing.module'; import {LandingComponent} from './component/landing/landing.component'; import {RestService} from './services/rest.service'; import {HTTP_INTERCEPTORS, HttpClientModule} from '@angular/common/http'; import {InterceptorService} from './services/interceptor.service'; -import {WebsocketService} from './services/websocket.service'; import {LoggerModule, NgxLoggerLevel} from 'ngx-logger'; import {environment} from '../environments/environment'; -import {TestSubCompComponent} from './component/testsubcomp/test-sub-comp.component'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {MatFormFieldModule} from '@angular/material/form-field'; import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; import {MatButtonModule} from '@angular/material/button'; import {MatInputModule} from '@angular/material/input'; import {MatSlideToggleModule} from '@angular/material/slide-toggle'; -import {MatSliderModule} from "@angular/material/slider"; @NgModule({ - declarations: [LandingComponent, TestSubCompComponent], + declarations: [LandingComponent], imports: [ ReactiveFormsModule, BrowserModule, BrowserAnimationsModule, - AppRoutingModule, LoggerModule.forRoot({level: environment.log_level, serverLogLevel: NgxLoggerLevel.ERROR}), HttpClientModule, MatFormFieldModule, FormsModule, MatButtonModule, MatInputModule, - MatSlideToggleModule, - MatSliderModule + MatSlideToggleModule ], // enables injecting providers: [ RestService, - WebsocketService, { provide: HTTP_INTERCEPTORS, useClass: InterceptorService, multi: true }, diff --git a/frontend/src/app/component/landing/landing.component.html b/frontend/src/app/component/landing/landing.component.html index fde4987..eba20f2 100644 --- a/frontend/src/app/component/landing/landing.component.html +++ b/frontend/src/app/component/landing/landing.component.html @@ -1,33 +1 @@ -

landing works!

- - - - -

Two way data binding, passing data, triggering child event...

- - - - - - - - -

Hide display with *ngIf

-Show paragraph -

Toggle me

- - - - -

Display a test list with *ngFor

-{{dict.value}}; +

Federated Storage Infrastructure for IoT Sensor Data

diff --git a/frontend/src/app/component/landing/landing.component.ts b/frontend/src/app/component/landing/landing.component.ts index 9261559..a62e3d5 100644 --- a/frontend/src/app/component/landing/landing.component.ts +++ b/frontend/src/app/component/landing/landing.component.ts @@ -1,8 +1,6 @@ import {Component, OnInit} from '@angular/core'; import {RestService} from '../../services/rest.service'; -import {WebsocketService} from '../../services/websocket.service'; import {NGXLogger} from 'ngx-logger'; -import {Subscription} from 'rxjs'; @Component({ selector: 'app-landing', @@ -11,78 +9,12 @@ import {Subscription} from 'rxjs'; }) export class LandingComponent implements OnInit { - private wsSubscription: Subscription; - private wsMessageCounter: number; - exampleInputText: string; - showPar = false; - testList = [{'value': 1}, {'value': 2}, {'value': 3}]; - myValue: any = 15; - constructor( private logger: NGXLogger, - private restService: RestService, - private wsService: WebsocketService + private restService: RestService ) { } ngOnInit(): void { - // perform test rest call as observable - this.observableCall(); - - // perform test rest call as promise (shorter - will only be executed exactly once) - this.promiseCall(); - - // perform test ws send / receive - setTimeout(() => { - this.wsCall(); - }, - 1000); - } - - private observableCall(): void { - - const subscription = this.restService.testCall(1).subscribe( - // subscribe with lambda function - response => { - this.logger.debug('Execute obs test call', response); - subscription.unsubscribe(); - }, - error => { - this.logger.error('Error while executing obs test call', error); - subscription.unsubscribe(); - } - ); - } - - private promiseCall(): void { - this.restService.testCall(2).toPromise() - // lambda for success - .then(response => { - this.logger.debug('Execute obs test call', response); - }) - // lambda for fail - .catch(error => { - this.logger.error('Error while executing obs test call', error); - }); - } - - private wsCall(): void { - this.wsMessageCounter = 0; - this.wsSubscription = this.wsService.wsTestCall('Test message').message.subscribe( - result => { - this.logger.debug('ws call result', result); - if (this.wsMessageCounter >= 2) { - this.wsSubscription.unsubscribe(); - } - }, - error => { - this.logger.error('ws call error', error); - this.wsSubscription.unsubscribe(); - } - ); - } - - alert() { - alert(this.exampleInputText); } } diff --git a/frontend/src/app/component/testsubcomp/test-sub-comp.component.css b/frontend/src/app/component/testsubcomp/test-sub-comp.component.css deleted file mode 100644 index e69de29..0000000 diff --git a/frontend/src/app/component/testsubcomp/test-sub-comp.component.html b/frontend/src/app/component/testsubcomp/test-sub-comp.component.html deleted file mode 100644 index 968e865..0000000 --- a/frontend/src/app/component/testsubcomp/test-sub-comp.component.html +++ /dev/null @@ -1 +0,0 @@ -

{{message}}

diff --git a/frontend/src/app/component/testsubcomp/test-sub-comp.component.ts b/frontend/src/app/component/testsubcomp/test-sub-comp.component.ts deleted file mode 100644 index 7979cec..0000000 --- a/frontend/src/app/component/testsubcomp/test-sub-comp.component.ts +++ /dev/null @@ -1,24 +0,0 @@ -import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; - -@Component({ - selector: 'app-test-sub-comp', - templateUrl: './test-sub-comp.component.html', - styleUrls: ['./test-sub-comp.component.css'] -}) -export class TestSubCompComponent implements OnInit { - @Input() - message: string; - @Input() - anotherInput: string; - - @Output() - buttonClickedEvent: EventEmitter = new EventEmitter(); - - constructor() { - } - - ngOnInit(): void { - this.message; - } - -} diff --git a/frontend/src/app/services/websocket.service.ts b/frontend/src/app/services/websocket.service.ts deleted file mode 100644 index c936698..0000000 --- a/frontend/src/app/services/websocket.service.ts +++ /dev/null @@ -1,52 +0,0 @@ -import {Injectable} from '@angular/core'; -import {NGXLogger} from 'ngx-logger'; -import {fromEvent, interval, Observable} from 'rxjs'; - -import {environment} from '../../environments/environment'; -import {WSEvents} from '../interfaces/interface'; - -@Injectable({ - providedIn: 'root' -}) -export class WebsocketService { - private wsEndpoint = environment.ws_location + ':' + environment.ws_port + '/test-ws-endpoint/'; - private readonly ws: WebSocket; - private wsEvents: WSEvents; - - constructor(private logger: NGXLogger) { - this.logger.debug('Initiating ws connection on', this.wsEndpoint); - this.ws = new WebSocket(this.wsEndpoint); - - interval(5000).subscribe(() => { - // continuously check if the connection is still open - if (this.ws.readyState !== WebSocket.OPEN) { - this.logger.error('Lost websocket connection ...', this.ws); - } - }); - - } - - wsTestCall(msg: string): WSEvents { - this.logger.debug( - 'Performing ws test call', - 'current ws ready state ==', this.ws.readyState + ',', - 'expected == 1 == open'); - - if (this.ws.readyState === WebSocket.OPEN) { - this.ws.send(msg); - } else { - return undefined; - } - - if (!this.wsEvents) { - this.wsEvents = { - message: fromEvent(this.ws, 'message'), - error: fromEvent(this.ws, 'error'), - close: fromEvent(this.ws, 'close') - }; - } - - return this.wsEvents; - } - -}