Browse Source

refactor

pull/6/head
Trung Nguyen 1 year ago
parent
commit
a2b36e7c38
9 changed files with 20 additions and 17 deletions
  1. +1
    -1
      .gitignore
  2. +5
    -5
      angular.json
  3. BIN
      dist.zip
  4. +2
    -3
      dist/lot-web-ui/index.html
  5. +1
    -0
      package.json
  6. +2
    -2
      src/app/modules/overview/camera-stream/camera-stream.component.ts
  7. +3
    -1
      src/app/modules/overview/map/map.component.ts
  8. +2
    -2
      src/app/modules/overview/overall-ground/overall-ground.component.html
  9. +4
    -3
      src/app/modules/overview/overall-ground/overall-ground.component.ts

+ 1
- 1
.gitignore View File

@@ -27,7 +27,7 @@ yarn-error.log
!.vscode/launch.json
!.vscode/extensions.json
.history/*
dist/*
# Miscellaneous
/.angular/cache
.sass-cache/

+ 5
- 5
angular.json View File

@@ -44,20 +44,20 @@
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumWarning": "1mb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
"maximumWarning": "1mb",
"maximumError": "1mb"
}
],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"buildOptimizer": true,
"optimization": true,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,

BIN
dist.zip View File


+ 2
- 3
dist/lot-web-ui/index.html
File diff suppressed because it is too large
View File


+ 1
- 0
package.json View File

@@ -24,6 +24,7 @@
"@asymmetrik/ngx-leaflet": "^16.0.1",
"@asymmetrik/ngx-leaflet-markercluster": "^16.0.0",
"leaflet": "^1.9.4",
"rtsp-relay": "^1.8.0",
"rxjs": "~7.8.0",
"rxjs-websockets": "^9.0.0",
"tslib": "^2.3.0",

+ 2
- 2
src/app/modules/overview/camera-stream/camera-stream.component.ts View File

@@ -9,8 +9,8 @@ import {loadPlayer, Player} from "rtsp-relay/browser";
export class CameraStreamComponent implements OnInit, AfterViewInit{
player?: Player;

@ViewChild('videoPlayer')
videoPlayer?: ElementRef<HTMLCanvasElement>;
// @ViewChild('videoPlayer')
// videoPlayer?: ElementRef<HTMLCanvasElement>;

ngOnInit() {
}

+ 3
- 1
src/app/modules/overview/map/map.component.ts View File

@@ -61,6 +61,8 @@ export class MapComponent implements OnInit, AfterViewInit, OnDestroy {
ngOnInit() {
this.statusSubscription = this.socketService$.status$.subscribe(isConnected => {
if (isConnected) {
let str = {id: '0', type: 'get'};
this.socketService$.sendMessage(str);
this.messageSubscription = this.socketService$.messages$.subscribe(message => {
this.onMessage(message);
});
@@ -123,7 +125,7 @@ export class MapComponent implements OnInit, AfterViewInit, OnDestroy {

updateIcons(): void {
this.map.eachLayer((layer:any) => {
if (layer instanceof L.Marker) {
if (layer instanceof L.Marker as any) {
this.map.removeLayer(layer);
}
});

+ 2
- 2
src/app/modules/overview/overall-ground/overall-ground.component.html View File

@@ -47,7 +47,7 @@
<img style="width: 30px; height: 30px;" src="assets/images/camera.png">
</a>
</div>
<ng-template [ngIf]="Sstate1 && Sstate2">
<ng-template *ngIf="Sstate1 && Sstate2">
<div class="alarm-text"
[ngClass]="{'alarm-text-on': Sstate1 && Sstate2 }">ALARM: <br>VIBRATION ALERT</div>
</ng-template>
@@ -63,7 +63,7 @@
<img style="width: 30px; height: 30px;" src="assets/images/camera.png">
</a>
</div>
<ng-template [ngIf]="Sstate1 && Sstate2">
<ng-template *ngIf="Sstate1 && Sstate2">
<div class="alarm-text"
[ngClass]="{'alarm-text-on': Sstate1 && Sstate2 }">ALARM: <br>SMOKE ALERT</div>
</ng-template>

+ 4
- 3
src/app/modules/overview/overall-ground/overall-ground.component.ts View File

@@ -34,8 +34,9 @@ export class OverallGroundComponent implements OnInit, OnDestroy {
// this.socketService$.connect();
this.statusSubscription = this.socketService$.status$.subscribe(isConnected => {
this.isConnected = isConnected;
this.getReadings();
if (this.isConnected) {
this.intervalId = setInterval(() => this.getReadings(), 2000);
this.intervalId = setInterval(() => this.getReadings(), 5000);
this.messageSubscription = this.socketService$.messages$.subscribe(message => {
this.onMessage(message);
});
@@ -89,9 +90,9 @@ export class OverallGroundComponent implements OnInit, OnDestroy {
this.state4 = message.state4 === '1' ? 'ON' : 'OFF';
this.state5 = message.state5 === '1' ? 'ON' : 'OFF';
this.state6 = message.state6 === '1' ? 'ON' : 'OFF';
this.Sstate1 = this.state5 === 'ON';
this.Sstate2 = this.state6 === 'ON';
}
this.Sstate1 = this.state5 === 'ON';
this.Sstate2 = this.state6 === 'ON';
if(this.Sstate1 && this.Sstate2)
this.title = 'ALARM: VIBRATION ALERT'


Loading…
Cancel
Save