Web: Client: fixed AdvancedSelector search on accessRights page, rename people folder with actions to setting
This commit is contained in:
parent
7cda5b4bbe
commit
770fdbc691
@ -115,7 +115,8 @@ class PureAccessRights extends Component {
|
|||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
showSelector: false
|
showSelector: false,
|
||||||
|
advancedOptions: []
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,15 +124,18 @@ class PureAccessRights extends Component {
|
|||||||
const { getListAdmins, getListUsers, getUserById, ownerId } = this.props;
|
const { getListAdmins, getListUsers, getUserById, ownerId } = this.props;
|
||||||
|
|
||||||
getUserById(ownerId).catch(error => {
|
getUserById(ownerId).catch(error => {
|
||||||
toastr("accessRights getUserById", error);
|
toastr.error("accessRights getUserById", error);
|
||||||
|
//console.log("accessRights getUserById", error);
|
||||||
});
|
});
|
||||||
|
|
||||||
getListUsers().catch(error => {
|
getListUsers().catch(error => {
|
||||||
toastr("accessRights getListAdmins", error);
|
toastr.error("accessRights getListAdmins", error);
|
||||||
|
//console.log("accessRights getListAdmins", error);
|
||||||
});
|
});
|
||||||
|
|
||||||
getListAdmins().catch(error => {
|
getListAdmins().catch(error => {
|
||||||
toastr("accessRights getListAdmins", error);
|
toastr.error("accessRights getListAdmins", error);
|
||||||
|
//console.log("accessRights getListAdmins", error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,33 +143,37 @@ class PureAccessRights extends Component {
|
|||||||
const { changeAdmins, productId } = this.props;
|
const { changeAdmins, productId } = this.props;
|
||||||
|
|
||||||
changeAdmins(userId, productId, isAdmin).catch(error => {
|
changeAdmins(userId, productId, isAdmin).catch(error => {
|
||||||
toastr("accessRights onChangeAdmin", error);
|
toastr.error("accessRights onChangeAdmin", error);
|
||||||
|
//console.log("accessRights onChangeAdmin", error)
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
onShowGroupSelector = () =>
|
onShowGroupSelector = () =>
|
||||||
this.setState({ showSelector: !this.state.showSelector });
|
this.setState({
|
||||||
|
showSelector: !this.state.showSelector,
|
||||||
|
advancedOptions: this.props.advancedOptions
|
||||||
|
});
|
||||||
|
|
||||||
onSelect = selected => {
|
onSelect = selected => {
|
||||||
selected.map(user => this.onChangeAdmin(user.key, true));
|
selected.map(user => this.onChangeAdmin(user.key, true));
|
||||||
this.onShowGroupSelector();
|
this.onShowGroupSelector();
|
||||||
};
|
};
|
||||||
|
|
||||||
onSearchUsers = template => {
|
onSearchUsers = template =>
|
||||||
const { advancedOptions } = this.state;
|
|
||||||
this.setState({
|
this.setState({
|
||||||
//advancedOptions: this.filterUserSelectorOptions(advancedOptions, template)
|
advancedOptions: this.filterUserSelectorOptions(
|
||||||
|
this.props.advancedOptions,
|
||||||
|
template
|
||||||
|
)
|
||||||
});
|
});
|
||||||
};
|
|
||||||
|
|
||||||
/*filterUserSelectorOptions = (options, template) => {
|
filterUserSelectorOptions = (options, template) => {
|
||||||
return options.filter(option => option.label.indexOf(template) > -1);
|
return options.filter(option => option.label.indexOf(template) > -1);
|
||||||
};
|
};
|
||||||
*/
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { t, owner, admins, advancedOptions } = this.props;
|
const { t, owner, admins } = this.props;
|
||||||
const { showSelector } = this.state;
|
const { showSelector, advancedOptions } = this.state;
|
||||||
const OwnerOpportunities = t("AccessRightsOwnerOpportunities").split("|");
|
const OwnerOpportunities = t("AccessRightsOwnerOpportunities").split("|");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -369,18 +377,12 @@ const AccessRights = props => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const filterAdminsSelectorOptions = (admins, ownerId) =>
|
|
||||||
filter(admins, function(f) {
|
|
||||||
return f.id !== ownerId;
|
|
||||||
});
|
|
||||||
|
|
||||||
const filterOwner = (users, ownerId) =>
|
const filterOwner = (users, ownerId) =>
|
||||||
filter(users, function(f) {
|
filter(users, function(f) {
|
||||||
return f.id !== ownerId;
|
return f.id !== ownerId;
|
||||||
});
|
});
|
||||||
const filterAdminUsers = users => {
|
const filterAdminUsers = users => {
|
||||||
return users.filter(user => user.listAdminModules === undefined);
|
return users.filter(user => user.listAdminModules === undefined);
|
||||||
//options.filter(option => option.label.indexOf(template) > -1);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const AdvancedSelectorFunction = users =>
|
const AdvancedSelectorFunction = users =>
|
||||||
@ -394,13 +396,12 @@ const AdvancedSelectorFunction = users =>
|
|||||||
function mapStateToProps(state) {
|
function mapStateToProps(state) {
|
||||||
const { ownerId } = state.auth.settings;
|
const { ownerId } = state.auth.settings;
|
||||||
const { admins, users } = state.settings;
|
const { admins, users } = state.settings;
|
||||||
|
|
||||||
const arrayUsers = filterOwner(users, ownerId);
|
const arrayUsers = filterOwner(users, ownerId);
|
||||||
const filterArrayUsers = filterAdminUsers(arrayUsers);
|
const filterArrayUsers = filterAdminUsers(arrayUsers);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
users: filterArrayUsers,
|
users: filterArrayUsers,
|
||||||
admins: filterAdminsSelectorOptions(admins, ownerId),
|
admins: filterOwner(admins, ownerId),
|
||||||
productId: state.auth.modules[0].id,
|
productId: state.auth.modules[0].id,
|
||||||
owner: state.settings.owner,
|
owner: state.settings.owner,
|
||||||
ownerId,
|
ownerId,
|
||||||
|
Loading…
Reference in New Issue
Block a user