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 { catchError, of, take } from 'rxjs';
|
||||
|
||||
import { PlatformContextStore } from '../../core/context/platform-context.store';
|
||||
import { TopologyLayoutService } from './topology-layout.service';
|
||||
import { TopologyGraphComponent } from './topology-graph.component';
|
||||
import {
|
||||
@@ -444,7 +443,6 @@ import {
|
||||
})
|
||||
export class TopologyGraphPageComponent {
|
||||
private readonly layoutService = inject(TopologyLayoutService);
|
||||
readonly context = inject(PlatformContextStore);
|
||||
|
||||
readonly loading = signal(false);
|
||||
readonly error = signal<string | null>(null);
|
||||
@@ -479,7 +477,7 @@ export class TopologyGraphPageComponent {
|
||||
const matchedRegionIds = new Set<string>();
|
||||
|
||||
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
|
||||
|| n.label.toLowerCase().includes(query)
|
||||
@@ -507,12 +505,7 @@ export class TopologyGraphPageComponent {
|
||||
});
|
||||
|
||||
constructor() {
|
||||
this.context.initialize();
|
||||
|
||||
effect(() => {
|
||||
this.context.contextVersion();
|
||||
this.load();
|
||||
});
|
||||
this.load();
|
||||
}
|
||||
|
||||
onNodeSelected(node: TopologyPositionedNode): void {
|
||||
@@ -535,7 +528,7 @@ export class TopologyGraphPageComponent {
|
||||
this.error.set(null);
|
||||
|
||||
this.layoutService
|
||||
.getLayout(this.context)
|
||||
.getLayout()
|
||||
.pipe(
|
||||
take(1),
|
||||
catchError((err: unknown) => {
|
||||
|
||||
@@ -2,30 +2,25 @@ import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { PlatformContextStore } from '../../core/context/platform-context.store';
|
||||
import { TopologyLayoutResponse } from './topology-layout.models';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class TopologyLayoutService {
|
||||
private readonly http = inject(HttpClient);
|
||||
|
||||
getLayout(
|
||||
context: PlatformContextStore,
|
||||
options?: {
|
||||
direction?: 'left-to-right' | 'top-to-bottom';
|
||||
effort?: 'draft' | 'balanced' | 'best';
|
||||
},
|
||||
): Observable<TopologyLayoutResponse> {
|
||||
getLayout(options?: {
|
||||
region?: string;
|
||||
environment?: string;
|
||||
direction?: 'left-to-right' | 'top-to-bottom';
|
||||
effort?: 'draft' | 'balanced' | 'best';
|
||||
}): Observable<TopologyLayoutResponse> {
|
||||
let params = new HttpParams();
|
||||
|
||||
const regions = context.selectedRegions();
|
||||
const environments = context.selectedEnvironments();
|
||||
|
||||
if (regions.length > 0) {
|
||||
params = params.set('region', regions.join(','));
|
||||
if (options?.region) {
|
||||
params = params.set('region', options.region);
|
||||
}
|
||||
if (environments.length > 0) {
|
||||
params = params.set('environment', environments.join(','));
|
||||
if (options?.environment) {
|
||||
params = params.set('environment', options.environment);
|
||||
}
|
||||
if (options?.direction) {
|
||||
params = params.set('direction', options.direction);
|
||||
|
||||
Reference in New Issue
Block a user