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);
}
vb.getChildren().add(rb);
vb.setMinHeight(150);
vb.setMinHeight(130);
}
alert.getDialogPane().setContent(vb);
})

View file

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

View file

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

View file

@ -94,12 +94,12 @@ public abstract class ExternalApplicationType implements PrefsChoiceValue {
public abstract static class PathApplication extends ExternalApplicationType {
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);
this.executable = executable;
this.explicityAsync = explicityAsync;
this.explicitlyAsync = explicitlyAsync;
}
public boolean isAvailable() {
@ -121,7 +121,7 @@ public abstract class ExternalApplicationType implements PrefsChoiceValue {
}
args.add(0, executable);
if (explicityAsync) {
if (explicitlyAsync) {
ExternalApplicationHelper.startAsync(args);
} else {
pc.executeSimpleCommand(args);

View file

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

View file

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

View file

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

View file

@ -5,10 +5,7 @@ import io.xpipe.app.issue.ErrorEvent;
import io.xpipe.app.prefs.AppPrefs;
import io.xpipe.app.util.FixedHierarchyStore;
import io.xpipe.app.util.ThreadHelper;
import io.xpipe.core.store.DataStore;
import io.xpipe.core.store.DataStoreId;
import io.xpipe.core.store.FixedChildStore;
import io.xpipe.core.store.LocalStore;
import io.xpipe.core.store.*;
import io.xpipe.core.util.UuidHelper;
import javafx.util.Pair;
import lombok.Getter;
@ -421,9 +418,6 @@ public abstract class DataStorage {
deleteWithChildren(toRemove.toArray(DataStoreEntry[]::new));
addStoreEntriesIfNotPresent(toAdd.stream().map(DataStoreEntryRef::get).toArray(DataStoreEntry[]::new));
toUpdate.forEach(pair -> {
// TODO do we need this, it erases any custom information?
// pair.getKey().setStoreInternal(pair.getValue().getStore(), false);
// Update state by merging
if (pair.getKey().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
// This can happen when there are multiple child classes and the ids got switched around
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();
mergedState.merge(pair.getValue().get().getStorePersistentState());
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:
// https://askubuntu.com/questions/1148475/launching-gnome-terminal-from-vscode
.envrironment("GNOME_TERMINAL_SCREEN", sc -> "");
pc.executeSimpleCommand(toExecute);
}
}
@ -819,7 +820,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
return launchConfiguration -> {
var args = toCommand(launchConfiguration);
args.add(0, executable);
if (explicityAsync) {
if (explicitlyAsync) {
args = systemDialect.launchAsnyc(args);
}
return args.buildSimple();

View file

@ -1,15 +1,16 @@
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.LocalShell;
import io.xpipe.app.util.ShellTemp;
import io.xpipe.app.util.ThreadHelper;
import io.xpipe.core.process.CommandBuilder;
import io.xpipe.core.process.ShellControl;
import io.xpipe.core.store.FilePath;
import io.xpipe.core.util.XPipeInstallation;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
public interface KittyTerminalType extends ExternalTerminalType {
ExternalTerminalType KITTY_LINUX = new Linux();
@ -91,6 +92,15 @@ public interface KittyTerminalType extends ExternalTerminalType {
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
public String getId() {
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) {
var storeName = DataStorage.get().getStoreDisplayName(store).orElse("localhost");
return Dialog.query(displayName, false, true, false, storeName, QueryConverter.STRING)

View file

@ -23,6 +23,10 @@
-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 {
-fx-background-color: -color-accent-subtle;
}

View file

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

View file

@ -10,6 +10,6 @@ public class TerminalInitScriptConfig {
TerminalInitFunction terminalSpecificCommands;
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 {
OptionalInt getFixedId();
default FixedChildStore merge(FixedChildStore other) {
return this;
}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -16,7 +16,8 @@ runTempContainer=Temporärer Container ausführen
vmwareUserDescription=Der Benutzername deines primären Gastbenutzers
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.
imageName=Bildname
#custom
imageName=Imagename
imageNameDescription=Die zu verwendende Kennung des Containerbildes
containerName=Container-Name
containerNameDescription=Der optionale benutzerdefinierte Containername