Search in sources :

Example 1 with Page

use of com.djrapitops.plan.delivery.rendering.pages.Page in project Plan by plan-player-analytics.

the class PlayerPageExporter method exportHtml.

private void exportHtml(ExportPaths exportPaths, Path playerDirectory, UUID playerUUID) throws IOException {
    Path to = playerDirectory.resolve("index.html");
    try {
        Page page = pageFactory.playerPage(playerUUID);
        export(to, exportPaths.resolveExportPaths(page.toHtml()));
    } catch (IllegalStateException notFound) {
        throw new NotFoundException(notFound.getMessage());
    }
}
Also used : Path(java.nio.file.Path) NotFoundException(com.djrapitops.plan.delivery.web.resolver.exception.NotFoundException) Page(com.djrapitops.plan.delivery.rendering.pages.Page)

Example 2 with Page

use of com.djrapitops.plan.delivery.rendering.pages.Page in project Plan by plan-player-analytics.

the class ServerPageExporter method exportHtml.

private void exportHtml(Path toDirectory, Server server) throws IOException {
    ServerUUID serverUUID = server.getUuid();
    Path to = toDirectory.resolve(serverInfo.getServer().isProxy() ? "server/" + toFileName(server.getName()) : "server").resolve("index.html");
    Page page = pageFactory.serverPage(serverUUID);
    // Fixes refreshingJsonRequest ignoring old data of export
    String html = StringUtils.replaceEach(page.toHtml(), new String[] { "loadOptimizedPerformanceGraph, 'performance', true);", "loadserverCalendar, 'online-activity-overview', true);", "}, 'playerlist', true);", "<head>" }, new String[] { "loadOptimizedPerformanceGraph, 'performance');", "loadserverCalendar, 'online-activity-overview');", "}, 'playerlist');", "<head><style>.refresh-element {display: none;}</style>" });
    export(to, exportPaths.resolveExportPaths(html));
}
Also used : Path(java.nio.file.Path) ServerUUID(com.djrapitops.plan.identification.ServerUUID) Page(com.djrapitops.plan.delivery.rendering.pages.Page)

Example 3 with Page

use of com.djrapitops.plan.delivery.rendering.pages.Page in project Plan by plan-player-analytics.

the class NetworkPageExporter method exportHtml.

private void exportHtml(ExportPaths exportPaths, Path toDirectory) throws IOException {
    Path to = toDirectory.resolve("network").resolve("index.html");
    Page page = pageFactory.networkPage();
    // Fixes refreshingJsonRequest ignoring old data of export
    String html = StringUtils.replaceEach(page.toHtml(), new String[] { "loadPlayersOnlineGraph, 'network-overview', true);", "&middot; Performance", "<head>" }, new String[] { "loadPlayersOnlineGraph, 'network-overview');", "&middot; Performance (Unavailable with Export)", "<head><style>.refresh-element {display: none;}</style>" });
    export(to, exportPaths.resolveExportPaths(html));
}
Also used : Path(java.nio.file.Path) Page(com.djrapitops.plan.delivery.rendering.pages.Page)

Example 4 with Page

use of com.djrapitops.plan.delivery.rendering.pages.Page in project Plan by plan-player-analytics.

the class PlayersPageExporter method exportHtml.

private void exportHtml(Path toDirectory) throws IOException {
    Path to = toDirectory.resolve("players").resolve("index.html");
    Page page = pageFactory.playersPage();
    // Fixes refreshingJsonRequest ignoring old data of export
    String html = StringUtils.replaceEach(page.toHtml(), new String[] { "}, 'playerlist', true);", "<head>" }, new String[] { "}, 'playerlist');", "<head><style>.refresh-element {display: none;}</style>" });
    export(to, exportPaths.resolveExportPaths(html));
}
Also used : Path(java.nio.file.Path) Page(com.djrapitops.plan.delivery.rendering.pages.Page)

Aggregations

Page (com.djrapitops.plan.delivery.rendering.pages.Page)4 Path (java.nio.file.Path)4 NotFoundException (com.djrapitops.plan.delivery.web.resolver.exception.NotFoundException)1 ServerUUID (com.djrapitops.plan.identification.ServerUUID)1