Add error label to thumb overview in case the scheduled service fails

This commit is contained in:
0xb00bface 2021-09-03 11:09:36 +02:00
parent e0f3d26ea1
commit e5468f6849
1 changed files with 8 additions and 3 deletions

View File

@ -114,6 +114,7 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
private final SimpleBooleanProperty preserveAspectRatio = new SimpleBooleanProperty(true);
ProgressIndicator progressIndicator;
Label noResultsFound = new Label("Nothing found!");
Label errorLabel = new Label("");
private ComboBox<Integer> thumbWidth;
@ -355,8 +356,7 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
gridLock.lock();
try {
ObservableList<Node> nodes = grid.getChildren();
nodes.remove(progressIndicator);
nodes.remove(noResultsFound);
nodes.removeAll(progressIndicator, noResultsFound, errorLabel);
// first remove models, which are not in the updated list
removeModelsMissingInUpdate(nodes, models);
@ -626,12 +626,17 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
if (event.getSource().getException() != null) {
if (event.getSource().getException() instanceof SocketTimeoutException) {
LOG.debug("Fetching model list timed out");
errorLabel.setText("Timeout while updating");
} else {
LOG.error("Couldn't update model list", event.getSource().getException());
errorLabel.setText("Error while updating " + event.getSource().getException().getLocalizedMessage());
}
} else {
LOG.error("Couldn't update model list {}", event.getEventType());
errorLabel.setText("Couldn't update model list " + event.getEventType());
}
grid.getChildren().removeAll(progressIndicator, noResultsFound, errorLabel);
grid.getChildren().add(errorLabel);
}
void filter() {
@ -779,7 +784,7 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
@Override
public void selected() {
grid.getChildren().remove(noResultsFound);
grid.getChildren().removeAll(noResultsFound, errorLabel);
if (grid.getChildren().isEmpty()) {
grid.getChildren().add(progressIndicator);
}