Skip to content

Commit

Permalink
Merge pull request #17 from sendilkumarn/settings
Browse files Browse the repository at this point in the history
Adds Metrics Page
  • Loading branch information
deepu105 authored Apr 1, 2017
2 parents 30bee44 + c86d47b commit 47f34c6
Show file tree
Hide file tree
Showing 6 changed files with 507 additions and 17 deletions.
6 changes: 6 additions & 0 deletions generators/client/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,14 @@ const files = {
{ file: 'modules/administration/configuration/configuration.js', method: 'processJsx' },
{ file: 'modules/administration/docs/docs.js', method: 'processJsx' },
{ file: 'modules/administration/health/health.js', method: 'processJsx' },
{ file: 'modules/administration/health/health-detail/health-detail.js', method: 'processJsx' },
{ file: 'modules/administration/health/health-detail/health-modal.js', method: 'processJsx' },
{ file: 'modules/administration/health/health-detail/index.js', method: 'processJsx' },
{ file: 'modules/administration/logs/logs.js', method: 'processJsx' },
{ file: 'modules/administration/metrics/metrics.js', method: 'processJsx' },
{ file: 'modules/administration/metrics/metrics-detail/metrics-detail.js', method: 'processJsx' },
{ file: 'modules/administration/metrics/metrics-detail/metrics-modal.js', method: 'processJsx' },
{ file: 'modules/administration/metrics/metrics-detail/index.js', method: 'processJsx' },
]
},
// {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export const MetricsRoute = {
path: 'admin/metrics-detail',
getComponent(nextState, cb) {
require.ensure([], (require) => {
cb(null, require('./metrics-detail'));
});
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { hashHistory } from 'react-router';

import MetricsModal from './metrics-modal';

export class Metrics extends Component {

static propTypes = {
isAuthenticated: PropTypes.bool.isRequired
};

constructor(props) {
super(props);
this.state = {
showModal: false
};
}

componentWillMount() {
this.setState({
showModal: true
});
}

componentWillReceiveProps(nextProps) {
this.setState({
showModal: !nextProps.isAuthenticated
});
}

handleClose = () => {
this.setState({ showModal: false });
hashHistory.push('/admin/metrics');
};

render() {
return (
<MetricsModal showModal={this.state.showModal} handleClose={this.handleClose} threadDump={this.props.threadDump} />
);
}
}

export default connect(({ administration }) => ({ threadDump: administration.threadDump, isFetching: administration.isFetching }))(Metrics);
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import React, { Component, PropTypes } from 'react';
import Dialog from 'material-ui/Dialog';
import FlatButton from 'material-ui/FlatButton';
import Translate from 'react-translate-component';

import { Table, TableBody, TableHeader, TableHeaderColumn, TableRow, TableRowColumn } from 'material-ui/Table';

class MetricsModal extends Component {

static propTypes = {
handleClose: PropTypes.func.isRequired,
showModal: PropTypes.bool.isRequired
};

constructor(props, context) {
super(props, context);
}

render() {
const { handleClose, threadDump } = this.props;
const showCheckboxes = false;
// FIX show / hide stacktrace function & filter & Labels
const actions = [
<FlatButton
label={<Translate content="entity.action.cancel" />}
onTouchTap={handleClose}
/>
];
return (
<Dialog
title={<h3><Translate content="metrics.title" /></h3>}
actions={actions}
modal autoScrollBodyContent
open={this.props.showModal}
onRequestClose={handleClose}
>
<div className="container">
{threadDump.map(threadDumpInfo => (
<div>
<h5>{threadDumpInfo.threadState} {threadDumpInfo.threadName} (ID {threadDumpInfo.threadId})</h5>
<FlatButton
label="Show StackTrace"
onTouchTap={() => this.setState({ showStack: !this.state.showStack })}
/>
<div className="row" >
<div className="col-md-12">
{Object.keys(threadDumpInfo.stackTrace).map((stK, stV) => (
<p>
{threadDumpInfo.stackTrace[stK].className}.{threadDumpInfo.stackTrace[stK].methodName}
({threadDumpInfo.stackTrace[stK].fileName}:{threadDumpInfo.stackTrace[stK].lineNumber})
</p>
))}
</div>
</div>
<div className="row">
<div className="col-md-12">
<Table>
<TableHeader
displaySelectAll={showCheckboxes}
adjustForCheckbox={showCheckboxes}
>
<TableRow>
<TableHeaderColumn>Blocked Time</TableHeaderColumn>
<TableHeaderColumn>Blocked Count</TableHeaderColumn>
<TableHeaderColumn>Waited Time</TableHeaderColumn>
<TableHeaderColumn>Waited Count</TableHeaderColumn>
<TableHeaderColumn>Lock Name</TableHeaderColumn>
</TableRow>
</TableHeader>
<TableBody displayRowCheckbox={showCheckboxes}>
<TableRow key={threadDumpInfo}>
<TableRowColumn>{threadDumpInfo.blockedTime}</TableRowColumn>
<TableRowColumn>{threadDumpInfo.blockedCount}</TableRowColumn>
<TableRowColumn>{threadDumpInfo.waitedTime}</TableRowColumn>
<TableRowColumn>{threadDumpInfo.waitedCount}</TableRowColumn>
<TableRowColumn>{threadDumpInfo.lockName}</TableRowColumn>
</TableRow>
</TableBody>
</Table>
</div>
</div>
</div>
))}
</div>
</Dialog>
);
}
}

export default MetricsModal;
Loading

0 comments on commit 47f34c6

Please sign in to comment.