summaryrefslogtreecommitdiffstats
path: root/webapp/components/audit_table.jsx
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2017-05-18 09:28:18 -0400
committerGitHub <noreply@github.com>2017-05-18 09:28:18 -0400
commit2bbedd9def2a782f370fb5280994ea0ecbf8a7c7 (patch)
treec97936580a81c561aa9884d1c414c54bd49d401a /webapp/components/audit_table.jsx
parent63e599c43b66f0dd95f7f07c783c40fdaf89e3fb (diff)
downloadchat-2bbedd9def2a782f370fb5280994ea0ecbf8a7c7.tar.gz
chat-2bbedd9def2a782f370fb5280994ea0ecbf8a7c7.tar.bz2
chat-2bbedd9def2a782f370fb5280994ea0ecbf8a7c7.zip
Updating client dependencies. Switching to yarn. (#6433)
* Updating client dependancies. Switching to using yarn. * Updating React * Moving pure components to using function syntax (performance gains with newer react version) * Updating client dependancies. * Ignore .yarninstall * Enabling pre-lockfile because it's the entire point of using yarn. * Removing old webpack config * Moving to new prop-types * Fixing ESLint Errors * Updating jest snapshots. * Cleaning up package.json
Diffstat (limited to 'webapp/components/audit_table.jsx')
-rw-r--r--webapp/components/audit_table.jsx208
1 files changed, 104 insertions, 104 deletions
diff --git a/webapp/components/audit_table.jsx b/webapp/components/audit_table.jsx
index e07d6ca12..1f005e7e5 100644
--- a/webapp/components/audit_table.jsx
+++ b/webapp/components/audit_table.jsx
@@ -206,129 +206,129 @@ const holders = defineMessages({
}
});
-import React from 'react';
+import PropTypes from 'prop-types';
-class AuditTable extends React.Component {
- render() {
- var accessList = [];
-
- const {formatMessage} = this.props.intl;
- for (var i = 0; i < this.props.audits.length; i++) {
- const audit = this.props.audits[i];
- const auditInfo = formatAuditInfo(audit, formatMessage);
-
- let uContent;
- if (this.props.showUserId) {
- var profile = UserStore.getProfile(auditInfo.userId);
- if (profile) {
- uContent = <td className='word-break--all'>{profile.email}</td>;
- } else {
- uContent = <td className='word-break--all'>{auditInfo.userId}</td>;
- }
- }
+import React from 'react';
- let iContent;
- if (this.props.showIp) {
- iContent = <td className='whitespace--nowrap word-break--all'>{auditInfo.ip}</td>;
- }
+function AuditTable(props) {
+ var accessList = [];
- let sContent;
- if (this.props.showSession) {
- sContent = <td className='whitespace--nowrap word-break--all'>{auditInfo.sessionId}</td>;
- }
+ const {formatMessage} = props.intl;
+ for (var i = 0; i < props.audits.length; i++) {
+ const audit = props.audits[i];
+ const auditInfo = formatAuditInfo(audit, formatMessage);
- const descStyle = {};
- if (auditInfo.desc.toLowerCase().indexOf('fail') !== -1) {
- descStyle.color = 'red';
+ let uContent;
+ if (props.showUserId) {
+ var profile = UserStore.getProfile(auditInfo.userId);
+ if (profile) {
+ uContent = <td className='word-break--all'>{profile.email}</td>;
+ } else {
+ uContent = <td className='word-break--all'>{auditInfo.userId}</td>;
}
-
- accessList[i] = (
- <tr key={audit.id}>
- <td className='whitespace--nowrap word-break--all'>{auditInfo.timestamp}</td>
- {uContent}
- <td
- className='word-break--all'
- style={descStyle}
- >
- {auditInfo.desc}
- </td>
- {iContent}
- {sContent}
- </tr>
- );
}
- let userIdContent;
- if (this.props.showUserId) {
- userIdContent = (
- <th>
- <FormattedMessage
- id='audit_table.userId'
- defaultMessage='User ID'
- />
- </th>
- );
+ let iContent;
+ if (props.showIp) {
+ iContent = <td className='whitespace--nowrap word-break--all'>{auditInfo.ip}</td>;
}
- let ipContent;
- if (this.props.showIp) {
- ipContent = (
- <th>
- <FormattedMessage
- id='audit_table.ip'
- defaultMessage='IP Address'
- />
- </th>
- );
+ let sContent;
+ if (props.showSession) {
+ sContent = <td className='whitespace--nowrap word-break--all'>{auditInfo.sessionId}</td>;
}
- let sessionContent;
- if (this.props.showSession) {
- sessionContent = (
- <th>
- <FormattedMessage
- id='audit_table.session'
- defaultMessage='Session ID'
- />
- </th>
- );
+ const descStyle = {};
+ if (auditInfo.desc.toLowerCase().indexOf('fail') !== -1) {
+ descStyle.color = 'red';
}
- return (
- <table className='table'>
- <thead>
- <tr>
- <th>
- <FormattedMessage
- id='audit_table.timestamp'
- defaultMessage='Timestamp'
- />
- </th>
- {userIdContent}
- <th>
- <FormattedMessage
- id='audit_table.action'
- defaultMessage='Action'
- />
- </th>
- {ipContent}
- {sessionContent}
- </tr>
- </thead>
- <tbody>
- {accessList}
- </tbody>
- </table>
+ accessList[i] = (
+ <tr key={audit.id}>
+ <td className='whitespace--nowrap word-break--all'>{auditInfo.timestamp}</td>
+ {uContent}
+ <td
+ className='word-break--all'
+ style={descStyle}
+ >
+ {auditInfo.desc}
+ </td>
+ {iContent}
+ {sContent}
+ </tr>
+ );
+ }
+
+ let userIdContent;
+ if (props.showUserId) {
+ userIdContent = (
+ <th>
+ <FormattedMessage
+ id='audit_table.userId'
+ defaultMessage='User ID'
+ />
+ </th>
+ );
+ }
+
+ let ipContent;
+ if (props.showIp) {
+ ipContent = (
+ <th>
+ <FormattedMessage
+ id='audit_table.ip'
+ defaultMessage='IP Address'
+ />
+ </th>
+ );
+ }
+
+ let sessionContent;
+ if (props.showSession) {
+ sessionContent = (
+ <th>
+ <FormattedMessage
+ id='audit_table.session'
+ defaultMessage='Session ID'
+ />
+ </th>
);
}
+
+ return (
+ <table className='table'>
+ <thead>
+ <tr>
+ <th>
+ <FormattedMessage
+ id='audit_table.timestamp'
+ defaultMessage='Timestamp'
+ />
+ </th>
+ {userIdContent}
+ <th>
+ <FormattedMessage
+ id='audit_table.action'
+ defaultMessage='Action'
+ />
+ </th>
+ {ipContent}
+ {sessionContent}
+ </tr>
+ </thead>
+ <tbody>
+ {accessList}
+ </tbody>
+ </table>
+ );
}
AuditTable.propTypes = {
intl: intlShape.isRequired,
- audits: React.PropTypes.array.isRequired,
- showUserId: React.PropTypes.bool,
- showIp: React.PropTypes.bool,
- showSession: React.PropTypes.bool
+ audits: PropTypes.array.isRequired,
+ showUserId: PropTypes.bool,
+ showIp: PropTypes.bool,
+ showSession: PropTypes.bool
};
export default injectIntl(AuditTable);