From 6983d9d72dfed2174fa54eb761fe88805ad02232 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 24 Nov 2022 10:12:59 +0100 Subject: [PATCH 01/16] Remove cryptolib dependency, bump cryptofs --- pom.xml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 725e3d7c2..221261a27 100644 --- a/pom.xml +++ b/pom.xml @@ -27,8 +27,7 @@ com.github.serceman,com.github.jnr,org.ow2.asm,net.java.dev.jna,org.apache.jackrabbit,org.apache.httpcomponents,de.swiesend,org.purejava,com.github.hypfvieh - 2.1.0-rc1 - 2.4.5 + 2.5.0 1.1.0 1.1.2 1.1.2 @@ -64,11 +63,6 @@ - - org.cryptomator - cryptolib - ${cryptomator.cryptolib.version} - org.cryptomator cryptofs From d896fe21b58927b7efe8b58f18f5852319cb014f Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 24 Nov 2022 10:13:37 +0100 Subject: [PATCH 02/16] adapt result fixing to new api --- .../java/org/cryptomator/ui/health/CheckExecutor.java | 2 +- src/main/java/org/cryptomator/ui/health/Result.java | 8 ++++++-- .../java/org/cryptomator/ui/health/ResultFixApplier.java | 5 +++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/cryptomator/ui/health/CheckExecutor.java b/src/main/java/org/cryptomator/ui/health/CheckExecutor.java index a9ee9a17f..c347f38cb 100644 --- a/src/main/java/org/cryptomator/ui/health/CheckExecutor.java +++ b/src/main/java/org/cryptomator/ui/health/CheckExecutor.java @@ -70,7 +70,7 @@ public class CheckExecutor { try (var masterkeyClone = masterkey.copy(); // var cryptor = CryptorProvider.forScheme(vaultConfig.getCipherCombo()).provide(masterkeyClone, csprng)) { c.getHealthCheck().check(vaultPath, vaultConfig, masterkeyClone, cryptor, diagnosis -> { - Platform.runLater(() -> c.getResults().add(Result.create(diagnosis))); + Platform.runLater(() -> c.getResults().add(Result.create(diagnosis, vaultPath, vaultConfig, masterkeyClone, cryptor))); highestResultSeverity = Comparators.max(highestResultSeverity, diagnosis.getSeverity()); }); } diff --git a/src/main/java/org/cryptomator/ui/health/Result.java b/src/main/java/org/cryptomator/ui/health/Result.java index 8327a1130..d8a18b890 100644 --- a/src/main/java/org/cryptomator/ui/health/Result.java +++ b/src/main/java/org/cryptomator/ui/health/Result.java @@ -1,10 +1,14 @@ package org.cryptomator.ui.health; +import org.cryptomator.cryptofs.VaultConfig; import org.cryptomator.cryptofs.health.api.DiagnosticResult; +import org.cryptomator.cryptolib.api.Cryptor; +import org.cryptomator.cryptolib.api.Masterkey; import javafx.beans.Observable; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; +import java.nio.file.Path; record Result(DiagnosticResult diagnosis, ObjectProperty fixState) { @@ -16,8 +20,8 @@ record Result(DiagnosticResult diagnosis, ObjectProperty fixState) { FIX_FAILED } - public static Result create(DiagnosticResult diagnosis) { - FixState initialState = diagnosis.getSeverity() == DiagnosticResult.Severity.WARN ? FixState.FIXABLE : FixState.NOT_FIXABLE; + public static Result create(DiagnosticResult diagnosis, Path vaultPath, VaultConfig config, Masterkey masterkey, Cryptor cryptor) { + FixState initialState = diagnosis.getFix(vaultPath, config, masterkey, cryptor).isPresent()? FixState.FIXABLE : FixState.NOT_FIXABLE; return new Result(diagnosis, new SimpleObjectProperty<>(initialState)); } diff --git a/src/main/java/org/cryptomator/ui/health/ResultFixApplier.java b/src/main/java/org/cryptomator/ui/health/ResultFixApplier.java index 3dc91e33b..4a71730a0 100644 --- a/src/main/java/org/cryptomator/ui/health/ResultFixApplier.java +++ b/src/main/java/org/cryptomator/ui/health/ResultFixApplier.java @@ -49,10 +49,11 @@ class ResultFixApplier { } public void fix(DiagnosticResult diagnosis) { - Preconditions.checkArgument(diagnosis.getSeverity() == DiagnosticResult.Severity.WARN, "Unfixable result"); try (var masterkeyClone = masterkey.copy(); // var cryptor = CryptorProvider.forScheme(vaultConfig.getCipherCombo()).provide(masterkeyClone, csprng)) { - diagnosis.fix(vaultPath, vaultConfig, masterkeyClone, cryptor); + diagnosis.getFix(vaultPath, vaultConfig, masterkeyClone, cryptor) + .orElseThrow(() -> new IllegalStateException("No fix for diagnosis "+diagnosis.getClass().getName() +" implemented.")) + .apply(); } catch (Exception e) { throw new FixFailedException(e); } From 74e3c284412d836742b209b1d5bccc3ea76a454b Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 25 Nov 2022 16:54:21 +0100 Subject: [PATCH 03/16] bump cryptofs --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 221261a27..911d0e2e1 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ com.github.serceman,com.github.jnr,org.ow2.asm,net.java.dev.jna,org.apache.jackrabbit,org.apache.httpcomponents,de.swiesend,org.purejava,com.github.hypfvieh - 2.5.0 + 2.5.1 1.1.0 1.1.2 1.1.2 From 4dc1d59305ae972e9f708c5f88c441460e78bb0b Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 25 Nov 2022 17:17:55 +0100 Subject: [PATCH 04/16] Implement fix all button --- .../ui/health/CheckDetailController.java | 38 ++++++++++++++-- .../ui/health/ResultFixApplier.java | 24 ++++++++--- .../ui/health/ResultListCellController.java | 31 ++++++------- .../resources/fxml/health_check_details.fxml | 43 ++++++++++++------- src/main/resources/i18n/strings.properties | 1 + 5 files changed, 95 insertions(+), 42 deletions(-) diff --git a/src/main/java/org/cryptomator/ui/health/CheckDetailController.java b/src/main/java/org/cryptomator/ui/health/CheckDetailController.java index c467a5328..83cb4ea7d 100644 --- a/src/main/java/org/cryptomator/ui/health/CheckDetailController.java +++ b/src/main/java/org/cryptomator/ui/health/CheckDetailController.java @@ -8,8 +8,12 @@ import org.cryptomator.ui.common.FxController; import javax.inject.Inject; import javafx.beans.binding.Binding; +import javafx.beans.binding.Bindings; +import javafx.beans.binding.BooleanBinding; import javafx.beans.binding.BooleanExpression; +import javafx.beans.property.BooleanProperty; import javafx.beans.property.ObjectProperty; +import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; import javafx.fxml.FXML; @@ -35,30 +39,42 @@ public class CheckDetailController implements FxController { private final Binding countOfCritSeverity; private final Binding warnOrCritsExist; private final ResultListCellFactory resultListCellFactory; + private final ResultFixApplier resultFixApplier; + + private final BooleanProperty fixAllInfoResultsExecuted; + private final BooleanBinding fixAllInfoResultsPossible; public ListView resultsListView; private Subscription resultSubscription; @Inject - public CheckDetailController(ObjectProperty selectedTask, ResultListCellFactory resultListCellFactory) { + public CheckDetailController(ObjectProperty selectedTask, ResultListCellFactory resultListCellFactory, ResultFixApplier resultFixApplier) { this.resultListCellFactory = resultListCellFactory; + this.resultFixApplier = resultFixApplier; this.results = EasyBind.wrapList(FXCollections.observableArrayList()); this.check = selectedTask; this.checkState = selectedTask.flatMap(Check::stateProperty); this.checkName = selectedTask.map(Check::getName).orElse(""); this.checkRunning = BooleanExpression.booleanExpression(checkState.map(Check.CheckState.RUNNING::equals).orElse(false)); this.checkScheduled = BooleanExpression.booleanExpression(checkState.map(Check.CheckState.SCHEDULED::equals).orElse(false)); - this.checkSkipped =BooleanExpression.booleanExpression(checkState.map(Check.CheckState.SKIPPED::equals).orElse(false)); + this.checkSkipped = BooleanExpression.booleanExpression(checkState.map(Check.CheckState.SKIPPED::equals).orElse(false)); this.checkSucceeded = BooleanExpression.booleanExpression(checkState.map(Check.CheckState.SUCCEEDED::equals).orElse(false)); this.checkFailed = BooleanExpression.booleanExpression(checkState.map(Check.CheckState.ERROR::equals).orElse(false)); this.checkCancelled = BooleanExpression.booleanExpression(checkState.map(Check.CheckState.CANCELLED::equals).orElse(false)); this.checkFinished = checkSucceeded.or(checkFailed).or(checkCancelled); this.countOfWarnSeverity = results.reduce(countSeverity(DiagnosticResult.Severity.WARN)); this.countOfCritSeverity = results.reduce(countSeverity(DiagnosticResult.Severity.CRITICAL)); - this.warnOrCritsExist = EasyBind.combine(checkSucceeded, countOfWarnSeverity, countOfCritSeverity, (suceeded, warns, crits) -> suceeded && (warns.longValue() > 0 || crits.longValue() > 0) ); + this.warnOrCritsExist = EasyBind.combine(checkSucceeded, countOfWarnSeverity, countOfCritSeverity, (suceeded, warns, crits) -> suceeded && (warns.longValue() > 0 || crits.longValue() > 0)); + this.fixAllInfoResultsExecuted = new SimpleBooleanProperty(false); + this.fixAllInfoResultsPossible = Bindings.createBooleanBinding(() -> results.stream().anyMatch(this::isFixableInfoResult), results) // + .and(fixAllInfoResultsExecuted.not()); selectedTask.addListener(this::selectedTaskChanged); } + private boolean isFixableInfoResult(Result r) { + return r.diagnosis().getSeverity() == DiagnosticResult.Severity.INFO && r.getState() == Result.FixState.FIXABLE; + } + private void selectedTaskChanged(ObservableValue observable, Check oldValue, Check newValue) { if (resultSubscription != null) { resultSubscription.unsubscribe(); @@ -78,6 +94,13 @@ public class CheckDetailController implements FxController { resultsListView.setCellFactory(resultListCellFactory); } + @FXML + public void fixAllInfoResults() { + fixAllInfoResultsExecuted.setValue(true); + results.stream().filter(this::isFixableInfoResult).forEach(resultFixApplier::fix); + } + + /* Getter/Setter */ public String getCheckName() { @@ -175,4 +198,13 @@ public class CheckDetailController implements FxController { public Check getCheck() { return check.get(); } + + public ObservableValue fixAllInfoResultsPossibleProperty() { + return fixAllInfoResultsPossible; + } + + public boolean getFixAllInfoResultsPossible() { + return fixAllInfoResultsPossible.getValue(); + } + } diff --git a/src/main/java/org/cryptomator/ui/health/ResultFixApplier.java b/src/main/java/org/cryptomator/ui/health/ResultFixApplier.java index 4a71730a0..2654da221 100644 --- a/src/main/java/org/cryptomator/ui/health/ResultFixApplier.java +++ b/src/main/java/org/cryptomator/ui/health/ResultFixApplier.java @@ -23,6 +23,8 @@ import java.util.concurrent.atomic.AtomicReference; @HealthCheckScoped class ResultFixApplier { + private static final Logger LOG = LoggerFactory.getLogger(ResultFixApplier.class); + private final Path vaultPath; private final SecureRandom csprng; private final Masterkey masterkey; @@ -40,19 +42,26 @@ class ResultFixApplier { public CompletionStage fix(Result result) { Preconditions.checkArgument(result.getState() == Result.FixState.FIXABLE); - result.setState(Result.FixState.FIXING); - return CompletableFuture.runAsync(() -> fix(result.diagnosis()), sequentialExecutor) + return CompletableFuture.runAsync(() -> result.setState(Result.FixState.FIXING), Platform::runLater) // + .thenRunAsync(() -> fix(result.diagnosis()), sequentialExecutor) // .whenCompleteAsync((unused, throwable) -> { - var fixed = throwable == null ? Result.FixState.FIXED : Result.FixState.FIX_FAILED; - result.setState(fixed); + final Result.FixState s; + if (throwable == null) { + LOG.debug("Fix for {} applied successful.", result.diagnosis().getClass().getName()); + s = Result.FixState.FIXED; + } else { + LOG.error("Failed to apply fix for {}", result.diagnosis().getClass().getName(), throwable); + s = Result.FixState.FIX_FAILED; + } + result.setState(s); }, Platform::runLater); } - public void fix(DiagnosticResult diagnosis) { + private void fix(DiagnosticResult diagnosis) { try (var masterkeyClone = masterkey.copy(); // var cryptor = CryptorProvider.forScheme(vaultConfig.getCipherCombo()).provide(masterkeyClone, csprng)) { - diagnosis.getFix(vaultPath, vaultConfig, masterkeyClone, cryptor) - .orElseThrow(() -> new IllegalStateException("No fix for diagnosis "+diagnosis.getClass().getName() +" implemented.")) + diagnosis.getFix(vaultPath, vaultConfig, masterkeyClone, cryptor) // + .orElseThrow(() -> new IllegalStateException("No fix for diagnosis " + diagnosis.getClass().getName() + " implemented.")) // .apply(); } catch (Exception e) { throw new FixFailedException(e); @@ -60,6 +69,7 @@ class ResultFixApplier { } public static class FixFailedException extends CompletionException { + private FixFailedException(Throwable cause) { super(cause); } diff --git a/src/main/java/org/cryptomator/ui/health/ResultListCellController.java b/src/main/java/org/cryptomator/ui/health/ResultListCellController.java index d655d0058..03c225d57 100644 --- a/src/main/java/org/cryptomator/ui/health/ResultListCellController.java +++ b/src/main/java/org/cryptomator/ui/health/ResultListCellController.java @@ -12,7 +12,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.inject.Inject; -import javafx.application.Platform; import javafx.beans.binding.Bindings; import javafx.beans.binding.BooleanBinding; import javafx.beans.binding.ObjectBinding; @@ -49,8 +48,8 @@ public class ResultListCellController implements FxController { private final BooleanBinding fixFailed; private final BooleanBinding fixRunningOrDone; private final List subscriptions; - private final Tooltip fixSuccess; - private final Tooltip fixFail; + private final Tooltip fixSuccessTip; + private final Tooltip fixFailTip; private AutoAnimator fixRunningRotator; @@ -73,10 +72,10 @@ public class ResultListCellController implements FxController { this.fixFailed = Bindings.createBooleanBinding(this::isFixFailed, fixState); this.fixRunningOrDone = fixing.or(fixed).or(fixFailed); this.subscriptions = new ArrayList<>(); - this.fixSuccess = new Tooltip(resourceBundle.getString("health.fix.successTip")); - this.fixFail = new Tooltip(resourceBundle.getString("health.fix.failTip")); - fixSuccess.setShowDelay(Duration.millis(100)); - fixFail.setShowDelay(Duration.millis(100)); + this.fixSuccessTip = new Tooltip(resourceBundle.getString("health.fix.successTip")); + this.fixFailTip = new Tooltip(resourceBundle.getString("health.fix.failTip")); + fixSuccessTip.setShowDelay(Duration.millis(100)); + fixFailTip.setShowDelay(Duration.millis(100)); } @FXML @@ -93,22 +92,20 @@ public class ResultListCellController implements FxController { .onCondition(fixing) // .afterStop(() -> fixView.setRotate(0)) // .build(); + fixState.addListener(((observable, oldValue, newValue) -> { + if (newValue == Result.FixState.FIXED) { + Tooltip.install(fixView, fixSuccessTip); + } else if (newValue == Result.FixState.FIX_FAILED) { + Tooltip.install(fixView, fixFailTip); + } + })); } @FXML public void fix() { Result r = result.get(); if (r != null) { - fixApplier.fix(r).whenCompleteAsync(this::fixFinished, Platform::runLater); - } - } - - private void fixFinished(Void unused, Throwable exception) { - if (exception != null) { - LOG.error("Failed to apply fix", exception); - Tooltip.install(fixView, fixFail); - } else { - Tooltip.install(fixView, fixSuccess); + fixApplier.fix(r); } } diff --git a/src/main/resources/fxml/health_check_details.fxml b/src/main/resources/fxml/health_check_details.fxml index 6dd7d224e..d4564a852 100644 --- a/src/main/resources/fxml/health_check_details.fxml +++ b/src/main/resources/fxml/health_check_details.fxml @@ -5,25 +5,38 @@ + + + - + spacing="12"> + + + + + + - \ No newline at end of file diff --git a/src/main/resources/i18n/strings.properties b/src/main/resources/i18n/strings.properties index 460b56476..d3ae3a0e4 100644 --- a/src/main/resources/i18n/strings.properties +++ b/src/main/resources/i18n/strings.properties @@ -219,6 +219,7 @@ health.check.detail.checkFinished=The check finished successfully. health.check.detail.checkFinishedAndFound=The check finished running. Please review the results. health.check.detail.checkFailed=The check exited due to an error. health.check.detail.checkCancelled=The check was cancelled. +health.check.detail.fixAllSpecificBtn=Fix all of type health.check.exportBtn=Export Report ## Fix Application health.fix.fixBtn=Fix From 96de2556a986dc65092a8dd6103e3d6f444598b9 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Mon, 28 Nov 2022 15:00:16 +0100 Subject: [PATCH 05/16] apply correct style class on check icon --- src/main/java/org/cryptomator/ui/health/CheckStateIconView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/cryptomator/ui/health/CheckStateIconView.java b/src/main/java/org/cryptomator/ui/health/CheckStateIconView.java index 4f1a35f7a..ffb6771ea 100644 --- a/src/main/java/org/cryptomator/ui/health/CheckStateIconView.java +++ b/src/main/java/org/cryptomator/ui/health/CheckStateIconView.java @@ -31,7 +31,7 @@ public class CheckStateIconView extends FontAwesome5IconView { this.severity = EasyBind.wrapNullable(check).mapObservable(Check::highestResultSeverityProperty).asOrdinary(); this.glyph.bind(Bindings.createObjectBinding(this::glyphForState, state, severity)); this.subscriptions = List.of( // - EasyBind.includeWhen(getStyleClass(), "glyph-icon-muted", Bindings.equal(state, Check.CheckState.SKIPPED).or(Bindings.equal(state, Check.CheckState.CANCELLED))), // + EasyBind.includeWhen(getStyleClass(), "glyph-icon-muted", Bindings.equal(state, Check.CheckState.SKIPPED).or(Bindings.equal(state, Check.CheckState.CANCELLED)).or(Bindings.equal(severity, DiagnosticResult.Severity.INFO))), // EasyBind.includeWhen(getStyleClass(), "glyph-icon-primary", Bindings.equal(severity, DiagnosticResult.Severity.GOOD)), // EasyBind.includeWhen(getStyleClass(), "glyph-icon-orange", Bindings.equal(severity, DiagnosticResult.Severity.WARN).or(Bindings.equal(severity, DiagnosticResult.Severity.CRITICAL))), // EasyBind.includeWhen(getStyleClass(), "glyph-icon-red", Bindings.equal(state, Check.CheckState.ERROR)) // From 5f55530b4a5d8716b7ddeb47df71f1a224c5c9a8 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 29 Nov 2022 13:49:11 +0100 Subject: [PATCH 06/16] Add filters to results list --- .../ui/controls/FontAwesome5Icon.java | 1 + .../ui/health/CheckDetailController.java | 43 +++++++++++++++++-- .../resources/fxml/health_check_details.fxml | 18 +++++++- 3 files changed, 56 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/cryptomator/ui/controls/FontAwesome5Icon.java b/src/main/java/org/cryptomator/ui/controls/FontAwesome5Icon.java index 66eda7556..ea6ba00d3 100644 --- a/src/main/java/org/cryptomator/ui/controls/FontAwesome5Icon.java +++ b/src/main/java/org/cryptomator/ui/controls/FontAwesome5Icon.java @@ -27,6 +27,7 @@ public enum FontAwesome5Icon { FILE("\uF15B"), // FILE_IMPORT("\uF56F"), // FOLDER_OPEN("\uF07C"), // + FUNNEL("\uF0B0"), // HAND_HOLDING_HEART("\uF4BE"), // HEART("\uF004"), // HDD("\uF0A0"), // diff --git a/src/main/java/org/cryptomator/ui/health/CheckDetailController.java b/src/main/java/org/cryptomator/ui/health/CheckDetailController.java index 83cb4ea7d..8f0454fd1 100644 --- a/src/main/java/org/cryptomator/ui/health/CheckDetailController.java +++ b/src/main/java/org/cryptomator/ui/health/CheckDetailController.java @@ -14,13 +14,25 @@ import javafx.beans.binding.BooleanExpression; import javafx.beans.property.BooleanProperty; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleBooleanProperty; +import javafx.beans.property.SimpleObjectProperty; import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; import javafx.fxml.FXML; +import javafx.scene.control.ChoiceBox; import javafx.scene.control.ListView; +import javafx.util.StringConverter; +import java.util.Arrays; import java.util.function.Function; +import java.util.function.Predicate; import java.util.stream.Stream; +import static org.cryptomator.cryptofs.health.api.DiagnosticResult.Severity; +import static org.cryptomator.ui.health.Result.FixState.FIXABLE; +import static org.cryptomator.ui.health.Result.FixState.FIXED; +import static org.cryptomator.ui.health.Result.FixState.FIXING; +import static org.cryptomator.ui.health.Result.FixState.FIX_FAILED; +import static org.cryptomator.ui.health.Result.FixState.NOT_FIXABLE; + @HealthCheckScoped public class CheckDetailController implements FxController { @@ -43,8 +55,11 @@ public class CheckDetailController implements FxController { private final BooleanProperty fixAllInfoResultsExecuted; private final BooleanBinding fixAllInfoResultsPossible; + private final ObjectProperty> resultsFilter; public ListView resultsListView; + public ChoiceBox severityChoiceBox; + public ChoiceBox fixStateChoiceBox; private Subscription resultSubscription; @Inject @@ -62,17 +77,18 @@ public class CheckDetailController implements FxController { this.checkFailed = BooleanExpression.booleanExpression(checkState.map(Check.CheckState.ERROR::equals).orElse(false)); this.checkCancelled = BooleanExpression.booleanExpression(checkState.map(Check.CheckState.CANCELLED::equals).orElse(false)); this.checkFinished = checkSucceeded.or(checkFailed).or(checkCancelled); - this.countOfWarnSeverity = results.reduce(countSeverity(DiagnosticResult.Severity.WARN)); - this.countOfCritSeverity = results.reduce(countSeverity(DiagnosticResult.Severity.CRITICAL)); + this.countOfWarnSeverity = results.reduce(countSeverity(Severity.WARN)); + this.countOfCritSeverity = results.reduce(countSeverity(Severity.CRITICAL)); this.warnOrCritsExist = EasyBind.combine(checkSucceeded, countOfWarnSeverity, countOfCritSeverity, (suceeded, warns, crits) -> suceeded && (warns.longValue() > 0 || crits.longValue() > 0)); this.fixAllInfoResultsExecuted = new SimpleBooleanProperty(false); this.fixAllInfoResultsPossible = Bindings.createBooleanBinding(() -> results.stream().anyMatch(this::isFixableInfoResult), results) // .and(fixAllInfoResultsExecuted.not()); + this.resultsFilter = new SimpleObjectProperty<>(r -> true); selectedTask.addListener(this::selectedTaskChanged); } private boolean isFixableInfoResult(Result r) { - return r.diagnosis().getSeverity() == DiagnosticResult.Severity.INFO && r.getState() == Result.FixState.FIXABLE; + return r.diagnosis().getSeverity() == Severity.INFO && r.getState() == FIXABLE; } private void selectedTaskChanged(ObservableValue observable, Check oldValue, Check newValue) { @@ -82,6 +98,8 @@ public class CheckDetailController implements FxController { if (newValue != null) { resultSubscription = EasyBind.bindContent(results, newValue.getResults()); } + severityChoiceBox.setValue(null); + fixStateChoiceBox.setValue(null); } private Function, Long> countSeverity(DiagnosticResult.Severity severity) { @@ -90,8 +108,25 @@ public class CheckDetailController implements FxController { @FXML public void initialize() { - resultsListView.setItems(results); + resultsListView.setItems(results.filtered(resultsFilter)); resultsListView.setCellFactory(resultListCellFactory); + + severityChoiceBox.getItems().add(null); + severityChoiceBox.getItems().addAll(Arrays.stream(DiagnosticResult.Severity.values()).toList()); + //severityFilter.setConverter(new SeverityStringifier()); + severityChoiceBox.setValue(null); + + fixStateChoiceBox.getItems().add(null); + fixStateChoiceBox.getItems().addAll(Arrays.stream(Result.FixState.values()).toList()); + fixStateChoiceBox.setValue(null); + + resultsFilter.bind(Bindings.createObjectBinding(() -> this::filterResults, severityChoiceBox.valueProperty(), fixStateChoiceBox.valueProperty())); + } + + private boolean filterResults(Result r) { + var desiredFixState = fixStateChoiceBox.getValue(); + var desiredSeverity = severityChoiceBox.getValue(); + return (desiredFixState == null || r.getState() == desiredFixState) && (desiredSeverity == null || r.diagnosis().getSeverity() == desiredSeverity); } @FXML diff --git a/src/main/resources/fxml/health_check_details.fxml b/src/main/resources/fxml/health_check_details.fxml index d4564a852..03b5a4dfa 100644 --- a/src/main/resources/fxml/health_check_details.fxml +++ b/src/main/resources/fxml/health_check_details.fxml @@ -8,6 +8,7 @@ + - - + + + + + + + \ No newline at end of file From 9cec45dc1f669fff1c357eec20dcaa6455ff1969 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 29 Nov 2022 14:18:43 +0100 Subject: [PATCH 07/16] Add context menu to copy single result info --- .../cryptomator/ui/health/CheckDetailController.java | 12 ++++++++++++ src/main/resources/fxml/health_check_details.fxml | 12 +++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/cryptomator/ui/health/CheckDetailController.java b/src/main/java/org/cryptomator/ui/health/CheckDetailController.java index 8f0454fd1..9ce582882 100644 --- a/src/main/java/org/cryptomator/ui/health/CheckDetailController.java +++ b/src/main/java/org/cryptomator/ui/health/CheckDetailController.java @@ -20,6 +20,8 @@ import javafx.collections.FXCollections; import javafx.fxml.FXML; import javafx.scene.control.ChoiceBox; import javafx.scene.control.ListView; +import javafx.scene.input.Clipboard; +import javafx.scene.input.ClipboardContent; import javafx.util.StringConverter; import java.util.Arrays; import java.util.function.Function; @@ -136,6 +138,16 @@ public class CheckDetailController implements FxController { } + @FXML + public void copyResultDetails() { + var result = resultsListView.getSelectionModel().getSelectedItem(); + if (result != null) { + ClipboardContent clipboardContent = new ClipboardContent(); + clipboardContent.putString(result.diagnosis().toString()); + Clipboard.getSystemClipboard().setContent(clipboardContent); + } + } + /* Getter/Setter */ public String getCheckName() { diff --git a/src/main/resources/fxml/health_check_details.fxml b/src/main/resources/fxml/health_check_details.fxml index 03b5a4dfa..41ccc4641 100644 --- a/src/main/resources/fxml/health_check_details.fxml +++ b/src/main/resources/fxml/health_check_details.fxml @@ -9,6 +9,8 @@ + + - + + + + + + + + + \ No newline at end of file From 65e1993b438d827ba97f6566a1b0628edfd163d1 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 30 Nov 2022 13:35:06 +0100 Subject: [PATCH 08/16] Add tooltip to result severity icon --- .../ui/health/ResultListCellController.java | 43 ++++++++++++++----- src/main/resources/i18n/strings.properties | 5 +++ 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/cryptomator/ui/health/ResultListCellController.java b/src/main/java/org/cryptomator/ui/health/ResultListCellController.java index 03c225d57..7debc4207 100644 --- a/src/main/java/org/cryptomator/ui/health/ResultListCellController.java +++ b/src/main/java/org/cryptomator/ui/health/ResultListCellController.java @@ -48,10 +48,10 @@ public class ResultListCellController implements FxController { private final BooleanBinding fixFailed; private final BooleanBinding fixRunningOrDone; private final List subscriptions; - private final Tooltip fixSuccessTip; - private final Tooltip fixFailTip; - + private final Tooltip fixStateTip; + private final Tooltip severityTip; private AutoAnimator fixRunningRotator; + private final ResourceBundle resourceBundle; /* FXML */ public FontAwesome5IconView severityView; @@ -59,6 +59,7 @@ public class ResultListCellController implements FxController { @Inject public ResultListCellController(ResultFixApplier fixApplier, ResourceBundle resourceBundle) { + this.resourceBundle = resourceBundle; this.result = new SimpleObjectProperty<>(null); this.severity = result.map(Result::diagnosis).map(DiagnosticResult::getSeverity); this.description = result.map(Result::getDescription).orElse(""); @@ -72,10 +73,31 @@ public class ResultListCellController implements FxController { this.fixFailed = Bindings.createBooleanBinding(this::isFixFailed, fixState); this.fixRunningOrDone = fixing.or(fixed).or(fixFailed); this.subscriptions = new ArrayList<>(); - this.fixSuccessTip = new Tooltip(resourceBundle.getString("health.fix.successTip")); - this.fixFailTip = new Tooltip(resourceBundle.getString("health.fix.failTip")); - fixSuccessTip.setShowDelay(Duration.millis(100)); - fixFailTip.setShowDelay(Duration.millis(100)); + + this.fixStateTip = new Tooltip(); + fixStateTip.textProperty().bind(fixState.map(this::getFixStateDescription)); + fixStateTip.setShowDelay(Duration.millis(100)); + + this.severityTip = new Tooltip(); + severityTip.textProperty().bind(severity.map(this::getSeverityDescription)); + severityTip.setShowDelay(Duration.millis(150)); + } + + private String getFixStateDescription(Result.FixState fixState) { + return switch (fixState) { + case FIXED -> resourceBundle.getString("health.fix.successTip"); + case FIX_FAILED -> resourceBundle.getString("health.fix.failTip"); + default -> ""; + }; + } + + private String getSeverityDescription(DiagnosticResult.Severity severity) { + return resourceBundle.getString(switch (severity) { + case GOOD -> "health.result.severityTip.good"; + case INFO -> "health.result.severityTip.info"; + case WARN -> "health.result.severityTip.warn"; + case CRITICAL -> "health.result.severityTip.critical"; + }); } @FXML @@ -93,12 +115,11 @@ public class ResultListCellController implements FxController { .afterStop(() -> fixView.setRotate(0)) // .build(); fixState.addListener(((observable, oldValue, newValue) -> { - if (newValue == Result.FixState.FIXED) { - Tooltip.install(fixView, fixSuccessTip); - } else if (newValue == Result.FixState.FIX_FAILED) { - Tooltip.install(fixView, fixFailTip); + if (newValue == Result.FixState.FIXED || newValue == Result.FixState.FIX_FAILED) { + Tooltip.install(fixView, fixStateTip); } })); + Tooltip.install(severityView, severityTip); } @FXML diff --git a/src/main/resources/i18n/strings.properties b/src/main/resources/i18n/strings.properties index d3ae3a0e4..32ef07983 100644 --- a/src/main/resources/i18n/strings.properties +++ b/src/main/resources/i18n/strings.properties @@ -221,6 +221,11 @@ health.check.detail.checkFailed=The check exited due to an error. health.check.detail.checkCancelled=The check was cancelled. health.check.detail.fixAllSpecificBtn=Fix all of type health.check.exportBtn=Export Report +## Result view +health.result.severityTip.good=Vault structure intact. +health.result.severityTip.info=Vault structure intact, fix suggested. +health.result.severityTip.warn=Vault structure corrupted, fix highly advised. +health.result.severityTip.critical=Vault structure corrupted, data loss determined. ## Fix Application health.fix.fixBtn=Fix health.fix.successTip=Fix successful From 7bac78bc5d628b68a1d0d8724e659a7dff9a60d2 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 30 Nov 2022 13:48:08 +0100 Subject: [PATCH 09/16] Center Filters and let result list grow to bottom --- src/main/resources/fxml/health_check_details.fxml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/fxml/health_check_details.fxml b/src/main/resources/fxml/health_check_details.fxml index 41ccc4641..04bf1d63d 100644 --- a/src/main/resources/fxml/health_check_details.fxml +++ b/src/main/resources/fxml/health_check_details.fxml @@ -40,14 +40,14 @@ - - + + - + - diff --git a/src/main/resources/i18n/strings.properties b/src/main/resources/i18n/strings.properties index 32ef07983..fc9134381 100644 --- a/src/main/resources/i18n/strings.properties +++ b/src/main/resources/i18n/strings.properties @@ -219,6 +219,9 @@ health.check.detail.checkFinished=The check finished successfully. health.check.detail.checkFinishedAndFound=The check finished running. Please review the results. health.check.detail.checkFailed=The check exited due to an error. health.check.detail.checkCancelled=The check was cancelled. +health.check.detail.listFilters.label=Filter +health.check.detail.listFilters.severity=Severity +health.check.detail.listFilters.fixState=Fix state health.check.detail.fixAllSpecificBtn=Fix all of type health.check.exportBtn=Export Report ## Result view From 792fe1eafee8913d522c99d55dfbbc73eb55da36 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 30 Nov 2022 16:23:44 +0100 Subject: [PATCH 11/16] use jfx19 API --- .../ui/health/ResultListCellController.java | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/cryptomator/ui/health/ResultListCellController.java b/src/main/java/org/cryptomator/ui/health/ResultListCellController.java index 7debc4207..64cac79d3 100644 --- a/src/main/java/org/cryptomator/ui/health/ResultListCellController.java +++ b/src/main/java/org/cryptomator/ui/health/ResultListCellController.java @@ -33,7 +33,6 @@ public class ResultListCellController implements FxController { private static final FontAwesome5Icon WARN_ICON = FontAwesome5Icon.EXCLAMATION_TRIANGLE; private static final FontAwesome5Icon CRIT_ICON = FontAwesome5Icon.TIMES; - private final Logger LOG = LoggerFactory.getLogger(ResultListCellController.class); private final ObjectProperty result; private final ObservableValue severity; @@ -41,12 +40,12 @@ public class ResultListCellController implements FxController { private final ResultFixApplier fixApplier; private final ObservableValue fixState; private final ObjectBinding severityGlyph; - private final ObjectBinding fixGlyph; private final BooleanBinding fixable; private final BooleanBinding fixing; private final BooleanBinding fixed; private final BooleanBinding fixFailed; private final BooleanBinding fixRunningOrDone; + private final ObservableValue fixGlyph; private final List subscriptions; private final Tooltip fixStateTip; private final Tooltip severityTip; @@ -66,12 +65,12 @@ public class ResultListCellController implements FxController { this.fixApplier = fixApplier; this.fixState = result.flatMap(Result::fixState); this.severityGlyph = Bindings.createObjectBinding(this::getSeverityGlyph, result); - this.fixGlyph = Bindings.createObjectBinding(this::getFixGlyph, fixState); this.fixable = Bindings.createBooleanBinding(this::isFixable, fixState); this.fixing = Bindings.createBooleanBinding(this::isFixing, fixState); this.fixed = Bindings.createBooleanBinding(this::isFixed, fixState); this.fixFailed = Bindings.createBooleanBinding(this::isFixFailed, fixState); this.fixRunningOrDone = fixing.or(fixed).or(fixFailed); + this.fixGlyph = fixState.map(this::getFixGlyph); this.subscriptions = new ArrayList<>(); this.fixStateTip = new Tooltip(); @@ -83,6 +82,15 @@ public class ResultListCellController implements FxController { severityTip.setShowDelay(Duration.millis(150)); } + public FontAwesome5Icon getFixGlyph(Result.FixState state) { + return switch (state) { + case FIXING -> FontAwesome5Icon.SPINNER; + case FIXED -> FontAwesome5Icon.CHECK; + case FIX_FAILED -> FontAwesome5Icon.TIMES; + default -> null; + }; + } + private String getFixStateDescription(Result.FixState fixState) { return switch (fixState) { case FIXED -> resourceBundle.getString("health.fix.successTip"); @@ -170,22 +178,10 @@ public class ResultListCellController implements FxController { }; } - public ObjectBinding fixGlyphProperty() { + public ObservableValue fixGlyphProperty() { return fixGlyph; } - public FontAwesome5Icon getFixGlyph() { - if (fixState.getValue() == null) { - return null; - } - return switch (fixState.getValue()) { - case NOT_FIXABLE, FIXABLE -> null; - case FIXING -> FontAwesome5Icon.SPINNER; - case FIXED -> FontAwesome5Icon.CHECK; - case FIX_FAILED -> FontAwesome5Icon.TIMES; - }; - } - public BooleanBinding fixableProperty() { return fixable; } From 216abf224e3d56b178719444e998fd496b5cd06d Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 1 Dec 2022 17:37:26 +0100 Subject: [PATCH 12/16] add severity and its list filter translatable --- .../ui/health/CheckDetailController.java | 40 ++++++++++++++++++- .../ui/health/ResultListCellController.java | 2 +- src/main/resources/i18n/strings.properties | 13 ++++-- 3 files changed, 48 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/cryptomator/ui/health/CheckDetailController.java b/src/main/java/org/cryptomator/ui/health/CheckDetailController.java index 9ce582882..7b6e9b85f 100644 --- a/src/main/java/org/cryptomator/ui/health/CheckDetailController.java +++ b/src/main/java/org/cryptomator/ui/health/CheckDetailController.java @@ -24,6 +24,7 @@ import javafx.scene.input.Clipboard; import javafx.scene.input.ClipboardContent; import javafx.util.StringConverter; import java.util.Arrays; +import java.util.ResourceBundle; import java.util.function.Function; import java.util.function.Predicate; import java.util.stream.Stream; @@ -54,6 +55,7 @@ public class CheckDetailController implements FxController { private final Binding warnOrCritsExist; private final ResultListCellFactory resultListCellFactory; private final ResultFixApplier resultFixApplier; + private final ResourceBundle resourceBundle; private final BooleanProperty fixAllInfoResultsExecuted; private final BooleanBinding fixAllInfoResultsPossible; @@ -65,9 +67,10 @@ public class CheckDetailController implements FxController { private Subscription resultSubscription; @Inject - public CheckDetailController(ObjectProperty selectedTask, ResultListCellFactory resultListCellFactory, ResultFixApplier resultFixApplier) { + public CheckDetailController(ObjectProperty selectedTask, ResultListCellFactory resultListCellFactory, ResultFixApplier resultFixApplier, ResourceBundle resourceBundle) { this.resultListCellFactory = resultListCellFactory; this.resultFixApplier = resultFixApplier; + this.resourceBundle = resourceBundle; this.results = EasyBind.wrapList(FXCollections.observableArrayList()); this.check = selectedTask; this.checkState = selectedTask.flatMap(Check::stateProperty); @@ -115,7 +118,7 @@ public class CheckDetailController implements FxController { severityChoiceBox.getItems().add(null); severityChoiceBox.getItems().addAll(Arrays.stream(DiagnosticResult.Severity.values()).toList()); - //severityFilter.setConverter(new SeverityStringifier()); + severityChoiceBox.setConverter(new SeverityStringifier()); severityChoiceBox.setValue(null); fixStateChoiceBox.getItems().add(null); @@ -148,6 +151,39 @@ public class CheckDetailController implements FxController { } } + /* -- Internal classes -- */ + + class SeverityStringifier extends StringConverter { + + @Override + public String toString(Severity object) { + if (object == null) { + return resourceBundle.getString("health.result.severityFilter.none"); + } + return switch (object) { + case GOOD -> resourceBundle.getString("health.result.severityFilter.good"); + case INFO -> resourceBundle.getString("health.result.severityFilter.info"); + case WARN -> resourceBundle.getString("health.result.severityFilter.warn"); + case CRITICAL -> resourceBundle.getString("health.result.severityFilter.crit"); + }; + } + + @Override + public Severity fromString(String string) { + if (resourceBundle.getString("health.result.severityFilter.good").equals(string)) { + return Severity.GOOD; + } else if (resourceBundle.getString("health.result.severityFilter.info").equals(string)) { + return Severity.INFO; + } else if (resourceBundle.getString("health.result.severityFilter.warn").equals(string)) { + return Severity.WARN; + } else if (resourceBundle.getString("health.result.severityFilter.crit").equals(string)) { + return Severity.CRITICAL; + } else { + return null; + } + } + } + /* Getter/Setter */ public String getCheckName() { diff --git a/src/main/java/org/cryptomator/ui/health/ResultListCellController.java b/src/main/java/org/cryptomator/ui/health/ResultListCellController.java index 64cac79d3..35889ec26 100644 --- a/src/main/java/org/cryptomator/ui/health/ResultListCellController.java +++ b/src/main/java/org/cryptomator/ui/health/ResultListCellController.java @@ -104,7 +104,7 @@ public class ResultListCellController implements FxController { case GOOD -> "health.result.severityTip.good"; case INFO -> "health.result.severityTip.info"; case WARN -> "health.result.severityTip.warn"; - case CRITICAL -> "health.result.severityTip.critical"; + case CRITICAL -> "health.result.severityTip.crit"; }); } diff --git a/src/main/resources/i18n/strings.properties b/src/main/resources/i18n/strings.properties index fc9134381..95efdb2d3 100644 --- a/src/main/resources/i18n/strings.properties +++ b/src/main/resources/i18n/strings.properties @@ -225,10 +225,15 @@ health.check.detail.listFilters.fixState=Fix state health.check.detail.fixAllSpecificBtn=Fix all of type health.check.exportBtn=Export Report ## Result view -health.result.severityTip.good=Vault structure intact. -health.result.severityTip.info=Vault structure intact, fix suggested. -health.result.severityTip.warn=Vault structure corrupted, fix highly advised. -health.result.severityTip.critical=Vault structure corrupted, data loss determined. +health.result.severityFilter.none=Severity - All +health.result.severityFilter.good=Good +health.result.severityFilter.info=Info +health.result.severityFilter.warn=Warning +health.result.severityFilter.crit=Critical +health.result.severityTip.good=Severity: Good\nNormal vault structure. +health.result.severityTip.info=Severity: Info\nVault structure intact, fix suggested. +health.result.severityTip.warn=Severity: Warning\nVault structure corrupted, fix highly advised. +health.result.severityTip.crit=Severity: Critical\nVault structure corrupted, data loss determined. ## Fix Application health.fix.fixBtn=Fix health.fix.successTip=Fix successful From d9320910217f7e8ecc90d29b488791e33286956d Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 1 Dec 2022 22:20:31 +0100 Subject: [PATCH 13/16] add translations for fixState filter --- .../ui/health/CheckDetailController.java | 38 ++++++++++++++++++- src/main/resources/i18n/strings.properties | 8 +++- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/cryptomator/ui/health/CheckDetailController.java b/src/main/java/org/cryptomator/ui/health/CheckDetailController.java index 7b6e9b85f..04d96b271 100644 --- a/src/main/java/org/cryptomator/ui/health/CheckDetailController.java +++ b/src/main/java/org/cryptomator/ui/health/CheckDetailController.java @@ -123,6 +123,7 @@ public class CheckDetailController implements FxController { fixStateChoiceBox.getItems().add(null); fixStateChoiceBox.getItems().addAll(Arrays.stream(Result.FixState.values()).toList()); + fixStateChoiceBox.setConverter(new FixStateStringifier()); fixStateChoiceBox.setValue(null); resultsFilter.bind(Bindings.createObjectBinding(() -> this::filterResults, severityChoiceBox.valueProperty(), fixStateChoiceBox.valueProperty())); @@ -158,7 +159,7 @@ public class CheckDetailController implements FxController { @Override public String toString(Severity object) { if (object == null) { - return resourceBundle.getString("health.result.severityFilter.none"); + return resourceBundle.getString("health.result.severityFilter.all"); } return switch (object) { case GOOD -> resourceBundle.getString("health.result.severityFilter.good"); @@ -184,6 +185,40 @@ public class CheckDetailController implements FxController { } } + class FixStateStringifier extends StringConverter { + + @Override + public String toString(Result.FixState object) { + if (object == null) { + return resourceBundle.getString("health.result.fixStateFilter.all"); + } + return switch (object) { + case FIXABLE -> resourceBundle.getString("health.result.fixStateFilter.fixable"); + case NOT_FIXABLE -> resourceBundle.getString("health.result.fixStateFilter.notFixable"); + case FIXING -> resourceBundle.getString("health.result.fixStateFilter.fixing"); + case FIXED -> resourceBundle.getString("health.result.fixStateFilter.fixed"); + case FIX_FAILED -> resourceBundle.getString("health.result.fixStateFilter.fixFailed"); + }; + } + + @Override + public Result.FixState fromString(String string) { + if (resourceBundle.getString("health.result.fixStateFilter.fixable").equals(string)) { + return FIXABLE; + } else if (resourceBundle.getString("health.result.fixStateFilter.notFixable").equals(string)) { + return NOT_FIXABLE; + } else if (resourceBundle.getString("health.result.fixStateFilter.fixing").equals(string)) { + return FIXING; + } else if (resourceBundle.getString("health.result.fixStateFilter.fixed").equals(string)) { + return FIXED; + } else if (resourceBundle.getString("health.result.fixStateFilter.fixFailed").equals(string)) { + return FIX_FAILED; + } else { + return null; + } + } + } + /* Getter/Setter */ public String getCheckName() { @@ -289,5 +324,4 @@ public class CheckDetailController implements FxController { public boolean getFixAllInfoResultsPossible() { return fixAllInfoResultsPossible.getValue(); } - } diff --git a/src/main/resources/i18n/strings.properties b/src/main/resources/i18n/strings.properties index 95efdb2d3..ea713f2d6 100644 --- a/src/main/resources/i18n/strings.properties +++ b/src/main/resources/i18n/strings.properties @@ -225,7 +225,7 @@ health.check.detail.listFilters.fixState=Fix state health.check.detail.fixAllSpecificBtn=Fix all of type health.check.exportBtn=Export Report ## Result view -health.result.severityFilter.none=Severity - All +health.result.severityFilter.all=Severity - All health.result.severityFilter.good=Good health.result.severityFilter.info=Info health.result.severityFilter.warn=Warning @@ -234,6 +234,12 @@ health.result.severityTip.good=Severity: Good\nNormal vault structure. health.result.severityTip.info=Severity: Info\nVault structure intact, fix suggested. health.result.severityTip.warn=Severity: Warning\nVault structure corrupted, fix highly advised. health.result.severityTip.crit=Severity: Critical\nVault structure corrupted, data loss determined. +health.result.fixStateFilter.all=Fix state - All +health.result.fixStateFilter.fixable=Fixable +health.result.fixStateFilter.notFixable=Not fixable +health.result.fixStateFilter.fixing=Fixing… +health.result.fixStateFilter.fixed=Fixed +health.result.fixStateFilter.fixFailed=Fix failed ## Fix Application health.fix.fixBtn=Fix health.fix.successTip=Fix successful From 0c1bbc5bfd3a8a49a1b9b46800cd1b76ea3a3d03 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 2 Dec 2022 10:52:49 +0100 Subject: [PATCH 14/16] remove labels and change alignment --- src/main/resources/fxml/health_check_details.fxml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/resources/fxml/health_check_details.fxml b/src/main/resources/fxml/health_check_details.fxml index 67f7c30c8..0d27e65f0 100644 --- a/src/main/resources/fxml/health_check_details.fxml +++ b/src/main/resources/fxml/health_check_details.fxml @@ -41,16 +41,14 @@ - + - From 06922717c416c119d8419e6c07e8c23e8bbeafd5 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Mon, 5 Dec 2022 23:32:49 +0100 Subject: [PATCH 15/16] adjust spacing and window size to fit (english) labels --- src/main/resources/fxml/health_check_details.fxml | 3 +-- src/main/resources/fxml/health_check_list.fxml | 2 +- src/main/resources/fxml/health_start.fxml | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/resources/fxml/health_check_details.fxml b/src/main/resources/fxml/health_check_details.fxml index 0d27e65f0..ac12a09c1 100644 --- a/src/main/resources/fxml/health_check_details.fxml +++ b/src/main/resources/fxml/health_check_details.fxml @@ -40,14 +40,13 @@ - + - diff --git a/src/main/resources/fxml/health_check_list.fxml b/src/main/resources/fxml/health_check_list.fxml index 1edb004df..3124e15c6 100644 --- a/src/main/resources/fxml/health_check_list.fxml +++ b/src/main/resources/fxml/health_check_list.fxml @@ -12,7 +12,7 @@ diff --git a/src/main/resources/fxml/health_start.fxml b/src/main/resources/fxml/health_start.fxml index 9edc65f50..cc65aaaaa 100644 --- a/src/main/resources/fxml/health_start.fxml +++ b/src/main/resources/fxml/health_start.fxml @@ -16,7 +16,7 @@ From 3cbe4aa7ebfca753ff5b80c50bf436c5d1efa2ec Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 6 Dec 2022 10:39:38 +0100 Subject: [PATCH 16/16] use functional style --- src/main/java/org/cryptomator/ui/health/Result.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/cryptomator/ui/health/Result.java b/src/main/java/org/cryptomator/ui/health/Result.java index d8a18b890..582e4f843 100644 --- a/src/main/java/org/cryptomator/ui/health/Result.java +++ b/src/main/java/org/cryptomator/ui/health/Result.java @@ -21,7 +21,7 @@ record Result(DiagnosticResult diagnosis, ObjectProperty fixState) { } public static Result create(DiagnosticResult diagnosis, Path vaultPath, VaultConfig config, Masterkey masterkey, Cryptor cryptor) { - FixState initialState = diagnosis.getFix(vaultPath, config, masterkey, cryptor).isPresent()? FixState.FIXABLE : FixState.NOT_FIXABLE; + FixState initialState = diagnosis.getFix(vaultPath, config, masterkey, cryptor).map( _f -> FixState.FIXABLE).orElse(FixState.NOT_FIXABLE); return new Result(diagnosis, new SimpleObjectProperty<>(initialState)); }