|
|
|
@ -3,6 +3,7 @@ import * as L from 'leaflet'; |
|
|
|
import {HttpClient} from "@angular/common/http"; |
|
|
|
import {NodeDTO} from "../../entities/NodeDTO"; |
|
|
|
import {Subscription} from "rxjs"; |
|
|
|
import {DatePipe} from "@angular/common"; |
|
|
|
|
|
|
|
@Component({ |
|
|
|
selector: "app-nodes-map", |
|
|
|
@ -19,9 +20,14 @@ import {Subscription} from "rxjs"; |
|
|
|
}) |
|
|
|
export class NodesMapComponent implements OnInit { |
|
|
|
map!: L.Map; |
|
|
|
logo: any = new L.Icon({ |
|
|
|
iconUrl: '../../../assets/meshtastic-logo.svg', |
|
|
|
iconSize: [32, 32] |
|
|
|
}) |
|
|
|
nodes: NodeDTO[] = [] |
|
|
|
|
|
|
|
constructor(private http: HttpClient) { |
|
|
|
constructor(private http: HttpClient, |
|
|
|
private datepipe: DatePipe) { |
|
|
|
} |
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
@ -36,7 +42,7 @@ export class NodesMapComponent implements OnInit { |
|
|
|
() => { |
|
|
|
this.nodes.filter((node) => node.havePosition).forEach( |
|
|
|
(node) => { |
|
|
|
L.marker(this.convertPosition(node)).addTo(this.map) |
|
|
|
L.marker(this.convertPosition(node), {icon: this.logo}).bindPopup(`<a href="network/status/${node.num}">${node.long_name} (${node.short_name})</a><p>snr: ${node.snr} hops: ${node.hops_away}</p><p>Изменена: ${this.datepipe.transform(node.position.time*1000, 'HH:mm dd.MM.yyyy')}</p>`).addTo(this.map) |
|
|
|
} |
|
|
|
) |
|
|
|
} |
|
|
|
|