Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert templates to use websocket #2855

Merged

Conversation

ppadti
Copy link
Contributor

@ppadti ppadti commented May 29, 2024

Closes: RHOAIENG-5368

Description

Convert templates to use websockets. Replaces templates#listTemplates with useTemplates.
Created hook useCustomK8sWatchResource to perform type check on errors.

How Has This Been Tested?

In settings, open serving runtimes:

  1. Add/Edit/Duplicate/Delete the serving runtimes and check network inspector for websocket connection.

Test Impact

Added unit test to the useCustomK8sWatchResource hook.
Updated unit and cypress test to use websocket.

Request review criteria:

Self checklist (all need to be checked):

  • The developer has manually tested the changes and verified that the changes work
  • Commits have been squashed into descriptive, self-contained units of work (e.g. 'WIP' and 'Implements feedback' style messages have been removed)
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has added tests or explained why testing cannot be added (unit or cypress tests for related changes)

If you have UI changes:

  • Included any necessary screenshots or gifs if it was a UI change.
  • Included tags to the UX team if it was a UI/UX change (find relevant UX in the SMEs section).

After the PR is posted & before it merges:

  • The developer has tested their solution on a cluster by using the image produced by the PR to main

@openshift-merge-robot openshift-merge-robot added the needs-rebase PR needs to be rebased label May 29, 2024
@ppadti ppadti requested a review from christianvogt May 29, 2024 08:05
@openshift-merge-robot openshift-merge-robot removed the needs-rebase PR needs to be rebased label May 29, 2024
Copy link

codecov bot commented May 29, 2024

Codecov Report

Attention: Patch coverage is 94.64286% with 3 lines in your changes missing coverage. Please review.

Project coverage is 78.49%. Comparing base (b33db83) to head (c43dfcd).
Report is 62 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2855      +/-   ##
==========================================
+ Coverage   78.16%   78.49%   +0.33%     
==========================================
  Files        1101     1127      +26     
  Lines       23421    23944     +523     
  Branches     5902     6042     +140     
==========================================
+ Hits        18307    18795     +488     
- Misses       5114     5149      +35     
Files Coverage Δ
frontend/src/api/k8s/groups.ts 100.00% <100.00%> (ø)
frontend/src/api/k8s/projects.ts 97.43% <100.00%> (ø)
frontend/src/api/k8s/templates.ts 100.00% <100.00%> (ø)
frontend/src/concepts/projects/ProjectsContext.tsx 87.75% <100.00%> (-0.25%) ⬇️
...rvingRuntimes/CustomServingRuntimeEditTemplate.tsx 76.92% <100.00%> (-6.42%) ⬇️
...vingRuntimes/CustomServingRuntimeEnabledToggle.tsx 58.06% <100.00%> (ø)
...omServingRuntimes/CustomServingRuntimeListView.tsx 84.61% <100.00%> (ø)
...customServingRuntimes/CustomServingRuntimeView.tsx 75.00% <100.00%> (-25.00%) ⬇️
...ervingRuntimes/DeleteCustomServingRuntimeModal.tsx 83.87% <100.00%> (ø)
...s/modelServing/screens/global/ServeModelButton.tsx 94.59% <100.00%> (ø)
... and 11 more

... and 117 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b33db83...c43dfcd. Read the comment docs.

@ppadti
Copy link
Contributor Author

ppadti commented May 29, 2024

@christianvogt I tried sending resource to websocket while editing serving templates in cypress test it doesn't seems to work. But I am unsure what should be the modelOrOption while sending Patch request.
This is what I tried for editing serving runtime:

cy.wsK8s(
     'MODIFIED',
     TemplateModel,
incrementResourceVersion(
     mockServingRuntimeTemplateK8sResource({
       name: 'template-1',
       displayName: 'Updated Multi platform',
       platforms: [ServingRuntimePlatform.SINGLE],
     }),)
   );

@openshift-merge-robot openshift-merge-robot added the needs-rebase PR needs to be rebased label May 29, 2024
@ppadti ppadti force-pushed the templates-to-websocket branch 2 times, most recently from 3445807 to 95c1862 Compare June 3, 2024 11:11
@openshift-merge-robot openshift-merge-robot removed the needs-rebase PR needs to be rebased label Jun 3, 2024
frontend/src/utilities/useCustomK8sWatchResource.ts Outdated Show resolved Hide resolved
frontend/src/types.ts Outdated Show resolved Hide resolved
frontend/src/api/k8s/templates.ts Outdated Show resolved Hide resolved
@openshift-merge-robot openshift-merge-robot added the needs-rebase PR needs to be rebased label Jun 4, 2024
@openshift-merge-robot openshift-merge-robot removed the needs-rebase PR needs to be rebased label Jun 5, 2024
@ppadti ppadti force-pushed the templates-to-websocket branch 2 times, most recently from 63bfb64 to 165d5f5 Compare June 5, 2024 13:42
@ppadti
Copy link
Contributor Author

ppadti commented Jun 7, 2024

Updated the PR.

@christianvogt
Copy link
Contributor

/lgtm
/approve

Copy link
Contributor

openshift-ci bot commented Jun 13, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: christianvogt

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 804e231 into opendatahub-io:main Jun 13, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants