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
yzhao583 authored Jun 24, 2024
2 parents 6943fc4 + 2cafeff commit c1b40e5
Show file tree
Hide file tree
Showing 124 changed files with 592 additions and 476 deletions.
2 changes: 1 addition & 1 deletion docs/dev-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ODH requires the following to run:
- [NodeJS and NPM](https://nodejs.org/)
- Node recommended version -> `18.16.0`
- NPM recommended version -> `9.6.7`
- [OpenShift CLI](https://docs.openshift.com/container-platform/4.12/cli_reference/openshift_cli/getting-started-cli.html)
- [OpenShift CLI](https://docs.openshift.com/container-platform/latest/cli_reference/openshift_cli/getting-started-cli.html)
- [kustomize](https://github.com/kubernetes-sigs/kustomize) (if you need to do deployment)

### Additional tooling
Expand Down
2 changes: 1 addition & 1 deletion frontend/.env
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ ODH_FAVICON=rhoai-favicon.svg
ODH_NOTEBOOK_REPO=opendatahub

########## Change this version with each dashboard release ###########
INTERNAL_DASHBOARD_VERSION=v2.23.0
INTERNAL_DASHBOARD_VERSION=v2.24.0
12 changes: 12 additions & 0 deletions frontend/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,18 @@
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"excludedFiles": ["**/__mocks__/**", "**/__tests__/**"],
"rules": {
"@typescript-eslint/consistent-type-assertions": [
"error",
{
"assertionStyle": "never"
}
]
}
}
]
}
61 changes: 27 additions & 34 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"@patternfly/react-styles": "^5.2.1",
"@patternfly/react-table": "^5.2.1",
"@patternfly/react-tokens": "^5.2.1",
"@patternfly/react-topology": "^5.4.0-prerelease.6",
"@patternfly/react-topology": "^5.4.0-prerelease.9",
"@patternfly/react-virtualized-extension": "^5.0.0",
"@types/classnames": "^2.3.1",
"axios": "^1.6.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,21 @@ class PipelineRunsRow extends TableRow {
findColumnName(name: string) {
return this.find().find(`[data-label=Name]`).contains(name);
}
}

findColumnVersion(name: string) {
return this.find().find(`[data-label="Pipeline"]`).contains(name);
class PipelineRunTableRow extends PipelineRunsRow {
findKebabAction(name: string): Cypress.Chainable<JQuery<HTMLElement>> {
this.find().findKebab().click();
return cy.findByTestId('pipeline-run-table-row-actions').findByRole('menuitem', { name });
}
}

class PipelineRunJobTableRow extends PipelineRunsRow {
findStatusSwitchByRowName() {
return this.find().findByTestId('job-status-switch');
}
}

class PipelineRunsTable {
protected testId = '';

Expand All @@ -33,12 +39,6 @@ class PipelineRunsTable {
return cy.findByTestId(this.testId);
}

getRowByName(name: string) {
return new PipelineRunsRow(() =>
this.find().find(`[data-label=Name]`).contains(name).parents('tr'),
);
}

shouldRowNotBeVisible(name: string) {
this.find()
.parents()
Expand Down Expand Up @@ -120,6 +120,12 @@ class ActiveRunsTable extends PipelineRunsTable {
mockGetActiveRuns(runs: PipelineRunKFv2[], namespace: string, times?: number) {
return this.mockGetRuns(runs, [], namespace, times);
}

getRowByName(name: string) {
return new PipelineRunTableRow(() =>
this.find().find(`[data-label=Name]`).contains(name).parents('tr'),
);
}
}
class ArchivedRunsTable extends PipelineRunsTable {
constructor() {
Expand All @@ -129,13 +135,25 @@ class ArchivedRunsTable extends PipelineRunsTable {
mockGetArchivedRuns(runs: PipelineRunKFv2[], namespace: string, times?: number) {
return this.mockGetRuns([], runs, namespace, times);
}

getRowByName(name: string) {
return new PipelineRunTableRow(() =>
this.find().find(`[data-label=Name]`).contains(name).parents('tr'),
);
}
}

class PipelineRunJobTable extends PipelineRunsTable {
constructor() {
super('schedules');
}

getRowByName(name: string) {
return new PipelineRunJobTableRow(() =>
this.find().find(`[data-label=Name]`).contains(name).parents('tr'),
);
}

findEmptyState() {
return cy.findByTestId('schedules-empty-state');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ describe('Pipeline create runs', () => {
},
double_param: {
parameterType: InputDefinitionParameterType.DOUBLE,
defaultValue: 0.1,
defaultValue: 7.0,
description: 'Some double helper text',
isOptional: true,
},
Expand Down Expand Up @@ -313,7 +313,7 @@ describe('Pipeline create runs', () => {
paramsSection.findParamById('string_param').should('have.value', 'String default value');
cy.findByTestId('string_param-helper-text').should('have.text', 'Some string helper text');

paramsSection.findParamById('double_param').should('have.value', '0.1');
paramsSection.findParamById('double_param').should('have.value', '7.0');
cy.findByTestId('double_param-form-group').should('not.have.text', '*', { exact: false });
cy.findByTestId('double_param-helper-text').should('have.text', 'Some double helper text');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ describe('Pipelines', () => {
dspVersion: 'v2',
objectStorage: {
externalStorage: {
host: 's3.amazonaws.com/',
host: 's3.amazonaws.com',
scheme: 'https',
bucket: 'sdsd',
region: 'us-east-1',
Expand Down
7 changes: 3 additions & 4 deletions frontend/src/__tests__/unit/testUtils/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ export const renderHook = <
options?: RenderHookOptions<Props, Q, Container, BaseElement>,
): RenderHookResultExt<Result, Props> => {
let updateCount = 0;
let prevResult: Result | undefined;
let currentResult: Result | undefined;
let prevResult: Result;
let currentResult: Result;

const renderResult = renderHookRTL((props) => {
updateCount++;
Expand All @@ -80,8 +80,7 @@ export const renderHook = <
const renderResultExt: RenderHookResultExt<Result, Props> = {
...renderResult,

getPreviousResult: () =>
updateCount > 1 ? (prevResult as Result) : renderResult.result.current,
getPreviousResult: () => (updateCount > 1 ? prevResult : renderResult.result.current),

getUpdateCount: () => updateCount,

Expand Down
3 changes: 2 additions & 1 deletion frontend/src/api/errorUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { K8sStatus } from '@openshift/dynamic-plugin-sdk-utils';
import { AxiosError } from 'axios';

export const isK8sStatus = (data: unknown): data is K8sStatus =>
(data as K8sStatus).kind === 'Status';
typeof data === 'object' && data !== null && 'kind' in data && data.kind === 'Status';

export class K8sStatusError extends Error {
public statusObject: K8sStatus;
Expand All @@ -18,6 +18,7 @@ const isAxiosErrorWithResponseMessage = (
error?: Error | AxiosError,
): error is AxiosError<{ message: string }> =>
Boolean(
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
error && typeof (error as AxiosError<{ message: string }>).response?.data.message === 'string',
);

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/api/modelRegistry/errorUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ModelRegistryError } from '~/concepts/modelRegistry/types';
import { isCommonStateError } from '~/utilities/useFetchState';

const isError = (e: unknown): e is ModelRegistryError =>
['code', 'message'].every((key) => key in (e as ModelRegistryError));
typeof e === 'object' && e !== null && ['code', 'message'].every((key) => key in e);

export const handleModelRegistryFailures = <T>(promise: Promise<T>): Promise<T> =>
promise
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/api/pipelines/errorUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ type ResultErrorKF = {
};

const isErrorKF = (e: unknown): e is ErrorKF =>
['error', 'code', 'message'].every((key) => key in (e as ErrorKF));
typeof e === 'object' && e !== null && ['error', 'code', 'message'].every((key) => key in e);

const isErrorDetailsKF = (result: unknown): result is ResultErrorKF =>
['error_details', 'error_message'].every((key) => key in (result as ResultErrorKF));
typeof result === 'object' &&
result !== null &&
['error_details', 'error_message'].every((key) => key in result);

export const handlePipelineFailures = <T>(promise: Promise<T>): Promise<T> =>
promise
Expand Down
Loading

0 comments on commit c1b40e5

Please sign in to comment.