opendatahub-io / odh-dashboard

Dashboard for ODH
Apache License 2.0
28 stars 160 forks source link

[RHOAIENG-11326] Creating new pipeline from Create Run Page redirects to the pipeline detail page #3262

Closed jpuzz0 closed 1 week ago

jpuzz0 commented 1 week ago

https://issues.redhat.com/browse/RHOAIENG-11326

Description

Add condition to pipeline import modal to only redirect when not located in the /create path associated with runs/schedules

Demo: https://github.com/user-attachments/assets/28f10956-9b84-465e-8db6-bf9fda2d5f6d

How Has This Been Tested?

  1. Import a pipeline from the Pipelines list page and verify you're redirected to the pipeline version details page after creation
  2. Import a pipeline from the Create run page and verify you are not redirected to the pipeline version details page
  3. Repeat step 2 for the Create schedule page

Test Impact

No new tests added

Request review criteria:

Self checklist (all need to be checked):

If you have UI changes:

After the PR is posted & before it merges:

Gkrumbach07 commented 1 week ago

/retest

jpuzz0 commented 1 week ago

This is a nice solution, but I do have another suggestion. I feel we could avoid inferring from the pathname, instead, we can pass isRedirectingToDetailsPage or something like this into the modal, and only when it's set to true, navigate to the details page... And we can default it to true and set it only to false when importing on the create run/schedules page... Matching with the pathname is not always secure because if we change the pathname in the future, it's hard to find the issue here. This is OK for now, but just a suggestion.

That's fair, I don't mind either way, so I made the change to add a prop instead.

codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 84.97%. Comparing base (a0d40fd) to head (0b7abcc). Report is 10 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/opendatahub-io/odh-dashboard/pull/3262/graphs/tree.svg?width=650&height=150&src=pr&token=UQM7NLQUXJ&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opendatahub-io)](https://app.codecov.io/gh/opendatahub-io/odh-dashboard/pull/3262?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opendatahub-io) ```diff @@ Coverage Diff @@ ## main #3262 +/- ## ======================================= Coverage 84.96% 84.97% ======================================= Files 1302 1302 Lines 29101 29106 +5 Branches 7828 7829 +1 ======================================= + Hits 24727 24733 +6 + Misses 4374 4373 -1 ``` | [Files with missing lines](https://app.codecov.io/gh/opendatahub-io/odh-dashboard/pull/3262?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opendatahub-io) | Coverage Δ | | |---|---|---| | [...tent/createRun/contentSections/PipelineSection.tsx](https://app.codecov.io/gh/opendatahub-io/odh-dashboard/pull/3262?src=pr&el=tree&filepath=frontend%2Fsrc%2Fconcepts%2Fpipelines%2Fcontent%2FcreateRun%2FcontentSections%2FPipelineSection.tsx&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opendatahub-io#diff-ZnJvbnRlbmQvc3JjL2NvbmNlcHRzL3BpcGVsaW5lcy9jb250ZW50L2NyZWF0ZVJ1bi9jb250ZW50U2VjdGlvbnMvUGlwZWxpbmVTZWN0aW9uLnRzeA==) | `85.00% <ø> (ø)` | | | [.../pipelines/content/import/ImportPipelineButton.tsx](https://app.codecov.io/gh/opendatahub-io/odh-dashboard/pull/3262?src=pr&el=tree&filepath=frontend%2Fsrc%2Fconcepts%2Fpipelines%2Fcontent%2Fimport%2FImportPipelineButton.tsx&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opendatahub-io#diff-ZnJvbnRlbmQvc3JjL2NvbmNlcHRzL3BpcGVsaW5lcy9jb250ZW50L2ltcG9ydC9JbXBvcnRQaXBlbGluZUJ1dHRvbi50c3g=) | `66.66% <100.00%> (+1.96%)` | :arrow_up: | | [...s/pipelines/content/import/PipelineImportModal.tsx](https://app.codecov.io/gh/opendatahub-io/odh-dashboard/pull/3262?src=pr&el=tree&filepath=frontend%2Fsrc%2Fconcepts%2Fpipelines%2Fcontent%2Fimport%2FPipelineImportModal.tsx&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opendatahub-io#diff-ZnJvbnRlbmQvc3JjL2NvbmNlcHRzL3BpcGVsaW5lcy9jb250ZW50L2ltcG9ydC9QaXBlbGluZUltcG9ydE1vZGFsLnRzeA==) | `91.42% <100.00%> (+0.51%)` | :arrow_up: | ... and [5 files with indirect coverage changes](https://app.codecov.io/gh/opendatahub-io/odh-dashboard/pull/3262/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opendatahub-io) ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/opendatahub-io/odh-dashboard/pull/3262?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opendatahub-io). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opendatahub-io) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/opendatahub-io/odh-dashboard/pull/3262?dropdown=coverage&src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opendatahub-io). Last update [a0d40fd...0b7abcc](https://app.codecov.io/gh/opendatahub-io/odh-dashboard/pull/3262?dropdown=coverage&src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opendatahub-io). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opendatahub-io).
Gkrumbach07 commented 1 week ago

@jpuzz0 we also should prevent navigation when importing from the empty states bc it is pretty much the same page anyway

jpuzz0 commented 1 week ago

we also should prevent navigation when importing from the empty states bc it is pretty much the same page anyway

@Gkrumbach07 So inside of GlobalNoPipelines, prevent the redirect there? I'm not sure how this would be different from the redirect that we want from the pipelines table action. Maybe I'm missing something here though.

Gkrumbach07 commented 1 week ago

/approve

was mis reading what was changed

openshift-ci[bot] commented 1 week ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: DaoDaoNoCode, Gkrumbach07

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: - ~~[frontend/OWNERS](https://github.com/opendatahub-io/odh-dashboard/blob/main/frontend/OWNERS)~~ [Gkrumbach07] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment