2017-04-12 08:27:57 -04:00
|
|
|
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
2016-02-02 16:49:27 -05:00
|
|
|
// See License.txt for license information.
|
|
|
|
|
|
|
|
|
|
import LoadingScreen from '../loading_screen.jsx';
|
|
|
|
|
import AuditTable from '../audit_table.jsx';
|
2016-03-14 16:07:58 -07:00
|
|
|
import ComplianceReports from './compliance_reports.jsx';
|
2016-02-02 16:49:27 -05:00
|
|
|
|
2016-03-14 08:50:46 -04:00
|
|
|
import AdminStore from 'stores/admin_store.jsx';
|
2016-02-02 16:49:27 -05:00
|
|
|
|
2016-03-14 08:50:46 -04:00
|
|
|
import * as AsyncClient from 'utils/async_client.jsx';
|
2016-02-02 16:49:27 -05:00
|
|
|
|
2016-03-14 08:50:46 -04:00
|
|
|
import {FormattedMessage} from 'react-intl';
|
|
|
|
|
|
|
|
|
|
import React from 'react';
|
2016-02-02 16:49:27 -05:00
|
|
|
|
|
|
|
|
export default class Audits extends React.Component {
|
|
|
|
|
constructor(props) {
|
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
|
|
this.onAuditListenerChange = this.onAuditListenerChange.bind(this);
|
|
|
|
|
this.reload = this.reload.bind(this);
|
|
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
|
audits: AdminStore.getAudits()
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
AdminStore.addAuditChangeListener(this.onAuditListenerChange);
|
|
|
|
|
AsyncClient.getServerAudits();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentWillUnmount() {
|
|
|
|
|
AdminStore.removeAuditChangeListener(this.onAuditListenerChange);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onAuditListenerChange() {
|
|
|
|
|
this.setState({
|
|
|
|
|
audits: AdminStore.getAudits()
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
reload() {
|
|
|
|
|
AdminStore.saveAudits(null);
|
|
|
|
|
this.setState({
|
|
|
|
|
audits: null
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
AsyncClient.getServerAudits();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
var content = null;
|
|
|
|
|
|
|
|
|
|
if (global.window.mm_license.IsLicensed !== 'true') {
|
|
|
|
|
return <div/>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.state.audits === null) {
|
2016-02-22 08:31:10 -05:00
|
|
|
content = <LoadingScreen/>;
|
2016-02-02 16:49:27 -05:00
|
|
|
} else {
|
|
|
|
|
content = (
|
|
|
|
|
<div style={{margin: '10px'}}>
|
2016-03-14 16:07:58 -07:00
|
|
|
<AuditTable
|
|
|
|
|
audits={this.state.audits}
|
|
|
|
|
showUserId={true}
|
|
|
|
|
showIp={true}
|
|
|
|
|
showSession={true}
|
|
|
|
|
/>
|
2016-02-02 16:49:27 -05:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
2016-03-14 16:07:58 -07:00
|
|
|
<div>
|
|
|
|
|
<ComplianceReports/>
|
|
|
|
|
|
2016-05-12 00:30:00 +05:00
|
|
|
<div className='panel audit-panel'>
|
2017-03-30 12:46:47 -04:00
|
|
|
<h3 className='admin-console-header'>
|
2016-03-14 16:07:58 -07:00
|
|
|
<FormattedMessage
|
|
|
|
|
id='admin.audits.title'
|
2016-05-12 00:30:00 +05:00
|
|
|
defaultMessage='User Activity Logs'
|
2016-03-14 16:07:58 -07:00
|
|
|
/>
|
2016-05-12 00:30:00 +05:00
|
|
|
<button
|
|
|
|
|
type='submit'
|
|
|
|
|
className='btn btn-link pull-right'
|
|
|
|
|
onClick={this.reload}
|
|
|
|
|
>
|
2016-09-23 12:29:54 -04:00
|
|
|
<i className='fa fa-refresh'/>
|
2016-05-12 00:30:00 +05:00
|
|
|
<FormattedMessage
|
|
|
|
|
id='admin.audits.reload'
|
|
|
|
|
defaultMessage='Reload User Activity Logs'
|
|
|
|
|
/>
|
|
|
|
|
</button>
|
2016-03-14 16:07:58 -07:00
|
|
|
</h3>
|
2016-05-12 00:30:00 +05:00
|
|
|
<div className='audit-panel__table'>
|
2016-03-14 16:07:58 -07:00
|
|
|
{content}
|
|
|
|
|
</div>
|
2016-02-02 16:49:27 -05:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|