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 Loading from 'core-components/loading';
|
||||||
import Button from 'core-components/button';
|
import Button from 'core-components/button';
|
||||||
import Icon from 'core-components/icon';
|
import Icon from 'core-components/icon';
|
||||||
|
import Message from 'core-components/message';
|
||||||
|
|
||||||
class ArticlesList extends React.Component {
|
class ArticlesList extends React.Component {
|
||||||
|
|
||||||
|
@ -18,6 +19,7 @@ class ArticlesList extends React.Component {
|
||||||
editable: React.PropTypes.bool,
|
editable: React.PropTypes.bool,
|
||||||
articlePath: React.PropTypes.string,
|
articlePath: React.PropTypes.string,
|
||||||
loading: React.PropTypes.bool,
|
loading: React.PropTypes.bool,
|
||||||
|
errored: React.PropTypes.bool,
|
||||||
topics: React.PropTypes.array,
|
topics: React.PropTypes.array,
|
||||||
retrieveOnMount: React.PropTypes.bool
|
retrieveOnMount: React.PropTypes.bool
|
||||||
};
|
};
|
||||||
|
@ -34,6 +36,10 @@ class ArticlesList extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
if(this.props.errored) {
|
||||||
|
return <Message type="error">{i18n('ERROR_RETRIEVING_ARTICLES')}</Message>;
|
||||||
|
}
|
||||||
|
|
||||||
return (this.props.loading) ? <Loading /> : this.renderContent();
|
return (this.props.loading) ? <Loading /> : this.renderContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,6 +90,7 @@ class ArticlesList extends React.Component {
|
||||||
export default connect((store) => {
|
export default connect((store) => {
|
||||||
return {
|
return {
|
||||||
topics: store.articles.topics,
|
topics: store.articles.topics,
|
||||||
|
errored: store.articles.errored,
|
||||||
loading: store.articles.loading
|
loading: store.articles.loading
|
||||||
};
|
};
|
||||||
})(ArticlesList);
|
})(ArticlesList);
|
||||||
|
|
|
@ -10,7 +10,7 @@ class PeopleList extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
list: React.PropTypes.arrayOf(React.PropTypes.shape({
|
list: React.PropTypes.arrayOf(React.PropTypes.shape({
|
||||||
profilePic: React.PropTypes.string,
|
profilePic: React.PropTypes.string,
|
||||||
name: React.PropTypes.string,
|
name: React.PropTypes.node,
|
||||||
assignedTickets: React.PropTypes.number,
|
assignedTickets: React.PropTypes.number,
|
||||||
closedTickets: React.PropTypes.number,
|
closedTickets: React.PropTypes.number,
|
||||||
lastLogin: 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_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_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_BANNING_EMAIL': 'An error occurred while trying to ban the email.',
|
||||||
|
'ERROR_RETRIEVING_ARTICLES': 'An error occurred while trying to retrieve articles.',
|
||||||
|
|
||||||
//MESSAGES
|
//MESSAGES
|
||||||
'SIGNUP_SUCCESS': 'You have registered successfully in our support system.',
|
'SIGNUP_SUCCESS': 'You have registered successfully in our support system.',
|
||||||
|
|
|
@ -9,6 +9,7 @@ class ArticlesReducer extends Reducer {
|
||||||
return {
|
return {
|
||||||
retrieved: false,
|
retrieved: false,
|
||||||
loading: true,
|
loading: true,
|
||||||
|
errored: false,
|
||||||
topics: []
|
topics: []
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -16,6 +17,7 @@ class ArticlesReducer extends Reducer {
|
||||||
getTypeHandlers() {
|
getTypeHandlers() {
|
||||||
return {
|
return {
|
||||||
'GET_ARTICLES_FULFILLED': this.onArticlesRetrieved,
|
'GET_ARTICLES_FULFILLED': this.onArticlesRetrieved,
|
||||||
|
'GET_ARTICLES_REJECTED': this.onArticlesRejected,
|
||||||
'INIT_ARTICLES': this.onInitArticles
|
'INIT_ARTICLES': this.onInitArticles
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -26,10 +28,19 @@ class ArticlesReducer extends Reducer {
|
||||||
return _.extend({}, state, {
|
return _.extend({}, state, {
|
||||||
retrieved: true,
|
retrieved: true,
|
||||||
loading: false,
|
loading: false,
|
||||||
|
errored: false,
|
||||||
topics: payload.data
|
topics: payload.data
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onArticlesRejected(state) {
|
||||||
|
return _.extend({}, state, {
|
||||||
|
retrieved: true,
|
||||||
|
loading: false,
|
||||||
|
errored: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
onInitArticles(state) {
|
onInitArticles(state) {
|
||||||
let topics = SessionStore.getItem('topics');
|
let topics = SessionStore.getItem('topics');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue