Skip to content

Commit

Permalink
2905/remove old web files (#3225)
Browse files Browse the repository at this point in the history
* Removed Plugin.Use_Legacy_Frontend feature flag
* Remove version modal html generation in Java
* Remove contributor list html generation in Java
* Remove more html generation in Java
* Delete old web file bundle
* Removed locale html/js translation from backend
* Move Html#swapColorsToSpan to the React side
* Reimplement datatables and backend for preferences
* Load preferences from backend
* Usability fixes to the players table
* Delete WebAssetVersionCheckTask
* Add new locale to locale files
* Export defaultPreferences as json on react export

Affects issues:
- Close #2905
  • Loading branch information
AuroraLS3 committed Sep 23, 2023
1 parent 2fc4ee7 commit 01d904c
Show file tree
Hide file tree
Showing 188 changed files with 6,297 additions and 33,842 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
package com.djrapitops.plan.extension.icon;

import java.util.Objects;

/**
* Object that represents an icon on the website.
* <p>
Expand Down Expand Up @@ -72,6 +74,19 @@ public Icon setColor(Color color) {
return this;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Icon icon = (Icon) o;
return type == icon.type && Objects.equals(getName(), icon.getName()) && getColor() == icon.getColor();
}

@Override
public int hashCode() {
return Objects.hash(id, type, getName(), getColor());
}

@Override
public String toString() {
return "Icon{" + type.name() + ", '" + name + '\'' + ", " + color.name() + '}';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
import com.djrapitops.plan.extension.icon.Icon;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.*;
import java.util.stream.Collectors;

/**
* Object for giving Plan table data.
Expand Down Expand Up @@ -100,6 +98,52 @@ public TableColumnFormat[] getTableColumnFormats() {
return tableColumnFormats;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Table table = (Table) o;
return Arrays.equals(getColumns(), table.getColumns())
&& Arrays.equals(getIcons(), table.getIcons())
&& Arrays.equals(getTableColumnFormats(), table.getTableColumnFormats())
&& valuesEqual(table);
}

private boolean valuesEqual(Table other) {
List<Object[]> rows1 = getRows();
List<Object[]> rows2 = other.getRows();
if (rows1.size() != rows2.size()) return false;
for (int i = 0; i < rows1.size(); i++) {
Object[] values1 = rows1.get(i);
Object[] values2 = rows2.get(i);
for (int j = 0; j < getMaxColumnSize(); j++) {
if (!Objects.equals(Objects.toString(values1[0]), Objects.toString(values2[0]))) {
return false;
}
}
}
return true;
}

@Override
public int hashCode() {
int result = Objects.hash(getRows());
result = 31 * result + Arrays.hashCode(getColumns());
result = 31 * result + Arrays.hashCode(getIcons());
result = 31 * result + Arrays.hashCode(getTableColumnFormats());
return result;
}

@Override
public String toString() {
return "Table{" +
"columns=" + Arrays.toString(columns) +
", icons=" + Arrays.toString(icons) +
", tableColumnFormats=" + Arrays.toString(tableColumnFormats) +
", rows=" + rows.stream().map(Arrays::toString).collect(Collectors.toList()) +
'}';
}

/**
* Factory for creating new {@link Table} objects.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.djrapitops.plan.TaskSystem;
import com.djrapitops.plan.addons.placeholderapi.PlaceholderCacheRefreshTask;
import com.djrapitops.plan.delivery.web.ResourceWriteTask;
import com.djrapitops.plan.delivery.web.WebAssetVersionCheckTask;
import com.djrapitops.plan.delivery.webserver.auth.ActiveCookieExpiryCleanupTask;
import com.djrapitops.plan.delivery.webserver.cache.JSONFileStorage;
import com.djrapitops.plan.delivery.webserver.configuration.AddressAllowList;
Expand Down Expand Up @@ -94,10 +93,6 @@ public interface BukkitTaskModule {
@IntoSet
TaskSystem.Task bindResourceWriteTask(ResourceWriteTask resourceWriteTask);

@Binds
@IntoSet
TaskSystem.Task bindWebAssetVersionCheckTask(WebAssetVersionCheckTask webAssetVersionCheckTask);

@Binds
@IntoSet
TaskSystem.Task bindActiveCookieStoreExpiryTask(ActiveCookieExpiryCleanupTask activeCookieExpiryCleanupTask);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import com.djrapitops.plan.TaskSystem;
import com.djrapitops.plan.delivery.web.ResourceWriteTask;
import com.djrapitops.plan.delivery.web.WebAssetVersionCheckTask;
import com.djrapitops.plan.delivery.webserver.auth.ActiveCookieExpiryCleanupTask;
import com.djrapitops.plan.delivery.webserver.cache.JSONFileStorage;
import com.djrapitops.plan.delivery.webserver.configuration.AddressAllowList;
Expand Down Expand Up @@ -81,10 +80,6 @@ public interface BungeeTaskModule {
@IntoSet
TaskSystem.Task bindResourceWriteTask(ResourceWriteTask resourceWriteTask);

@Binds
@IntoSet
TaskSystem.Task bindWebAssetVersionCheckTask(WebAssetVersionCheckTask webAssetVersionCheckTask);

@Binds
@IntoSet
TaskSystem.Task bindActiveCookieStoreExpiryTask(ActiveCookieExpiryCleanupTask activeCookieExpiryCleanupTask);
Expand Down
5 changes: 5 additions & 0 deletions Plan/common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ task yarnStart(type: YarnTask) {
task copyYarnBuildResults {
inputs.files(fileTree("$rootDir/react/dashboard/build"))
outputs.dir("$rootDir/common/build/resources/main/assets/plan/web")
outputs.dir("$rootDir/common/build/resources/test/assets/plan/web")

dependsOn yarnBundle
doLast {
Expand All @@ -144,6 +145,10 @@ task copyYarnBuildResults {
from "$rootDir/react/dashboard/build"
into "$rootDir/common/build/resources/main/assets/plan/web"
}
copy {
into "$rootDir/common/build/resources/main/assets/plan/web"
into "$rootDir/common/build/resources/test/assets/plan/web"
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* This file is part of Player Analytics (Plan).
*
* Plan is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License v3 as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Plan is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Plan. If not, see <https://www.gnu.org/licenses/>.
*/
package com.djrapitops.plan.delivery.domain.datatransfer;

import com.djrapitops.plan.delivery.domain.datatransfer.extension.ExtensionDescriptionDto;

import java.util.List;

/**
* @author AuroraLS3
*/
public class PlayerListDto {

private final List<TablePlayerDto> players;
private final List<ExtensionDescriptionDto> extensionDescriptors;

public PlayerListDto(List<TablePlayerDto> players, List<ExtensionDescriptionDto> extensionDescriptors) {
this.players = players;
this.extensionDescriptors = extensionDescriptors;
}

public List<TablePlayerDto> getPlayers() {
return players;
}

public List<ExtensionDescriptionDto> getExtensionDescriptors() {
return extensionDescriptors;
}

@Override
public String toString() {
return "PlayerListDto{" +
"players=" + players +
", extensionDescriptors=" + extensionDescriptors +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
/*
* This file is part of Player Analytics (Plan).
*
* Plan is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License v3 as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Plan is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* aLong with Plan. If not, see <https://www.gnu.org/licenses/>.
*/
package com.djrapitops.plan.delivery.domain.datatransfer;

import com.djrapitops.plan.delivery.domain.datatransfer.extension.ExtensionValueDataDto;

import java.util.Map;
import java.util.UUID;

/**
* Represents a row for players table.
*
* @author AuroraLS3
*/
public class TablePlayerDto {

private UUID playerUUID;
private String playerName;
private double activityIndex;
private Long playtimeActive;
private Long sessionCount;
private Long lastSeen;
private Long registered;
private String country;

private Map<String, ExtensionValueDataDto> extensionValues;

private TablePlayerDto() {
// Builder constructor
}

public static TablePlayerDtoBuilder builder() {
return new TablePlayerDtoBuilder();
}

public String getPlayerName() {
return playerName;
}

private void setPlayerName(String playerName) {
this.playerName = playerName;
}

public double getActivityIndex() {
return activityIndex;
}

private void setActivityIndex(double activityIndex) {
this.activityIndex = activityIndex;
}

public Long getPlaytimeActive() {
return playtimeActive;
}

private void setPlaytimeActive(Long playtimeActive) {
this.playtimeActive = playtimeActive;
}

public Long getSessionCount() {
return sessionCount;
}

private void setSessionCount(Long sessionCount) {
this.sessionCount = sessionCount;
}

public Long getLastSeen() {
return lastSeen;
}

private void setLastSeen(Long lastSeen) {
this.lastSeen = lastSeen;
}

public Long getRegistered() {
return registered;
}

private void setRegistered(Long registered) {
this.registered = registered;
}

public String getCountry() {
return country;
}

private void setCountry(String country) {
this.country = country;
}

public Map<String, ExtensionValueDataDto> getExtensionValues() {
return extensionValues;
}

private void setExtensionValues(Map<String, ExtensionValueDataDto> extensionValues) {
this.extensionValues = extensionValues;
}

public UUID getPlayerUUID() {
return playerUUID;
}

public void setPlayerUUID(UUID playerUUID) {
this.playerUUID = playerUUID;
}

public static final class TablePlayerDtoBuilder {
private final TablePlayerDto tablePlayerDto;

private TablePlayerDtoBuilder() {tablePlayerDto = new TablePlayerDto();}

public TablePlayerDtoBuilder withUuid(UUID playerUUID) {
tablePlayerDto.setPlayerUUID(playerUUID);
return this;
}

public TablePlayerDtoBuilder withName(String name) {
tablePlayerDto.setPlayerName(name);
return this;
}

public TablePlayerDtoBuilder withActivityIndex(double activityIndex) {
tablePlayerDto.setActivityIndex(activityIndex);
return this;
}

public TablePlayerDtoBuilder withPlaytimeActive(Long playtimeActive) {
tablePlayerDto.setPlaytimeActive(playtimeActive);
return this;
}

public TablePlayerDtoBuilder withSessionCount(Long sessionCount) {
tablePlayerDto.setSessionCount(sessionCount);
return this;
}

public TablePlayerDtoBuilder withLastSeen(Long lastSeen) {
tablePlayerDto.setLastSeen(lastSeen);
return this;
}

public TablePlayerDtoBuilder withRegistered(Long registered) {
tablePlayerDto.setRegistered(registered);
return this;
}

public TablePlayerDtoBuilder withCountry(String country) {
tablePlayerDto.setCountry(country);
return this;
}

public TablePlayerDtoBuilder withExtensionValues(Map<String, ExtensionValueDataDto> extensionValues) {
tablePlayerDto.setExtensionValues(extensionValues);
return this;
}

public TablePlayerDto build() {return tablePlayerDto;}
}
}
Loading

0 comments on commit 01d904c

Please sign in to comment.