Jelajahi Sumber

Remove count of warnings/criticals from GUI

Armin Schrenk 3 tahun lalu
induk
melakukan
e40ce62877

+ 10 - 0
src/main/java/org/cryptomator/ui/health/CheckDetailController.java

@@ -34,6 +34,7 @@ public class CheckDetailController implements FxController {
 	private final Binding<Boolean> checkCancelled;
 	private final Binding<Number> countOfWarnSeverity;
 	private final Binding<Number> countOfCritSeverity;
+	private final Binding<Boolean> warnOrCritsExist;
 	private final ResultListCellFactory resultListCellFactory;
 
 	public CheckStateIconView checkStateIconView;
@@ -56,6 +57,7 @@ public class CheckDetailController implements FxController {
 		this.checkFinished = EasyBind.combine(checkSucceeded, checkFailed, checkCancelled, (a, b, c) -> a || b || c);
 		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) );
 		selectedTask.addListener(this::selectedTaskChanged);
 	}
 
@@ -156,6 +158,14 @@ public class CheckDetailController implements FxController {
 		return checkCancelled.getValue();
 	}
 
+	public Binding<Boolean> warnOrCritsExistProperty() {
+		return warnOrCritsExist;
+	}
+
+	public boolean isWarnOrCritsExist() {
+		return warnOrCritsExist.getValue();
+	}
+
 	public Binding<Boolean> checkCancelledProperty() {
 		return checkCancelled;
 	}

+ 2 - 0
src/main/java/org/cryptomator/ui/health/CheckListController.java

@@ -19,6 +19,7 @@ import javafx.event.ActionEvent;
 import javafx.fxml.FXML;
 import javafx.scene.control.CheckBox;
 import javafx.scene.control.ListView;
+import javafx.scene.control.SelectionMode;
 import javafx.stage.Stage;
 import java.io.IOException;
 import java.util.List;
@@ -60,6 +61,7 @@ public class CheckListController implements FxController {
 
 	@FXML
 	public void initialize() {
+		checksListView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
 		checksListView.setItems(checks);
 		checksListView.setCellFactory(view -> new CheckListCell());
 		selectedCheck.bind(checksListView.getSelectionModel().selectedItemProperty());

+ 2 - 3
src/main/resources/fxml/health_check_details.fxml

@@ -20,9 +20,8 @@
 	<Label text="%health.check.detail.checkSkipped" visible="${controller.checkSkipped}" managed="${controller.checkSkipped}"/>
 	<Label text="%health.check.detail.checkCancelled" visible="${controller.checkCancelled}" managed="${controller.checkCancelled}"/>
 	<Label text="%health.check.detail.checkFailed" visible="${controller.checkFailed}" managed="${controller.checkFailed}"/>
-	<Label text="%health.check.detail.checkSucceeded" visible="${controller.checkSucceeded}" managed="${controller.checkSucceeded}"/>
+	<Label text="%health.check.detail.checkSucceeded" visible="${controller.checkSucceeded &amp;&amp; !controller.warnOrCritsExist}" managed="${controller.checkSucceeded &amp;&amp; !controller.warnOrCritsExist}"/>
+	<Label text="TODO: check finished and found something" visible="${controller.checkSucceeded &amp;&amp; controller.warnOrCritsExist}" managed="${controller.checkSucceeded &amp;&amp; controller.warnOrCritsExist}"/>
 
-	<FormattedLabel styleClass="label" format="%health.check.detail.problemCount" arg1="${controller.countOfWarnSeverity}" arg2="${controller.countOfCritSeverity}" visible="${!controller.checkSkipped}"
-					managed="${!controller.checkSkipped}"/>
 	<ListView fx:id="resultsListView" VBox.vgrow="ALWAYS" visible="${!controller.checkSkipped}"/>
 </VBox>

+ 0 - 1
src/main/resources/i18n/strings.properties

@@ -162,7 +162,6 @@ health.check.detail.checkSkipped=The check was not selected to run.
 health.check.detail.checkSucceeded=The check finished successfully.
 health.check.detail.checkFailed=The check exited due to an error.
 health.check.detail.checkCancelled=The check was cancelled.
-health.check.detail.problemCount=Found %d problems and %d unfixable errors.
 health.check.exportBtn=Export Report
 health.check.fixBtn=Fix
 ## Checks