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 7, 2025
1 parent f90ce23 commit feabc77
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 2 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;
};
/** @deprecated -- replacing this with Platform Auth resource -- remove when this is no longer in the CRD */
groupsConfig?: {
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: true,
},
notebookController: {
enabled: true,
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/__mocks__/mockDashboardConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export type MockDashboardConfigType = {
disableNotebookController?: boolean;
notebookSizes?: NotebookSize[];
disableNIMModelServing?: boolean;
disableAdminConnectionTypes?: boolean;
};

export const mockDashboardConfig = ({
Expand Down Expand Up @@ -69,6 +70,7 @@ export const mockDashboardConfig = ({
disableStorageClasses = false,
disableNotebookController = false,
disableNIMModelServing = true,
disableAdminConnectionTypes = true,
notebookSizes = [
{
name: 'XSmall',
Expand Down Expand Up @@ -180,6 +182,7 @@ export const mockDashboardConfig = ({
disableServingRuntimeParams,
disableStorageClasses,
disableNIMModelServing,
disableAdminConnectionTypes,
},
notebookController: {
enabled: !disableNotebookController,
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,
} satisfies DashboardCommonConfig);

export const SupportedAreasStateMap: SupportedAreasState = {
Expand Down Expand Up @@ -144,4 +145,7 @@ export const SupportedAreasStateMap: SupportedAreasState = {
featureFlags: ['disableNIMModelServing'],
reliantAreas: [SupportedArea.K_SERVE],
},
[SupportedArea.ADMIN_CONNECTION_TYPES]: {
featureFlags: ['disableAdminConnectionTypes'],
},
};
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 = 'admin-connection-types',

/* DS Projects specific areas */
DS_PROJECTS_PERMISSIONS = 'ds-projects-permission',
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;
};

export type DashboardConfigKind = K8sResourceCommon & {
Expand Down
5 changes: 3 additions & 2 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[] => [
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

0 comments on commit feabc77

Please sign in to comment.