mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
chore: Fix typings and add Page-component to ServerStats #14762
This commit is contained in:
parent
d54c4173ca
commit
ab62a09fe6
@ -4,7 +4,7 @@ import { connect } from 'react-redux';
|
||||
import { NavModel, StoreState } from 'app/types';
|
||||
import { getNavModel } from 'app/core/selectors/navModel';
|
||||
import { getServerStats, ServerStat } from './state/apis';
|
||||
import PageHeader from 'app/core/components/PageHeader/PageHeader';
|
||||
import Page from 'app/core/components/Page/Page';
|
||||
|
||||
interface Props {
|
||||
navModel: NavModel;
|
||||
@ -13,21 +13,24 @@ interface Props {
|
||||
|
||||
interface State {
|
||||
stats: ServerStat[];
|
||||
isLoading: boolean;
|
||||
}
|
||||
|
||||
export class ServerStats extends PureComponent<Props, State> {
|
||||
constructor(props) {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
stats: [],
|
||||
isLoading: false
|
||||
};
|
||||
}
|
||||
|
||||
async componentDidMount() {
|
||||
try {
|
||||
this.setState({ isLoading: true });
|
||||
const stats = await this.props.getServerStats();
|
||||
this.setState({ stats });
|
||||
this.setState({ stats, isLoading: false });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
@ -35,12 +38,11 @@ export class ServerStats extends PureComponent<Props, State> {
|
||||
|
||||
render() {
|
||||
const { navModel } = this.props;
|
||||
const { stats } = this.state;
|
||||
const { stats, isLoading } = this.state;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<PageHeader model={navModel} />
|
||||
<div className="page-container page-body">
|
||||
<Page navModel={navModel}>
|
||||
<Page.Contents isLoading={isLoading}>
|
||||
<table className="filter-table form-inline">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -50,8 +52,8 @@ export class ServerStats extends PureComponent<Props, State> {
|
||||
</thead>
|
||||
<tbody>{stats.map(StatItem)}</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</Page.Contents>
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,43 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`ServerStats Should render table with stats 1`] = `
|
||||
<div>
|
||||
<div
|
||||
className="page-scrollbar-wrapper"
|
||||
>
|
||||
<div
|
||||
className="custom-scrollbars"
|
||||
style={
|
||||
Object {
|
||||
"height": "auto",
|
||||
"maxHeight": "100%",
|
||||
"minHeight": "100%",
|
||||
"overflow": "hidden",
|
||||
"position": "relative",
|
||||
"width": "100%",
|
||||
}
|
||||
}
|
||||
>
|
||||
<div
|
||||
className="view"
|
||||
style={
|
||||
Object {
|
||||
"WebkitOverflowScrolling": "touch",
|
||||
"bottom": undefined,
|
||||
"left": undefined,
|
||||
"marginBottom": 0,
|
||||
"marginRight": 0,
|
||||
"maxHeight": "calc(100% + 0px)",
|
||||
"minHeight": "calc(100% + 0px)",
|
||||
"overflow": "scroll",
|
||||
"position": "relative",
|
||||
"right": undefined,
|
||||
"top": undefined,
|
||||
}
|
||||
}
|
||||
>
|
||||
<div
|
||||
className="page-scrollbar-content"
|
||||
>
|
||||
<div
|
||||
className="page-header-canvas"
|
||||
>
|
||||
@ -114,5 +150,109 @@ exports[`ServerStats Should render table with stats 1`] = `
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<footer
|
||||
className="footer"
|
||||
>
|
||||
<div
|
||||
className="text-center"
|
||||
>
|
||||
<ul>
|
||||
<li>
|
||||
<a
|
||||
href="http://docs.grafana.org"
|
||||
target="_blank"
|
||||
>
|
||||
<i
|
||||
className="fa fa-file-code-o"
|
||||
/>
|
||||
Docs
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://grafana.com/services/support"
|
||||
target="_blank"
|
||||
>
|
||||
<i
|
||||
className="fa fa-support"
|
||||
/>
|
||||
Support Plans
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://community.grafana.com/"
|
||||
target="_blank"
|
||||
>
|
||||
<i
|
||||
className="fa fa-comments-o"
|
||||
/>
|
||||
Community
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://grafana.com"
|
||||
target="_blank"
|
||||
>
|
||||
Grafana
|
||||
</a>
|
||||
|
||||
<span>
|
||||
v
|
||||
v1.0
|
||||
(commit:
|
||||
1
|
||||
)
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="track-horizontal"
|
||||
style={
|
||||
Object {
|
||||
"display": "none",
|
||||
"height": 6,
|
||||
"position": "absolute",
|
||||
}
|
||||
}
|
||||
>
|
||||
<div
|
||||
className="thumb-horizontal"
|
||||
style={
|
||||
Object {
|
||||
"display": "block",
|
||||
"height": "100%",
|
||||
"position": "relative",
|
||||
}
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
className="track-vertical"
|
||||
style={
|
||||
Object {
|
||||
"display": "none",
|
||||
"position": "absolute",
|
||||
"width": 6,
|
||||
}
|
||||
}
|
||||
>
|
||||
<div
|
||||
className="thumb-vertical"
|
||||
style={
|
||||
Object {
|
||||
"display": "block",
|
||||
"position": "relative",
|
||||
"width": "100%",
|
||||
}
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
@ -2,7 +2,6 @@ import React, { PureComponent } from 'react';
|
||||
import { hot } from 'react-hot-loader';
|
||||
import { connect } from 'react-redux';
|
||||
import Page from 'app/core/components/Page/Page';
|
||||
// import PageHeader from 'app/core/components/PageHeader/PageHeader';
|
||||
import AlertRuleItem from './AlertRuleItem';
|
||||
import appEvents from 'app/core/app_events';
|
||||
import { updateLocation } from 'app/core/actions';
|
||||
|
Loading…
Reference in New Issue
Block a user