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-timezone'; import { apiUrl, statusColor, BasicTable, staticUrl, requester } from './utils.js'; import { NotFound } from './Misc.js'; let historyCache = false; let excludeSystemCache = true; let focusCache = false; export function AdminHistory(props) { const { token, user } = props; const [history, setHistory] = useState(historyCache); const [excludeSystem, setExcludeSystem] = useState(excludeSystemCache); const [focus, setFocus] = useState(focusCache); const [error, setError] = useState(false); const handleExcludeSystem = (e, v) => { setExcludeSystem(v.checked); excludeSystemCache = v.checked; }; useEffect(() => { const extra = excludeSystem ? '?exclude_system' : ''; requester('/history/'+extra, 'GET', token) .then(res => { setHistory(res.results); historyCache = res.results; }) .catch(err => { console.log(err); }); }, [excludeSystem]); return (
{!error ? history ? <> Date Username Type Owner Object Changed Fields {history.map(x => setFocus(x.id)}> {moment.utc(x.history_date).format('YYYY-MM-DD')} {x.is_system ? 'System' : (x.history_user || 'Deleted User')} {x.history_type} {x.owner_name} {x.object_name} {x.changes.map(x => x.field).join(', ')} {focus == x.id && } )}

Object ID: {x.object_id}, Database Revert

{!!x.changes.length && Change Before After {x.changes.map(y => {y.field} {y.old} {y.new} )}
}
:

Loading...

:

Error loading.

}
); }; 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 (
Portal Admin
Member Data Backup

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

Backup Downloads
History

Last 50 database changes:

); };