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

Fix #905. Implemented user manager plugin #1061

Merged
merged 20 commits into from
Oct 4, 2016

Conversation

offtherailz
Copy link
Member

Implemented user manager.

image

  • Creation / Editing /Deletion of users

image
image
image

  • Minimal support to group management (no creation or delete, only add to the user).
    image
    image
  • Plus:
    • Improvements to dialog (support loading mask and modal mode)
    • Add a reusable confirm dialog already configured.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.5%) to 80.511% when pulling 6d16249 on offtherailz:user_manager into e777e1a on geosolutions-it:master.

@@ -0,0 +1,615 @@
/**
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you have importer related actions in this PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

going to remove them

return (dispatch, getState) => {
let text = searchText;
let state = getState && getState();
if (state) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like too much handling this sort of stuff here

Copy link
Member Author

@offtherailz offtherailz Oct 3, 2016

Choose a reason for hiding this comment

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

Yes I know that search text and current page should come from the action, but this way the component are not indipendent. Where you should place them?

groups
});
});
dispatch({
Copy link
Contributor

Choose a reason for hiding this comment

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

define an action creator, please

Copy link
Member Author

Choose a reason for hiding this comment

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

Didn't find any convention that forces to create module internal function that create the final object from the action creator. I thought to improve readability in this way (avoid to jump here and there for simple objects definition, avoid passing variables that can be inverted and so on...) I fixed this, let's check if it is a good convention and lets write it if there is a reason to make it mandatory.

Copy link
Contributor

Choose a reason for hiding this comment

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

The only reason for now is: we always did this way, so far, let's discuss if we want to improve it and how, but I agree it's not mandatory


});
}).catch((error) => {
dispatch({
Copy link
Contributor

Choose a reason for hiding this comment

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

define an action creator, please

status: "loading"
});
return API.getAvailableGroups(user).then((groups) => {
dispatch({
Copy link
Contributor

Choose a reason for hiding this comment

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

define an action creator, please

const {editUser, changeUserMetadata, saveUser} = require('../../../actions/users');


const mapStateToProps = (state) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to make it so complex? Please, use the usual selectors composition with reselect

Copy link
Member Author

Choose a reason for hiding this comment

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

They are only not null checks, how it is less complex and more readable than this?

groups: users && users.groups
};
};
const mapDispatchToProps = (dispatch) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

bindActionCreators is not needed, bind is not needed

Copy link
Member Author

Choose a reason for hiding this comment

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

line 25, bind the action with null as first parameter, this is needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, got it, do we also need it for onChange and onSave ?

onDelete: deleteUser
}, dispatch);
};
const mergeProps = (stateProps, dispatchProps, ownProps) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not clear the purpose of this...

Copy link
Member Author

Choose a reason for hiding this comment

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

allow overriding from ownProps , start and limit , even if not defined.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

const assign = require('object-assign');
function users(state = {
start: 0,
limit: 12
Copy link
Contributor

Choose a reason for hiding this comment

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

12 is duplicated everywhere, can we make this a constant that we change in a single place?

top: "50%",
left: "50%",
transform: "translate(-50%, -40%)"
}}>Loading...<Spinner spinnerName="circle" noFadeIn/></div></div>);
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be localized

@coveralls
Copy link

Coverage Status

Coverage increased (+0.5%) to 80.454% when pulling 7eee84c on offtherailz:user_manager into e777e1a on geosolutions-it:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.6%) to 80.557% when pulling 7eee84c on offtherailz:user_manager into e777e1a on geosolutions-it:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.6%) to 80.557% when pulling 9170b2e on offtherailz:user_manager into e777e1a on geosolutions-it:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.6%) to 80.549% when pulling 9170b2e on offtherailz:user_manager into e777e1a on geosolutions-it:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.6%) to 80.557% when pulling d49c2c3 on offtherailz:user_manager into e777e1a on geosolutions-it:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.5%) to 80.464% when pulling a023262 on offtherailz:user_manager into e777e1a on geosolutions-it:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.6%) to 80.55% when pulling a023262 on offtherailz:user_manager into e777e1a on geosolutions-it:master.

@offtherailz offtherailz merged commit 3724048 into geosolutions-it:master Oct 4, 2016
@offtherailz offtherailz deleted the user_manager branch March 21, 2018 08:56
@allyoucanmap allyoucanmap mentioned this pull request Aug 9, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants