diff --git a/people-service/PeopleService.WebApi/Program.cs b/people-service/PeopleService.WebApi/Program.cs index 57a344ef1..acdacfd3a 100644 --- a/people-service/PeopleService.WebApi/Program.cs +++ b/people-service/PeopleService.WebApi/Program.cs @@ -6,6 +6,10 @@ var builder = WebApplication.CreateBuilder(args); +// Configure port from environment variable +var port = Environment.GetEnvironmentVariable("PEOPLE_SERVICE_PORT") ?? "18089"; +builder.WebHost.UseUrls($"http://0.0.0.0:{port}"); + // Add services to the container. builder.Services.AddControllers(); diff --git a/people-service/PeopleService.WebApi/Properties/launchSettings.json b/people-service/PeopleService.WebApi/Properties/launchSettings.json index b8cf77f56..cd9a7a89c 100644 --- a/people-service/PeopleService.WebApi/Properties/launchSettings.json +++ b/people-service/PeopleService.WebApi/Properties/launchSettings.json @@ -14,9 +14,9 @@ "dotnetRunMessages": true, "launchBrowser": true, "launchUrl": "swagger", - "applicationUrl": "http://0.0.0.0:18089", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" + "ASPNETCORE_ENVIRONMENT": "Development", + "PEOPLE_SERVICE_PORT": "18089" } }, "IIS Express": { diff --git a/people-service/README.md b/people-service/README.md index 5f09ce137..f0c0f099d 100644 --- a/people-service/README.md +++ b/people-service/README.md @@ -12,7 +12,7 @@ The people service is used for managing users in the system, and associating the Default Port is 18089. -TODO: Get this port configurable by env var PEOPLE_SERVICE_PORT +The port can be configured using the `PEOPLE_SERVICE_PORT` environment variable. ## Building and Running ```bash @@ -20,6 +20,12 @@ $ cd PeopleService.WebApi $ dotnet run ``` +To run on a different port: +```bash +$ export PEOPLE_SERVICE_PORT=8080 +$ dotnet run +``` + ## Accessing the Swagger URL Visit the forwarded port `/swagger` to open the SwaggerUI. diff --git a/web-front-end/angular/main/app/trade/position-blotter/position-blotter.component.ts b/web-front-end/angular/main/app/trade/position-blotter/position-blotter.component.ts index 6b7546019..d64bc738f 100644 --- a/web-front-end/angular/main/app/trade/position-blotter/position-blotter.component.ts +++ b/web-front-end/angular/main/app/trade/position-blotter/position-blotter.component.ts @@ -71,7 +71,8 @@ export class PositionBlotterComponent implements OnChanges, OnDestroy { } update(data: any) { - const row = this.gridApi.getRowNode(data.security); + const rowId = `Position-${data.security}`; + const row = this.gridApi.getRowNode(rowId); let positionData; if (row) { positionData = { diff --git a/web-front-end/react/src/Datatable/Datatable.tsx b/web-front-end/react/src/Datatable/Datatable.tsx index 60ce9ee03..c2a2cfad4 100644 --- a/web-front-end/react/src/Datatable/Datatable.tsx +++ b/web-front-end/react/src/Datatable/Datatable.tsx @@ -45,7 +45,17 @@ export const Datatable = () => { } if (data.topic === `/accounts/${event.target.value}/positions`) { console.log("INCOMING POSITION DATA: ", data); - setPositionRowData((current: PositionData[]) => [...current, data.payload]); + setPositionRowData((current: PositionData[]) => { + const existingIndex = current.findIndex( + (pos: PositionData) => pos.security === data.payload.security + ); + if (existingIndex >= 0) { + const updated = [...current]; + updated[existingIndex] = data.payload; + return updated; + } + return [...current, data.payload]; + }); } }); }, [selectedId]) @@ -86,4 +96,4 @@ return ( ); -} \ No newline at end of file +}