console icon indicating copy to clipboard operation
console copied to clipboard

[WIP] Expose `CreateProjectListPage` and `NamespacedPage` components in internal SDK

Open mturley opened this issue 3 years ago • 7 comments

Based on the usage here on the Add page and here on the Pipelines page, these two components allow a plugin to provide pages which require a namespace/project to be selected/created before reaching the page.

  • By rendering CreateProjectListPage instead of the page when there is no namespace present in the URL, the plugin can let the user create or select a project and then automatically proceed to the namespaced page in the same way that the above pages do (with a custom description at the top) without having to reimplement this selection page.
  • By wrapping the page in NamespacedPage, the plugin can provide the project switcher bar at the top even on pages which don't have /k8s in their URL (which is useful if a page doesn't strictly map to a k8s resource semantically). This is done above for both the /add/* and /dev-pipelines/* paths.

This PR moves the above two components from frontend/packages/dev-console/src/components into frontend/packages/console-shared/src/components, moves their prop types to frontend/packages/console-dynamic-plugin-sdk/src/api/internal-types.ts and exports them from frontend/packages/console-dynamic-plugin-sdk/src/api/internal-api.ts. This pattern is based on the last PR to expose something in this package (https://github.com/openshift/console/pull/11708).

  • Previously, dev-console/src/components/projects contained CreateProjectListPage and its internal ProjectListPage, and also a details subdirectory containing the ProjectDetailsPage component. This PR moves the former two components to a new directory at console-shared/src/components/projects, but leaves behind the ProjectDetailsPage in a new directory at dev-console/src/components/project-details because it is imported dynamically in the dev-console plugin's routes, so it didn't seem right to move it out of that package.
  • The NamespacedPage component wasn't in a subdirectory of dev-console/src/components, so it is now also at the top level of console-shared/src/components.
  • An index.ts file was added at console-shared/src/components/projects to match the pattern of other subdirectories there.
  • Imports have been adjusted to import each of these from @console/shared now that they are exported there.

mturley avatar Jul 12 '22 17:07 mturley

Skipping CI for Draft Pull Request. If you want CI signal for your change, please convert it to an actual PR. You can still manually trigger a test run with /test all

openshift-ci[bot] avatar Jul 12 '22 17:07 openshift-ci[bot]

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mturley To complete the pull request process, please assign jhadvig after the PR has been reviewed. You can assign the PR to them by writing /assign @jhadvig in a comment when ready.

The full list of commands accepted by this bot can be found 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-ci[bot] avatar Jul 12 '22 17:07 openshift-ci[bot]

/test all

mturley avatar Jul 12 '22 17:07 mturley

/retest

mturley avatar Jul 12 '22 18:07 mturley

@mturley: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/frontend e6673baf13f5382fa765bc1cd0b54da6acb75460 link true /test frontend
ci/prow/e2e-gcp-console e6673baf13f5382fa765bc1cd0b54da6acb75460 link true /test e2e-gcp-console
ci/prow/analyze e6673baf13f5382fa765bc1cd0b54da6acb75460 link true /test analyze
ci/prow/kubevirt-plugin e6673baf13f5382fa765bc1cd0b54da6acb75460 link true /test kubevirt-plugin

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

openshift-ci[bot] avatar Jul 12 '22 21:07 openshift-ci[bot]

Putting this on hold for now, it seems this belongs in the SDK proper.

mturley avatar Jul 13 '22 15:07 mturley

@mturley: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

openshift-merge-robot avatar Jul 23 '22 10:07 openshift-merge-robot

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close. Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

openshift-bot avatar Oct 22 '22 01:10 openshift-bot