Skip to content

Commit 7e0c05a

Browse files
Merge branch 'main' into fix/registry-name-field-validation
2 parents 4f617fd + ad86ed7 commit 7e0c05a

8 files changed

Lines changed: 12 additions & 64 deletions

File tree

backend/src/utils/dsci.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,5 @@ export const getClusterInitialization = async (
2121
throw createCustomError('DSCI Unavailable', 'Unable to get status', 404);
2222
}
2323

24-
const monitoringNamespace = result.spec.monitoring?.namespace;
25-
26-
return {
27-
...result.status,
28-
...(monitoringNamespace != null && { monitoring: { namespace: monitoringNamespace } }),
29-
};
24+
return result.status;
3025
};

docs/observability.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ The ODH Dashboard uses [Perses](https://perses.dev/) dashboards for observabilit
1010

1111
### Resource Location
1212

13-
Dashboard resources **must** be created in the product namespace (e.g., `opendatahub`).
14-
15-
The UI fetches dashboards via the Perses API provided by the Perses service and automatically loads them.
13+
Dashboard resources can be created in any Perses project. The UI fetches all dashboards via the global Perses API (`/api/v1/dashboards`) and automatically loads them. Dashboards are filtered by name prefix and admin status regardless of which project they belong to.
1614

1715
### File Location
1816

frontend/src/__mocks__/mockDsciStatus.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@ export const mockDsciStatus = ({
1212
conditions = [],
1313
requiredCapabilities = [],
1414
phase = 'Ready',
15-
monitoringNamespace = 'opendatahub',
1615
}: MockDsciStatus): DataScienceClusterInitializationKindStatus => ({
17-
monitoring: {
18-
namespace: monitoringNamespace,
19-
},
2016
conditions: [
2117
...[
2218
{

frontend/src/k8sTypes.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,10 +1543,6 @@ export type DataScienceClusterInitializationKindStatus = {
15431543
};
15441544
components?: Record<string, never>;
15451545
phase?: string;
1546-
// Added by the backend to identify the monitoring namespace
1547-
monitoring?: {
1548-
namespace?: string;
1549-
};
15501546
};
15511547

15521548
export type ModelRegistryKind = K8sResourceCommon & {

packages/observability/cypress/tests/mocked/observabilityDashboard.cy.ts

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { DashboardResource } from '@perses-dev/core';
22
import { mockDashboardConfig, mockStatus } from '@odh-dashboard/internal/__mocks__';
3-
import { mockDsciStatus } from '@odh-dashboard/internal/__mocks__/mockDsciStatus';
43
import { observabilityDashboardPage } from '../../pages/observabilityDashboard';
54

65
// Minimal test fixtures following the naming pattern from packages/observability/setup
@@ -26,44 +25,27 @@ const mockNonAdminDashboard = createMockPersesDashboard('dashboard-1-model', 'Mo
2625
type InitInterceptsOptions = {
2726
dashboards?: DashboardResource[];
2827
isAdmin?: boolean;
29-
monitoringNamespace?: string;
3028
};
3129

32-
const initIntercepts = ({
33-
dashboards = [],
34-
isAdmin = false,
35-
monitoringNamespace,
36-
}: InitInterceptsOptions = {}) => {
37-
// Mock dashboard config with observability feature enabled
30+
const initIntercepts = ({ dashboards = [], isAdmin = false }: InitInterceptsOptions = {}) => {
3831
cy.interceptOdh('GET /api/config', mockDashboardConfig({ observabilityDashboard: true }));
3932

4033
cy.interceptOdh('GET /api/status', mockStatus({ isAllowed: true, isAdmin }));
4134

42-
if (monitoringNamespace) {
43-
cy.interceptOdh('GET /api/dsci/status', mockDsciStatus({ monitoringNamespace }));
44-
}
45-
46-
// Mock the Perses dashboards API endpoint
47-
// The actual endpoint is: /perses/api/api/v1/projects/{namespace}/dashboards
48-
cy.intercept('GET', '/perses/api/api/v1/projects/*/dashboards', {
35+
// Mock the global Perses dashboards API endpoint
36+
cy.intercept('GET', '/perses/api/api/v1/dashboards', {
4937
statusCode: 200,
5038
body: dashboards,
5139
}).as('getPersesDashboards');
5240
};
5341

5442
describe('Observability Dashboard', () => {
55-
it('should show empty state and use the monitoringNamespace from DSCI', () => {
56-
const customNamespace = 'custom-monitoring-ns';
57-
58-
initIntercepts({ dashboards: [], isAdmin: true, monitoringNamespace: customNamespace });
43+
it('should show empty state when no dashboards exist', () => {
44+
initIntercepts({ dashboards: [], isAdmin: true });
5945

6046
observabilityDashboardPage.visit();
6147

62-
cy.wait('@getPersesDashboards').then((interception) => {
63-
expect(interception.request.url).to.include(
64-
`/perses/api/api/v1/projects/${customNamespace}/dashboards`,
65-
);
66-
});
48+
cy.wait('@getPersesDashboards');
6749

6850
observabilityDashboardPage.shouldHaveEmptyState();
6951
});

packages/observability/src/api/usePersesDashboards.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import * as React from 'react';
22
import { DashboardResource } from '@perses-dev/core';
33
import { useAccessReview } from '@odh-dashboard/internal/api/useAccessReview';
4-
import useFetchDsciStatus from '@odh-dashboard/internal/concepts/areas/useFetchDsciStatus';
54
import { useUser } from '@odh-dashboard/internal/redux/selectors/user';
65
import useFetch, { type FetchStateObject } from '@odh-dashboard/internal/utilities/useFetch';
7-
import { fetchProjectDashboards } from '../perses/perses-client/perses-client';
86
import {
97
filterDashboards,
108
filterDashboardsByThanosNonTenancyAccess,
119
THANOS_QUERIER_NON_TENANCY_ACCESS,
1210
} from '../utils/dashboardUtils';
11+
import { fetchPersesDashboardsMetadata } from '../perses/perses-client';
1312

1413
type UsePersesDashboardsResult = Omit<FetchStateObject<DashboardResource[]>, 'data'> & {
1514
dashboards: DashboardResource[];
@@ -19,24 +18,17 @@ type UsePersesDashboardsResult = Omit<FetchStateObject<DashboardResource[]>, 'da
1918
* Hook to fetch observability dashboards from Perses API
2019
*/
2120
export const usePersesDashboards = (): UsePersesDashboardsResult => {
22-
const [dsciStatus, dsciLoaded] = useFetchDsciStatus();
23-
const monitoringNamespace = dsciStatus?.monitoring?.namespace;
2421
const { isAdmin } = useUser();
2522
const [canAccessThanosNonTenancy, thanosNonTenancyAccessLoaded] = useAccessReview(
2623
THANOS_QUERIER_NON_TENANCY_ACCESS,
2724
);
2825

29-
const fetchDashboards = React.useCallback(
30-
() => (monitoringNamespace ? fetchProjectDashboards(monitoringNamespace) : Promise.resolve([])),
31-
[monitoringNamespace],
32-
);
33-
3426
const {
3527
data: allDashboards,
3628
loaded,
3729
error,
3830
refresh,
39-
} = useFetch(fetchDashboards, [], { initialPromisePurity: true });
31+
} = useFetch(fetchPersesDashboardsMetadata, [], { initialPromisePurity: true });
4032

4133
const dashboards = React.useMemo(() => {
4234
const afterAdminFilter = filterDashboards(allDashboards, isAdmin);
@@ -45,7 +37,7 @@ export const usePersesDashboards = (): UsePersesDashboardsResult => {
4537

4638
return {
4739
dashboards,
48-
loaded: loaded && dsciLoaded && thanosNonTenancyAccessLoaded,
40+
loaded: loaded && thanosNonTenancyAccessLoaded,
4941
error,
5042
refresh,
5143
};

packages/observability/src/perses/perses-client/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ configurations from a Perses server, you need this client code.
3838
- Build proxy URLs for datasource queries (`/perses/api/proxy/...`)
3939
- Fetch datasources and global datasources through the ODH backend proxy
4040
- **`odhPersesFetchJson` function** (`perses-client.ts`): Wrapper around Perses `fetchJson` for ODH-specific fetch handling
41-
- **`fetchProjectDashboards` function** (`perses-client.ts`): Helper to fetch all dashboards for a specific project
41+
- **`fetchPersesDashboardsMetadata` function** (`perses-client.ts`): Helper to fetch all dashboards
4242

4343
## Future
4444

packages/observability/src/perses/perses-client/perses-client.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,3 @@ export const fetchPersesDashboard = async (
5555

5656
return odhPersesFetchJson<DashboardResource>(persesURL);
5757
};
58-
59-
/**
60-
* Fetch all dashboards for a specific project
61-
* URL: /api/v1/projects/{project}/dashboards
62-
*/
63-
export const fetchProjectDashboards = async (project: string): Promise<DashboardResource[]> => {
64-
const listDashboardsURL = `/api/v1/projects/${encodeURIComponent(project)}/dashboards`;
65-
const persesURL = `${PERSES_PROXY_BASE_PATH}${listDashboardsURL}`;
66-
67-
return odhPersesFetchJson<DashboardResource[]>(persesURL);
68-
};

0 commit comments

Comments
 (0)