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

Execution Environment add or edit #1054

Merged
merged 37 commits into from
Nov 21, 2023
Merged

Execution Environment add or edit #1054

merged 37 commits into from
Nov 21, 2023

Conversation

MilanPospisil
Copy link
Contributor

No description provided.

@github-actions github-actions bot added the HUB label Oct 18, 2023
@github-actions github-actions bot added AWX Label to indicate changes relevant to AWX AFW Ansible Framework and removed AWX Label to indicate changes relevant to AWX labels Oct 24, 2023
@MilanPospisil MilanPospisil marked this pull request as ready for review October 24, 2023 09:19
Copy link
Member

@AlexSCorey AlexSCorey left a comment

Choose a reason for hiding this comment

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

Milan and I discussed these changes off line. This is a great start. Let make some changes to help all AAP UI projects unify around some conventions.

Copy link
Contributor

@nixocio nixocio left a comment

Choose a reason for hiding this comment

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

@MilanPospisil I got the latest version locally, and it seems to be working as expected.

Good job.

Copy link
Member

@AlexSCorey AlexSCorey left a comment

Choose a reason for hiding this comment

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

Just update that 1 string and I think we will be good to go.

@himdel
Copy link
Contributor

himdel commented Oct 30, 2023

The problem where clicking on the "Show less" button in the LabelGroup causes a reload is unrelated to this PR, that's a patternfly bug:

  • LabelGroup renders items as <Label ..., and the last one as <Label isOverflowLabel ...,
  • Label renders a <span> .. except with isOverflowLabel where it renders a <button>
  • <button> inside <form> submits the form

The problem is that pattenrfly Label renders a raw <button> (which submits forms) instead of a <button type="button"> (which doesn't).

So, the solution is to fix patternfly, either of these works:

diff --git a/packages/react-core/src/components/Label/Label.tsx b/packages/react-core/src/components/Label/Label.tsx
index 0bab0335a..101b5c894 100644
--- a/packages/react-core/src/components/Label/Label.tsx
+++ b/packages/react-core/src/components/Label/Label.tsx
@@ -180,7 +180,8 @@ export const Label: React.FunctionComponent<LabelProps> = ({
     }
   };
 
-  const LabelComponent = (isOverflowLabel ? 'button' : 'span') as any;
+  const safeButton = ({ children, ...props }) => <button type="button" {...props}>{children}</button>;
+  const LabelComponent = (isOverflowLabel ? safeButton : 'span') as any;
 
   const button = closeBtn ? (
     closeBtn

OR

diff --git a/packages/react-core/src/components/LabelGroup/LabelGroup.tsx b/packages/react-core/src/components/LabelGroup/LabelGroup.tsx
index 82e8d0376..ba449b3d9 100644
--- a/packages/react-core/src/components/LabelGroup/LabelGroup.tsx
+++ b/packages/react-core/src/components/LabelGroup/LabelGroup.tsx
@@ -104,7 +104,9 @@ export class LabelGroup extends React.Component<LabelGroupProps, LabelGroupState
     });
   }
 
-  toggleCollapse = () => {
+  toggleCollapse = (e) => {
+    e.preventDefault();
+
     this.setState(prevState => ({
       isOpen: !prevState.isOpen,
       isTooltipVisible: Boolean(

(not sure how that interacts with the pf5 switch)

Copy link
Contributor

@nixocio nixocio left a comment

Choose a reason for hiding this comment

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

@MilanPospisil informed that will the last framework changes in a follow up PR.

Copy link
Member

@AlexSCorey AlexSCorey 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. All of my concerns have been addressed. Well done!

@MilanPospisil MilanPospisil merged commit ad4c0fd into main Nov 21, 2023
18 checks passed
@MilanPospisil MilanPospisil deleted the milan_ee_add_or_edit branch November 21, 2023 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AFW Ansible Framework HUB
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants