Skip to content

Commit

Permalink
Merge branch 'opendatahub-io:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
olavtar authored Jun 25, 2024
2 parents c1b40e5 + 1c5b791 commit 7cdc1ad
Show file tree
Hide file tree
Showing 22 changed files with 409 additions and 612 deletions.
16 changes: 16 additions & 0 deletions frontend/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,22 @@
}
]
}
},
{
"files": ["src/__tests__/cypress/**"],
"rules": {
"no-restricted-syntax": [
"error",
{
"selector": "Literal[value=/\\bRed Hat OpenShift AI\\b/i],JSXText[value=/\\bRed Hat OpenShift AI\\b/i]",
"message": "Do not hard code product name `Red Hat OpenShift AI`. Use `Cypress.env('ODH_PRODUCT_NAME')` instead."
},
{
"selector": "Literal[value=/\\bOpen Data Hub\\b/i],JSXText[value=/\\bOpen Data Hub\\b/i]",
"message": "Do not hard code product name `Open Data Hub`. Use `Cypress.env('ODH_PRODUCT_NAME')` instead."
}
]
}
}
]
}
342 changes: 161 additions & 181 deletions frontend/package-lock.json

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,20 @@
"dependencies": {
"@openshift/dynamic-plugin-sdk": "^4.0.0",
"@openshift/dynamic-plugin-sdk-utils": "^4.0.1",
"@patternfly/patternfly": "^5.2.1",
"@patternfly/quickstarts": "^5.1.0",
"@patternfly/patternfly": "^5.3.1",
"@patternfly/quickstarts": "^5.3.0",
"@patternfly/react-catalog-view-extension": "^5.0.0",
"@patternfly/react-charts": "^7.1.1",
"@patternfly/react-code-editor": "^5.2.1",
"@patternfly/react-core": "^5.2.1",
"@patternfly/react-charts": "^7.3.1",
"@patternfly/react-code-editor": "^5.3.3",
"@patternfly/react-core": "^5.3.3",
"@patternfly/react-drag-drop": "^5.3.3",
"@patternfly/react-icons": "^5.2.1",
"@patternfly/react-icons": "^5.3.2",
"@patternfly/react-log-viewer": "^5.2.0",
"@patternfly/react-styles": "^5.2.1",
"@patternfly/react-table": "^5.2.1",
"@patternfly/react-tokens": "^5.2.1",
"@patternfly/react-styles": "^5.3.1",
"@patternfly/react-table": "^5.3.3",
"@patternfly/react-tokens": "^5.3.1",
"@patternfly/react-topology": "^5.4.0-prerelease.9",
"@patternfly/react-virtualized-extension": "^5.0.0",
"@patternfly/react-virtualized-extension": "^5.1.0",
"@types/classnames": "^2.3.1",
"axios": "^1.6.4",
"classnames": "^2.2.6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class JupyterCard extends Card {
.findByTestId('tooltip-img')
.trigger('mouseenter')
.then(() => {
cy.findByText('Open Data Hub certified and supported');
cy.findByText(`${Cypress.env('ODH_PRODUCT_NAME')} certified and supported`);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ class PipelinesTableRow extends TableRow {
]) as unknown as Cypress.Chainable<JQuery<HTMLTableRowElement>>,
);
}

findPipelineNameLink(value: string) {
return this.find().findByTestId('table-row-title').contains(value);
}
}

class PipelineVersionsTableRow extends TableRow {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Application', () => {
const applicationLauncher = appChrome.getApplicationLauncher();
applicationLauncher.toggleAppLauncherButton();
const applicationLauncherMenuGroup = applicationLauncher.getApplicationLauncherMenuGroup(
'Open Data Hub Applications',
`${Cypress.env('ODH_PRODUCT_NAME')} Applications`,
);
applicationLauncherMenuGroup.shouldHaveApplicationLauncherItem('OpenShift Cluster Manager');
applicationLauncher.toggleAppLauncherButton();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,19 @@ describe('Pipelines', () => {
);
});

it('navigates to pipeline version details page via pipeline name', () => {
initIntercepts({});
pipelinesGlobal.visit(projectName);
pipelinesTable.find();

const pipelineRow = pipelinesTable.getRowById(initialMockPipeline.pipeline_id);
pipelineRow.findPipelineNameLink(initialMockPipeline.display_name).click();

verifyRelativeURL(
`/pipelines/${projectName}/pipeline/view/${initialMockPipeline.pipeline_id}/${initialMockPipelineVersion.pipeline_version_id}`,
);
});

it('delete pipeline and versions', () => {
initIntercepts({});
pipelinesGlobal.visit(projectName);
Expand Down
15 changes: 3 additions & 12 deletions frontend/src/api/k8s/__tests__/clusterQueues.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { k8sListResourceItems } from '@openshift/dynamic-plugin-sdk-utils';
import { mockClusterQueueK8sResource } from '~/__mocks__/mockClusterQueueK8sResource';
import { ClusterQueueKind } from '~/k8sTypes';
import { listClusterQueues } from '~/api/k8s/clusterQueues';
import { ClusterQueueModel } from '~/api/models/kueue';

jest.mock('@openshift/dynamic-plugin-sdk-utils', () => ({
k8sListResourceItems: jest.fn(),
Expand All @@ -16,12 +17,7 @@ describe('listClusterQueues', () => {
k8sListResourceItemsMock.mockResolvedValue([clusterQueueMock]);
const result = await listClusterQueues();
expect(k8sListResourceItemsMock).toHaveBeenCalledWith({
model: {
apiGroup: 'kueue.x-k8s.io',
apiVersion: 'v1beta1',
kind: 'ClusterQueue',
plural: 'clusterqueues',
},
model: ClusterQueueModel,
queryOptions: {},
});
expect(k8sListResourceItemsMock).toHaveBeenCalledTimes(1);
Expand All @@ -33,12 +29,7 @@ describe('listClusterQueues', () => {
await expect(listClusterQueues()).rejects.toThrow('error1');
expect(k8sListResourceItemsMock).toHaveBeenCalledTimes(1);
expect(k8sListResourceItemsMock).toHaveBeenCalledWith({
model: {
apiGroup: 'kueue.x-k8s.io',
apiVersion: 'v1beta1',
kind: 'ClusterQueue',
plural: 'clusterqueues',
},
model: ClusterQueueModel,
queryOptions: {},
});
});
Expand Down
42 changes: 7 additions & 35 deletions frontend/src/api/k8s/__tests__/configMaps.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,7 @@ describe('createConfigMap', () => {
expect(k8sCreateResourceMock).toHaveBeenCalledTimes(1);
expect(k8sCreateResourceMock).toHaveBeenCalledWith({
fetchOptions: { requestInit: {} },
model: {
apiVersion: 'v1',
kind: 'ConfigMap',
plural: 'configmaps',
},
model: ConfigMapModel,
queryOptions: { queryParams: {} },
resource: configMapMock,
});
Expand All @@ -112,11 +108,7 @@ describe('createConfigMap', () => {
expect(k8sCreateResourceMock).toHaveBeenCalledTimes(1);
expect(k8sCreateResourceMock).toHaveBeenCalledWith({
fetchOptions: { requestInit: {} },
model: {
apiVersion: 'v1',
kind: 'ConfigMap',
plural: 'configmaps',
},
model: ConfigMapModel,
queryOptions: { queryParams: {} },
resource: configMapMock,
});
Expand All @@ -133,11 +125,7 @@ describe('replaceConfigMap', () => {
expect(k8sUpdateResourceMock).toHaveBeenCalledTimes(1);
expect(k8sUpdateResourceMock).toHaveBeenCalledWith({
fetchOptions: { requestInit: {} },
model: {
apiVersion: 'v1',
kind: 'ConfigMap',
plural: 'configmaps',
},
model: ConfigMapModel,
queryOptions: { queryParams: {} },
resource: configMapMock,
});
Expand All @@ -153,11 +141,7 @@ describe('replaceConfigMap', () => {
expect(k8sUpdateResourceMock).toHaveBeenCalledTimes(1);
expect(k8sUpdateResourceMock).toHaveBeenCalledWith({
fetchOptions: { requestInit: {} },
model: {
apiVersion: 'v1',
kind: 'ConfigMap',
plural: 'configmaps',
},
model: ConfigMapModel,
queryOptions: { queryParams: {} },
resource: configMapMock,
});
Expand All @@ -174,11 +158,7 @@ describe('deleteConfigMap', () => {
expect(k8sDeleteResourceMock).toHaveBeenCalledTimes(1);
expect(k8sDeleteResourceMock).toHaveBeenCalledWith({
fetchOptions: { requestInit: {} },
model: {
apiVersion: 'v1',
kind: 'ConfigMap',
plural: 'configmaps',
},
model: ConfigMapModel,
queryOptions: {
name: configMapName,
ns: namespace,
Expand All @@ -196,11 +176,7 @@ describe('deleteConfigMap', () => {
expect(k8sDeleteResourceMock).toHaveBeenCalledTimes(1);
expect(k8sDeleteResourceMock).toHaveBeenCalledWith({
fetchOptions: { requestInit: {} },
model: {
apiVersion: 'v1',
kind: 'ConfigMap',
plural: 'configmaps',
},
model: ConfigMapModel,
queryOptions: {
name: configMapName,
ns: namespace,
Expand All @@ -216,11 +192,7 @@ describe('deleteConfigMap', () => {
expect(k8sDeleteResourceMock).toHaveBeenCalledTimes(1);
expect(k8sDeleteResourceMock).toHaveBeenCalledWith({
fetchOptions: { requestInit: {} },
model: {
apiVersion: 'v1',
kind: 'ConfigMap',
plural: 'configmaps',
},
model: ConfigMapModel,
queryOptions: {
name: configMapName,
ns: namespace,
Expand Down
35 changes: 5 additions & 30 deletions frontend/src/api/k8s/__tests__/inferenceServices.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,12 +328,7 @@ describe('listInferenceService', () => {
expect(k8sListResourceMock).toHaveBeenCalledTimes(1);
expect(k8sListResourceMock).toHaveBeenCalledWith({
fetchOptions: { requestInit: {} },
model: {
apiGroup: 'serving.kserve.io',
apiVersion: 'v1beta1',
kind: 'InferenceService',
plural: 'inferenceservices',
},
model: InferenceServiceModel,
queryOptions: { queryParams: {} },
});
});
Expand All @@ -344,12 +339,7 @@ describe('listInferenceService', () => {
expect(k8sListResourceMock).toHaveBeenCalledTimes(1);
expect(k8sListResourceMock).toHaveBeenCalledWith({
fetchOptions: { requestInit: {} },
model: {
apiGroup: 'serving.kserve.io',
apiVersion: 'v1beta1',
kind: 'InferenceService',
plural: 'inferenceservices',
},
model: InferenceServiceModel,
queryOptions: { queryParams: {} },
});
});
Expand Down Expand Up @@ -598,12 +588,7 @@ describe('deleteInferenceService', () => {
fetchOptions: {
requestInit: {},
},
model: {
apiGroup: 'serving.kserve.io',
apiVersion: 'v1beta1',
kind: 'InferenceService',
plural: 'inferenceservices',
},
model: InferenceServiceModel,
queryOptions: {
name: 'test',
ns: 'test-project',
Expand All @@ -622,12 +607,7 @@ describe('deleteInferenceService', () => {
fetchOptions: {
requestInit: {},
},
model: {
apiGroup: 'serving.kserve.io',
apiVersion: 'v1beta1',
kind: 'InferenceService',
plural: 'inferenceservices',
},
model: InferenceServiceModel,
queryOptions: {
name: 'test',
ns: 'test-project',
Expand All @@ -645,12 +625,7 @@ describe('deleteInferenceService', () => {
fetchOptions: {
requestInit: {},
},
model: {
apiGroup: 'serving.kserve.io',
apiVersion: 'v1beta1',
kind: 'InferenceService',
plural: 'inferenceservices',
},
model: InferenceServiceModel,
queryOptions: {
name: 'test',
ns: 'test-project',
Expand Down
15 changes: 3 additions & 12 deletions frontend/src/api/k8s/__tests__/localQueues.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { k8sListResourceItems } from '@openshift/dynamic-plugin-sdk-utils';
import { mockLocalQueueK8sResource } from '~/__mocks__/mockLocalQueueK8sResource';
import { LocalQueueKind } from '~/k8sTypes';
import { listLocalQueues } from '~/api/k8s/localQueues';
import { LocalQueueModel } from '~/api/models/kueue';

jest.mock('@openshift/dynamic-plugin-sdk-utils', () => ({
k8sListResourceItems: jest.fn(),
Expand All @@ -19,12 +20,7 @@ describe('listLocalQueues', () => {
k8sListResourceItemsMock.mockResolvedValue([mockedLocalQueue]);
const result = await listLocalQueues('test-project');
expect(k8sListResourceItemsMock).toHaveBeenCalledWith({
model: {
apiGroup: 'kueue.x-k8s.io',
apiVersion: 'v1beta1',
kind: 'LocalQueue',
plural: 'localqueues',
},
model: LocalQueueModel,
queryOptions: { ns: 'test-project' },
});
expect(k8sListResourceItemsMock).toHaveBeenCalledTimes(1);
Expand All @@ -36,12 +32,7 @@ describe('listLocalQueues', () => {
await expect(listLocalQueues('test-project')).rejects.toThrow('error1');
expect(k8sListResourceItemsMock).toHaveBeenCalledTimes(1);
expect(k8sListResourceItemsMock).toHaveBeenCalledWith({
model: {
apiGroup: 'kueue.x-k8s.io',
apiVersion: 'v1beta1',
kind: 'LocalQueue',
plural: 'localqueues',
},
model: LocalQueueModel,
queryOptions: { ns: 'test-project' },
});
});
Expand Down
12 changes: 3 additions & 9 deletions frontend/src/api/k8s/__tests__/projects.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
updateProject,
useProjects,
} from '~/api/k8s/projects';
import { ProjectModel } from '~/api/models';
import { ProjectModel, ProjectRequestModel } from '~/api/models';
import { ODH_PRODUCT_NAME } from '~/utilities/const';
import { NamespaceApplicationCase } from '~/pages/projects/types';
import { ProjectKind } from '~/k8sTypes';
Expand Down Expand Up @@ -118,12 +118,6 @@ describe('createProject', () => {
applied,
},
});
const projectRequest = {
apiGroup: 'project.openshift.io',
apiVersion: 'v1',
kind: 'ProjectRequest',
plural: 'projectrequests',
};

it('should create a project when k8s name is given', async () => {
const projectMock = mockProjectK8sResource({ k8sName });
Expand All @@ -133,7 +127,7 @@ describe('createProject', () => {
expect(result).toStrictEqual(k8sName);
expect(k8sCreateResourceMock).toHaveBeenCalledTimes(1);
expect(k8sCreateResourceMock).toHaveBeenCalledWith({
model: projectRequest,
model: ProjectRequestModel,
resource: {
apiVersion: 'project.openshift.io/v1',
kind: 'ProjectRequest',
Expand All @@ -156,7 +150,7 @@ describe('createProject', () => {
expect(result).toStrictEqual(displayName);
expect(k8sCreateResourceMock).toHaveBeenCalledTimes(1);
expect(k8sCreateResourceMock).toHaveBeenCalledWith({
model: projectRequest,
model: ProjectRequestModel,
resource: {
apiVersion: 'project.openshift.io/v1',
kind: 'ProjectRequest',
Expand Down
Loading

0 comments on commit 7cdc1ad

Please sign in to comment.