Fixes [stage]

This commit is contained in:
crschnick 2024-08-10 10:50:18 +00:00
parent 1caa6cad6b
commit de03207d90
6 changed files with 8 additions and 65 deletions

View file

@ -1,50 +0,0 @@
package io.xpipe.app.comp.base;
import atlantafx.base.theme.Styles;
import io.xpipe.app.fxcomps.SimpleComp;
import io.xpipe.app.fxcomps.impl.TooltipAugment;
import javafx.geometry.Pos;
import javafx.scene.layout.Region;
import lombok.Getter;
import org.kordamp.ikonli.javafx.FontIcon;
import org.kordamp.ikonli.javafx.StackedFontIcon;
@Getter
public class TtyWarningComp extends SimpleComp {
@Override
protected Region createSimple() {
var fi = new FontIcon("mdi2l-lightning-bolt");
fi.getStyleClass().add("inner-icon");
var border = new FontIcon("mdi2s-square-rounded-outline");
border.getStyleClass().add("outer-icon");
border.setOpacity(0.5);
var bg = new FontIcon("mdi2s-square-rounded");
bg.getStyleClass().add("background-icon");
var pane = new StackedFontIcon();
pane.getChildren().addAll(bg, fi, border);
pane.setAlignment(Pos.CENTER);
var style =
"""
.stacked-ikonli-font-icon > .outer-icon { -fx-icon-color: -color-danger-emphasis; }
.stacked-ikonli-font-icon > .outer-icon {
-fx-icon-size: 26px;
}
.stacked-ikonli-font-icon > .background-icon {
-fx-icon-size: 26px;
-fx-icon-color: -color-danger-9;
}
.stacked-ikonli-font-icon > .inner-icon {
-fx-icon-size: 12px;
}
""";
pane.getStylesheets().add(Styles.toDataURI(style));
new TooltipAugment<>("ttyWarning", null).augment(pane);
return pane;
}
}

View file

@ -42,7 +42,7 @@ public class DataStoreFormatter {
return s.getShellDialect().getDisplayName(); return s.getShellDialect().getDisplayName();
} }
var prefix = s.getTtyState() != ShellTtyState.NONE ? "[PTY] " : ""; var prefix = s.getTtyState() != null && s.getTtyState() != ShellTtyState.NONE ? "[PTY] " : "";
return s.isRunning() ? prefix + formattedOsName(s.getOsName()) : "Connection failed"; return s.isRunning() ? prefix + formattedOsName(s.getOsName()) : "Connection failed";
} }

View file

@ -36,6 +36,11 @@ public class ConnectionFileSystem implements FileSystem {
@Override @Override
public FileSystem open() throws Exception { public FileSystem open() throws Exception {
shellControl.start(); shellControl.start();
if (!shellControl.getTtyState().isPreservesOutput() || !shellControl.getTtyState().isSupportsInput()) {
throw new UnsupportedOperationException("Shell has a PTY allocated and does not support file system operations");
}
var d = shellControl.getShellDialect().getDumbMode(); var d = shellControl.getShellDialect().getDumbMode();
if (!d.supportsAnyPossibleInteraction()) { if (!d.supportsAnyPossibleInteraction()) {
shellControl.close(); shellControl.close();

View file

@ -17,6 +17,7 @@ open module io.xpipe.core {
requires com.fasterxml.jackson.databind; requires com.fasterxml.jackson.databind;
requires java.net.http; requires java.net.http;
requires static lombok; requires static lombok;
requires java.sql;
uses com.fasterxml.jackson.databind.Module; uses com.fasterxml.jackson.databind.Module;
uses ProcessControlProvider; uses ProcessControlProvider;

View file

@ -3,7 +3,6 @@ package io.xpipe.ext.base.store;
import io.xpipe.app.browser.session.BrowserSessionModel; import io.xpipe.app.browser.session.BrowserSessionModel;
import io.xpipe.app.comp.base.OsLogoComp; import io.xpipe.app.comp.base.OsLogoComp;
import io.xpipe.app.comp.base.SystemStateComp; import io.xpipe.app.comp.base.SystemStateComp;
import io.xpipe.app.comp.base.TtyWarningComp;
import io.xpipe.app.comp.store.StoreEntryWrapper; import io.xpipe.app.comp.store.StoreEntryWrapper;
import io.xpipe.app.comp.store.StoreSection; import io.xpipe.app.comp.store.StoreSection;
import io.xpipe.app.ext.ActionProvider; import io.xpipe.app.ext.ActionProvider;
@ -14,25 +13,13 @@ import io.xpipe.app.storage.DataStorage;
import io.xpipe.app.storage.DataStoreEntry; import io.xpipe.app.storage.DataStoreEntry;
import io.xpipe.app.util.DataStoreFormatter; import io.xpipe.app.util.DataStoreFormatter;
import io.xpipe.app.util.TerminalLauncher; import io.xpipe.app.util.TerminalLauncher;
import io.xpipe.core.process.ShellStoreState;
import io.xpipe.core.process.ShellTtyState;
import io.xpipe.core.store.ShellStore; import io.xpipe.core.store.ShellStore;
import io.xpipe.ext.base.script.ScriptStore; import io.xpipe.ext.base.script.ScriptStore;
import javafx.beans.binding.Bindings;
import javafx.beans.property.BooleanProperty; import javafx.beans.property.BooleanProperty;
import javafx.beans.value.ObservableValue; import javafx.beans.value.ObservableValue;
public interface ShellStoreProvider extends DataStoreProvider { public interface ShellStoreProvider extends DataStoreProvider {
default Comp<?> createTtyWarning(StoreEntryWrapper w) {
return new TtyWarningComp().hide(Bindings.createObjectBinding(
() -> {
ShellStoreState state = (ShellStoreState) w.getPersistentState().getValue();
return state.getTtyState() == ShellTtyState.NONE;
},
w.getPersistentState()));
}
@Override @Override
default ActionProvider.Action launchAction(DataStoreEntry entry) { default ActionProvider.Action launchAction(DataStoreEntry entry) {
return new ActionProvider.Action() { return new ActionProvider.Action() {

View file

@ -1 +1 @@
11.0-1 11.0-2