Various fixes

This commit is contained in:
crschnick 2024-04-25 18:55:41 +00:00
parent 45e2e9a95c
commit 09ffad1ec6
32 changed files with 59 additions and 113 deletions

View file

@ -1,41 +0,0 @@
package io.xpipe.app.fxcomps.impl;
import io.xpipe.app.core.AppI18n;
import io.xpipe.app.fxcomps.SimpleComp;
import io.xpipe.core.store.DataFlow;
import javafx.beans.property.Property;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ObservableValue;
import javafx.scene.layout.Region;
import lombok.EqualsAndHashCode;
import lombok.Value;
import java.util.LinkedHashMap;
@Value
@EqualsAndHashCode(callSuper = true)
public class DataStoreFlowChoiceComp extends SimpleComp {
Property<DataFlow> selected;
DataFlow[] available;
@Override
protected Region createSimple() {
var map = new LinkedHashMap<DataFlow, ObservableValue<String>>();
map.put(DataFlow.INPUT, AppI18n.observable("app.input"));
map.put(DataFlow.OUTPUT, AppI18n.observable("app.output"));
map.put(DataFlow.INPUT_OUTPUT, AppI18n.observable("app.inout"));
return new ToggleGroupComp<>(selected, new SimpleObjectProperty<>(map))
.apply(struc -> {
new TooltipAugment<>("app.inputDescription")
.augment(struc.get().getChildren().get(0));
new TooltipAugment<>("app.outputDescription")
.augment(struc.get().getChildren().get(1));
new TooltipAugment<>("app.inoutDescription")
.augment(struc.get().getChildren().get(2));
})
.createRegion();
}
}

View file

@ -47,7 +47,7 @@ public class CloseBehaviourAlert {
rb.setSelected(true); rb.setSelected(true);
} }
vb.getChildren().add(rb); vb.getChildren().add(rb);
vb.setMinHeight(150); vb.setMinHeight(130);
} }
alert.getDialogPane().setContent(vb); alert.getDialogPane().setContent(vb);
}) })

View file

@ -31,7 +31,6 @@ public class DeveloperCategory extends AppPrefsCategory {
var prefs = AppPrefs.get(); var prefs = AppPrefs.get();
var localCommand = new SimpleStringProperty(); var localCommand = new SimpleStringProperty();
Runnable test = () -> { Runnable test = () -> {
prefs.save();
var cmd = localCommand.get(); var cmd = localCommand.get();
if (cmd == null) { if (cmd == null) {
return; return;

View file

@ -30,7 +30,6 @@ public class EditorCategory extends AppPrefsCategory {
var prefs = AppPrefs.get(); var prefs = AppPrefs.get();
var terminalTest = new StackComp( var terminalTest = new StackComp(
List.of(new ButtonComp(AppI18n.observable("test"), new FontIcon("mdi2p-play"), () -> { List.of(new ButtonComp(AppI18n.observable("test"), new FontIcon("mdi2p-play"), () -> {
prefs.save();
ThreadHelper.runFailableAsync(() -> { ThreadHelper.runFailableAsync(() -> {
var editor = AppPrefs.get().externalEditor().getValue(); var editor = AppPrefs.get().externalEditor().getValue();
if (editor != null) { if (editor != null) {

View file

@ -94,12 +94,12 @@ public abstract class ExternalApplicationType implements PrefsChoiceValue {
public abstract static class PathApplication extends ExternalApplicationType { public abstract static class PathApplication extends ExternalApplicationType {
protected final String executable; protected final String executable;
protected final boolean explicityAsync; protected final boolean explicitlyAsync;
public PathApplication(String id, String executable, boolean explicityAsync) { public PathApplication(String id, String executable, boolean explicitlyAsync) {
super(id); super(id);
this.executable = executable; this.executable = executable;
this.explicityAsync = explicityAsync; this.explicitlyAsync = explicitlyAsync;
} }
public boolean isAvailable() { public boolean isAvailable() {
@ -121,7 +121,7 @@ public abstract class ExternalApplicationType implements PrefsChoiceValue {
} }
args.add(0, executable); args.add(0, executable);
if (explicityAsync) { if (explicitlyAsync) {
ExternalApplicationHelper.startAsync(args); ExternalApplicationHelper.startAsync(args);
} else { } else {
pc.executeSimpleCommand(args); pc.executeSimpleCommand(args);

View file

@ -215,7 +215,7 @@ public interface ExternalEditorType extends PrefsChoiceValue {
@Override @Override
public void launch(Path file) throws Exception { public void launch(Path file) throws Exception {
var builder = CommandBuilder.of().addFile(executable).addFile(file.toString()); var builder = CommandBuilder.of().addFile(executable).addFile(file.toString());
if (explicityAsync) { if (explicitlyAsync) {
ExternalApplicationHelper.startAsync(builder); ExternalApplicationHelper.startAsync(builder);
} else { } else {
LocalShell.getShell().executeSimpleCommand(builder); LocalShell.getShell().executeSimpleCommand(builder);

View file

@ -52,7 +52,6 @@ public class PasswordManagerCategory extends AppPrefsCategory {
var prefs = AppPrefs.get(); var prefs = AppPrefs.get();
var testPasswordManagerValue = new SimpleStringProperty(); var testPasswordManagerValue = new SimpleStringProperty();
Runnable test = () -> { Runnable test = () -> {
prefs.save();
var cmd = prefs.passwordManagerString(testPasswordManagerValue.get()); var cmd = prefs.passwordManagerString(testPasswordManagerValue.get());
if (cmd == null) { if (cmd == null) {
return; return;

View file

@ -37,7 +37,6 @@ public class TerminalCategory extends AppPrefsCategory {
var prefs = AppPrefs.get(); var prefs = AppPrefs.get();
var terminalTest = new StackComp( var terminalTest = new StackComp(
List.of(new ButtonComp(AppI18n.observable("test"), new FontIcon("mdi2p-play"), () -> { List.of(new ButtonComp(AppI18n.observable("test"), new FontIcon("mdi2p-play"), () -> {
prefs.save();
ThreadHelper.runFailableAsync(() -> { ThreadHelper.runFailableAsync(() -> {
var term = AppPrefs.get().terminalType().getValue(); var term = AppPrefs.get().terminalType().getValue();
if (term != null) { if (term != null) {
@ -58,12 +57,6 @@ public class TerminalCategory extends AppPrefsCategory {
.apply(struc -> struc.get().setPromptText("myterminal -e $CMD")) .apply(struc -> struc.get().setPromptText("myterminal -e $CMD"))
.hide(prefs.terminalType.isNotEqualTo(ExternalTerminalType.CUSTOM))) .hide(prefs.terminalType.isNotEqualTo(ExternalTerminalType.CUSTOM)))
.addComp(terminalTest) .addComp(terminalTest)
.disable(Bindings.createBooleanBinding(
() -> {
return prefs.terminalType().getValue() != null
&& !prefs.terminalType.get().supportsTabs();
},
prefs.terminalType()))
.nameAndDescription("clearTerminalOnInit") .nameAndDescription("clearTerminalOnInit")
.addToggle(prefs.clearTerminalOnInit)) .addToggle(prefs.clearTerminalOnInit))
.buildComp(); .buildComp();

View file

@ -5,10 +5,7 @@ import io.xpipe.app.issue.ErrorEvent;
import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.prefs.AppPrefs;
import io.xpipe.app.util.FixedHierarchyStore; import io.xpipe.app.util.FixedHierarchyStore;
import io.xpipe.app.util.ThreadHelper; import io.xpipe.app.util.ThreadHelper;
import io.xpipe.core.store.DataStore; import io.xpipe.core.store.*;
import io.xpipe.core.store.DataStoreId;
import io.xpipe.core.store.FixedChildStore;
import io.xpipe.core.store.LocalStore;
import io.xpipe.core.util.UuidHelper; import io.xpipe.core.util.UuidHelper;
import javafx.util.Pair; import javafx.util.Pair;
import lombok.Getter; import lombok.Getter;
@ -421,9 +418,6 @@ public abstract class DataStorage {
deleteWithChildren(toRemove.toArray(DataStoreEntry[]::new)); deleteWithChildren(toRemove.toArray(DataStoreEntry[]::new));
addStoreEntriesIfNotPresent(toAdd.stream().map(DataStoreEntryRef::get).toArray(DataStoreEntry[]::new)); addStoreEntriesIfNotPresent(toAdd.stream().map(DataStoreEntryRef::get).toArray(DataStoreEntry[]::new));
toUpdate.forEach(pair -> { toUpdate.forEach(pair -> {
// TODO do we need this, it erases any custom information?
// pair.getKey().setStoreInternal(pair.getValue().getStore(), false);
// Update state by merging // Update state by merging
if (pair.getKey().getStorePersistentState() != null if (pair.getKey().getStorePersistentState() != null
&& pair.getValue().get().getStorePersistentState() != null) { && pair.getValue().get().getStorePersistentState() != null) {
@ -434,6 +428,11 @@ public abstract class DataStorage {
// Children classes might not be the same, the same goes for state classes // Children classes might not be the same, the same goes for state classes
// This can happen when there are multiple child classes and the ids got switched around // This can happen when there are multiple child classes and the ids got switched around
if (classMatch) { if (classMatch) {
DataStore merged = ((FixedChildStore) pair.getKey().getStore()).merge(pair.getValue().getStore().asNeeded());
if (merged != pair.getKey().getStore()) {
pair.getKey().setStoreInternal(merged, false);
}
var mergedState = pair.getKey().getStorePersistentState().deepCopy(); var mergedState = pair.getKey().getStorePersistentState().deepCopy();
mergedState.merge(pair.getValue().get().getStorePersistentState()); mergedState.merge(pair.getValue().get().getStorePersistentState());
pair.getKey().setStorePersistentState(mergedState); pair.getKey().setStorePersistentState(mergedState);

View file

@ -161,6 +161,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
// In order to fix this bug which also affects us: // In order to fix this bug which also affects us:
// https://askubuntu.com/questions/1148475/launching-gnome-terminal-from-vscode // https://askubuntu.com/questions/1148475/launching-gnome-terminal-from-vscode
.envrironment("GNOME_TERMINAL_SCREEN", sc -> ""); .envrironment("GNOME_TERMINAL_SCREEN", sc -> "");
pc.executeSimpleCommand(toExecute);
} }
} }
@ -819,7 +820,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
return launchConfiguration -> { return launchConfiguration -> {
var args = toCommand(launchConfiguration); var args = toCommand(launchConfiguration);
args.add(0, executable); args.add(0, executable);
if (explicityAsync) { if (explicitlyAsync) {
args = systemDialect.launchAsnyc(args); args = systemDialect.launchAsnyc(args);
} }
return args.buildSimple(); return args.buildSimple();

View file

@ -1,15 +1,16 @@
package io.xpipe.app.terminal; package io.xpipe.app.terminal;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import io.xpipe.app.issue.ErrorEvent;
import io.xpipe.app.util.CommandSupport; import io.xpipe.app.util.CommandSupport;
import io.xpipe.app.util.LocalShell; import io.xpipe.app.util.LocalShell;
import io.xpipe.app.util.ShellTemp; import io.xpipe.app.util.ShellTemp;
import io.xpipe.app.util.ThreadHelper; import io.xpipe.app.util.ThreadHelper;
import io.xpipe.core.process.CommandBuilder; import io.xpipe.core.process.CommandBuilder;
import io.xpipe.core.process.ShellControl;
import io.xpipe.core.store.FilePath; import io.xpipe.core.store.FilePath;
import io.xpipe.core.util.XPipeInstallation; import io.xpipe.core.util.XPipeInstallation;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
public interface KittyTerminalType extends ExternalTerminalType { public interface KittyTerminalType extends ExternalTerminalType {
ExternalTerminalType KITTY_LINUX = new Linux(); ExternalTerminalType KITTY_LINUX = new Linux();
@ -91,6 +92,15 @@ public interface KittyTerminalType extends ExternalTerminalType {
class Linux implements KittyTerminalType { class Linux implements KittyTerminalType {
public boolean isAvailable() {
try (ShellControl pc = LocalShell.getShell()) {
return pc.executeSimpleBooleanCommand(pc.getShellDialect().getWhichCommand("kitty"));
} catch (Exception e) {
ErrorEvent.fromThrowable(e).omit().handle();
return false;
}
}
@Override @Override
public String getId() { public String getId() {
return "app.kitty"; return "app.kitty";

View file

@ -40,10 +40,6 @@ public class DialogHelper {
}); });
} }
public static Dialog dataStoreFlowQuery(DataFlow flow, DataFlow[] available) {
return Dialog.choice("Flow", (DataFlow o) -> o.getDisplayName(), true, false, flow, available);
}
public static Dialog shellQuery(String displayName, DataStore store) { public static Dialog shellQuery(String displayName, DataStore store) {
var storeName = DataStorage.get().getStoreDisplayName(store).orElse("localhost"); var storeName = DataStorage.get().getStoreDisplayName(store).orElse("localhost");
return Dialog.query(displayName, false, true, false, storeName, QueryConverter.STRING) return Dialog.query(displayName, false, true, false, storeName, QueryConverter.STRING)

View file

@ -23,6 +23,10 @@
-fx-background-radius: 0; -fx-background-radius: 0;
} }
.root.nord .store-section-mini-comp .item:hover, .root.nord:key-navigation .store-section-mini-comp .item:focused {
-fx-background-color: -color-accent-muted;
}
.store-section-mini-comp .item:hover, .root:key-navigation .store-section-mini-comp .item:focused { .store-section-mini-comp .item:hover, .root:key-navigation .store-section-mini-comp .item:focused {
-fx-background-color: -color-accent-subtle; -fx-background-color: -color-accent-subtle;
} }

View file

@ -74,7 +74,7 @@ public class ShellDialects {
CSH = byId("csh"); CSH = byId("csh");
ASH = byId("ash"); ASH = byId("ash");
SH = byId("sh"); SH = byId("sh");
NO_INTERACTION = byId("unsupported"); NO_INTERACTION = byId("noInteraction");
CISCO = byId("cisco"); CISCO = byId("cisco");
MIKROTIK = byId("mikrotik"); MIKROTIK = byId("mikrotik");
RBASH = byId("rbash"); RBASH = byId("rbash");

View file

@ -10,6 +10,6 @@ public class TerminalInitScriptConfig {
TerminalInitFunction terminalSpecificCommands; TerminalInitFunction terminalSpecificCommands;
public static TerminalInitScriptConfig ofName(String name) { public static TerminalInitScriptConfig ofName(String name) {
return new TerminalInitScriptConfig(name, true, null); return new TerminalInitScriptConfig(name, true, TerminalInitFunction.none());
} }
} }

View file

@ -1,32 +0,0 @@
package io.xpipe.core.store;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
@Getter
public enum DataFlow {
@JsonProperty("input")
INPUT("Input"),
@JsonProperty("output")
OUTPUT("Output"),
@JsonProperty("inputOrOutput")
INPUT_OR_OUTPUT("Input or Output"),
@JsonProperty("inputOutput")
INPUT_OUTPUT("Input/Output"),
@JsonProperty("transformer")
TRANSFORMER("Transformer");
private final String displayName;
DataFlow(String displayName) {
this.displayName = displayName;
}
public boolean hasInput() {
return this == INPUT || this == INPUT_OUTPUT;
}
public boolean hasOutput() {
return this == OUTPUT || this == INPUT_OUTPUT;
}
}

View file

@ -5,4 +5,8 @@ import java.util.OptionalInt;
public interface FixedChildStore extends DataStore { public interface FixedChildStore extends DataStore {
OptionalInt getFixedId(); OptionalInt getFixedId();
default FixedChildStore merge(FixedChildStore other) {
return this;
}
} }

View file

@ -56,10 +56,15 @@ public interface SingletonSessionStore<T extends SingletonSessionStore.Session>
return; return;
} }
try {
s = newSession(); s = newSession();
s.start(); s.start();
setCache("session", s); setCache("session", s);
onSessionUpdate(true); onSessionUpdate(true);
} catch (Exception ex) {
onSessionUpdate(false);
throw ex;
}
} }
} }

View file

@ -4,7 +4,6 @@ pwsh=Powershell Core
windowsTerminal=Windows Terminal windowsTerminal=Windows Terminal
windowsTerminalPreview=Windows Terminal Preview windowsTerminalPreview=Windows Terminal Preview
gnomeTerminal=Gnome Terminal gnomeTerminal=Gnome Terminal
createLock=Create lock
tilix=Tilix tilix=Tilix
wezterm=WezTerm wezterm=WezTerm
konsole=Konsole konsole=Konsole
@ -48,8 +47,6 @@ mousepad=Mousepad
pluma=Pluma pluma=Pluma
textEdit=Text Edit textEdit=Text Edit
sublime=Sublime Text sublime=Sublime Text
customTerminalPlaceholder=myterminal -e $CMD
customEditorPlaceholder=myeditor $FILE
nullPointer=Null Pointer nullPointer=Null Pointer
discord=Discord discord=Discord
slack=Slack slack=Slack

View file

@ -70,6 +70,7 @@ customCommand=Brugerdefineret kommando
other=Andet other=Andet
setLock=Indstil lås setLock=Indstil lås
selectConnection=Vælg forbindelse selectConnection=Vælg forbindelse
createLock=Opret adgangssætning
changeLock=Skift adgangssætning changeLock=Skift adgangssætning
test=Test test=Test
lockCreationAlertTitle=Indstil adgangssætning lockCreationAlertTitle=Indstil adgangssætning

View file

@ -73,6 +73,7 @@ customCommand=Benutzerdefinierter Befehl
other=Andere other=Andere
setLock=Sperre setzen setLock=Sperre setzen
selectConnection=Verbindung auswählen selectConnection=Verbindung auswählen
createLock=Passphrase erstellen
changeLock=Passphrase ändern changeLock=Passphrase ändern
test=Test test=Test
lockCreationAlertTitle=Passphrase festlegen lockCreationAlertTitle=Passphrase festlegen

View file

@ -71,6 +71,7 @@ customCommand=Custom command
other=Other other=Other
setLock=Set lock setLock=Set lock
selectConnection=Select connection selectConnection=Select connection
createLock=Create passphrase
changeLock=Change passphrase changeLock=Change passphrase
test=Test test=Test
lockCreationAlertTitle=Set passphrase lockCreationAlertTitle=Set passphrase

View file

@ -69,6 +69,7 @@ customCommand=Comando personalizado
other=Otros other=Otros
setLock=Fijar bloqueo setLock=Fijar bloqueo
selectConnection=Seleccionar conexión selectConnection=Seleccionar conexión
createLock=Crear frase de contraseña
changeLock=Cambiar frase de contraseña changeLock=Cambiar frase de contraseña
test=Prueba test=Prueba
lockCreationAlertTitle=Establecer frase de contraseña lockCreationAlertTitle=Establecer frase de contraseña

View file

@ -69,6 +69,7 @@ customCommand=Commande personnalisée
other=Autre other=Autre
setLock=Verrouiller setLock=Verrouiller
selectConnection=Sélectionner une connexion selectConnection=Sélectionner une connexion
createLock=Créer une phrase de passe
changeLock=Changer de phrase de passe changeLock=Changer de phrase de passe
test=Test test=Test
lockCreationAlertTitle=Définir une phrase de passe lockCreationAlertTitle=Définir une phrase de passe

View file

@ -69,6 +69,7 @@ customCommand=Comando personalizzato
other=Altro other=Altro
setLock=Imposta blocco setLock=Imposta blocco
selectConnection=Seleziona la connessione selectConnection=Seleziona la connessione
createLock=Creare una passphrase
changeLock=Modifica della passphrase changeLock=Modifica della passphrase
test=Test test=Test
lockCreationAlertTitle=Imposta una passphrase lockCreationAlertTitle=Imposta una passphrase

View file

@ -69,6 +69,7 @@ customCommand=カスタムコマンド
other=その他 other=その他
setLock=ロックを設定する setLock=ロックを設定する
selectConnection=接続を選択する selectConnection=接続を選択する
createLock=パスフレーズを作成する
changeLock=パスフレーズを変更する changeLock=パスフレーズを変更する
test=テスト test=テスト
lockCreationAlertTitle=パスフレーズを設定する lockCreationAlertTitle=パスフレーズを設定する

View file

@ -69,6 +69,7 @@ customCommand=Aangepaste opdracht
other=Andere other=Andere
setLock=Slot instellen setLock=Slot instellen
selectConnection=Verbinding selecteren selectConnection=Verbinding selecteren
createLock=Passphrase aanmaken
changeLock=Wachtwoordzin wijzigen changeLock=Wachtwoordzin wijzigen
test=Test test=Test
lockCreationAlertTitle=Passphrase instellen lockCreationAlertTitle=Passphrase instellen

View file

@ -69,6 +69,7 @@ customCommand=Comando personalizado
other=Outro other=Outro
setLock=Definir bloqueio setLock=Definir bloqueio
selectConnection=Selecionar ligação selectConnection=Selecionar ligação
createLock=Cria uma frase-chave
changeLock=Altera a frase-chave changeLock=Altera a frase-chave
test=Testa test=Testa
lockCreationAlertTitle=Define a frase-chave lockCreationAlertTitle=Define a frase-chave

View file

@ -69,6 +69,7 @@ customCommand=Пользовательская команда
other=Другие other=Другие
setLock=Установить замок setLock=Установить замок
selectConnection=Выберите соединение selectConnection=Выберите соединение
createLock=Создание парольной фразы
changeLock=Изменить парольную фразу changeLock=Изменить парольную фразу
test=Тест test=Тест
lockCreationAlertTitle=Установите парольную фразу lockCreationAlertTitle=Установите парольную фразу

View file

@ -69,6 +69,7 @@ customCommand=Özel komut
other=Diğer other=Diğer
setLock=Kilidi ayarla setLock=Kilidi ayarla
selectConnection=Bağlantı seçin selectConnection=Bağlantı seçin
createLock=Parola oluştur
changeLock=Parolayı değiştir changeLock=Parolayı değiştir
test=Test test=Test
lockCreationAlertTitle=Parolayı ayarla lockCreationAlertTitle=Parolayı ayarla

View file

@ -69,6 +69,7 @@ customCommand=自定义命令
other=其他 other=其他
setLock=设置锁定 setLock=设置锁定
selectConnection=选择连接 selectConnection=选择连接
createLock=创建口令
changeLock=更改密码 changeLock=更改密码
test=测试 test=测试
lockCreationAlertTitle=设置口令 lockCreationAlertTitle=设置口令

View file

@ -16,7 +16,8 @@ runTempContainer=Temporärer Container ausführen
vmwareUserDescription=Der Benutzername deines primären Gastbenutzers vmwareUserDescription=Der Benutzername deines primären Gastbenutzers
dockerTempRunAlertTitle=Temporärer Container ausführen dockerTempRunAlertTitle=Temporärer Container ausführen
dockerTempRunAlertHeader=Damit wird ein Shell-Prozess in einem temporären Container ausgeführt, der automatisch entfernt wird, sobald er gestoppt wird. dockerTempRunAlertHeader=Damit wird ein Shell-Prozess in einem temporären Container ausgeführt, der automatisch entfernt wird, sobald er gestoppt wird.
imageName=Bildname #custom
imageName=Imagename
imageNameDescription=Die zu verwendende Kennung des Containerbildes imageNameDescription=Die zu verwendende Kennung des Containerbildes
containerName=Container-Name containerName=Container-Name
containerNameDescription=Der optionale benutzerdefinierte Containername containerNameDescription=Der optionale benutzerdefinierte Containername