diff --git a/server/zanata-frontend/src/app/editor/components/ActivitySelectList/index.js b/server/zanata-frontend/src/app/editor/components/ActivitySelectList/index.js
index be253233e7..479706ad94 100644
--- a/server/zanata-frontend/src/app/editor/components/ActivitySelectList/index.js
+++ b/server/zanata-frontend/src/app/editor/components/ActivitySelectList/index.js
@@ -1,9 +1,11 @@
import React from 'react'
import * as PropTypes from 'prop-types'
import SelectButtonList from '../../components/SelectButtonList'
-import { filterActivityTypes } from '../../utils/activity-util'
+import {
+ filterActivityItems, filterActivityTypes
+} from '../../utils/activity-util'
-const idType = PropTypes.oneOf(['all', 'comments', 'updates'])
+const idType = PropTypes.oneOf(filterActivityTypes)
class ActivitySelectList extends React.Component {
static propTypes = {
@@ -13,7 +15,7 @@ class ActivitySelectList extends React.Component {
render () {
return (
-
diff --git a/server/zanata-frontend/src/app/editor/containers/TranslationInfoPanel/index.js b/server/zanata-frontend/src/app/editor/containers/TranslationInfoPanel/index.js
index 91eb38cc32..3c90b28333 100644
--- a/server/zanata-frontend/src/app/editor/containers/TranslationInfoPanel/index.js
+++ b/server/zanata-frontend/src/app/editor/containers/TranslationInfoPanel/index.js
@@ -9,6 +9,7 @@ import { connect } from 'react-redux'
import { isEmpty, isUndefined, orderBy } from 'lodash'
import { FormattedDate, FormattedTime } from 'react-intl'
import { transUnitStatusToPhraseStatus } from '../../utils/status-util'
+import { ALL, COMMENTS, UPDATES } from '../../utils/activity-util'
import GlossaryTab from '../GlossaryTab'
import ActivityTab from '../ActivityTab'
@@ -144,7 +145,8 @@ class TranslationInfoPanel extends React.Component {
)
}
- filterActivityItems = () => {
+ /* Returns Activity Items list filtered by comments and updates */
+ filterActivityItems = (activityFilterType) => {
const { reviewComments, historyItems } = this.props
if (isEmpty(reviewComments) && isEmpty(historyItems)) {
return undefined
@@ -176,8 +178,17 @@ class TranslationInfoPanel extends React.Component {
}
}
})
- const combinedHistory = reviewCommentsList.concat(historyItemsList)
- return orderBy(combinedHistory, ['lastModifiedTime'], ['desc'])
+ switch (activityFilterType) {
+ case ALL:
+ return orderBy(reviewCommentsList.concat(historyItemsList),
+ ['lastModifiedTime'], ['desc'])
+ case COMMENTS:
+ return orderBy(reviewCommentsList, ['lastModifiedTime'], ['desc'])
+ case UPDATES:
+ return orderBy(historyItemsList, ['lastModifiedTime'], ['desc'])
+ default:
+ return undefined
+ }
}
render () {
@@ -201,7 +212,7 @@ class TranslationInfoPanel extends React.Component {
)
- const activityItems = this.filterActivityItems()
+ const activityItems = this.filterActivityItems(this.state.selectedActivites)
return (
diff --git a/server/zanata-frontend/src/app/editor/utils/activity-util.js b/server/zanata-frontend/src/app/editor/utils/activity-util.js
index f5452b78e5..6b52d7e258 100644
--- a/server/zanata-frontend/src/app/editor/utils/activity-util.js
+++ b/server/zanata-frontend/src/app/editor/utils/activity-util.js
@@ -1,17 +1,20 @@
-
-export const filterActivityTypes = [
+export const ALL = 'all'
+export const COMMENTS = 'comments'
+export const UPDATES = 'updates'
+export const filterActivityTypes = [ALL, COMMENTS, UPDATES]
+export const activityItems = [
{
- id: 'all',
+ id: ALL,
icon: 'clock',
label: 'All'
},
{
- id: 'comments',
+ id: COMMENTS,
icon: 'comment',
label: 'Comments'
},
{
- id: 'updates',
+ id: UPDATES,
icon: 'refresh',
label: 'Updates'
}