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

Fixes #21755: Impossible to move groups #4482

Conversation

ElaadF
Copy link
Member

@ElaadF ElaadF commented Sep 15, 2022

@@ -222,7 +222,7 @@ class NodeGroupForm(
& "group-save" #> { if (CurrentUser.checkRights(AuthorizationType.Group.Edit))
<span class="save-tooltip-container">
{
SHtml.ajaxButton(<span>Save <i class="fa fa-download"></i></span>, onSubmit _) % ("id" -> saveButtonId) % ("class" -> " btn btn-success btn-icon")
SHtml.ajaxSubmit("Save", onSubmit _) % ("id" -> saveButtonId) % ("class" -> " btn btn-success")
Copy link
Member Author

Choose a reason for hiding this comment

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

Not an easy one for me, I'm still not so sure about how it works, but it seems to resolve the bug
This is how it was done in 7.0

Copy link
Member

Choose a reason for hiding this comment

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

You need to keep the element as before, just replace ajaxButton by ajaxSubmit

Copy link
Member

Choose a reason for hiding this comment

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

Submit, applies all changes in the form before executing it, Ajaxbutton executes it without the changes from the form. so it explains why the changes were not kept

Copy link
Member Author

Choose a reason for hiding this comment

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

W

You need to keep the element as before, just replace ajaxButton by ajaxSubmit

We can't give HTML to ajaxSubmit like ajaxButton (for the icon), we need to find another way to add the dowload icon at the end of the button

@@ -222,7 +222,7 @@ class NodeGroupForm(
& "group-save" #> { if (CurrentUser.checkRights(AuthorizationType.Group.Edit))
<span class="save-tooltip-container">
{
SHtml.ajaxButton(<span>Save <i class="fa fa-download"></i></span>, onSubmit _) % ("id" -> saveButtonId) % ("class" -> " btn btn-success btn-icon")
SHtml.ajaxSubmit("Save", onSubmit _) % ("id" -> saveButtonId) % ("class" -> " btn btn-success")
Copy link
Member Author

Choose a reason for hiding this comment

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

Not an easy one for me, I'm still not so sure about how it works, but it seems to resolve the bug
This is how it was done in 7.0

@ElaadF
Copy link
Member Author

ElaadF commented Sep 15, 2022

Commit modified

@ElaadF ElaadF force-pushed the bug_21755/impossible_to_move_groups branch from 106b819 to d99e3de Compare September 15, 2022 09:22
@ElaadF
Copy link
Member Author

ElaadF commented Sep 19, 2022

PR updated with a new commit

@@ -222,10 +222,12 @@ class NodeGroupForm(
& "group-save" #> { if (CurrentUser.checkRights(AuthorizationType.Group.Edit))
<span class="save-tooltip-container">
{
SHtml.ajaxButton(<span>Save <i class="fa fa-download"></i></span>, onSubmit _) % ("id" -> saveButtonId) % ("class" -> " btn btn-success btn-icon")
<button class="btn btn-success btn-icon ui-button ui-corner-all ui-widget" id="groupSaveButtonId"> <span>Save <i class="fa fa-download"></i></span></button>
SHtml.ajaxOnSubmit(onSubmit _)
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't understand how ajaxOnSubmit works, I get this in UI :
image

@ElaadF
Copy link
Member Author

ElaadF commented Sep 20, 2022

Commit modified

@ElaadF ElaadF force-pushed the bug_21755/impossible_to_move_groups branch from 1daa5c5 to df454c1 Compare September 20, 2022 13:56
@@ -222,10 +222,15 @@ class NodeGroupForm(
& "group-save" #> { if (CurrentUser.checkRights(AuthorizationType.Group.Edit))
<span class="save-tooltip-container">
{
SHtml.ajaxButton(<span>Save <i class="fa fa-download"></i></span>, onSubmit _) % ("id" -> saveButtonId) % ("class" -> " btn btn-success btn-icon")
SHtml.ajaxOnSubmit(onSubmit _)(
<button class="btn btn-success btn-icon ui-button ui-corner-all ui-widget" id="groupSaveButtonId">
Copy link
Member

Choose a reason for hiding this comment

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

I think you should try to give the id attribute from the saveButtonId val

try something like id="${saveButtonId}"

If saveButtonId was only used here, you may delete it i would be quite happy too

Copy link
Member Author

Choose a reason for hiding this comment

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

It's used in other places

@ElaadF
Copy link
Member Author

ElaadF commented Sep 20, 2022

Commit modified

@ElaadF ElaadF force-pushed the bug_21755/impossible_to_move_groups branch from df454c1 to 594c2bf Compare September 20, 2022 14:21
Fixes #21755: Impossible to move groups
@ElaadF
Copy link
Member Author

ElaadF commented Sep 20, 2022

PR rebased

@ElaadF ElaadF force-pushed the bug_21755/impossible_to_move_groups branch from 594c2bf to 8485087 Compare September 20, 2022 14:39
@Normation-Quality-Assistant
Copy link
Contributor

OK, merging this PR

@Normation-Quality-Assistant Normation-Quality-Assistant merged commit 8485087 into Normation:branches/rudder/7.2 Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants