mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-52618] Adding generic error to handle network issues when fetching groups (#23495)
* adding generic error to handle network issues --------- Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
parent
37196a6a26
commit
c2417efc33
@ -48,6 +48,7 @@ type FilterSearchMap = {
|
||||
type State = {
|
||||
checked?: any;
|
||||
loading: boolean;
|
||||
fetchError: boolean;
|
||||
page: number;
|
||||
showFilters: boolean;
|
||||
searchString: string;
|
||||
@ -75,6 +76,7 @@ export default class GroupsList extends React.PureComponent<Props, State> {
|
||||
super(props);
|
||||
this.state = {
|
||||
checked: {},
|
||||
fetchError: false,
|
||||
loading: true,
|
||||
page: 0,
|
||||
showFilters: false,
|
||||
@ -91,9 +93,7 @@ export default class GroupsList extends React.PureComponent<Props, State> {
|
||||
};
|
||||
|
||||
public componentDidMount() {
|
||||
this.props.actions.getLdapGroups(this.state.page, LDAP_GROUPS_PAGE_SIZE).then(() => {
|
||||
this.setState({loading: false});
|
||||
});
|
||||
this.props.actions.getLdapGroups(this.state.page, LDAP_GROUPS_PAGE_SIZE).then(this.handleGetGroupsResponse);
|
||||
}
|
||||
|
||||
public async previousPage(e: any): Promise<void> {
|
||||
@ -232,6 +232,16 @@ export default class GroupsList extends React.PureComponent<Props, State> {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if (this.state.fetchError) {
|
||||
return (
|
||||
<div className='groups-list-empty'>
|
||||
<FormattedMessage
|
||||
id='admin.group_settings.groups_list.groups_list_error'
|
||||
defaultMessage='Failed to retrieve LDAP groups. Please check your logs for details.'
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if (this.props.groups.length === 0) {
|
||||
return (
|
||||
<div className='groups-list-empty'>
|
||||
@ -294,9 +304,7 @@ export default class GroupsList extends React.PureComponent<Props, State> {
|
||||
newState.showFilters = false;
|
||||
this.setState(newState);
|
||||
|
||||
this.props.actions.getLdapGroups(page, LDAP_GROUPS_PAGE_SIZE, opts).then(() => {
|
||||
this.setState({loading: false});
|
||||
});
|
||||
this.props.actions.getLdapGroups(page, LDAP_GROUPS_PAGE_SIZE, opts).then(this.handleGetGroupsResponse);
|
||||
}
|
||||
|
||||
public handleGroupSearchKeyUp(e: any) {
|
||||
@ -434,9 +442,16 @@ export default class GroupsList extends React.PureComponent<Props, State> {
|
||||
filterIsUnlinked: false,
|
||||
};
|
||||
this.setState(newState as any);
|
||||
this.props.actions.getLdapGroups(this.state.page, LDAP_GROUPS_PAGE_SIZE, {q: ''}).then(() => {
|
||||
this.setState({loading: false});
|
||||
});
|
||||
this.props.actions.getLdapGroups(this.state.page, LDAP_GROUPS_PAGE_SIZE, {q: ''}).then(this.handleGetGroupsResponse);
|
||||
};
|
||||
|
||||
handleGetGroupsResponse = (response: any) => {
|
||||
if (response?.error) {
|
||||
this.setState({fetchError: true});
|
||||
} else {
|
||||
this.setState({fetchError: false});
|
||||
}
|
||||
this.setState({loading: false});
|
||||
};
|
||||
|
||||
public render(): JSX.Element {
|
||||
|
@ -1104,6 +1104,7 @@
|
||||
"admin.group_settings.group_row.not_linked": "Not Linked",
|
||||
"admin.group_settings.group_row.unlink_failed": "Unlink failed",
|
||||
"admin.group_settings.group_row.unlinking": "Unlinking",
|
||||
"admin.group_settings.groups_list.groups_list_error": "Failed to retrieve LDAP groups. Please check your logs for details.",
|
||||
"admin.group_settings.groups_list.link_selected": "Link Selected Groups",
|
||||
"admin.group_settings.groups_list.mappingHeader": "Mattermost Linking",
|
||||
"admin.group_settings.groups_list.nameHeader": "Name",
|
||||
|
Loading…
Reference in New Issue
Block a user