From 27ff4f14b5993cb6bf7f20508dac891081453090 Mon Sep 17 00:00:00 2001 From: main Date: Wed, 18 Oct 2023 20:12:37 -0400 Subject: [PATCH 1/4] Add logging --- .idea/codeStyles/Project.xml | 12 ------------ .idea/codeStyles/codeStyleConfig.xml | 5 ----- .idea/compiler.xml | 21 ++------------------- .idea/encodings.xml | 11 ----------- .idea/gradle.xml | 3 --- .idea/misc.xml | 18 ++---------------- .idea/modules.xml | 16 ---------------- .idea/runConfigurations.xml | 10 ++++++++++ spring.log | 13 +++++++++++++ src/main/resources/logback-spring.xml | 9 +++++++++ 10 files changed, 36 insertions(+), 82 deletions(-) delete mode 100644 .idea/codeStyles/Project.xml delete mode 100644 .idea/codeStyles/codeStyleConfig.xml delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/modules.xml create mode 100644 .idea/runConfigurations.xml create mode 100644 spring.log create mode 100644 src/main/resources/logback-spring.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml deleted file mode 100644 index 06ff64a..0000000 --- a/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml deleted file mode 100644 index 79ee123..0000000 --- a/.idea/codeStyles/codeStyleConfig.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 5b964c2..3b215ec 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -2,7 +2,6 @@ - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index 31b9e0c..0000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index dea8515..ba1ec5c 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,6 +1,5 @@ - diff --git a/.idea/misc.xml b/.idea/misc.xml index 822b4bf..668048d 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,19 +1,5 @@ - - - - - - - - - - - + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index bf45ccf..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..797acea --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/spring.log b/spring.log new file mode 100644 index 0000000..b90d51b --- /dev/null +++ b/spring.log @@ -0,0 +1,13 @@ +2023-10-18T20:09:06.941-04:00 INFO 498248 --- [JavaFX-Launcher] o.s.boot.SpringApplication : Starting application using Java 17.0.1 with PID 498248 (started by main in /home/main/IdeaProjects/faf-moderator-client) +2023-10-18T20:09:06.943-04:00 INFO 498248 --- [JavaFX-Launcher] o.s.boot.SpringApplication : No active profile set, falling back to 1 default profile: "default" +2023-10-18T20:09:07.845-04:00 INFO 498248 --- [JavaFX-Launcher] f.a.AutowiredAnnotationBeanPostProcessor : Autowired annotation is not supported on static fields: private static com.faforever.moderatorclient.ui.caches.LargeThumbnailCache com.faforever.moderatorclient.ui.ViewHelper.largeThumbnailCache +2023-10-18T20:09:08.089-04:00 INFO 498248 --- [JavaFX-Launcher] o.s.boot.SpringApplication : Started application in 1.708 seconds (process running for 2.374) +2023-10-18T20:10:11.462-04:00 DEBUG 498248 --- [JavaFX Application Thread] c.f.moderatorclient.api.TokenService : Token still valid for 3598 seconds +2023-10-18T20:10:11.938-04:00 DEBUG 498248 --- [ForkJoinPool.commonPool-worker-15] c.f.m.api.FafApiCommunicationService : Sending API request: /data/featuredMod?page[size]=10000&page[number]=1 +2023-10-18T20:10:11.940-04:00 DEBUG 498248 --- [ForkJoinPool.commonPool-worker-15] c.f.moderatorclient.api.TokenService : Token still valid for 3598 seconds +2023-10-18T20:10:11.979-04:00 DEBUG 498248 --- [JavaFX Application Thread] c.f.m.api.domain.MapService : Searching for all matchmaker queues +2023-10-18T20:10:11.980-04:00 DEBUG 498248 --- [JavaFX Application Thread] c.f.m.api.FafApiCommunicationService : Sending API request: /data/matchmakerQueue?page[size]=10000&page[number]=1 +2023-10-18T20:10:11.981-04:00 DEBUG 498248 --- [JavaFX Application Thread] c.f.moderatorclient.api.TokenService : Token still valid for 3598 seconds +2023-10-18T20:10:12.289-04:00 DEBUG 498248 --- [JavaFX Application Thread] c.f.m.api.domain.MapService : found 5 matchmaker queues +2023-10-18T20:10:13.838-04:00 DEBUG 498248 --- [ForkJoinPool.commonPool-worker-15] c.f.m.api.FafApiCommunicationService : Sending API request: /data/banInfo?include=player,author,revokeAuthor&sort=-createTime&page[size]=100&page[number]=1 +2023-10-18T20:10:13.839-04:00 DEBUG 498248 --- [ForkJoinPool.commonPool-worker-15] c.f.moderatorclient.api.TokenService : Token still valid for 3596 seconds diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..9f493dd --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,9 @@ + + + + + + + + + From e4e943b6ad1a64389c27d6bbe79eaff3aec2ca46 Mon Sep 17 00:00:00 2001 From: main Date: Thu, 19 Oct 2023 19:30:38 -0400 Subject: [PATCH 2/4] avatar fixes --- .idea/misc.xml | 4 +- client.log | 18 +++++ .../api/domain/AvatarService.java | 43 ++++++----- .../moderatorclient/ui/ViewHelper.java | 29 +++++++- .../ui/data_cells/UrlImageViewTableCell.java | 53 +++++++++----- .../data_cells/UrlImageViewTableCellSync.java | 57 +++++++++++++++ .../ui/main_window/AvatarsController.java | 41 +++++++++-- .../resources/ui/main_window/avatars.fxml | 73 +++++++++---------- 8 files changed, 231 insertions(+), 87 deletions(-) create mode 100644 client.log create mode 100644 src/main/java/com/faforever/moderatorclient/ui/data_cells/UrlImageViewTableCellSync.java diff --git a/.idea/misc.xml b/.idea/misc.xml index 668048d..24e284c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,5 +1,7 @@ - + + + \ No newline at end of file diff --git a/client.log b/client.log new file mode 100644 index 0000000..8bcc451 --- /dev/null +++ b/client.log @@ -0,0 +1,18 @@ +2023-10-19T19:15:11.180-04:00 INFO 905956 --- [JavaFX-Launcher] o.s.boot.SpringApplication : Starting application using Java 17.0.1 with PID 905956 (started by main in /home/main/IdeaProjects/faf-moderator-client) +2023-10-19T19:15:11.182-04:00 INFO 905956 --- [JavaFX-Launcher] o.s.boot.SpringApplication : No active profile set, falling back to 1 default profile: "default" +2023-10-19T19:15:11.894-04:00 INFO 905956 --- [JavaFX-Launcher] f.a.AutowiredAnnotationBeanPostProcessor : Autowired annotation is not supported on static fields: private static com.faforever.moderatorclient.ui.caches.LargeThumbnailCache com.faforever.moderatorclient.ui.ViewHelper.largeThumbnailCache +2023-10-19T19:15:12.094-04:00 INFO 905956 --- [JavaFX-Launcher] o.s.boot.SpringApplication : Started application in 1.377 seconds (process running for 1.949) +2023-10-19T19:15:30.820-04:00 DEBUG 905956 --- [JavaFX Application Thread] c.f.moderatorclient.api.TokenService : Token still valid for 3599 seconds +2023-10-19T19:15:31.177-04:00 DEBUG 905956 --- [ForkJoinPool.commonPool-worker-3] c.f.m.api.FafApiCommunicationService : Sending API request: /data/featuredMod?page[size]=10000&page[number]=1 +2023-10-19T19:15:31.179-04:00 DEBUG 905956 --- [ForkJoinPool.commonPool-worker-3] c.f.moderatorclient.api.TokenService : Token still valid for 3599 seconds +2023-10-19T19:15:31.215-04:00 DEBUG 905956 --- [JavaFX Application Thread] c.f.m.api.domain.MapService : Searching for all matchmaker queues +2023-10-19T19:15:31.215-04:00 DEBUG 905956 --- [JavaFX Application Thread] c.f.m.api.FafApiCommunicationService : Sending API request: /data/matchmakerQueue?page[size]=10000&page[number]=1 +2023-10-19T19:15:31.216-04:00 DEBUG 905956 --- [JavaFX Application Thread] c.f.moderatorclient.api.TokenService : Token still valid for 3599 seconds +2023-10-19T19:15:31.351-04:00 DEBUG 905956 --- [JavaFX Application Thread] c.f.m.api.domain.MapService : found 5 matchmaker queues +2023-10-19T19:15:32.149-04:00 DEBUG 905956 --- [ForkJoinPool.commonPool-worker-3] c.f.m.api.FafApiCommunicationService : Sending API request: /data/banInfo?include=player,author,revokeAuthor&sort=-createTime&page[size]=100&page[number]=1 +2023-10-19T19:15:32.151-04:00 DEBUG 905956 --- [ForkJoinPool.commonPool-worker-3] c.f.moderatorclient.api.TokenService : Token still valid for 3598 seconds +2023-10-19T19:15:38.230-04:00 DEBUG 905956 --- [ForkJoinPool.commonPool-worker-3] c.f.m.api.domain.AvatarService : Retrieving all avatars +2023-10-19T19:15:38.230-04:00 DEBUG 905956 --- [ForkJoinPool.commonPool-worker-3] c.f.m.api.FafApiCommunicationService : Sending API request: /data/avatar?include=assignments,assignments.player&page[size]=10000&page[number]=1 +2023-10-19T19:15:38.231-04:00 DEBUG 905956 --- [ForkJoinPool.commonPool-worker-3] c.f.moderatorclient.api.TokenService : Token still valid for 3592 seconds +2023-10-19T19:17:35.594-04:00 DEBUG 905956 --- [ForkJoinPool.commonPool-worker-15] c.f.m.api.FafApiCommunicationService : Sending API request: /data/banInfo?include=player,author,revokeAuthor&sort=-createTime&page[size]=100&page[number]=1 +2023-10-19T19:17:35.595-04:00 DEBUG 905956 --- [ForkJoinPool.commonPool-worker-15] c.f.moderatorclient.api.TokenService : Token still valid for 3475 seconds diff --git a/src/main/java/com/faforever/moderatorclient/api/domain/AvatarService.java b/src/main/java/com/faforever/moderatorclient/api/domain/AvatarService.java index 56560ee..86584b1 100644 --- a/src/main/java/com/faforever/moderatorclient/api/domain/AvatarService.java +++ b/src/main/java/com/faforever/moderatorclient/api/domain/AvatarService.java @@ -22,6 +22,7 @@ import java.io.File; import java.util.List; +import java.util.concurrent.CompletableFuture; @Service @Slf4j @@ -34,14 +35,16 @@ public AvatarService(FafApiCommunicationService fafApi, AvatarAssignmentMapper a this.avatarAssignmentMapper = avatarAssignmentMapper; } - public List getAll() { - log.debug("Retrieving all avatars"); - List result = fafApi.getAll(Avatar.class, ElideNavigator.of(Avatar.class) - .collection() - .addInclude("assignments") - .addInclude("assignments.player")); - log.trace("found {} avatars", result.size()); - return result; + public CompletableFuture> getAll() { + return CompletableFuture.supplyAsync(() -> { + log.debug("Retrieving all avatars"); + List result = fafApi.getAll(Avatar.class, ElideNavigator.of(Avatar.class) + .collection() + .addInclude("assignments") + .addInclude("assignments.player")); + log.trace("found {} avatars", result.size()); + return result; + }); } private List findAvatarsByAttribute(@NotNull String attribute, @NotNull String pattern) { @@ -65,19 +68,21 @@ public List findAvatarsByTooltip(@NotNull String pattern) { return findAvatarsByAttribute("tooltip", pattern); } - public List findAvatarsByAssignedUser(@NotNull String pattern) { - log.debug("Searching for avatars by assigned player with pattern: {}", pattern); - boolean isNumeric = pattern.matches("^[0-9]+$"); + public CompletableFuture> findAvatarsByAssignedUser(@NotNull String pattern) { + return CompletableFuture.supplyAsync(() -> { + log.debug("Searching for avatars by assigned player with pattern: {}", pattern); + boolean isNumeric = pattern.matches("^[0-9]+$"); - ElideNavigatorOnCollection navigator = ElideNavigator.of(Avatar.class) - .collection() - .addInclude("assignments") - .addInclude("assignments.player") - .setFilter(ElideNavigator.qBuilder().string(isNumeric ? "assignments.player.id" : "assignments.player.login").eq(pattern)); + ElideNavigatorOnCollection navigator = ElideNavigator.of(Avatar.class) + .collection() + .addInclude("assignments") + .addInclude("assignments.player") + .setFilter(ElideNavigator.qBuilder().string(isNumeric ? "assignments.player.id" : "assignments.player.login").eq(pattern)); - List result = fafApi.getAll(Avatar.class, navigator); - log.trace("found {} avatars", result.size()); - return result; + List result = fafApi.getAll(Avatar.class, navigator); + log.trace("found {} avatars", result.size()); + return result; + }); } public void uploadAvatar(String name, File avatarImageFile) { diff --git a/src/main/java/com/faforever/moderatorclient/ui/ViewHelper.java b/src/main/java/com/faforever/moderatorclient/ui/ViewHelper.java index 5371e06..f2866e1 100644 --- a/src/main/java/com/faforever/moderatorclient/ui/ViewHelper.java +++ b/src/main/java/com/faforever/moderatorclient/ui/ViewHelper.java @@ -176,7 +176,7 @@ public static void buildAvatarTableView(TableView tableView, Observabl TableColumn idColumn = new TableColumn<>("ID"); idColumn.setCellValueFactory(o -> o.getValue().idProperty()); idColumn.setComparator(Comparator.comparingInt(Integer::parseInt)); - idColumn.setMinWidth(50); + idColumn.setMinWidth(25); tableView.getColumns().add(idColumn); extractors.put(idColumn, AvatarFX::getId); @@ -188,7 +188,7 @@ public static void buildAvatarTableView(TableView tableView, Observabl TableColumn tooltipColumn = new TableColumn<>("Tooltip"); tooltipColumn.setCellValueFactory(o -> o.getValue().tooltipProperty()); - tooltipColumn.setMinWidth(50); + tooltipColumn.setMinWidth(250); tableView.getColumns().add(tooltipColumn); extractors.put(tooltipColumn, AvatarFX::getTooltip); @@ -199,7 +199,7 @@ public static void buildAvatarTableView(TableView tableView, Observabl TableColumn urlColumn = new TableColumn<>("URL"); urlColumn.setCellValueFactory(o -> o.getValue().urlProperty()); - urlColumn.setMinWidth(50); + urlColumn.setMinWidth(500); tableView.getColumns().add(urlColumn); extractors.put(urlColumn, AvatarFX::getUrl); @@ -221,7 +221,7 @@ public static void bindMapTreeViewToImageView(TreeTableView }); } - public static void buildAvatarAssignmentTableView(TableView tableView, ObservableList data) { + public static void buildAvatarAssignmentTableView(TableView tableView, ObservableList data, @Nullable Consumer onRemove) { tableView.setItems(data); HashMap, Function> extractors = new HashMap<>(); @@ -265,6 +265,27 @@ public static void buildAvatarAssignmentTableView(TableView assignedAtColumn.setMinWidth(180); tableView.getColumns().add(assignedAtColumn); + TableColumn removeColumn = new TableColumn<>("Remove"); + removeColumn.setMinWidth(90); + removeColumn.setCellValueFactory(param -> new SimpleObjectProperty<>(param.getValue())); + removeColumn.setCellFactory(param -> new TableCell() { + + @Override + protected void updateItem(AvatarAssignmentFX item, boolean empty) { + super.updateItem(item, empty); + if (!empty) { + Button button = new Button("Remove"); + button.setOnMouseClicked(event -> onRemove.accept(item)); + button.setTextFill(Color.rgb(200, 10, 10)); + + setGraphic(button); + return; + } + setGraphic(null); + } + }); + tableView.getColumns().add(removeColumn); + applyCopyContextMenus(tableView, extractors); } diff --git a/src/main/java/com/faforever/moderatorclient/ui/data_cells/UrlImageViewTableCell.java b/src/main/java/com/faforever/moderatorclient/ui/data_cells/UrlImageViewTableCell.java index acbfbbc..40a9ca1 100644 --- a/src/main/java/com/faforever/moderatorclient/ui/data_cells/UrlImageViewTableCell.java +++ b/src/main/java/com/faforever/moderatorclient/ui/data_cells/UrlImageViewTableCell.java @@ -3,6 +3,8 @@ import com.faforever.moderatorclient.ui.caches.AvatarCache; import com.faforever.moderatorclient.ui.domain.AvatarAssignmentFX; import com.faforever.moderatorclient.ui.domain.AvatarFX; +import javafx.application.Platform; +import javafx.concurrent.Task; import javafx.scene.control.TableCell; import javafx.scene.image.Image; import javafx.scene.image.ImageView; @@ -18,27 +20,44 @@ public class UrlImageViewTableCell extends TableCell { protected void updateItem(String item, boolean empty) { super.updateItem(item, empty); - if (item != null) { - if (!Objects.equals(currentUrl, item)) { - currentUrl = item; - Image img; - if (getTableRow() != null && getTableRow().getItem() != null) { - String cacheKey = cacheKeyFrom(item, getTableRow().getItem()); - if (AvatarCache.getInstance().containsKey(cacheKey)) { - img = AvatarCache.getInstance().get(cacheKey); - } else { - img = new Image(item, true); - AvatarCache.getInstance().put(cacheKey, img); + + if (item == null) return; + Task task = new Task() { + @Override + protected Void call() throws Exception { + if (item != null) { + if (!Objects.equals(currentUrl, item)) { + currentUrl = item; + Image img; + if (getTableRow() != null && getTableRow().getItem() != null) { + String cacheKey = cacheKeyFrom(item, getTableRow().getItem()); + if (AvatarCache.getInstance().containsKey(cacheKey)) { + img = AvatarCache.getInstance().get(cacheKey); + } else { + img = new Image(item, true); + AvatarCache.getInstance().put(cacheKey, img); + } + } else { + img = new Image(item); + } + imageView.setImage(img); } + Platform.runLater(() -> { + if (Objects.equals(currentUrl, item)) { + setGraphic(imageView); + } + + }); + } else { - img = new Image(item); + setGraphic(null); } - imageView.setImage(img); + return null; } - setGraphic(imageView); - } else { - setGraphic(null); - } + }; + + new Thread(task).start(); + } private String cacheKeyFrom(String item, Object rawData) { diff --git a/src/main/java/com/faforever/moderatorclient/ui/data_cells/UrlImageViewTableCellSync.java b/src/main/java/com/faforever/moderatorclient/ui/data_cells/UrlImageViewTableCellSync.java new file mode 100644 index 0000000..aea6af7 --- /dev/null +++ b/src/main/java/com/faforever/moderatorclient/ui/data_cells/UrlImageViewTableCellSync.java @@ -0,0 +1,57 @@ +package com.faforever.moderatorclient.ui.data_cells; + +import com.faforever.moderatorclient.ui.caches.AvatarCache; +import com.faforever.moderatorclient.ui.domain.AvatarAssignmentFX; +import com.faforever.moderatorclient.ui.domain.AvatarFX; +import javafx.scene.control.TableCell; +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; + +import java.time.OffsetDateTime; +import java.util.Objects; + +public class UrlImageViewTableCellSync extends TableCell { + private ImageView imageView = new ImageView(); + private String currentUrl; + + @Override + protected void updateItem(String item, boolean empty) { + super.updateItem(item, empty); + + if (item != null) { + if (!Objects.equals(currentUrl, item)) { + currentUrl = item; + Image img; + if (getTableRow() != null && getTableRow().getItem() != null) { + String cacheKey = cacheKeyFrom(item, getTableRow().getItem()); + if (AvatarCache.getInstance().containsKey(cacheKey)) { + img = AvatarCache.getInstance().get(cacheKey); + } else { + img = new Image(item, true); + AvatarCache.getInstance().put(cacheKey, img); + } + } else { + img = new Image(item); + } + imageView.setImage(img); + } + + setGraphic(imageView); + + + } else { + setGraphic(null); + } + + } + + private String cacheKeyFrom(String item, Object rawData) { + OffsetDateTime updateTime = null; + if (rawData instanceof AvatarFX) { + updateTime = ((AvatarFX)rawData).getUpdateTime(); + } else if (rawData instanceof AvatarAssignmentFX) { + updateTime = ((AvatarAssignmentFX)rawData).getUpdateTime(); + } + return updateTime != null ? item+updateTime.toString() : item; + } +} \ No newline at end of file diff --git a/src/main/java/com/faforever/moderatorclient/ui/main_window/AvatarsController.java b/src/main/java/com/faforever/moderatorclient/ui/main_window/AvatarsController.java index e9762a6..5eeb51e 100644 --- a/src/main/java/com/faforever/moderatorclient/ui/main_window/AvatarsController.java +++ b/src/main/java/com/faforever/moderatorclient/ui/main_window/AvatarsController.java @@ -11,6 +11,7 @@ import com.faforever.moderatorclient.ui.domain.AvatarFX; import javafx.collections.FXCollections; import javafx.collections.ObservableList; +import javafx.concurrent.Task; import javafx.fxml.FXML; import javafx.scene.Scene; import javafx.scene.control.*; @@ -23,6 +24,7 @@ import java.util.List; import java.util.Optional; +import java.util.concurrent.ExecutionException; @Slf4j @Component @@ -55,14 +57,16 @@ public SplitPane getRoot() { @FXML public void initialize() { ViewHelper.buildAvatarTableView(avatarTableView, avatars); - ViewHelper.buildAvatarAssignmentTableView(avatarAssignmentTableView, avatarAssignments); + ViewHelper.buildAvatarAssignmentTableView(avatarAssignmentTableView, avatarAssignments, this::removeAvatarFromPlayer); editAvatarButton.disableProperty().bind(avatarTableView.getSelectionModel().selectedItemProperty().isNull()); deleteAvatarButton.disableProperty().bind(avatarTableView.getSelectionModel().selectedItemProperty().isNull()); avatarTableView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { avatarAssignments.clear(); - Optional.ofNullable(newValue).ifPresent(avatar -> avatarAssignments.addAll(avatar.getAssignments())); + Optional.ofNullable(newValue).ifPresent(avatar -> { + avatarAssignments.addAll(avatar.getAssignments()); + }); if (newValue != null) { applicationEventPublisher.publishEvent(newValue); @@ -70,11 +74,34 @@ public void initialize() { }); } + private void removeAvatarFromPlayer(AvatarAssignmentFX a) { + AvatarAssignmentFX avatarAssignmentFX = a; + Assert.notNull(avatarAssignmentFX, "You need to select a user's avatar."); + + avatarService.removeAvatarAssignment(avatarAssignmentFX); + avatarAssignmentTableView.getItems().remove(avatarAssignmentFX); + avatarAssignmentFX.getPlayer().getAvatarAssignments().remove(avatarAssignmentFX); + avatarAssignmentFX.getAvatar().setAssignments(avatarAssignmentTableView.getItems()); + avatarAssignmentTableView.refresh(); + refresh(); + Optional.ofNullable(a.getAvatar()).ifPresent(avatar -> avatarAssignments.addAll(a.getAvatar().getAssignments())); + } + public void refresh() { + System.out.println("refeshing"); avatars.clear(); - avatars.addAll(avatarMapper.map(avatarService.getAll())); + avatarAssignments.clear(); + Task task = new Task() { + @Override + protected Void call() throws Exception { + avatars.addAll(avatarMapper.map(avatarService.getAll().get())); - avatarTableView.getSortOrder().clear(); + avatarTableView.getSortOrder().clear(); + return null; + + } + }; + new Thread(task).start(); } @@ -89,7 +116,7 @@ private void openAvatarDialog(AvatarFX avatarFX, boolean isNew) { refresh(); } - public void onSearchAvatars() { + public void onSearchAvatars() throws ExecutionException, InterruptedException { avatars.clear(); avatarTableView.getSortOrder().clear(); @@ -101,9 +128,9 @@ public void onSearchAvatars() { } else if (searchAvatarsByTooltipRadioButton.isSelected()) { avatarSearchResult = avatarService.findAvatarsByTooltip(pattern); } else if (searchAvatarsByAssignedUserRadioButton.isSelected()) { - avatarSearchResult = avatarService.findAvatarsByAssignedUser(pattern); + avatarSearchResult = avatarService.findAvatarsByAssignedUser(pattern).get(); } else { - avatarSearchResult = avatarService.getAll(); + avatarSearchResult = avatarService.getAll().get(); } avatars.addAll(avatarMapper.map(avatarSearchResult)); } diff --git a/src/main/resources/ui/main_window/avatars.fxml b/src/main/resources/ui/main_window/avatars.fxml index 008ec7b..453ed0a 100644 --- a/src/main/resources/ui/main_window/avatars.fxml +++ b/src/main/resources/ui/main_window/avatars.fxml @@ -1,93 +1,88 @@ - - - - + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - - - + - + - - - - - - + From f23e8374901d3cb2ab537d9ad5d04f8f98c730a4 Mon Sep 17 00:00:00 2001 From: main Date: Thu, 19 Oct 2023 19:31:32 -0400 Subject: [PATCH 3/4] remove client from gh --- client.log | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 client.log diff --git a/client.log b/client.log deleted file mode 100644 index 8bcc451..0000000 --- a/client.log +++ /dev/null @@ -1,18 +0,0 @@ -2023-10-19T19:15:11.180-04:00 INFO 905956 --- [JavaFX-Launcher] o.s.boot.SpringApplication : Starting application using Java 17.0.1 with PID 905956 (started by main in /home/main/IdeaProjects/faf-moderator-client) -2023-10-19T19:15:11.182-04:00 INFO 905956 --- [JavaFX-Launcher] o.s.boot.SpringApplication : No active profile set, falling back to 1 default profile: "default" -2023-10-19T19:15:11.894-04:00 INFO 905956 --- [JavaFX-Launcher] f.a.AutowiredAnnotationBeanPostProcessor : Autowired annotation is not supported on static fields: private static com.faforever.moderatorclient.ui.caches.LargeThumbnailCache com.faforever.moderatorclient.ui.ViewHelper.largeThumbnailCache -2023-10-19T19:15:12.094-04:00 INFO 905956 --- [JavaFX-Launcher] o.s.boot.SpringApplication : Started application in 1.377 seconds (process running for 1.949) -2023-10-19T19:15:30.820-04:00 DEBUG 905956 --- [JavaFX Application Thread] c.f.moderatorclient.api.TokenService : Token still valid for 3599 seconds -2023-10-19T19:15:31.177-04:00 DEBUG 905956 --- [ForkJoinPool.commonPool-worker-3] c.f.m.api.FafApiCommunicationService : Sending API request: /data/featuredMod?page[size]=10000&page[number]=1 -2023-10-19T19:15:31.179-04:00 DEBUG 905956 --- [ForkJoinPool.commonPool-worker-3] c.f.moderatorclient.api.TokenService : Token still valid for 3599 seconds -2023-10-19T19:15:31.215-04:00 DEBUG 905956 --- [JavaFX Application Thread] c.f.m.api.domain.MapService : Searching for all matchmaker queues -2023-10-19T19:15:31.215-04:00 DEBUG 905956 --- [JavaFX Application Thread] c.f.m.api.FafApiCommunicationService : Sending API request: /data/matchmakerQueue?page[size]=10000&page[number]=1 -2023-10-19T19:15:31.216-04:00 DEBUG 905956 --- [JavaFX Application Thread] c.f.moderatorclient.api.TokenService : Token still valid for 3599 seconds -2023-10-19T19:15:31.351-04:00 DEBUG 905956 --- [JavaFX Application Thread] c.f.m.api.domain.MapService : found 5 matchmaker queues -2023-10-19T19:15:32.149-04:00 DEBUG 905956 --- [ForkJoinPool.commonPool-worker-3] c.f.m.api.FafApiCommunicationService : Sending API request: /data/banInfo?include=player,author,revokeAuthor&sort=-createTime&page[size]=100&page[number]=1 -2023-10-19T19:15:32.151-04:00 DEBUG 905956 --- [ForkJoinPool.commonPool-worker-3] c.f.moderatorclient.api.TokenService : Token still valid for 3598 seconds -2023-10-19T19:15:38.230-04:00 DEBUG 905956 --- [ForkJoinPool.commonPool-worker-3] c.f.m.api.domain.AvatarService : Retrieving all avatars -2023-10-19T19:15:38.230-04:00 DEBUG 905956 --- [ForkJoinPool.commonPool-worker-3] c.f.m.api.FafApiCommunicationService : Sending API request: /data/avatar?include=assignments,assignments.player&page[size]=10000&page[number]=1 -2023-10-19T19:15:38.231-04:00 DEBUG 905956 --- [ForkJoinPool.commonPool-worker-3] c.f.moderatorclient.api.TokenService : Token still valid for 3592 seconds -2023-10-19T19:17:35.594-04:00 DEBUG 905956 --- [ForkJoinPool.commonPool-worker-15] c.f.m.api.FafApiCommunicationService : Sending API request: /data/banInfo?include=player,author,revokeAuthor&sort=-createTime&page[size]=100&page[number]=1 -2023-10-19T19:17:35.595-04:00 DEBUG 905956 --- [ForkJoinPool.commonPool-worker-15] c.f.moderatorclient.api.TokenService : Token still valid for 3475 seconds From f23cdc0c2b875da5fd4d834bb70fafc9a7ffc0f1 Mon Sep 17 00:00:00 2001 From: main Date: Thu, 19 Oct 2023 19:42:48 -0400 Subject: [PATCH 4/4] remove log file --- spring.log | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 spring.log diff --git a/spring.log b/spring.log deleted file mode 100644 index b90d51b..0000000 --- a/spring.log +++ /dev/null @@ -1,13 +0,0 @@ -2023-10-18T20:09:06.941-04:00 INFO 498248 --- [JavaFX-Launcher] o.s.boot.SpringApplication : Starting application using Java 17.0.1 with PID 498248 (started by main in /home/main/IdeaProjects/faf-moderator-client) -2023-10-18T20:09:06.943-04:00 INFO 498248 --- [JavaFX-Launcher] o.s.boot.SpringApplication : No active profile set, falling back to 1 default profile: "default" -2023-10-18T20:09:07.845-04:00 INFO 498248 --- [JavaFX-Launcher] f.a.AutowiredAnnotationBeanPostProcessor : Autowired annotation is not supported on static fields: private static com.faforever.moderatorclient.ui.caches.LargeThumbnailCache com.faforever.moderatorclient.ui.ViewHelper.largeThumbnailCache -2023-10-18T20:09:08.089-04:00 INFO 498248 --- [JavaFX-Launcher] o.s.boot.SpringApplication : Started application in 1.708 seconds (process running for 2.374) -2023-10-18T20:10:11.462-04:00 DEBUG 498248 --- [JavaFX Application Thread] c.f.moderatorclient.api.TokenService : Token still valid for 3598 seconds -2023-10-18T20:10:11.938-04:00 DEBUG 498248 --- [ForkJoinPool.commonPool-worker-15] c.f.m.api.FafApiCommunicationService : Sending API request: /data/featuredMod?page[size]=10000&page[number]=1 -2023-10-18T20:10:11.940-04:00 DEBUG 498248 --- [ForkJoinPool.commonPool-worker-15] c.f.moderatorclient.api.TokenService : Token still valid for 3598 seconds -2023-10-18T20:10:11.979-04:00 DEBUG 498248 --- [JavaFX Application Thread] c.f.m.api.domain.MapService : Searching for all matchmaker queues -2023-10-18T20:10:11.980-04:00 DEBUG 498248 --- [JavaFX Application Thread] c.f.m.api.FafApiCommunicationService : Sending API request: /data/matchmakerQueue?page[size]=10000&page[number]=1 -2023-10-18T20:10:11.981-04:00 DEBUG 498248 --- [JavaFX Application Thread] c.f.moderatorclient.api.TokenService : Token still valid for 3598 seconds -2023-10-18T20:10:12.289-04:00 DEBUG 498248 --- [JavaFX Application Thread] c.f.m.api.domain.MapService : found 5 matchmaker queues -2023-10-18T20:10:13.838-04:00 DEBUG 498248 --- [ForkJoinPool.commonPool-worker-15] c.f.m.api.FafApiCommunicationService : Sending API request: /data/banInfo?include=player,author,revokeAuthor&sort=-createTime&page[size]=100&page[number]=1 -2023-10-18T20:10:13.839-04:00 DEBUG 498248 --- [ForkJoinPool.commonPool-worker-15] c.f.moderatorclient.api.TokenService : Token still valid for 3596 seconds