Add barebone to support socket.io

(This is more a temp commit to update the frontend)
This commit is contained in:
2021-05-06 15:24:20 +02:00
parent 533749c7c8
commit 9f1aa50681
16 changed files with 26370 additions and 3185 deletions

24759
frontend/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -13,7 +13,7 @@
"dependencies": {
"@angular/animations": "~10.1.5",
"@angular/cdk": "^10.2.1",
"@angular/common": "~10.1.5",
"@angular/common": ",
"@angular/compiler": "~10.1.5",
"@angular/core": "~10.1.5",
"@angular/forms": "~10.1.5",
@@ -36,7 +36,6 @@
"moment": "^2.29.1",
"ng2-charts": "^2.4.2",
"ngx-mapbox-gl": "^4.8.1",
"ngx-mqtt": "^7.0.14",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.10.2"

View File

@@ -1,6 +1,5 @@
import { HttpClient, HttpErrorResponse, HttpHeaders, HttpParams } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { MqttService } from 'ngx-mqtt';
import { BehaviorSubject } from 'rxjs';
import * as moment from 'moment';
import { error } from 'protractor';
@@ -128,11 +127,12 @@ export class APIService {
API_ENDPOINT = 'http://192.168.178.26:8040';
constructor(private httpClient: HttpClient, private mqtt: MqttService, private alert: AlertService) { }
constructor(private httpClient: HttpClient, private alert: AlertService) { }
private mqttInit(): void {
// Connect with RabbitMQ after we received our user information
this.mqtt.connect({
private socketInit(): void {
// Connect with Socket:io after we received our user information
/*this.mqtt.connect({
hostname: '192.168.178.26',
port: 15675,
protocol: 'ws',
@@ -163,7 +163,7 @@ export class APIService {
this.alert.dynamic('Device is now offline', obj.severity, obj.displayName);
}
}
});
});*/
}
/*
@@ -181,7 +181,7 @@ export class APIService {
await this.getUserInfo();
await this.getNotifications();
this.mqttInit();
this.socketInit();
await this.getBeats();
await this.getBeatStats();

View File

@@ -14,7 +14,6 @@ import { LoginComponent } from './login/login.component';
import { MapComponent } from './map/map.component';
import { UserComponent } from './user/user.component';
import { DashboardWidgetComponent } from './dashboard-widget/dashboard-widget.component';
import { MqttModule } from 'ngx-mqtt';
import { ServiceWorkerModule } from '@angular/service-worker';
import { environment } from '../environments/environment';
import { AdminComponent } from './admin/admin.component';
@@ -22,6 +21,8 @@ import { AlertComponent } from './_alert/alert/alert.component';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { NotificationsComponent } from './notifications/notifications.component';
const config: SocketIoConfig = { url: 'http://localhost:8988', options: {} };
@NgModule({
declarations: [
AppComponent,
@@ -42,7 +43,6 @@ import { NotificationsComponent } from './notifications/notifications.component'
FontAwesomeModule,
FormsModule,
HttpClientModule,
MqttModule.forRoot({}),
NgxMapboxGLModule.withConfig({
accessToken: 'pk.eyJ1IjoibW9uZGVpMSIsImEiOiJja2dsY2ZtaG0xZ2o5MnR0ZWs0Mm82OTBpIn0.NzDWN3P6jJLmci_v3MM1tA'
}),