Small fixes

This commit is contained in:
crschnick 2024-08-06 14:19:13 +00:00
parent 3d05c9b443
commit f8d13841ac
6 changed files with 20 additions and 16 deletions

View file

@ -163,10 +163,10 @@ public class StoreSection {
var allChildren = all.filtered( var allChildren = all.filtered(
other -> { other -> {
// Legacy implementation that does not use children caches. Use for testing // Legacy implementation that does not use children caches. Use for testing
// if (true) return DataStorage.get() // if (true) return DataStorage.get()
// .getDisplayParent(other.getEntry()) // .getDefaultDisplayParent(other.getEntry())
// .map(found -> found.equals(e.getEntry())) // .map(found -> found.equals(e.getEntry()))
// .orElse(false); // .orElse(false);
// is children. This check is fast as the children are cached in the storage // is children. This check is fast as the children are cached in the storage
return DataStorage.get().getStoreChildren(e.getEntry()).contains(other.getEntry()) return DataStorage.get().getStoreChildren(e.getEntry()).contains(other.getEntry())

View file

@ -2,10 +2,8 @@ package io.xpipe.app.ext;
import io.xpipe.app.storage.DataStoreEntry; import io.xpipe.app.storage.DataStoreEntry;
import io.xpipe.core.process.ShellControl; import io.xpipe.core.process.ShellControl;
import io.xpipe.core.store.DataStore;
import io.xpipe.core.util.FailableRunnable; import io.xpipe.core.util.FailableRunnable;
import io.xpipe.core.util.ModuleLayerLoader; import io.xpipe.core.util.ModuleLayerLoader;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Value; import lombok.Value;
@ -22,10 +20,6 @@ public abstract class ScanProvider {
return ALL; return ALL;
} }
public ScanOperation create(DataStore store) {
return null;
}
public ScanOperation create(DataStoreEntry entry, ShellControl sc) throws Exception { public ScanOperation create(DataStoreEntry entry, ShellControl sc) throws Exception {
return null; return null;
} }

View file

@ -10,6 +10,9 @@ import io.xpipe.app.fxcomps.util.PlatformThread;
import javafx.beans.binding.Bindings; import javafx.beans.binding.Bindings;
import javafx.beans.property.Property; import javafx.beans.property.Property;
import javafx.scene.Cursor; import javafx.scene.Cursor;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyCodeCombination;
import javafx.scene.input.KeyEvent;
import javafx.scene.input.MouseButton; import javafx.scene.input.MouseButton;
import atlantafx.base.controls.CustomTextField; import atlantafx.base.controls.CustomTextField;
@ -53,6 +56,13 @@ public class FilterComp extends Comp<CompStructure<CustomTextField>> {
filter.focusedProperty())); filter.focusedProperty()));
filter.setAccessibleText("Filter"); filter.setAccessibleText("Filter");
filter.addEventFilter(KeyEvent.KEY_PRESSED,event -> {
if (new KeyCodeCombination(KeyCode.ESCAPE).match(event)) {
filter.getScene().getRoot().requestFocus();
event.consume();
}
});
filterText.subscribe(val -> { filterText.subscribe(val -> {
PlatformThread.runLaterIfNeeded(() -> { PlatformThread.runLaterIfNeeded(() -> {
clear.setVisible(val != null); clear.setVisible(val != null);

View file

@ -157,7 +157,7 @@ public class DataStoreEntry extends StorageElement {
null, null,
uuid, uuid,
categoryUuid, categoryUuid,
name, name.trim(),
Instant.now(), Instant.now(),
Instant.now(), Instant.now(),
storeFromNode, storeFromNode,
@ -194,7 +194,7 @@ public class DataStoreEntry extends StorageElement {
var categoryUuid = Optional.ofNullable(json.get("categoryUuid")) var categoryUuid = Optional.ofNullable(json.get("categoryUuid"))
.map(jsonNode -> UUID.fromString(jsonNode.textValue())) .map(jsonNode -> UUID.fromString(jsonNode.textValue()))
.orElse(DataStorage.DEFAULT_CATEGORY_UUID); .orElse(DataStorage.DEFAULT_CATEGORY_UUID);
var name = json.required("name").textValue(); var name = json.required("name").textValue().trim();
var persistentState = stateJson.get("persistentState"); var persistentState = stateJson.get("persistentState");
var lastUsed = Optional.ofNullable(stateJson.get("lastUsed")) var lastUsed = Optional.ofNullable(stateJson.get("lastUsed"))

View file

@ -40,7 +40,7 @@ public class ScanAlert {
}); });
} }
private static void showForShellStore(DataStoreEntry initial) { public static void showForShellStore(DataStoreEntry initial) {
show(initial, (DataStoreEntry entry, ShellControl sc) -> { show(initial, (DataStoreEntry entry, ShellControl sc) -> {
if (!sc.getShellDialect().getDumbMode().supportsAnyPossibleInteraction()) { if (!sc.getShellDialect().getDumbMode().supportsAnyPossibleInteraction()) {
return null; return null;

View file

@ -7,9 +7,7 @@ import io.xpipe.app.storage.DataStoreEntryRef;
import io.xpipe.app.util.ScanAlert; import io.xpipe.app.util.ScanAlert;
import io.xpipe.core.process.ShellStoreState; import io.xpipe.core.process.ShellStoreState;
import io.xpipe.core.store.ShellStore; import io.xpipe.core.store.ShellStore;
import javafx.beans.value.ObservableValue; import javafx.beans.value.ObservableValue;
import lombok.Value; import lombok.Value;
public class ScanStoreAction implements ActionProvider { public class ScanStoreAction implements ActionProvider {
@ -67,7 +65,9 @@ public class ScanStoreAction implements ActionProvider {
@Override @Override
public void execute() { public void execute() {
ScanAlert.showAsync(entry); if (entry == null || entry.getStore() instanceof ShellStore) {
ScanAlert.showForShellStore(entry);
}
} }
} }
} }