|
@@ -1,12 +1,11 @@
|
|
import React from "react";
|
|
import React from "react";
|
|
-import { Form, Table, Button} from "react-bootstrap";
|
|
|
|
|
|
+import { Form, Table, Button, Spinner} from "react-bootstrap";
|
|
import axios from "axios";
|
|
import axios from "axios";
|
|
import Pagination from 'react-bootstrap/Pagination'
|
|
import Pagination from 'react-bootstrap/Pagination'
|
|
|
|
|
|
import { alternativeBackendApis } from "../../config"
|
|
import { alternativeBackendApis } from "../../config"
|
|
|
|
|
|
import { ValidatorApiResponse } from "../../types";
|
|
import { ValidatorApiResponse } from "../../types";
|
|
-import { Left } from "react-bootstrap/lib/Media";
|
|
|
|
|
|
|
|
interface IProps {
|
|
interface IProps {
|
|
}
|
|
}
|
|
@@ -17,6 +16,7 @@ interface IState {
|
|
blockEnd: number
|
|
blockEnd: number
|
|
page: number,
|
|
page: number,
|
|
search: boolean,
|
|
search: boolean,
|
|
|
|
+ loading: boolean,
|
|
apiResponse?: ValidatorApiResponse;
|
|
apiResponse?: ValidatorApiResponse;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -29,7 +29,8 @@ class ValidatorReport extends React.Component<IProps, IState> {
|
|
blockStart: 0,
|
|
blockStart: 0,
|
|
blockEnd: 0,
|
|
blockEnd: 0,
|
|
page: 1,
|
|
page: 1,
|
|
- search: false
|
|
|
|
|
|
+ search: false,
|
|
|
|
+ loading: false
|
|
};
|
|
};
|
|
this.accountTxFilterChanged = this.accountTxFilterChanged.bind(this);
|
|
this.accountTxFilterChanged = this.accountTxFilterChanged.bind(this);
|
|
this.searchClicked = this.searchClicked.bind(this);
|
|
this.searchClicked = this.searchClicked.bind(this);
|
|
@@ -42,7 +43,7 @@ class ValidatorReport extends React.Component<IProps, IState> {
|
|
console.log(`Fetching transactions`);
|
|
console.log(`Fetching transactions`);
|
|
const backend = `${alternativeBackendApis}/validator-report?addr=${address}&start_block=${blockStart}&end_block=${blockEnd}&page=${page}`;
|
|
const backend = `${alternativeBackendApis}/validator-report?addr=${address}&start_block=${blockStart}&end_block=${blockEnd}&page=${page}`;
|
|
|
|
|
|
- axios.get(backend).then((response) => {this.setState({...this.state, apiResponse: response.data, search: false})});
|
|
|
|
|
|
+ axios.get(backend).then((response) => {this.setState({...this.state, apiResponse: response.data, search: false, loading: false})});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -72,19 +73,19 @@ class ValidatorReport extends React.Component<IProps, IState> {
|
|
|
|
|
|
changePage(page: number) {
|
|
changePage(page: number) {
|
|
if(this.state.page !== page) {
|
|
if(this.state.page !== page) {
|
|
- this.setState({...this.state, page: page, search: true });
|
|
|
|
|
|
+ this.setState({...this.state, page: page, search: true, loading: true });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
searchClicked() {
|
|
searchClicked() {
|
|
if(!this.state.search) {
|
|
if(!this.state.search) {
|
|
- this.setState({...this.state, page: 1, search: true });
|
|
|
|
|
|
+ this.setState({...this.state, page: 1, search: true, loading: true });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
render() {
|
|
render() {
|
|
|
|
|
|
- const { address, blockStart, blockEnd, apiResponse, page } = this.state;
|
|
|
|
|
|
+ const { address, blockStart, blockEnd, apiResponse, page, loading } = this.state;
|
|
|
|
|
|
return (
|
|
return (
|
|
<div className="box" style={{textAlign: "left"}}>
|
|
<div className="box" style={{textAlign: "left"}}>
|
|
@@ -110,7 +111,7 @@ class ValidatorReport extends React.Component<IProps, IState> {
|
|
<Button variant="outline-light" onClick={this.searchClicked}>Search</Button>
|
|
<Button variant="outline-light" onClick={this.searchClicked}>Search</Button>
|
|
</div>
|
|
</div>
|
|
<>
|
|
<>
|
|
- { !apiResponse ? <div/> :
|
|
|
|
|
|
+ { !apiResponse ? (loading ? <Spinner animation="border" /> : <div/>) :
|
|
(apiResponse.report && apiResponse.report.length == 0) ? <h4>No records found</h4> :
|
|
(apiResponse.report && apiResponse.report.length == 0) ? <h4>No records found</h4> :
|
|
<>
|
|
<>
|
|
<Pagination>
|
|
<Pagination>
|
|
@@ -122,7 +123,7 @@ class ValidatorReport extends React.Component<IProps, IState> {
|
|
}
|
|
}
|
|
</Pagination>
|
|
</Pagination>
|
|
|
|
|
|
- <Table striped bordered hover size="sm">
|
|
|
|
|
|
+ <Table striped bordered hover size="sm" variant="dark">
|
|
<thead>
|
|
<thead>
|
|
<tr>
|
|
<tr>
|
|
<th>Era</th>
|
|
<th>Era</th>
|