Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
dchourasia committed Oct 19, 2024
2 parents f7d1ec6 + 6b6dc43 commit 1946490
Show file tree
Hide file tree
Showing 37 changed files with 540 additions and 295 deletions.
2 changes: 1 addition & 1 deletion backend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export type DashboardConfig = K8sResourceCommon & {
disableProjectSharing: boolean;
disableCustomServingRuntimes: boolean;
disablePipelines: boolean;
disableBiasMetrics: boolean;
disableTrustyBiasMetrics: boolean;
disablePerformanceMetrics: boolean;
disableKServe: boolean;
disableKServeAuth: boolean;
Expand Down
2 changes: 1 addition & 1 deletion backend/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const blankDashboardCR: DashboardConfig = {
disableModelServing: false,
disableProjectSharing: false,
disableCustomServingRuntimes: false,
disableBiasMetrics: false,
disableTrustyBiasMetrics: false,
disablePerformanceMetrics: false,
disablePipelines: false,
disableKServe: false,
Expand Down
46 changes: 1 addition & 45 deletions backend/src/utils/resourceUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ const DASHBOARD_CONFIG = {
};

const fetchDashboardCR = async (fastify: KubeFastifyInstance): Promise<DashboardConfig[]> => {
return fetchOrCreateDashboardCR(fastify)
.then(softDisableBiasMetrics(fastify))
.then((dashboardCR) => [dashboardCR]);
return fetchOrCreateDashboardCR(fastify).then((dashboardCR) => [dashboardCR]);
};

const fetchWatchedClusterStatus = async (
Expand All @@ -87,48 +85,6 @@ const fetchWatchedClusterStatus = async (
return fetchClusterStatus(fastify).then((clusterStatus) => [clusterStatus]);
};

/**
* TODO: Support Bias Metrics https://issues.redhat.com/browse/RHOAIENG-13084
* For RHOAI Only
* Always disable bias metrics until we can properly support the new UI flow.
* Note: This does no changes to the on-cluster value -- there can be a de-sync
*/
const softDisableBiasMetrics =
(fastify: KubeFastifyInstance) =>
(dashboardConfig: DashboardConfig): DashboardConfig & { status?: object } => {
if (!isRHOAI(fastify)) {
return dashboardConfig;
}

fastify.log.info(
'Trusty Bias Metrics are explicitly disabled in the cached odh-dashboard-config',
);
return {
...dashboardConfig,
spec: {
...dashboardConfig.spec,
dashboardConfig: {
...dashboardConfig.spec.dashboardConfig,
disableBiasMetrics: true,
},
},
// NOTE: This is a fake status to help show in the UI that we are overriding the value
// The CRD does not support a status property today and should not have existing statuses here
// No code should use this -- this is purely for debugging in the UI
// To be removed as soon as we can support trusty properly
status: {
conditions: [
{
message: 'This feature flag state is being ignored',
reason: 'IgnoredFeatureFlag',
status: 'False',
type: 'disableBiasMetricsAvailable',
},
],
},
};
};

const fetchOrCreateDashboardCR = async (fastify: KubeFastifyInstance): Promise<DashboardConfig> => {
return fastify.kube.customObjectsApi
.getNamespacedCustomObject(
Expand Down
6 changes: 3 additions & 3 deletions docs/dashboard-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The following are a list of features that are supported, along with there defaul
| disableKServeMetrics | false | Disables the ability to see KServe Metrics. |
| disableModelMesh | false | Disables the ability to select ModelMesh as a Serving Platform. |
| disableAcceleratorProfiles | false | Disables Accelerator profiles from the Admin Panel. |
| disableBiasMetrics | false | Disables Model Bias tab from Model Serving metrics. |
| disableTrustyBiasMetrics | false | Disables Model Bias tab from Model Serving metrics. |
| disablePerformanceMetrics | false | Disables Endpoint Performance tab from Model Serving metrics. |
| disableDistributedWorkloads | false | Disables Distributed Workload Metrics from the dashboard. |
| disableModelRegistry | false | Disables Model Registry from the dashboard. |
Expand Down Expand Up @@ -62,7 +62,7 @@ spec:
disableCustomServingRuntimes: false
disableAcceleratorProfiles: false
disableKServeMetrics: false
disableBiasMetrics: false
disableTrustyBiasMetrics: false
disablePerformanceMetrics: false
disableDistributedWorkloads: false
disableConnectionTypes: false
Expand Down Expand Up @@ -159,7 +159,7 @@ spec:
disableCustomServingRuntimes: false
disableAcceleratorProfiles: true
disableKServeMetrics: true
disableBiasMetrics: false
disableTrustyBiasMetrics: false
disablePerformanceMetrics: false
disableNIMModelServing: true
notebookController:
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/__mocks__/mockDashboardConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type MockDashboardConfigType = {
disableModelMesh?: boolean;
disableAcceleratorProfiles?: boolean;
disablePerformanceMetrics?: boolean;
disableBiasMetrics?: boolean;
disableTrustyBiasMetrics?: boolean;
disableDistributedWorkloads?: boolean;
disableModelRegistry?: boolean;
disableConnectionTypes?: boolean;
Expand Down Expand Up @@ -51,7 +51,7 @@ export const mockDashboardConfig = ({
disableModelMesh = false,
disableAcceleratorProfiles = false,
disablePerformanceMetrics = false,
disableBiasMetrics = false,
disableTrustyBiasMetrics = false,
disableDistributedWorkloads = false,
disableModelRegistry = false,
disableConnectionTypes = true,
Expand Down Expand Up @@ -152,7 +152,7 @@ export const mockDashboardConfig = ({
disableCustomServingRuntimes,
disablePipelines,
disableProjectSharing: false,
disableBiasMetrics,
disableTrustyBiasMetrics,
disablePerformanceMetrics,
disableKServe,
disableKServeAuth,
Expand Down
16 changes: 16 additions & 0 deletions frontend/src/__tests__/cypress/cypress/pages/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ class ProjectNotebookRow extends TableRow {
findNotebookStatusText() {
return this.find().findByTestId('notebook-status-text');
}

findNotebookStart() {
return this.find().findByTestId('notebook-start-action');
}

findNotebookStop() {
return this.find().findByTestId('notebook-stop-action');
}
}

class ProjectRow extends TableRow {
Expand All @@ -57,10 +65,18 @@ class ProjectRow extends TableRow {
return this.find().findByTestId('notebook-column-expand');
}

findNotebookColumnExpander() {
return this.find().findByTestId('notebook-column-count');
}

findNotebookTable() {
return this.find().parents('tbody').findByTestId('project-notebooks-table');
}

getNotebookRows() {
return this.findNotebookTable().findByTestId('project-notebooks-table-row');
}

getNotebookRow(notebookName: string) {
return new ProjectNotebookRow(() => this.findNotebookLink(notebookName).parents('tr'));
}
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/__tests__/cypress/cypress/pages/workbench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@ class NotebookRow extends TableRow {
return this.find().findByTestId('notebook-status-text');
}

findNotebookStart() {
return this.find().findByTestId('notebook-start-action');
}

findNotebookStop() {
return this.find().findByTestId('notebook-stop-action');
}

findNotebookStatusPopover(name: string) {
return cy.findByTestId('notebook-status-popover').contains(name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,26 @@ describe('MR Permissions', () => {
it('Disabled actions on default group', () => {
initIntercepts({ isEmpty: false });
modelRegistryPermissions.visit('example-mr');
groupTable.getTableRow('example-mr-users').findKebab().should('be.disabled');
groupTable.getTableRow('example-mr-users-2').findKebab().should('not.be.disabled');

cy.contains('td', 'example-mr-users')
.closest('tr')
.within(() => {
cy.get('button[aria-disabled="true"]')
.should('exist')
.and(
'have.attr',
'aria-label',
'The default group always has access to model registry.',
)
.find('svg')
.should('exist');
});

cy.contains('td', 'example-mr-users-2')
.closest('tr')
.within(() => {
cy.get('button:not([aria-disabled="true"])').should('exist').and('be.visible');
});
});
});

Expand Down
Loading

0 comments on commit 1946490

Please sign in to comment.