diff --git a/.vscode/settings.json b/.vscode/settings.json index b9939f84..5ec8246c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,6 @@ { "idf.flashType": "UART", - "idf.portWin": "COM36", + "idf.portWin": "COM30", "idf.adapterTargetName": "esp32s3", "idf.openOcdConfigs": [ "interface/ftdi/esp32_devkitj_v1.cfg", diff --git a/main/http_server/axe-os/src/app/components/swarm/swarm.component.ts b/main/http_server/axe-os/src/app/components/swarm/swarm.component.ts index 25b78a6d..9753a9e2 100644 --- a/main/http_server/axe-os/src/app/components/swarm/swarm.component.ts +++ b/main/http_server/axe-os/src/app/components/swarm/swarm.component.ts @@ -1,7 +1,7 @@ import { Component } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import { ToastrService } from 'ngx-toastr'; -import { BehaviorSubject, catchError, forkJoin, map, Observable, of, startWith, switchMap } from 'rxjs'; +import { BehaviorSubject, catchError, combineLatest, forkJoin, map, Observable, of, startWith, switchMap } from 'rxjs'; import { SystemService } from 'src/app/services/system.service'; @Component({ @@ -60,11 +60,11 @@ export class SwarmComponent { public add() { const newIp = this.form.value.ip; - this.systemService.getSwarmInfo().pipe( - switchMap((swarmInfo) => { + combineLatest([this.systemService.getSwarmInfo('http://' + newIp), this.systemService.getSwarmInfo()]).pipe( + switchMap(([newSwarmInfo, swarmInfo]) => { const swarmUpdate = swarmInfo.map(({ ip }) => { - return this.systemService.updateSwarm('http://' + ip, [{ ip: newIp }, ...swarmInfo]) + return this.systemService.updateSwarm('http://' + ip, [{ ip: newIp }, ...newSwarmInfo, ...swarmInfo]) }); const newAxeOs = this.systemService.updateSwarm('http://' + newIp, [{ ip: newIp }, ...swarmInfo]) diff --git a/main/http_server/axe-os/src/app/services/system.service.ts b/main/http_server/axe-os/src/app/services/system.service.ts index a5a96f69..cc607b8d 100644 --- a/main/http_server/axe-os/src/app/services/system.service.ts +++ b/main/http_server/axe-os/src/app/services/system.service.ts @@ -100,8 +100,8 @@ export class SystemService { } - public getSwarmInfo(): Observable<{ ip: string }[]> { - return this.httpClient.get(`/api/swarm/info`) as Observable<{ ip: string }[]>; + public getSwarmInfo(uri: string = ''): Observable<{ ip: string }[]> { + return this.httpClient.get(`${uri}/api/swarm/info`) as Observable<{ ip: string }[]>; } public updateSwarm(uri: string = '', swarmConfig: any) {