|
@@ -30,6 +30,7 @@ import Alert from "@material-ui/lab/Alert";
|
|
import Tabs from "@material-ui/core/Tabs";
|
|
import Tabs from "@material-ui/core/Tabs";
|
|
import Backdrop from "@material-ui/core/Backdrop";
|
|
import Backdrop from "@material-ui/core/Backdrop";
|
|
import "./index.css";
|
|
import "./index.css";
|
|
|
|
+import pako from "pako";
|
|
import { alternativeBackendApis } from "../../config";
|
|
import { alternativeBackendApis } from "../../config";
|
|
|
|
|
|
config();
|
|
config();
|
|
@@ -57,8 +58,8 @@ const useStyles = makeStyles((theme: Theme) =>
|
|
})
|
|
})
|
|
);
|
|
);
|
|
|
|
|
|
-const oldChainStatsLocation =
|
|
|
|
- "https://joystreamstats.live/static/validators-old-testnet.json";
|
|
|
|
|
|
+const oldChainStatsFileName = "validators-old-testnet.json.gz";
|
|
|
|
+const oldChainStatsLocation = `https://joystreamstats.live/static/${oldChainStatsFileName}`;
|
|
const ValidatorReport = () => {
|
|
const ValidatorReport = () => {
|
|
const dateFormat = "yyyy-MM-DD";
|
|
const dateFormat = "yyyy-MM-DD";
|
|
const [oldChainLastDate, setOldChainLastDate] = useState(moment());
|
|
const [oldChainLastDate, setOldChainLastDate] = useState(moment());
|
|
@@ -200,6 +201,7 @@ const ValidatorReport = () => {
|
|
};
|
|
};
|
|
});
|
|
});
|
|
setOldChainRows(filteredStats);
|
|
setOldChainRows(filteredStats);
|
|
|
|
+ setError(undefined);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -209,16 +211,14 @@ const ValidatorReport = () => {
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
setIsLoading(true);
|
|
setIsLoading(true);
|
|
axios
|
|
axios
|
|
- .get(oldChainStatsLocation)
|
|
|
|
|
|
+ .get(oldChainStatsLocation, {
|
|
|
|
+ responseType: "arraybuffer",
|
|
|
|
+ })
|
|
.then((response) => {
|
|
.then((response) => {
|
|
try {
|
|
try {
|
|
- const oldStats = response.data;
|
|
|
|
- setOldChainStats(oldStats as ValidatorsJSResponse);
|
|
|
|
- setOldChainLastDate(
|
|
|
|
- moment(
|
|
|
|
- oldStats.eraStats[oldStats.eraStats.length - 1].timestampEnded
|
|
|
|
- )
|
|
|
|
- );
|
|
|
|
|
|
+ const binData = new Uint8Array(response.data);
|
|
|
|
+ const decompressedData = pako.inflate(binData);
|
|
|
|
+ updateOldChainStats(new TextDecoder().decode(decompressedData));
|
|
setIsLoading(false);
|
|
setIsLoading(false);
|
|
} catch (err) {
|
|
} catch (err) {
|
|
setIsLoading(false);
|
|
setIsLoading(false);
|
|
@@ -231,6 +231,14 @@ const ValidatorReport = () => {
|
|
});
|
|
});
|
|
}, []);
|
|
}, []);
|
|
|
|
|
|
|
|
+ const updateOldChainStats = (stringData: string) => {
|
|
|
|
+ const oldStats = JSON.parse(stringData);
|
|
|
|
+ setOldChainStats(oldStats as ValidatorsJSResponse);
|
|
|
|
+ setOldChainLastDate(
|
|
|
|
+ moment(oldStats.eraStats[oldStats.eraStats.length - 1].timestampEnded)
|
|
|
|
+ );
|
|
|
|
+ };
|
|
|
|
+
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
updateChainState();
|
|
updateChainState();
|
|
const interval = setInterval(() => {
|
|
const interval = setInterval(() => {
|