Skip to content

Commit

Permalink
Connection type admin view feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
ashley-o0o committed Feb 12, 2025
1 parent ba5a863 commit 3ef9ee1
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 7 deletions.
1 change: 1 addition & 0 deletions backend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export type DashboardConfig = K8sResourceCommon & {
disableConnectionTypes: boolean;
disableStorageClasses: boolean;
disableNIMModelServing: boolean;
disableAdminConnectionTypes: boolean;
disableFineTuning: boolean;
};
/** @deprecated -- replacing this with Platform Auth resource -- remove when this is no longer in the CRD */
Expand Down
1 change: 1 addition & 0 deletions backend/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const blankDashboardCR: DashboardConfig = {
disableConnectionTypes: false,
disableStorageClasses: false,
disableNIMModelServing: true,
disableAdminConnectionTypes: false,
disableFineTuning: true,
},
notebookController: {
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/__mocks__/mockDashboardConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export type MockDashboardConfigType = {
disableModelRegistrySecureDB?: boolean;
disableServingRuntimeParams?: boolean;
disableConnectionTypes?: boolean;
disableAdminConnectionTypes?: boolean;
disableStorageClasses?: boolean;
disableNotebookController?: boolean;
notebookSizes?: NotebookSize[];
Expand Down Expand Up @@ -182,6 +183,7 @@ export const mockDashboardConfig = ({
disableServingRuntimeParams,
disableStorageClasses,
disableNIMModelServing,
disableAdminConnectionTypes: false,
disableFineTuning,
},
notebookController: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,23 @@ it('Connection types should not be available for non product admins', () => {
connectionTypesPage.findNavItem().should('not.exist');
});

it('Connection types should be hidden by feature flag', () => {
asProductAdminUser();

cy.visitWithLogin('/connectionTypes');

cy.interceptOdh(
'GET /api/config',
mockDashboardConfig({
disableAdminConnectionTypes: false,
}),
);

cy.interceptOdh('GET /api/connection-types', []);
connectionTypesPage.visit();
connectionTypesPage.shouldBeEmpty();
});

describe('Connection types', () => {
beforeEach(() => {
asProductAdminUser();
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/concepts/areas/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const allFeatureFlags: string[] = Object.keys({
disableServingRuntimeParams: false,
disableStorageClasses: false,
disableNIMModelServing: true,
disableAdminConnectionTypes: true,
disableFineTuning: true,
} satisfies DashboardCommonConfig);

Expand Down Expand Up @@ -145,6 +146,9 @@ export const SupportedAreasStateMap: SupportedAreasState = {
featureFlags: ['disableNIMModelServing'],
reliantAreas: [SupportedArea.K_SERVE],
},
[SupportedArea.ADMIN_CONNECTION_TYPES]: {
featureFlags: ['disableAdminConnectionTypes'],
},
[SupportedArea.FINE_TUNING]: {
featureFlags: ['disableFineTuning'],
reliantAreas: [SupportedArea.DS_PIPELINES],
Expand Down
1 change: 1 addition & 0 deletions frontend/src/concepts/areas/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export enum SupportedArea {
ACCELERATOR_PROFILES = 'accelerator-profiles',
HARDWARE_PROFILES = 'hardware-profiles',
STORAGE_CLASSES = 'storage-classes',
ADMIN_CONNECTION_TYPES = 'connection-types',
FINE_TUNING = 'fine-tuning',

/* DS Projects specific areas */
Expand Down
1 change: 1 addition & 0 deletions frontend/src/k8sTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,7 @@ export type DashboardCommonConfig = {
disableServingRuntimeParams: boolean;
disableStorageClasses: boolean;
disableNIMModelServing: boolean;
disableAdminConnectionTypes: boolean;
disableFineTuning: boolean;
};

Expand Down
15 changes: 8 additions & 7 deletions frontend/src/utilities/NavData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,14 @@ const useCustomRuntimesNav = (): NavDataHref[] =>
},
]);

const useConnectionTypesNav = (): NavDataHref[] => [
{
id: 'settings-connection-types',
label: 'Connection types',
href: '/connectionTypes',
},
];
const useConnectionTypesNav = (): NavDataHref[] =>
useAreaCheck<NavDataHref>(SupportedArea.ADMIN_CONNECTION_TYPES, [
{
id: 'settings-connection-types',
label: 'Connection types',
href: '/connectionTypes',
},
]);

const useStorageClassesNav = (): NavDataHref[] =>
useAreaCheck<NavDataHref>(SupportedArea.STORAGE_CLASSES, [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ spec:
type: boolean
disableNIMModelServing:
type: boolean
disableAdminConnectionTypes:
type: boolean
disableFineTuning:
type: boolean
groupsConfig:
Expand Down

0 comments on commit 3ef9ee1

Please sign in to comment.