Skip to content

Conversation

@rhamilto
Copy link
Member

@rhamilto rhamilto commented Apr 27, 2023

localhost_8006_extensions_detailspage

@rhamilto rhamilto force-pushed the CONSOLE-3305 branch 8 times, most recently from ba42874 to 9f476e0 Compare May 1, 2023 20:25
@rhamilto rhamilto changed the title [WIP] CONSOLE-3305: add DetailsPage and associated components CONSOLE-3305: add DetailsPage and associated components May 3, 2023
@rhamilto rhamilto changed the title CONSOLE-3305: add DetailsPage and associated components [WIP] CONSOLE-3305: add DetailsPage and associated components May 3, 2023
@Hyperkid123 Hyperkid123 requested a review from fhlavac May 5, 2023 07:48
Copy link
Contributor

@fhlavac fhlavac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thank you for the docs examples @rhamilto 🙂

Copy link
Member Author

@rhamilto rhamilto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments to clarify significant changes.

@rhamilto rhamilto changed the title [WIP] CONSOLE-3305: add DetailsPage and associated components CONSOLE-3305: add DetailsPage and associated components May 5, 2023
@rhamilto
Copy link
Member Author

rhamilto commented May 5, 2023

@fhlavac, thanks for the review!

@jhadvig, PTAL.

Copy link

@jhadvig jhadvig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Copy link
Collaborator

@Hyperkid123 Hyperkid123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a few comments.

@rhamilto
Copy link
Member Author

@Hyperkid123, thanks for the review and comments! I believe all your comments relate to the code as it exists in https://github.com/openshift/dynamic-plugin-sdk (what I'm doing in this PR is migrating it over). I don't know the entire history since @vidyanambiar did the work, but it certainly can be reconsidered here. Just want to make sure everyone is on the same page and the history is considered. cc: @jhadvig, @florkbr

@rhamilto rhamilto changed the title CONSOLE-3305: add DetailsPage and associated components [WIP] CONSOLE-3305: add DetailsPage and associated components May 11, 2023
@Hyperkid123
Copy link
Collaborator

Hyperkid123 commented May 15, 2023

@rhamilto Yup I am ware of its origin. We want to make sure that we do not transfer any product-specific code to this generic repository. Component API changes are OK and to be expected to some degree. Functionality should be preserved.

if (location?.pathname && navigate) {
const currentPathName = location.pathname;
if (params?.selectedTab) {
navigate(currentPathName.replace(params.selectedTab, eventKey as string), {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. The Tab component does support a href prop, but we can't customize the root component.

I think using the Link from the router package component is optimal but the Tab component support is currently not good enough. If we use it as a child node of the Tab title prop, we will require some extra styling. Can you experiment with it to see if we can use it? Let me know if its too much work for too little reward. We can skip it if it is.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For starters, I'm unclear how to deal with routing in general in the context of patternfly-docs. For example, how do I make use of react-router-dom hooks? Adding them to an example does not work. Perhaps it's not possible?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that is fair. I see we have two options. We either endorses the react-router-dom library for routing and expect the consuming app to have the router context setup, or we extend the API to not just only use click events to handle navigation but also proved the option to configure root elements of components that support the usage of link tags.

The reason why it's not working in example docs is because the Router context was never set up.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Hyperkid123, I defer to those of you with more experience on the subject. What do y'all think? @jhadvig, @florkbr, @fhlavac, @dlabaj

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do try to keep this repo as generic as possible. I would personally go with providing the API to modify the components rather than enforcing any libraries. After all, the long-term goal of this repo is to be product agnostic.

That said, there are other files that already use the router hooks etc.

Is it OK if we say, is OK for now, but we will make a breaking change in the near future that would change the component API to allow this generic approach?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that the intent of this repo is for reusable UI components that extend PF in a meaningful way. The flows may be specific to Redhat.

@dlabaj can we reuse the PF beta mechanism for releasing these components? That way we can really think through the API changes going forward. I'd imagine this would be valuable to other components we contribute in the future.

Something like:
image

@rhamilto rhamilto changed the title [WIP] CONSOLE-3305: add DetailsPage and associated components CONSOLE-3305: add DetailsPage and associated components May 31, 2023
Copy link

@jhadvig jhadvig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice work @rhamilto
Thanks @Hyperkid123 @dlabaj @florkbr for guidance here 👍

/lgtm

@Hyperkid123
Copy link
Collaborator

@florkbr @dlabaj can we use the beta flag for modules in PF extensions?

@florkbr
Copy link
Collaborator

florkbr commented Jun 8, 2023

@Hyperkid123 @rhamilto I performed a quick test locally and it appears we can add the beta: true clause in DetailsPage.md metadata and it shows up in the docs UI:
Screenshot 2023-06-08 at 3 22 18 PM

I'm looking at the promotion of the truncate component in PF5 as an example: patternfly/patternfly-react@34c1688

@Hyperkid123 Hyperkid123 self-requested a review June 9, 2023 07:29
@Hyperkid123
Copy link
Collaborator

@florkbr @rhamilto cool. If we can add that we can merge the initial work. I'll think about how we could ensure the flexibility of the components.

@rhamilto
Copy link
Member Author

rhamilto commented Jun 9, 2023

@Hyperkid123 @rhamilto I performed a quick test locally and it appears we can add the beta: true clause in DetailsPage.md metadata and it shows up in the docs UI: Screenshot 2023-06-08 at 3 22 18 PM

I'm looking at the promotion of the truncate component in PF5 as an example: patternfly/patternfly-react@34c1688

Done. Thanks, @florkbr.

@Hyperkid123 Hyperkid123 merged commit 6d9512b into patternfly:main Jun 9, 2023
@rhamilto rhamilto deleted the CONSOLE-3305 branch June 9, 2023 12:43
@github-actions
Copy link

🎉 This PR is included in version 1.0.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

import { Tabs, Tab, TabProps as PfTabProps, TabTitleText } from '@patternfly/react-core';
import React from 'react';
import { useNavigate, useLocation } from 'react-router-dom';
import '@patternfly/react-styles/css/utilities/Spacing/spacing.css';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

D'oh! This should have been removed. cc: @florkbr, @jhadvig, @Hyperkid123, @dlabaj

I will open a PR to fix as this blocks me from making use of DetailsPage in https://github.com/openshift/crontab-plugin

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR to resolve: #22

ouiaId={tab?.ouiaId}
key={tab.eventKey}
>
<div className="pf-u-m-md">{tab.children}</div>
Copy link
Member Author

@rhamilto rhamilto Jun 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<div className="pf-u-m-md"> is probably a mistake here as it is possible to not want padding on the tab children.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened a PR to address: #26

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.

8 participants