mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-09-04 15:18:09 +00:00
Added I/O stats (work in progress)
This commit is contained in:
@@ -44,6 +44,7 @@ import javafx.stage.FileChooser;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.util.Duration;
|
||||
import org.apache.commons.lang3.SystemUtils;
|
||||
import org.cryptomator.common.vaults.VaultState;
|
||||
import org.cryptomator.ui.fxapp.FxApplicationScoped;
|
||||
import org.cryptomator.common.settings.VaultSettings;
|
||||
import org.cryptomator.ui.ExitUtil;
|
||||
@@ -100,9 +101,9 @@ public class MainController implements ViewController {
|
||||
private final ObservableList<Vault> vaults;
|
||||
private final BooleanBinding areAllVaultsLocked;
|
||||
private final ObjectProperty<Vault> selectedVault = new SimpleObjectProperty<>();
|
||||
private final ObjectExpression<Vault.State> selectedVaultState = ObjectExpression.objectExpression(EasyBind.select(selectedVault).selectObject(Vault::stateProperty));
|
||||
private final ObjectExpression<VaultState> selectedVaultState = ObjectExpression.objectExpression(EasyBind.select(selectedVault).selectObject(Vault::stateProperty));
|
||||
private final BooleanExpression isSelectedVaultValid = BooleanExpression.booleanExpression(EasyBind.monadic(selectedVault).map(Vault::isValidVaultDirectory).orElse(false));
|
||||
private final BooleanExpression canEditSelectedVault = selectedVaultState.isEqualTo(Vault.State.LOCKED);
|
||||
private final BooleanExpression canEditSelectedVault = selectedVaultState.isEqualTo(VaultState.LOCKED);
|
||||
private final MonadicBinding<UpgradeStrategy> upgradeStrategyForSelectedVault;
|
||||
private final BooleanBinding isShowingSettings;
|
||||
private final Map<Vault, UnlockedController> unlockedVaults = new HashMap<>();
|
||||
@@ -410,7 +411,7 @@ public class MainController implements ViewController {
|
||||
if (newValue == null) {
|
||||
return;
|
||||
}
|
||||
if (newValue.getState() != Vault.State.LOCKED) {
|
||||
if (newValue.getState() != VaultState.LOCKED) {
|
||||
this.showUnlockedView(newValue, false);
|
||||
} else if (!newValue.doesVaultDirectoryExist()) {
|
||||
this.showNotFoundView();
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
package org.cryptomator.ui.controls;
|
||||
|
||||
import org.cryptomator.common.vaults.Vault;
|
||||
import org.cryptomator.common.vaults.VaultState;
|
||||
import org.fxmisc.easybind.EasyBind;
|
||||
|
||||
import javafx.beans.binding.ObjectExpression;
|
||||
@@ -35,7 +36,7 @@ public class DirectoryListCell extends DraggableListCell<Vault> {
|
||||
private ContextMenu vaultContextMenu;
|
||||
|
||||
public DirectoryListCell() {
|
||||
ObjectExpression<Vault.State> vaultState = ObjectExpression.objectExpression(EasyBind.select(itemProperty()).selectObject(Vault::stateProperty));
|
||||
ObjectExpression<VaultState> vaultState = ObjectExpression.objectExpression(EasyBind.select(itemProperty()).selectObject(Vault::stateProperty));
|
||||
|
||||
hbox.setAlignment(Pos.CENTER_LEFT);
|
||||
hbox.setPrefWidth(1);
|
||||
@@ -62,7 +63,7 @@ public class DirectoryListCell extends DraggableListCell<Vault> {
|
||||
setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
|
||||
}
|
||||
|
||||
private String getStatusIconText(Vault.State state) {
|
||||
private String getStatusIconText(VaultState state) {
|
||||
if (state == null) {
|
||||
return "";
|
||||
}
|
||||
@@ -76,7 +77,7 @@ public class DirectoryListCell extends DraggableListCell<Vault> {
|
||||
}
|
||||
}
|
||||
|
||||
private Paint getStatusIconColor(Vault.State state, Paint lockedValue) {
|
||||
private Paint getStatusIconColor(VaultState state, Paint lockedValue) {
|
||||
if (state == null) {
|
||||
return lockedValue;
|
||||
}
|
||||
@@ -90,8 +91,8 @@ public class DirectoryListCell extends DraggableListCell<Vault> {
|
||||
}
|
||||
}
|
||||
|
||||
private ContextMenu getContextMenu(Vault.State state) {
|
||||
if (state == Vault.State.LOCKED) {
|
||||
private ContextMenu getContextMenu(VaultState state) {
|
||||
if (state == VaultState.LOCKED) {
|
||||
return vaultContextMenu;
|
||||
} else {
|
||||
return null;
|
||||
|
||||
@@ -8,6 +8,7 @@ import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import org.cryptomator.common.vaults.Vault;
|
||||
import org.cryptomator.common.vaults.VaultState;
|
||||
import org.cryptomator.common.vaults.Volume;
|
||||
import org.cryptomator.ui.changepassword.ChangePasswordComponent;
|
||||
import org.cryptomator.ui.common.FxController;
|
||||
@@ -46,7 +47,7 @@ public class VaultDetailController implements FxController {
|
||||
this.anyVaultSelected = vault.isNotNull();
|
||||
}
|
||||
|
||||
private FontAwesome5Icon getGlyphForVaultState(Vault.State state) {
|
||||
private FontAwesome5Icon getGlyphForVaultState(VaultState state) {
|
||||
switch (state) {
|
||||
case LOCKED:
|
||||
return FontAwesome5Icon.LOCK_ALT;
|
||||
@@ -67,14 +68,14 @@ public class VaultDetailController implements FxController {
|
||||
@FXML
|
||||
public void lock() {
|
||||
Vault v = vault.get();
|
||||
v.setState(Vault.State.PROCESSING);
|
||||
v.setState(VaultState.PROCESSING);
|
||||
Tasks.create(() -> {
|
||||
v.lock(false);
|
||||
}).onSuccess(() -> {
|
||||
LOG.trace("Regular unmount succeeded.");
|
||||
v.setState(Vault.State.LOCKED);
|
||||
v.setState(VaultState.LOCKED);
|
||||
}).onError(Exception.class, e -> {
|
||||
v.setState(Vault.State.UNLOCKED);
|
||||
v.setState(VaultState.UNLOCKED);
|
||||
// TODO
|
||||
}).runOnce(executor);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.cryptomator.ui.mainwindow;
|
||||
import javafx.beans.binding.Binding;
|
||||
import javafx.beans.property.ObjectProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import org.cryptomator.common.vaults.VaultState;
|
||||
import org.cryptomator.ui.common.FxController;
|
||||
import org.cryptomator.common.vaults.Vault;
|
||||
import org.cryptomator.ui.controls.FontAwesome5Icon;
|
||||
@@ -21,7 +22,7 @@ public class VaultListCellController implements FxController {
|
||||
this.glyph = EasyBind.select(vault).selectObject(Vault::stateProperty).map(this::getGlyphForVaultState).orElse(FontAwesome5Icon.EXCLAMATION_TRIANGLE);
|
||||
}
|
||||
|
||||
private FontAwesome5Icon getGlyphForVaultState(Vault.State state) {
|
||||
private FontAwesome5Icon getGlyphForVaultState(VaultState state) {
|
||||
switch (state) {
|
||||
case LOCKED:
|
||||
return FontAwesome5Icon.LOCK_ALT;
|
||||
|
||||
@@ -9,6 +9,7 @@ import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ContentDisplay;
|
||||
import javafx.stage.Stage;
|
||||
import org.cryptomator.common.vaults.Vault;
|
||||
import org.cryptomator.common.vaults.VaultState;
|
||||
import org.cryptomator.common.vaults.Volume;
|
||||
import org.cryptomator.ui.common.FxController;
|
||||
import org.slf4j.Logger;
|
||||
@@ -83,7 +84,7 @@ public class QuitController implements FxController {
|
||||
}
|
||||
};
|
||||
task.setOnSucceeded(evt -> {
|
||||
vault.setState(Vault.State.LOCKED);
|
||||
vault.setState(VaultState.LOCKED);
|
||||
});
|
||||
task.setOnFailed(evt -> {
|
||||
LOG.warn("Failed to lock vault", vault);
|
||||
|
||||
@@ -15,6 +15,7 @@ import javafx.scene.control.ContentDisplay;
|
||||
import javafx.stage.Stage;
|
||||
import org.apache.commons.lang3.SystemUtils;
|
||||
import org.cryptomator.common.vaults.Vault;
|
||||
import org.cryptomator.common.vaults.VaultState;
|
||||
import org.cryptomator.cryptolib.api.InvalidPassphraseException;
|
||||
import org.cryptomator.cryptolib.api.UnsupportedVaultFormatException;
|
||||
import org.cryptomator.keychain.KeychainAccess;
|
||||
@@ -70,7 +71,7 @@ public class UnlockController implements FxController {
|
||||
} else {
|
||||
savePassword.setDisable(true);
|
||||
}
|
||||
unlockButtonDisabled.bind(vault.stateProperty().isNotEqualTo(Vault.State.LOCKED).or(passwordField.textProperty().isEmpty()));
|
||||
unlockButtonDisabled.bind(vault.stateProperty().isNotEqualTo(VaultState.LOCKED).or(passwordField.textProperty().isEmpty()));
|
||||
}
|
||||
|
||||
@FXML
|
||||
@@ -83,14 +84,14 @@ public class UnlockController implements FxController {
|
||||
public void unlock() {
|
||||
LOG.trace("UnlockController.unlock()");
|
||||
CharSequence password = passwordField.getCharacters();
|
||||
vault.setState(Vault.State.PROCESSING);
|
||||
vault.setState(VaultState.PROCESSING);
|
||||
Tasks.create(() -> {
|
||||
vault.unlock(password);
|
||||
if (keychainAccess.isPresent() && savePassword.isSelected()) {
|
||||
keychainAccess.get().storePassphrase(vault.getId(), password);
|
||||
}
|
||||
}).onSuccess(() -> {
|
||||
vault.setState(Vault.State.UNLOCKED);
|
||||
vault.setState(VaultState.UNLOCKED);
|
||||
passwordField.swipe();
|
||||
LOG.info("Unlock of '{}' succeeded.", vault.getDisplayableName());
|
||||
window.setScene(successScene.get());
|
||||
@@ -110,7 +111,7 @@ public class UnlockController implements FxController {
|
||||
// TODO
|
||||
}).andFinally(() -> {
|
||||
if (!vault.isUnlocked()) {
|
||||
vault.setState(Vault.State.LOCKED);
|
||||
vault.setState(VaultState.LOCKED);
|
||||
}
|
||||
}).runOnce(executor);
|
||||
}
|
||||
|
||||
@@ -62,15 +62,21 @@
|
||||
<Region HBox.hgrow="ALWAYS"/>
|
||||
<Label styleClass="button-group-action" text="TODO REVEAL"/>
|
||||
</HBox>
|
||||
<Region styleClass="button-group-separator"/>
|
||||
<HBox styleClass="button-group,last" alignment="CENTER">
|
||||
<VBox styleClass="button-group-labels">
|
||||
<Label styleClass="button-group-heading" text="example heading"/>
|
||||
<Label text="example text"/>
|
||||
<HBox styleClass="button-group,last" spacing="24" alignment="CENTER">
|
||||
<VBox styleClass="button-group-labels" HBox.hgrow="ALWAYS">
|
||||
<Label styleClass="button-group-heading" text="TODO Read"/>
|
||||
<Label text="${controller.vault.stats.bytesPerSecondRead}"/>
|
||||
</VBox>
|
||||
<VBox styleClass="button-group-labels" HBox.hgrow="ALWAYS">
|
||||
<Label styleClass="button-group-heading" text="TODO Written"/>
|
||||
<Label text="${controller.vault.stats.bytesPerSecondWritten}"/>
|
||||
</VBox>
|
||||
<!-- Future use:
|
||||
<Region HBox.hgrow="ALWAYS"/>
|
||||
<Label styleClass="button-group-action" text="EXAMPLE ACTION"/>
|
||||
<Label styleClass="button-group-action" text="SHOW CHART"/>
|
||||
-->
|
||||
</HBox>
|
||||
<Region styleClass="button-group-separator"/>
|
||||
</VBox>
|
||||
|
||||
<Region prefHeight="24" VBox.vgrow="NEVER"/>
|
||||
|
||||
Reference in New Issue
Block a user