* show correct name for health check tasks
* some padding
* resize window when run button is hit
This commit is contained in:
Armin Schrenk
2021-05-21 12:43:07 +02:00
parent b6f5ddaf30
commit 4845984a35
5 changed files with 26 additions and 7 deletions

View File

@@ -5,6 +5,7 @@ import org.cryptomator.ui.controls.FontAwesome5IconView;
import javafx.beans.value.ObservableValue;
import javafx.concurrent.Worker;
import javafx.geometry.Insets;
import javafx.scene.control.ContentDisplay;
import javafx.scene.control.ListCell;
@@ -12,6 +13,10 @@ class CheckListCell extends ListCell<HealthCheckTask> {
private final FontAwesome5IconView stateIcon = new FontAwesome5IconView();
CheckListCell(){
paddingProperty().set(new Insets(6));
}
@Override
protected void updateItem(HealthCheckTask item, boolean empty) {
super.updateItem(item, empty);

View File

@@ -22,6 +22,8 @@ import javafx.concurrent.Worker;
import javafx.fxml.FXML;
import javafx.scene.control.ListView;
import javafx.scene.control.cell.CheckBoxListCell;
import javafx.stage.Stage;
import javafx.util.StringConverter;
import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;
@@ -35,6 +37,7 @@ public class CheckListController implements FxController {
private static final Logger LOG = LoggerFactory.getLogger(CheckListController.class);
private static final Set<Worker.State> END_STATES = Set.of(Worker.State.FAILED, Worker.State.CANCELLED, Worker.State.SUCCEEDED);
private final Stage window;
private final ObservableList<HealthCheckTask> tasks;
private final ReportWriter reportWriter;
private final ExecutorService executorService;
@@ -52,7 +55,8 @@ public class CheckListController implements FxController {
@Inject
public CheckListController(Lazy<Collection<HealthCheckTask>> tasks, ReportWriter reportWriteTask, ObjectProperty<HealthCheckTask> selectedTask, ExecutorService executorService) {
public CheckListController(@HealthCheckWindow Stage window, Lazy<Collection<HealthCheckTask>> tasks, ReportWriter reportWriteTask, ObjectProperty<HealthCheckTask> selectedTask, ExecutorService executorService) {
this.window = window;
this.tasks = FXCollections.observableArrayList(tasks.get());
this.reportWriter = reportWriteTask;
this.executorService = executorService;
@@ -74,7 +78,17 @@ public class CheckListController implements FxController {
@FXML
public void initialize() {
checksListView.setItems(tasks);
checksListView.setCellFactory(CheckBoxListCell.forListView(listPickIndicators::get));
checksListView.setCellFactory(CheckBoxListCell.forListView(listPickIndicators::get, new StringConverter<HealthCheckTask>() {
@Override
public String toString(HealthCheckTask object) {
return object.getCheck().identifier();
}
@Override
public HealthCheckTask fromString(String string) {
return null;
}
}));
selectedTask.bind(checksListView.getSelectionModel().selectedItemProperty());
}
@@ -89,6 +103,7 @@ public class CheckListController implements FxController {
checksListView.setCellFactory(view -> new CheckListCell());
showResultScreen.set(true);
checksListView.getSelectionModel().select(batch.getViewIndex(0));
window.sizeToScene();
}
@FXML

View File

@@ -12,8 +12,6 @@
<VBox xmlns:fx="http://javafx.com/fxml"
xmlns="http://javafx.com/javafx"
fx:controller="org.cryptomator.ui.health.CheckListController"
minWidth="400"
prefWidth="400"
minHeight="145"
spacing="12">
<padding>
@@ -24,8 +22,8 @@
</fx:define>
<children>
<HBox spacing="12" VBox.vgrow="ALWAYS">
<VBox minWidth="80" spacing="6" >
<Label fx:id="listHeading" text="Health checks"/>
<VBox minWidth="80" spacing="6" HBox.hgrow="ALWAYS" >
<Label fx:id="listHeading" text="%health.check.listHeader"/>
<!-- TODO:HEADER with select all checkbox -->
<ListView fx:id="checksListView" VBox.vgrow="ALWAYS"/>
</VBox>

View File

@@ -21,6 +21,6 @@
<FontAwesome5IconView fx:id="iconView" HBox.hgrow="NEVER" glyphSize="16"/>
<Label text="${controller.description}" wrapText="true"/>
<Region HBox.hgrow="ALWAYS"/>
<Button fx:id="actionButton" text="%health.check.export" onAction="#runResultAction" alignment="CENTER_RIGHT" visible="false" />
<Button fx:id="actionButton" text="%health.check.fix" onAction="#runResultAction" alignment="CENTER_RIGHT" visible="false" />
</children>
</HBox>

View File

@@ -148,6 +148,7 @@ migration.impossible.moreInfo=The vault can still be opened with an older versio
# Health Check
health.title=Vault Check
health.check.listHeader=Available Checks
health.check.runBatchButton=Run selected Checks
health.check.result.noSelectedCheck=For results select a finished check in the left list.
health.check.export=Export Report