diff --git a/ui/src/kapacitor/components/LogItemHTTP.js b/ui/src/kapacitor/components/LogItemHTTP.js new file mode 100644 index 0000000000..0d8b7a7758 --- /dev/null +++ b/ui/src/kapacitor/components/LogItemHTTP.js @@ -0,0 +1,32 @@ +import React, {PropTypes} from 'react' + +const LogItemHTTP = ({logItem}) => +
+
+
+
+ {logItem.ts} +
+
+
+
HTTP Request
+
+ {logItem.method} {logItem.username}@{logItem.host} ({logItem.duration}) +
+
+
+ +const {shape, string} = PropTypes + +LogItemHTTP.propTypes = { + logItem: shape({ + lvl: string.isRequired, + ts: string.isRequired, + method: string.isRequired, + username: string.isRequired, + host: string.isRequired, + duration: string.isRequired, + }), +} + +export default LogItemHTTP diff --git a/ui/src/kapacitor/components/LogItemHTTPError.js b/ui/src/kapacitor/components/LogItemHTTPError.js new file mode 100644 index 0000000000..fa0e79694f --- /dev/null +++ b/ui/src/kapacitor/components/LogItemHTTPError.js @@ -0,0 +1,32 @@ +import React, {PropTypes} from 'react' + +const LogItemHTTPError = ({logItem}) => +
+
+
+
+ {logItem.ts} +
+
+
+
HTTP Server
+
+
+ ERROR: {logItem.msg} +
+
+
+
+ +const {shape, string} = PropTypes + +LogItemHTTPError.propTypes = { + logItem: shape({ + key: string.isRequired, + lvl: string.isRequired, + ts: string.isRequired, + msg: string.isRequired, + }), +} + +export default LogItemHTTPError diff --git a/ui/src/kapacitor/components/LogItemInfluxDBDebug.js b/ui/src/kapacitor/components/LogItemInfluxDBDebug.js new file mode 100644 index 0000000000..b6be11705d --- /dev/null +++ b/ui/src/kapacitor/components/LogItemInfluxDBDebug.js @@ -0,0 +1,34 @@ +import React, {PropTypes} from 'react' + +const LogItemInfluxDBDebug = ({logItem}) => +
+
+
+
+ {logItem.ts} +
+
+
+
InfluxDB
+
+
+ DEBUG: {logItem.msg} +
+ Cluster: {logItem.cluster} +
+
+
+
+ +const {shape, string} = PropTypes + +LogItemInfluxDBDebug.propTypes = { + logItem: shape({ + lvl: string.isRequired, + ts: string.isRequired, + msg: string.isRequired, + cluster: string.isRequired, + }), +} + +export default LogItemInfluxDBDebug diff --git a/ui/src/kapacitor/components/LogItemKapacitorDebug.js b/ui/src/kapacitor/components/LogItemKapacitorDebug.js new file mode 100644 index 0000000000..9b99d51290 --- /dev/null +++ b/ui/src/kapacitor/components/LogItemKapacitorDebug.js @@ -0,0 +1,31 @@ +import React, {PropTypes} from 'react' + +const LogItemKapacitorDebug = ({logItem}) => +
+
+
+
+ {logItem.ts} +
+
+
+
Kapacitor
+
+
+ DEBUG: {logItem.msg} +
+
+
+
+ +const {shape, string} = PropTypes + +LogItemKapacitorDebug.propTypes = { + logItem: shape({ + lvl: string.isRequired, + ts: string.isRequired, + msg: string.isRequired, + }), +} + +export default LogItemKapacitorDebug diff --git a/ui/src/kapacitor/components/LogItemKapacitorError.js b/ui/src/kapacitor/components/LogItemKapacitorError.js new file mode 100644 index 0000000000..1d4ca573db --- /dev/null +++ b/ui/src/kapacitor/components/LogItemKapacitorError.js @@ -0,0 +1,31 @@ +import React, {PropTypes} from 'react' + +const LogItemKapacitorError = ({logItem}) => +
+
+
+
+ {logItem.ts} +
+
+
+
Kapacitor
+
+
+ ERROR: {logItem.msg} +
+
+
+
+ +const {shape, string} = PropTypes + +LogItemKapacitorError.propTypes = { + logItem: shape({ + lvl: string.isRequired, + ts: string.isRequired, + msg: string.isRequired, + }), +} + +export default LogItemKapacitorError diff --git a/ui/src/kapacitor/components/LogItemKapacitorPoint.js b/ui/src/kapacitor/components/LogItemKapacitorPoint.js new file mode 100644 index 0000000000..6a7639330c --- /dev/null +++ b/ui/src/kapacitor/components/LogItemKapacitorPoint.js @@ -0,0 +1,51 @@ +import React, {PropTypes} from 'react' + +const renderKeysAndValues = object => { + if (!object) { + return -- + } + const objKeys = Object.keys(object) + const objValues = Object.values(object) + + const objElements = objKeys.map((objKey, i) => +
+ {objKey}: {objValues[i]} +
+ ) + return objElements +} +const LogItemKapacitorPoint = ({logItem}) => +
+
+
+
+ {logItem.ts} +
+
+
+
Kapacitor Point
+
+
+ TAGS
+ {renderKeysAndValues(logItem.tag)} +
+
+ FIELDS
+ {renderKeysAndValues(logItem.field)} +
+
+
+
+ +const {shape, string} = PropTypes + +LogItemKapacitorPoint.propTypes = { + logItem: shape({ + lvl: string.isRequired, + ts: string.isRequired, + tag: shape.isRequired, + field: shape.isRequired, + }), +} + +export default LogItemKapacitorPoint diff --git a/ui/src/kapacitor/components/LogItemSession.js b/ui/src/kapacitor/components/LogItemSession.js new file mode 100644 index 0000000000..c5c1cb2860 --- /dev/null +++ b/ui/src/kapacitor/components/LogItemSession.js @@ -0,0 +1,28 @@ +import React, {PropTypes} from 'react' + +const LogItemSession = ({logItem}) => +
+
+
+
+ {logItem.ts} +
+
+
+
+ {logItem.msg} +
+
+
+ +const {shape, string} = PropTypes + +LogItemSession.propTypes = { + logItem: shape({ + lvl: string.isRequired, + ts: string.isRequired, + msg: string.isRequired, + }), +} + +export default LogItemSession diff --git a/ui/src/kapacitor/components/LogsTable.js b/ui/src/kapacitor/components/LogsTable.js index b16de6f40e..60497499f8 100644 --- a/ui/src/kapacitor/components/LogsTable.js +++ b/ui/src/kapacitor/components/LogsTable.js @@ -1,124 +1,57 @@ import React, {Component, PropTypes} from 'react' +import LogItemSession from 'src/kapacitor/components/LogItemSession' +import LogItemHTTP from 'src/kapacitor/components/LogItemHTTP' +import LogItemHTTPError from 'src/kapacitor/components/LogItemHTTPError' +import LogItemKapacitorPoint from 'src/kapacitor/components/LogItemKapacitorPoint' +import LogItemKapacitorError from 'src/kapacitor/components/LogItemKapacitorError' +import LogItemKapacitorDebug from 'src/kapacitor/components/LogItemKapacitorDebug' +import LogItemInfluxDBDebug from 'src/kapacitor/components/LogItemInfluxDBDebug' + class LogsTable extends Component { constructor(props) { super(props) } - renderKeysAndValues = object => { - if (!object) { - return -- - } - const objKeys = Object.keys(object) - const objValues = Object.values(object) - - const objElements = objKeys.map((objKey, i) => -
- {objKey}: {objValues[i]} -
- ) - return objElements - } - - renderTableRow = logItem => { - let rowDetails - + renderTableRow = (logItem, index) => { if (logItem.service === 'sessions') { - rowDetails = ( -
-
- {logItem.msg} -
-
- ) + return } if (logItem.service === 'http' && logItem.msg === 'http request') { - rowDetails = ( -
-
HTTP Request
-
- {logItem.method} {logItem.username}@{logItem.host} ({logItem.duration}) -
-
- ) + return } if (logItem.service === 'kapacitor' && logItem.msg === 'point') { - rowDetails = ( -
-
Kapacitor Point
-
-
- TAGS
- {this.renderKeysAndValues(logItem.tag)} -
-
- FIELDS
- {this.renderKeysAndValues(logItem.field)} -
-
-
- ) + return } if (logItem.service === 'httpd_server_errors' && logItem.lvl === 'error') { - rowDetails = ( -
-
HTTP Server
-
-
- ERROR: {logItem.msg} -
-
-
- ) + return } if (logItem.service === 'kapacitor' && logItem.lvl === 'error') { - rowDetails = ( -
-
Kapacitor
-
-
- ERROR: {logItem.msg} -
-
-
- ) + return } if (logItem.service === 'kapacitor' && logItem.lvl === 'debug') { - rowDetails = ( -
-
Kapacitor
-
-
- DEBUG: {logItem.msg} -
-
-
- ) + return } if (logItem.service === 'influxdb' && logItem.lvl === 'debug') { - rowDetails = ( -
-
InfluxDB
-
-
- DEBUG: {logItem.msg} -
- Cluster: {logItem.cluster} -
-
-
- ) + return } return ( -
+
{logItem.ts}
- {rowDetails} +
+
Thing
+
+
+

Thang

+
+
+
) } @@ -140,7 +73,7 @@ class LogsTable extends Component {
- {logs.map(l => this.renderTableRow(l))} + {logs.map((log, i) => this.renderTableRow(log, i))}