Skip to content

Commit aca301b

Browse files
committed
Improve resource filtering and UI feedback
Enhanced resource filtering in ResourceGraph to respect selected tiers, namespaces, and health status. Added spin animation for refresh icon in FilterPanel. Improved error handling and feedback in AdminResources and InferenceTest components. Updated node ID generation in AdminResources for better uniqueness. Added address format validation and DNS override documentation in test_execution.go.
1 parent f7f2a64 commit aca301b

File tree

5 files changed

+56
-4
lines changed

5 files changed

+56
-4
lines changed

management/test_execution.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,22 @@ func (s *TestExecutionService) createHTTPClient(settings *ConnectionSettings) *h
255255
// Create custom transport with DNS override
256256
transport := &http.Transport{
257257
DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
258-
// Check if we have a DNS override for this address
258+
// Validate the format of addr (expected format: host:port)
259+
if !strings.Contains(addr, ":") {
260+
return nil, fmt.Errorf("invalid address format: %s, expected host:port", addr)
261+
}
262+
263+
// DNS Override Logic:
264+
// This allows overriding DNS resolution for specific addresses.
265+
// The dnsResolveMap contains mappings from original addresses (host:port)
266+
// to target addresses (host:port). This is useful for:
267+
// - Testing against local services
268+
// - Bypassing DNS resolution issues
269+
// - Routing to specific service instances
259270
if dnsOverride, exists := dnsResolveMap[addr]; exists {
260271
addr = dnsOverride
261272
}
273+
262274
return dialer.DialContext(ctx, network, addr)
263275
},
264276
MaxIdleConns: 100,

management/ui/src/components/AdminResources.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ const AdminResources = () => {
8484
servingRuntimes: [],
8585
clusterServingRuntimes: []
8686
});
87+
// Only update discovery time on successful fetch
8788
setLastDiscoveryTime(new Date().toISOString());
8889
} catch (error) {
8990
toast.error('Failed to fetch resources');
@@ -131,7 +132,7 @@ const AdminResources = () => {
131132
status = 'healthy'; // Default for other resources
132133
}
133134

134-
const nodeId = `${type}-${resource.namespace || 'default'}-${resource.name}-${index}`;
135+
const nodeId = `${type}-${resource.namespace || 'default'}-${resource.name}-${resource.uid || resource.id || index}`;
135136

136137
nodes.push({
137138
id: nodeId,

management/ui/src/components/FilterPanel.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,22 @@ import {
1515
RefreshCw
1616
} from 'lucide-react';
1717

18+
// Add the spin animation keyframes
19+
const spinKeyframes = `
20+
@keyframes spin {
21+
from { transform: rotate(0deg); }
22+
to { transform: rotate(360deg); }
23+
}
24+
`;
25+
26+
// Inject the CSS into the document head if not already present
27+
if (typeof document !== 'undefined' && !document.querySelector('#spin-animation')) {
28+
const style = document.createElement('style');
29+
style.id = 'spin-animation';
30+
style.textContent = spinKeyframes;
31+
document.head.appendChild(style);
32+
}
33+
1834
const FilterPanel = ({
1935
resourceGraph,
2036
filters,
@@ -216,7 +232,12 @@ const FilterPanel = ({
216232
gap: '0.25rem'
217233
}}
218234
>
219-
<RefreshCw size={12} className={isRefreshing ? 'animate-spin' : ''} />
235+
<RefreshCw
236+
size={12}
237+
style={isRefreshing ? {
238+
animation: 'spin 1s linear infinite'
239+
} : {}}
240+
/>
220241
{isRefreshing ? 'Refreshing...' : 'Refresh'}
221242
</button>
222243
<span style={{ fontSize: '0.75rem', color: '#6b7280' }}>

management/ui/src/components/InferenceTest.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ const InferenceTest = () => {
9898
setAiGatewayInfo(response.data);
9999
} catch (error) {
100100
console.error('Error fetching gateway info:', error);
101+
toast.error('Failed to fetch AI Gateway information');
101102
setAiGatewayInfo(null);
102103
}
103104
};

management/ui/src/components/ResourceGraph.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,25 @@ const ResourceGraph = ({ resourceGraph, onRefresh, isRefreshing }) => {
199199
// Filter resources to focus on Gateway API, Envoy Gateway, and related services
200200
const isRelevantResource = (node) => {
201201
const type = node.type.toLowerCase();
202+
const namespace = node.namespace || 'all';
203+
const isHealthy = node.health === 'healthy';
204+
205+
// Filter by selected tiers
206+
const tier = getTierForType(type);
207+
if (!selectedTiers.includes(tier)) {
208+
return false;
209+
}
210+
211+
// Filter by selected namespace
212+
if (selectedNamespace !== 'all' && namespace !== selectedNamespace) {
213+
return false;
214+
}
215+
216+
// Filter by health status
217+
if (showHealthyOnly && !isHealthy) {
218+
return false;
219+
}
202220

203-
// Include all resource types for comprehensive view
204221
return true;
205222
};
206223

0 commit comments

Comments
 (0)