From 6e23250eb038916287422de53fa3a842276090d8 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sun, 8 Mar 2020 01:11:31 +0000 Subject: [PATCH] Display when backups were downloaded --- webclient/src/Admin.js | 56 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/webclient/src/Admin.js b/webclient/src/Admin.js index 05c1f21..855982a 100644 --- a/webclient/src/Admin.js +++ b/webclient/src/Admin.js @@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'; import { BrowserRouter as Router, Switch, Route, Link, useParams, useHistory } from 'react-router-dom'; import './light.css'; import { Button, Container, Checkbox, Dimmer, Divider, Dropdown, Form, Grid, Header, Icon, Image, Menu, Message, Segment, Table } from 'semantic-ui-react'; -import moment from 'moment'; +import moment from 'moment-timezone'; import { apiUrl, statusColor, BasicTable, staticUrl, requester } from './utils.js'; import { NotFound } from './Misc.js'; @@ -62,6 +62,55 @@ export function AdminHistory(props) { ); }; +let backupsCache = false; + +export function AdminBackups(props) { + const [backups, setBackups] = useState(backupsCache); + const [error, setError] = useState(false); + + useEffect(() => { + requester('/backup/', 'GET') + .then(res => { + setBackups(res); + backupsCache = res; + }) + .catch(err => { + console.log(err); + }); + }, []); + + return ( +
+ {!error ? + backups ? + + + + Username + Last Downloaded + Less than 24 hours ago? + + + + + {backups.filter(x => x.download_time).map(x => + + {x.backup_user} + {moment.utc(x.download_time).tz('America/Edmonton').format('LLLL')} + {x.less_than_24h ? 'Yes' : 'No - please investigate'} + + )} + +
+ : +

Loading...

+ : +

Error loading.

+ } +
+ ); +}; + export function Admin(props) { return ( @@ -69,8 +118,9 @@ export function Admin(props) {
Member Data Backup

Spaceport backups are created daily. 14 days are kept on the server.

-

Backups contain the complete member data and must be kept secure.

-

Talk to Tanner to learn how to get backups.

+ +
Backup Downloads
+
History (Experimental)

Last 100 database changes: