summaryrefslogtreecommitdiffstats
path: root/openecomp-ui/src/sdc-app/common/activity-log
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-ui/src/sdc-app/common/activity-log')
-rw-r--r--openecomp-ui/src/sdc-app/common/activity-log/ActivityLog.js5
-rw-r--r--openecomp-ui/src/sdc-app/common/activity-log/ActivityLogActionHelper.js11
-rw-r--r--openecomp-ui/src/sdc-app/common/activity-log/ActivityLogView.jsx13
3 files changed, 12 insertions, 17 deletions
diff --git a/openecomp-ui/src/sdc-app/common/activity-log/ActivityLog.js b/openecomp-ui/src/sdc-app/common/activity-log/ActivityLog.js
index f7354f96e2..a1ad437f5b 100644
--- a/openecomp-ui/src/sdc-app/common/activity-log/ActivityLog.js
+++ b/openecomp-ui/src/sdc-app/common/activity-log/ActivityLog.js
@@ -16,11 +16,12 @@
import {connect} from 'react-redux';
import ActivityLogView from './ActivityLogView.jsx';
-export const mapStateToProps = ({licenseModel: {activityLog}}) => {
+export const mapStateToProps = ({users: {usersList}, licenseModel: {activityLog}}) => {
let activities = activityLog;
return {
- activities
+ activities: activities.map(activity => ({...activity, user: {id: activity.user, name: usersList.find(userObject => userObject.userId === activity.user).fullName}})),
+ usersList
};
};
diff --git a/openecomp-ui/src/sdc-app/common/activity-log/ActivityLogActionHelper.js b/openecomp-ui/src/sdc-app/common/activity-log/ActivityLogActionHelper.js
index 01a27abbc5..729d8fb5f3 100644
--- a/openecomp-ui/src/sdc-app/common/activity-log/ActivityLogActionHelper.js
+++ b/openecomp-ui/src/sdc-app/common/activity-log/ActivityLogActionHelper.js
@@ -13,19 +13,12 @@
* or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
-import RestAPIUtil from 'nfvo-utils/RestAPIUtil.js';
-import Configuration from 'sdc-app/config/Configuration.js';
import ActivityLogConstants from './ActivityLogConstants.js';
-
-
-function baseUrl(itemId, versionId) {
- const restPrefix = Configuration.get('restPrefix');
- return `${restPrefix}/v1.0/activity-logs/${itemId}/versions/${versionId}`;
-}
+import ItemHelper from 'sdc-app/common/helpers/ItemsHelper.js';
export default {
fetchActivityLog(dispatch, {itemId, versionId}){
- return RestAPIUtil.fetch(baseUrl(itemId, versionId)).then(response => dispatch({type: ActivityLogConstants.ACTIVITY_LOG_UPDATED, response}));
+ return ItemHelper.fetchActivityLog({itemId, versionId}).then(response => dispatch({type: ActivityLogConstants.ACTIVITY_LOG_UPDATED, response}));
}
};
diff --git a/openecomp-ui/src/sdc-app/common/activity-log/ActivityLogView.jsx b/openecomp-ui/src/sdc-app/common/activity-log/ActivityLogView.jsx
index 9abddea542..5b8c29b719 100644
--- a/openecomp-ui/src/sdc-app/common/activity-log/ActivityLogView.jsx
+++ b/openecomp-ui/src/sdc-app/common/activity-log/ActivityLogView.jsx
@@ -67,9 +67,9 @@ export function ActivityListItem({activity, isHeader, isDes, onSort}) {
return (
<li className={`activity-list-item ${isHeader ? 'header' : ''}`} data-test-id='activity-list-item'>
<div className='table-cell activity-date' data-test-id='activity-date'><ActivityLogSortableCellHeader isHeader={isHeader} data={timestamp} isDes={isDes} onSort={onSort}/></div>
- <div className='table-cell activity-action' data-test-id='activity-action'>{type}</div>
- <div className='table-cell activity-comment' title={comment} data-test-id='activity-comment'><span>{comment}</span></div>
- <div className='table-cell activity-username' data-test-id='activity-username'>{user}</div>
+ <div className='table-cell activity-action' data-test-id='activity-action'>{i18n(type)}</div>
+ <div className='table-cell activity-comment' title={isHeader ? '' : comment} data-test-id='activity-comment'><span>{i18n(comment)}</span></div>
+ <div className='table-cell activity-username' data-test-id='activity-username'>{isHeader ? i18n(activity.user) : `${i18n(user.name)} (${user.id})`}</div>
<div className='table-cell activity-status' data-test-id='activity-status'><ActivityLogStatus isHeader={isHeader} status={status}/></div>
</li>
);
@@ -91,10 +91,10 @@ class ActivityLogView extends Component {
filterValue={this.state.localFilter}
onFilter={filter => this.setState({localFilter: filter})}>
<ActivityListItem
- isHeader={true}
activity={{timestamp: 'Date', type: 'Action', comment: 'Comment', user: 'Username', status: 'Status'}}
isDes={this.state.sortDescending}
- onSort={() => this.setState({sortDescending: !this.state.sortDescending})}/>
+ onSort={() => this.setState({sortDescending: !this.state.sortDescending})}
+ isHeader/>
{this.sortActivities(this.filterActivities(), this.state.sortDescending).map(activity => <ActivityListItem key={activity.id} activity={activity}/>)}
</ListEditorView>
</div>
@@ -106,7 +106,8 @@ class ActivityLogView extends Component {
let {localFilter} = this.state;
if (localFilter.trim()) {
const filter = new RegExp(escape(localFilter), 'i');
- return activities.filter(({user = '', comment = '', type = ''}) => escape(user).match(filter) || escape(comment).match(filter) || escape(type).match(filter));
+ return activities.filter(({user = {id: '', name: ''}, comment = '', type = ''}) =>
+ escape(user.id).match(filter) || escape(user.name).match(filter) || escape(comment).match(filter) || escape(type).match(filter));
}
else {
return activities;