Ivan - Add error messages for admin articles view [skip ci]
This commit is contained in:
parent
5b68997437
commit
0fd70ec441
|
@ -11,6 +11,7 @@ import TopicEditModal from 'app-components/topic-edit-modal';
|
|||
import Loading from 'core-components/loading';
|
||||
import Button from 'core-components/button';
|
||||
import Icon from 'core-components/icon';
|
||||
import Message from 'core-components/message';
|
||||
|
||||
class ArticlesList extends React.Component {
|
||||
|
||||
|
@ -18,6 +19,7 @@ class ArticlesList extends React.Component {
|
|||
editable: React.PropTypes.bool,
|
||||
articlePath: React.PropTypes.string,
|
||||
loading: React.PropTypes.bool,
|
||||
errored: React.PropTypes.bool,
|
||||
topics: React.PropTypes.array,
|
||||
retrieveOnMount: React.PropTypes.bool
|
||||
};
|
||||
|
@ -34,6 +36,10 @@ class ArticlesList extends React.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
if(this.props.errored) {
|
||||
return <Message type="error">{i18n('ERROR_RETRIEVING_ARTICLES')}</Message>;
|
||||
}
|
||||
|
||||
return (this.props.loading) ? <Loading /> : this.renderContent();
|
||||
}
|
||||
|
||||
|
@ -84,6 +90,7 @@ class ArticlesList extends React.Component {
|
|||
export default connect((store) => {
|
||||
return {
|
||||
topics: store.articles.topics,
|
||||
errored: store.articles.errored,
|
||||
loading: store.articles.loading
|
||||
};
|
||||
})(ArticlesList);
|
||||
|
|
|
@ -10,7 +10,7 @@ class PeopleList extends React.Component {
|
|||
static propTypes = {
|
||||
list: React.PropTypes.arrayOf(React.PropTypes.shape({
|
||||
profilePic: React.PropTypes.string,
|
||||
name: React.PropTypes.string,
|
||||
name: React.PropTypes.node,
|
||||
assignedTickets: React.PropTypes.number,
|
||||
closedTickets: React.PropTypes.number,
|
||||
lastLogin: React.PropTypes.number
|
||||
|
|
|
@ -165,6 +165,7 @@ export default {
|
|||
'ERROR_RETRIEVING_USERS': 'An error occurred while trying to retrieve users.',
|
||||
'ERROR_RETRIEVING_BAN_LIST': 'An error occurred while trying to retrieve the list of banned emails.',
|
||||
'ERROR_BANNING_EMAIL': 'An error occurred while trying to ban the email.',
|
||||
'ERROR_RETRIEVING_ARTICLES': 'An error occurred while trying to retrieve articles.',
|
||||
|
||||
//MESSAGES
|
||||
'SIGNUP_SUCCESS': 'You have registered successfully in our support system.',
|
||||
|
|
|
@ -9,6 +9,7 @@ class ArticlesReducer extends Reducer {
|
|||
return {
|
||||
retrieved: false,
|
||||
loading: true,
|
||||
errored: false,
|
||||
topics: []
|
||||
};
|
||||
}
|
||||
|
@ -16,6 +17,7 @@ class ArticlesReducer extends Reducer {
|
|||
getTypeHandlers() {
|
||||
return {
|
||||
'GET_ARTICLES_FULFILLED': this.onArticlesRetrieved,
|
||||
'GET_ARTICLES_REJECTED': this.onArticlesRejected,
|
||||
'INIT_ARTICLES': this.onInitArticles
|
||||
};
|
||||
}
|
||||
|
@ -26,10 +28,19 @@ class ArticlesReducer extends Reducer {
|
|||
return _.extend({}, state, {
|
||||
retrieved: true,
|
||||
loading: false,
|
||||
errored: false,
|
||||
topics: payload.data
|
||||
});
|
||||
}
|
||||
|
||||
onArticlesRejected(state) {
|
||||
return _.extend({}, state, {
|
||||
retrieved: true,
|
||||
loading: false,
|
||||
errored: true
|
||||
});
|
||||
}
|
||||
|
||||
onInitArticles(state) {
|
||||
let topics = SessionStore.getItem('topics');
|
||||
|
||||
|
|
Loading…
Reference in New Issue