|
@@ -58,8 +58,8 @@ const useStyles = makeStyles((theme: Theme) =>
|
|
})
|
|
})
|
|
);
|
|
);
|
|
|
|
|
|
-const oldChainStatsLocation =
|
|
|
|
- "https://joystreamstats.live/static/validators-old-testnet.json.gz";
|
|
|
|
|
|
+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());
|
|
@@ -201,6 +201,7 @@ const ValidatorReport = () => {
|
|
};
|
|
};
|
|
});
|
|
});
|
|
setOldChainRows(filteredStats);
|
|
setOldChainRows(filteredStats);
|
|
|
|
+ setError(undefined);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -215,15 +216,9 @@ const ValidatorReport = () => {
|
|
})
|
|
})
|
|
.then((response) => {
|
|
.then((response) => {
|
|
try {
|
|
try {
|
|
- var binData = new Uint8Array(response.data);
|
|
|
|
- var data = pako.inflate(binData);
|
|
|
|
- const oldStats = JSON.parse(new TextDecoder().decode(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);
|
|
@@ -236,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(() => {
|