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

mgr/dashboard: Remove _filterValue from CdFormGroup #24719

Merged
merged 2 commits into from Nov 8, 2018

Conversation

Devp00l
Copy link

@Devp00l Devp00l commented Oct 23, 2018

The current behavior when submitting an empty mail field in the RGW user form
that was previously filled was to replace it with "false".

This was a regression introduced through the use of "CdFormGroup" which had
a "_filterValue" method which converted empty strings into false, but it was
removed now.

Fixes: http://tracker.ceph.com/issues/26861
Signed-off-by: Stephan Müller smueller@suse.com

  • References tracker ticket
  • Updates documentation if necessary
  • Includes tests for new functionality or reproducer for bug

@@ -113,6 +113,7 @@ export class RgwUserFormComponent implements OnInit {
]
]
});
this.userForm._filterValue = (value) => value;
Copy link
Member

Choose a reason for hiding this comment

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

Please add a comment here why it is necessary to override this function.

Copy link
Contributor

Choose a reason for hiding this comment

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

IMHO, a comment on that function doesn't make the implementation better. What we really need, and that's what you've already said @votdev, is a refactoring.

@votdev
Copy link
Member

votdev commented Oct 29, 2018

Can you please add a comment that explains the need of the _filterValue function (https://github.com/ceph/ceph/blob/master/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/cd-form-group.ts#L63)? After reviewing the code of the getValue function the intention is still not clear to me. I do not see a sense that the getValue function is doing any expectations or addtional things for me than returning me the original value of the form control. If this is necessary to post process the value, i as the developer have to do this somewhere in my form or elsewhere.

I think the current implementation of getValue will fail if the processed control is a checkbox that return 'false' in unchecked state. If you call the method then you can not differentiate anymore between unchecked state and "if it has none it will return false". In my opinion this method is missdesigned and should be refactored.

@Devp00l Devp00l changed the title mgr/dashboard: Resetting the mail address of a RGW user [WIP] mgr/dashboard: Resetting the mail address of a RGW user Nov 1, 2018
@Devp00l
Copy link
Author

Devp00l commented Nov 1, 2018

jenkins test dashboard

@Devp00l Devp00l changed the title [WIP] mgr/dashboard: Resetting the mail address of a RGW user mgr/dashboard: Remove _filterValue from CdFormGroup Nov 1, 2018
@Devp00l
Copy link
Author

Devp00l commented Nov 1, 2018

Addressed all comments

@p-se
Copy link
Contributor

p-se commented Nov 2, 2018

lgtm, but it feels a little bit odd that a (by now) refactoring PR contains a test addition for an issue. It might make sense to have two commits here.

spyOn(rgwUserService, 'update');
component.editing = true;

const user_id = component.userForm.get('email');
Copy link
Member

Choose a reason for hiding this comment

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

s/user_id/email/

It turned out that "_filterValue" wasn't needed for any form.

Fixes: http://tracker.ceph.com/issues/26861
Signed-off-by: Stephan Müller <smueller@suse.com>
@Devp00l
Copy link
Author

Devp00l commented Nov 6, 2018

Addressed all comments

The current behavior when submitting an empty mail field in the RGW user form
that was previously filled was to replace it with "false".

This was a regression introduced through the use of "CdFormGroup" which had
a "_filterValue" method which converted empty strings into false, but it was
removed now.

Fixes: http://tracker.ceph.com/issues/26861
Signed-off-by: Stephan Müller <smueller@suse.com>
@Devp00l
Copy link
Author

Devp00l commented Nov 8, 2018

jenkins retest this please

@LenzGr LenzGr merged commit d9c9cf6 into ceph:master Nov 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants