mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-25 18:47:50 +01:00
Fix issues of the exported pages
- Fixed / opening "Redirecting.." view due to wrong whoAmI replacement - Fixed page not opening because sidebar contained undefined items (static site can't have everything) - Fixed some sidebar links being anchors instead of react-router links - Fixed network page not opening due to missing extensionData json - Fixed server page not opening due to missing extensionData and serverIdentifier json - Added visual icon to the page when it is exported rather than dynamic for my own sanity - Removed query page links from exported pages
This commit is contained in:
parent
143c64308f
commit
ad6abacf7f
@ -132,11 +132,13 @@ public class NetworkPageExporter extends FileExporter {
|
|||||||
"graph?type=hourlyUniqueAndNew",
|
"graph?type=hourlyUniqueAndNew",
|
||||||
"graph?type=serverPie",
|
"graph?type=serverPie",
|
||||||
"graph?type=joinAddressPie",
|
"graph?type=joinAddressPie",
|
||||||
|
"graph?type=joinAddressByDay",
|
||||||
"graph?type=activity",
|
"graph?type=activity",
|
||||||
"graph?type=geolocation",
|
"graph?type=geolocation",
|
||||||
"graph?type=uniqueAndNew",
|
"graph?type=uniqueAndNew",
|
||||||
"network/pingTable",
|
"network/pingTable",
|
||||||
"sessions"
|
"sessions",
|
||||||
|
"extensionData?server=" + serverUUID
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,6 +142,7 @@ public class ServerPageExporter extends FileExporter {
|
|||||||
"playerVersus?server=" + serverUUID,
|
"playerVersus?server=" + serverUUID,
|
||||||
"playerbaseOverview?server=" + serverUUID,
|
"playerbaseOverview?server=" + serverUUID,
|
||||||
"performanceOverview?server=" + serverUUID,
|
"performanceOverview?server=" + serverUUID,
|
||||||
|
"graph?type=playersOnline&server=" + serverUUID,
|
||||||
"graph?type=optimizedPerformance&server=" + serverUUID,
|
"graph?type=optimizedPerformance&server=" + serverUUID,
|
||||||
"graph?type=aggregatedPing&server=" + serverUUID,
|
"graph?type=aggregatedPing&server=" + serverUUID,
|
||||||
"graph?type=worldPie&server=" + serverUUID,
|
"graph?type=worldPie&server=" + serverUUID,
|
||||||
@ -150,12 +151,15 @@ public class ServerPageExporter extends FileExporter {
|
|||||||
"graph?type=uniqueAndNew&server=" + serverUUID,
|
"graph?type=uniqueAndNew&server=" + serverUUID,
|
||||||
"graph?type=hourlyUniqueAndNew&server=" + serverUUID,
|
"graph?type=hourlyUniqueAndNew&server=" + serverUUID,
|
||||||
"graph?type=joinAddressPie&server=" + serverUUID,
|
"graph?type=joinAddressPie&server=" + serverUUID,
|
||||||
|
"graph?type=joinAddressByDay&server=" + serverUUID,
|
||||||
"graph?type=serverCalendar&server=" + serverUUID,
|
"graph?type=serverCalendar&server=" + serverUUID,
|
||||||
"graph?type=punchCard&server=" + serverUUID,
|
"graph?type=punchCard&server=" + serverUUID,
|
||||||
"players?server=" + serverUUID,
|
"players?server=" + serverUUID,
|
||||||
"kills?server=" + serverUUID,
|
"kills?server=" + serverUUID,
|
||||||
"pingTable?server=" + serverUUID,
|
"pingTable?server=" + serverUUID,
|
||||||
"sessions?server=" + serverUUID
|
"sessions?server=" + serverUUID,
|
||||||
|
"extensionData?server=" + serverUUID,
|
||||||
|
"serverIdentity?server=" + serverUUID
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +306,8 @@ public enum HtmlLang implements Lang {
|
|||||||
|
|
||||||
WARNING_NO_GAME_SERVERS("html.description.noGameServers", "Some data requires Plan to be installed on game servers."),
|
WARNING_NO_GAME_SERVERS("html.description.noGameServers", "Some data requires Plan to be installed on game servers."),
|
||||||
WARNING_NO_GEOLOCATIONS("html.description.noGeolocations", "Geolocation gathering needs to be enabled in the config (Accept GeoLite2 EULA)."),
|
WARNING_NO_GEOLOCATIONS("html.description.noGeolocations", "Geolocation gathering needs to be enabled in the config (Accept GeoLite2 EULA)."),
|
||||||
WARNING_NO_SPONGE_CHUNKS("html.description.noSpongeChunks", "Chunks unavailable on Sponge");
|
WARNING_NO_SPONGE_CHUNKS("html.description.noSpongeChunks", "Chunks unavailable on Sponge"),
|
||||||
|
EXPORTED_TITLE("html.label.exported", "Data export time");
|
||||||
|
|
||||||
private final String key;
|
private final String key;
|
||||||
private final String defaultValue;
|
private final String defaultValue;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import {useMetadata} from "../../hooks/metadataHook";
|
import {useMetadata} from "../../hooks/metadataHook";
|
||||||
import {useAuth} from "../../hooks/authenticationHook";
|
import {useAuth} from "../../hooks/authenticationHook";
|
||||||
import {FontAwesomeIcon as Fa} from "@fortawesome/react-fontawesome";
|
import {FontAwesomeIcon as Fa} from "@fortawesome/react-fontawesome";
|
||||||
import {faBars, faCog, faDoorOpen, faPalette, faSyncAlt} from "@fortawesome/free-solid-svg-icons";
|
import {faBars, faClockRotateLeft, faCog, faDoorOpen, faPalette, faSyncAlt} from "@fortawesome/free-solid-svg-icons";
|
||||||
import DropdownMenu from "react-bootstrap-v5/lib/esm/DropdownMenu";
|
import DropdownMenu from "react-bootstrap-v5/lib/esm/DropdownMenu";
|
||||||
import DropdownItem from "react-bootstrap-v5/lib/esm/DropdownItem";
|
import DropdownItem from "react-bootstrap-v5/lib/esm/DropdownItem";
|
||||||
import {useTheme} from "../../hooks/themeHook";
|
import {useTheme} from "../../hooks/themeHook";
|
||||||
@ -58,6 +58,7 @@ const Header = ({page, tab, hideUpdater}) => {
|
|||||||
{!staticSite && <button onClick={requestUpdate}>
|
{!staticSite && <button onClick={requestUpdate}>
|
||||||
<Fa icon={faSyncAlt} spin={Boolean(updating)}/>
|
<Fa icon={faSyncAlt} spin={Boolean(updating)}/>
|
||||||
</button>}
|
</button>}
|
||||||
|
{staticSite && <Fa icon={faClockRotateLeft} title={t('html.label.exported')}/>}
|
||||||
{' '}
|
{' '}
|
||||||
<span className="refresh-time">{lastUpdate.formatted}</span>
|
<span className="refresh-time">{lastUpdate.formatted}</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -23,12 +23,12 @@ const Divider = ({showMargin}) => (
|
|||||||
<hr className={"sidebar-divider" + (showMargin ? '' : " my-0")}/>
|
<hr className={"sidebar-divider" + (showMargin ? '' : " my-0")}/>
|
||||||
)
|
)
|
||||||
|
|
||||||
const InnerItem = ({href, icon, name, nameShort, color}) => {
|
const InnerItem = ({href, icon, name, nameShort, color, external}) => {
|
||||||
if (!href) {
|
if (!href) {
|
||||||
return (<hr className={"nav-servers dropdown-divider mx-3 my-2"}/>)
|
return (<hr className={"nav-servers dropdown-divider mx-3 my-2"}/>)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (href.startsWith('/')) {
|
if (external) {
|
||||||
return (
|
return (
|
||||||
<a href={href} className="collapse-item nav-button">
|
<a href={href} className="collapse-item nav-button">
|
||||||
<Fa icon={icon} className={color ? "col-" + color : undefined}/>
|
<Fa icon={icon} className={color ? "col-" + color : undefined}/>
|
||||||
@ -56,10 +56,11 @@ const Item = ({item, inner}) => {
|
|||||||
}, [pathname, href, setCurrentTab, name, external])
|
}, [pathname, href, setCurrentTab, name, external])
|
||||||
|
|
||||||
if (inner) {
|
if (inner) {
|
||||||
return (<InnerItem href={href} icon={icon} name={t(name)} nameShort={t(nameShort)} color={color}/>)
|
return (<InnerItem href={href} icon={icon} name={t(name)} nameShort={t(nameShort)} color={color}
|
||||||
|
external={external}/>)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (href.startsWith('/')) {
|
if (external) {
|
||||||
return (
|
return (
|
||||||
<li className={"nav-item nav-button"}>
|
<li className={"nav-item nav-button"}>
|
||||||
<a href={baseAddress + href} className="nav-link">
|
<a href={baseAddress + href} className="nav-link">
|
||||||
@ -165,7 +166,9 @@ const SidebarCollapse = ({item, open, setOpen}) => {
|
|||||||
<Collapse in={open}>
|
<Collapse in={open}>
|
||||||
<div id={item.name + "-collapse"}>
|
<div id={item.name + "-collapse"}>
|
||||||
<div className="bg-white py-2 collapse-inner rounded">
|
<div className="bg-white py-2 collapse-inner rounded">
|
||||||
{item.contents.map((content, i) =>
|
{item.contents
|
||||||
|
.filter(content => content !== undefined)
|
||||||
|
.map((content, i) =>
|
||||||
<Item key={i}
|
<Item key={i}
|
||||||
inner
|
inner
|
||||||
active={false}
|
active={false}
|
||||||
|
@ -15,9 +15,11 @@ export const NavigationContextProvider = ({children}) => {
|
|||||||
const pathname = window.location.href;
|
const pathname = window.location.href;
|
||||||
setItems(items);
|
setItems(items);
|
||||||
for (const item of items) {
|
for (const item of items) {
|
||||||
|
if (!item) continue;
|
||||||
if ('/' !== item.href && pathname.includes(item.href)) setCurrentTab(item.name);
|
if ('/' !== item.href && pathname.includes(item.href)) setCurrentTab(item.name);
|
||||||
if (item.contents) {
|
if (item.contents) {
|
||||||
for (const subItem of item.contents) {
|
for (const subItem of item.contents) {
|
||||||
|
if (!subItem) continue;
|
||||||
if ('/' !== subItem.href && pathname.includes(subItem.href)) setCurrentTab(subItem.name);
|
if ('/' !== subItem.href && pathname.includes(subItem.href)) setCurrentTab(subItem.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ import {doGetRequest, doSomePostRequest, standard200option, staticSite} from "./
|
|||||||
|
|
||||||
export const fetchWhoAmI = async () => {
|
export const fetchWhoAmI = async () => {
|
||||||
if (staticSite) {
|
if (staticSite) {
|
||||||
return {authRequired: false, loggedIn: false}
|
return {data: {authRequired: false, loggedIn: false}, error: null};
|
||||||
}
|
}
|
||||||
const url = '/v1/whoami';
|
const url = '/v1/whoami';
|
||||||
return doGetRequest(url);
|
return doGetRequest(url);
|
||||||
|
@ -95,11 +95,13 @@ const NetworkSidebar = () => {
|
|||||||
}).forEach(item => items.push(item))
|
}).forEach(item => items.push(item))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!staticSite) {
|
||||||
items.push(
|
items.push(
|
||||||
{},
|
{},
|
||||||
{name: 'html.label.links'},
|
{name: 'html.label.links'},
|
||||||
{name: 'html.label.query', icon: faSearch, href: "/query"}
|
{name: 'html.label.query', icon: faSearch, href: "/query"}
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
setSidebarItems(items);
|
setSidebarItems(items);
|
||||||
window.document.title = `Plan | Network`;
|
window.document.title = `Plan | Network`;
|
||||||
|
@ -9,6 +9,7 @@ import Header from "../../components/navigation/Header";
|
|||||||
import ColorSelectorModal from "../../components/modal/ColorSelectorModal";
|
import ColorSelectorModal from "../../components/modal/ColorSelectorModal";
|
||||||
import {useMetadata} from "../../hooks/metadataHook";
|
import {useMetadata} from "../../hooks/metadataHook";
|
||||||
import ErrorPage from "./ErrorPage";
|
import ErrorPage from "./ErrorPage";
|
||||||
|
import {staticSite} from "../../service/backendConfiguration";
|
||||||
|
|
||||||
const PlayersPage = () => {
|
const PlayersPage = () => {
|
||||||
const {t, i18n} = useTranslation();
|
const {t, i18n} = useTranslation();
|
||||||
@ -20,7 +21,7 @@ const PlayersPage = () => {
|
|||||||
const {currentTab, setCurrentTab} = useNavigation();
|
const {currentTab, setCurrentTab} = useNavigation();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const items = [
|
const items = staticSite ? [] : [
|
||||||
{name: 'html.label.links'},
|
{name: 'html.label.links'},
|
||||||
{name: 'html.label.query', icon: faSearch, href: "/query"},
|
{name: 'html.label.query', icon: faSearch, href: "/query"},
|
||||||
]
|
]
|
||||||
|
@ -29,6 +29,7 @@ import {useDataRequest} from "../../hooks/dataFetchHook";
|
|||||||
import {fetchServerIdentity} from "../../service/serverService";
|
import {fetchServerIdentity} from "../../service/serverService";
|
||||||
import {ServerExtensionContextProvider, useServerExtensionContext} from "../../hooks/serverExtensionDataContext";
|
import {ServerExtensionContextProvider, useServerExtensionContext} from "../../hooks/serverExtensionDataContext";
|
||||||
import {iconTypeToFontAwesomeClass} from "../../util/icons";
|
import {iconTypeToFontAwesomeClass} from "../../util/icons";
|
||||||
|
import {staticSite} from "../../service/backendConfiguration";
|
||||||
|
|
||||||
const ServerSidebar = () => {
|
const ServerSidebar = () => {
|
||||||
const {t, i18n} = useTranslation();
|
const {t, i18n} = useTranslation();
|
||||||
@ -93,11 +94,13 @@ const ServerSidebar = () => {
|
|||||||
}).forEach(item => items.push(item))
|
}).forEach(item => items.push(item))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!staticSite) {
|
||||||
items.push(
|
items.push(
|
||||||
{},
|
{},
|
||||||
{name: 'html.label.links'},
|
{name: 'html.label.links'},
|
||||||
{name: 'html.label.query', icon: faSearch, href: "/query"}
|
{name: 'html.label.query', icon: faSearch, href: "/query"}
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
setSidebarItems(items);
|
setSidebarItems(items);
|
||||||
window.document.title = `Plan | Server Analysis`;
|
window.document.title = `Plan | Server Analysis`;
|
||||||
|
Loading…
Reference in New Issue
Block a user