Fix topology layout API call to not pass context filters by default
The PlatformContextStore pre-selects regions/environments which caused the layout API to return 400. The topology page should show everything on initial load - filtering is done client-side via the filter bar. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,6 @@ import { FormsModule } from '@angular/forms';
|
|||||||
import { RouterLink } from '@angular/router';
|
import { RouterLink } from '@angular/router';
|
||||||
import { catchError, of, take } from 'rxjs';
|
import { catchError, of, take } from 'rxjs';
|
||||||
|
|
||||||
import { PlatformContextStore } from '../../core/context/platform-context.store';
|
|
||||||
import { TopologyLayoutService } from './topology-layout.service';
|
import { TopologyLayoutService } from './topology-layout.service';
|
||||||
import { TopologyGraphComponent } from './topology-graph.component';
|
import { TopologyGraphComponent } from './topology-graph.component';
|
||||||
import {
|
import {
|
||||||
@@ -444,7 +443,6 @@ import {
|
|||||||
})
|
})
|
||||||
export class TopologyGraphPageComponent {
|
export class TopologyGraphPageComponent {
|
||||||
private readonly layoutService = inject(TopologyLayoutService);
|
private readonly layoutService = inject(TopologyLayoutService);
|
||||||
readonly context = inject(PlatformContextStore);
|
|
||||||
|
|
||||||
readonly loading = signal(false);
|
readonly loading = signal(false);
|
||||||
readonly error = signal<string | null>(null);
|
readonly error = signal<string | null>(null);
|
||||||
@@ -479,7 +477,7 @@ export class TopologyGraphPageComponent {
|
|||||||
const matchedRegionIds = new Set<string>();
|
const matchedRegionIds = new Set<string>();
|
||||||
|
|
||||||
const filteredNodes = data.nodes.filter((n) => {
|
const filteredNodes = data.nodes.filter((n) => {
|
||||||
if (n.kind === 'region') return true; // keep all regions initially
|
if (n.kind === 'region') return true;
|
||||||
|
|
||||||
const matchesSearch = !query
|
const matchesSearch = !query
|
||||||
|| n.label.toLowerCase().includes(query)
|
|| n.label.toLowerCase().includes(query)
|
||||||
@@ -507,12 +505,7 @@ export class TopologyGraphPageComponent {
|
|||||||
});
|
});
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.context.initialize();
|
this.load();
|
||||||
|
|
||||||
effect(() => {
|
|
||||||
this.context.contextVersion();
|
|
||||||
this.load();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onNodeSelected(node: TopologyPositionedNode): void {
|
onNodeSelected(node: TopologyPositionedNode): void {
|
||||||
@@ -535,7 +528,7 @@ export class TopologyGraphPageComponent {
|
|||||||
this.error.set(null);
|
this.error.set(null);
|
||||||
|
|
||||||
this.layoutService
|
this.layoutService
|
||||||
.getLayout(this.context)
|
.getLayout()
|
||||||
.pipe(
|
.pipe(
|
||||||
take(1),
|
take(1),
|
||||||
catchError((err: unknown) => {
|
catchError((err: unknown) => {
|
||||||
|
|||||||
@@ -2,30 +2,25 @@ import { HttpClient, HttpParams } from '@angular/common/http';
|
|||||||
import { Injectable, inject } from '@angular/core';
|
import { Injectable, inject } from '@angular/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
import { PlatformContextStore } from '../../core/context/platform-context.store';
|
|
||||||
import { TopologyLayoutResponse } from './topology-layout.models';
|
import { TopologyLayoutResponse } from './topology-layout.models';
|
||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class TopologyLayoutService {
|
export class TopologyLayoutService {
|
||||||
private readonly http = inject(HttpClient);
|
private readonly http = inject(HttpClient);
|
||||||
|
|
||||||
getLayout(
|
getLayout(options?: {
|
||||||
context: PlatformContextStore,
|
region?: string;
|
||||||
options?: {
|
environment?: string;
|
||||||
direction?: 'left-to-right' | 'top-to-bottom';
|
direction?: 'left-to-right' | 'top-to-bottom';
|
||||||
effort?: 'draft' | 'balanced' | 'best';
|
effort?: 'draft' | 'balanced' | 'best';
|
||||||
},
|
}): Observable<TopologyLayoutResponse> {
|
||||||
): Observable<TopologyLayoutResponse> {
|
|
||||||
let params = new HttpParams();
|
let params = new HttpParams();
|
||||||
|
|
||||||
const regions = context.selectedRegions();
|
if (options?.region) {
|
||||||
const environments = context.selectedEnvironments();
|
params = params.set('region', options.region);
|
||||||
|
|
||||||
if (regions.length > 0) {
|
|
||||||
params = params.set('region', regions.join(','));
|
|
||||||
}
|
}
|
||||||
if (environments.length > 0) {
|
if (options?.environment) {
|
||||||
params = params.set('environment', environments.join(','));
|
params = params.set('environment', options.environment);
|
||||||
}
|
}
|
||||||
if (options?.direction) {
|
if (options?.direction) {
|
||||||
params = params.set('direction', options.direction);
|
params = params.set('direction', options.direction);
|
||||||
|
|||||||
Reference in New Issue
Block a user