Squash merge branch 18-release into master

This commit is contained in:
crschnick
2025-08-15 02:34:05 +00:00
parent 34a08e0877
commit 9d6aa2d340
750 changed files with 12026 additions and 7442 deletions

View File

@@ -17,6 +17,10 @@ import java.util.stream.Collectors;
public class IncusCommandView extends CommandViewBase {
public IncusCommandView(ShellControl shellControl) {
super(shellControl);
}
private static ElevationFunction requiresElevation() {
return new ElevationFunction() {
@Override
@@ -44,10 +48,6 @@ public class IncusCommandView extends CommandViewBase {
};
}
public IncusCommandView(ShellControl shellControl) {
super(shellControl);
}
private static String formatErrorMessage(String s) {
return s;
}

View File

@@ -16,11 +16,6 @@ import java.util.List;
public class IncusContainerActionProviderMenu implements HubBranchProvider<IncusContainerStore> {
@Override
public Class<IncusContainerStore> getApplicableClass() {
return IncusContainerStore.class;
}
@Override
public boolean isMajor(DataStoreEntryRef<IncusContainerStore> o) {
return true;
@@ -36,6 +31,11 @@ public class IncusContainerActionProviderMenu implements HubBranchProvider<Incus
return new LabelGraphic.IconGraphic("mdi2p-package-variant-closed");
}
@Override
public Class<IncusContainerStore> getApplicableClass() {
return IncusContainerStore.class;
}
@Override
public List<HubMenuItemProvider<?>> getChildren(DataStoreEntryRef<IncusContainerStore> store) {
return List.of(

View File

@@ -5,7 +5,7 @@ import io.xpipe.app.core.AppI18n;
import io.xpipe.app.hub.action.HubLeafProvider;
import io.xpipe.app.hub.action.StoreAction;
import io.xpipe.app.storage.DataStoreEntryRef;
import io.xpipe.app.terminal.TerminalLauncher;
import io.xpipe.app.terminal.TerminalLaunch;
import io.xpipe.app.util.LabelGraphic;
import javafx.beans.value.ObservableValue;
@@ -21,8 +21,8 @@ public class IncusContainerConsoleActionProvider implements HubLeafProvider<Incu
}
@Override
public Class<IncusContainerStore> getApplicableClass() {
return IncusContainerStore.class;
public boolean requiresValidStore() {
return false;
}
@Override
@@ -36,8 +36,8 @@ public class IncusContainerConsoleActionProvider implements HubLeafProvider<Incu
}
@Override
public boolean requiresValidStore() {
return false;
public Class<IncusContainerStore> getApplicableClass() {
return IncusContainerStore.class;
}
@Override
@@ -54,7 +54,11 @@ public class IncusContainerConsoleActionProvider implements HubLeafProvider<Incu
var d = (IncusContainerStore) ref.getStore();
var view = new IncusCommandView(
d.getInstall().getStore().getHost().getStore().getOrStartSession());
TerminalLauncher.open(ref.get().getName(), view.console(d.getContainerName()));
TerminalLaunch.builder()
.entry(ref.get())
.title("Console")
.command(view.console(d.getName()))
.launch();
}
}
}

View File

@@ -5,7 +5,7 @@ import io.xpipe.app.core.AppI18n;
import io.xpipe.app.hub.action.HubLeafProvider;
import io.xpipe.app.hub.action.StoreAction;
import io.xpipe.app.storage.DataStoreEntryRef;
import io.xpipe.app.terminal.TerminalLauncher;
import io.xpipe.app.terminal.TerminalLaunch;
import io.xpipe.app.util.LabelGraphic;
import javafx.beans.value.ObservableValue;
@@ -21,8 +21,8 @@ public class IncusContainerEditConfigActionProvider implements HubLeafProvider<I
}
@Override
public Class<IncusContainerStore> getApplicableClass() {
return IncusContainerStore.class;
public boolean requiresValidStore() {
return false;
}
@Override
@@ -36,8 +36,8 @@ public class IncusContainerEditConfigActionProvider implements HubLeafProvider<I
}
@Override
public boolean requiresValidStore() {
return false;
public Class<IncusContainerStore> getApplicableClass() {
return IncusContainerStore.class;
}
@Override
@@ -49,17 +49,21 @@ public class IncusContainerEditConfigActionProvider implements HubLeafProvider<I
@SuperBuilder
public static class Action extends StoreAction<IncusContainerStore> {
@Override
public boolean isMutation() {
return true;
}
@Override
public void executeImpl() throws Exception {
var d = (IncusContainerStore) ref.getStore();
var view = new IncusCommandView(
d.getInstall().getStore().getHost().getStore().getOrStartSession());
TerminalLauncher.open(ref.get().getName(), view.configEdit(d.getContainerName()));
TerminalLaunch.builder()
.entry(ref.get())
.title("Config")
.command(view.configEdit(d.getName()))
.launch();
}
@Override
public boolean isMutation() {
return true;
}
}
}

View File

@@ -25,8 +25,8 @@ public class IncusContainerEditRunConfigActionProvider implements HubLeafProvide
}
@Override
public Class<IncusContainerStore> getApplicableClass() {
return IncusContainerStore.class;
public boolean requiresValidStore() {
return false;
}
@Override
@@ -40,8 +40,8 @@ public class IncusContainerEditRunConfigActionProvider implements HubLeafProvide
}
@Override
public boolean requiresValidStore() {
return false;
public Class<IncusContainerStore> getApplicableClass() {
return IncusContainerStore.class;
}
@Override
@@ -53,11 +53,6 @@ public class IncusContainerEditRunConfigActionProvider implements HubLeafProvide
@SuperBuilder
public static class Action extends StoreAction<IncusContainerStore> {
@Override
public boolean isMutation() {
return true;
}
@Override
public void executeImpl() throws Exception {
var d = (IncusContainerStore) ref.getStore();
@@ -73,5 +68,10 @@ public class IncusContainerEditRunConfigActionProvider implements HubLeafProvide
AppLayoutModel.get().selectBrowser();
BrowserFileOpener.openInTextEditor(model, found.get());
}
@Override
public boolean isMutation() {
return true;
}
}
}

View File

@@ -38,12 +38,6 @@ public class IncusContainerStore
String containerName;
IdentityValue identity;
@Override
public FixedChildStore merge(FixedChildStore other) {
var o = (IncusContainerStore) other;
return toBuilder().identity(identity != null ? identity : o.identity).build();
}
@Override
public Class<ContainerStoreState> getStateClass() {
return ContainerStoreState.class;
@@ -65,15 +59,16 @@ public class IncusContainerStore
return OptionalInt.of(Objects.hash(containerName));
}
@Override
public FixedChildStore merge(FixedChildStore other) {
var o = (IncusContainerStore) other;
return toBuilder().identity(identity != null ? identity : o.identity).build();
}
@Override
public ShellControlFunction shellFunction() {
return new ShellControlParentStoreFunction() {
@Override
public ShellStore getParentStore() {
return getInstall().getStore().getHost().getStore();
}
@Override
public ShellControl control(ShellControl parent) throws Exception {
refreshContainerState(
@@ -107,6 +102,11 @@ public class IncusContainerStore
return sc;
}
@Override
public ShellStore getParentStore() {
return getInstall().getStore().getHost().getStore();
}
};
}

View File

@@ -33,13 +33,16 @@ public class IncusContainerStoreProvider implements ShellStoreProvider {
}
@Override
public DocumentationLink getHelpLink() {
return DocumentationLink.LXC;
public ObservableValue<String> informationString(StoreSection section) {
var c = (ContainerStoreState) section.getWrapper().getPersistentState().getValue();
var missing = c.getShellMissing() != null && c.getShellMissing() ? "No shell available" : null;
return StoreStateFormat.shellStore(section, (ContainerStoreState s) ->
new String[] {missing, DataStoreFormatter.capitalize(s.getContainerState())});
}
@Override
public String getDisplayIconFileName(DataStore store) {
return "system:lxd_icon.svg";
public DocumentationLink getHelpLink() {
return DocumentationLink.LXC;
}
@Override
@@ -91,11 +94,8 @@ public class IncusContainerStoreProvider implements ShellStoreProvider {
}
@Override
public ObservableValue<String> informationString(StoreSection section) {
var c = (ContainerStoreState) section.getWrapper().getPersistentState().getValue();
var missing = c.getShellMissing() != null && c.getShellMissing() ? "No shell available" : null;
return StoreStateFormat.shellStore(section, (ContainerStoreState s) ->
new String[] {missing, DataStoreFormatter.capitalize(s.getContainerState())});
public String getDisplayIconFileName(DataStore store) {
return "system:lxd_icon.svg";
}
@Override

View File

@@ -22,11 +22,6 @@ public class IncusInstallStoreProvider implements DataStoreProvider {
return DocumentationLink.LXC;
}
@Override
public DataStoreUsageCategory getUsageCategory() {
return DataStoreUsageCategory.GROUP;
}
@Override
public StoreEntryComp customEntryComp(StoreSection sec, boolean preferLarge) {
var nonRunning = StoreToggleComp.<IncusInstallStore>childrenToggle(
@@ -49,6 +44,11 @@ public class IncusInstallStoreProvider implements DataStoreProvider {
}));
}
@Override
public DataStoreUsageCategory getUsageCategory() {
return DataStoreUsageCategory.GROUP;
}
@Override
public DataStoreEntry getDisplayParent(DataStoreEntry store) {
IncusInstallStore s = store.getStore().asNeeded();

View File

@@ -22,11 +22,6 @@ public class LxdCmdStoreProvider implements DataStoreProvider {
return DocumentationLink.LXC;
}
@Override
public DataStoreUsageCategory getUsageCategory() {
return DataStoreUsageCategory.GROUP;
}
@Override
public StoreEntryComp customEntryComp(StoreSection sec, boolean preferLarge) {
var nonRunning = StoreToggleComp.<LxdCmdStore>childrenToggle(
@@ -49,6 +44,11 @@ public class LxdCmdStoreProvider implements DataStoreProvider {
}));
}
@Override
public DataStoreUsageCategory getUsageCategory() {
return DataStoreUsageCategory.GROUP;
}
@Override
public DataStoreEntry getDisplayParent(DataStoreEntry store) {
LxdCmdStore s = store.getStore().asNeeded();

View File

@@ -18,6 +18,10 @@ import java.util.stream.Collectors;
public class LxdCommandView extends CommandViewBase {
public LxdCommandView(ShellControl shellControl) {
super(shellControl);
}
private static ElevationFunction requiresElevation() {
return new ElevationFunction() {
@Override
@@ -37,16 +41,13 @@ public class LxdCommandView extends CommandViewBase {
// path
return !shellControl
.command(
"test -S /var/lib/lxd/unix.socket && test -w /var/lib/lxd/unix.socket || test -S /var/snap/lxd/common/lxd/unix.socket && test -w /var/snap/lxd/common/lxd/unix.socket")
"test -S /var/lib/lxd/unix.socket && test -w /var/lib/lxd/unix.socket || test -S /var/snap/lxd/common/lxd/unix"
+ ".socket && test -w /var/snap/lxd/common/lxd/unix.socket")
.executeAndCheck();
}
};
}
public LxdCommandView(ShellControl shellControl) {
super(shellControl);
}
private static String formatErrorMessage(String s) {
return s;
}

View File

@@ -16,11 +16,6 @@ import java.util.List;
public class LxdContainerActionProviderMenu implements HubBranchProvider<LxdContainerStore> {
@Override
public Class<LxdContainerStore> getApplicableClass() {
return LxdContainerStore.class;
}
@Override
public boolean isMajor(DataStoreEntryRef<LxdContainerStore> o) {
return true;
@@ -36,6 +31,11 @@ public class LxdContainerActionProviderMenu implements HubBranchProvider<LxdCont
return new LabelGraphic.IconGraphic("mdi2p-package-variant-closed");
}
@Override
public Class<LxdContainerStore> getApplicableClass() {
return LxdContainerStore.class;
}
@Override
public List<HubMenuItemProvider<?>> getChildren(DataStoreEntryRef<LxdContainerStore> store) {
return List.of(

View File

@@ -5,7 +5,7 @@ import io.xpipe.app.core.AppI18n;
import io.xpipe.app.hub.action.HubLeafProvider;
import io.xpipe.app.hub.action.StoreAction;
import io.xpipe.app.storage.DataStoreEntryRef;
import io.xpipe.app.terminal.TerminalLauncher;
import io.xpipe.app.terminal.TerminalLaunch;
import io.xpipe.app.util.LabelGraphic;
import javafx.beans.value.ObservableValue;
@@ -21,8 +21,8 @@ public class LxdContainerConsoleActionProvider implements HubLeafProvider<LxdCon
}
@Override
public Class<LxdContainerStore> getApplicableClass() {
return LxdContainerStore.class;
public boolean requiresValidStore() {
return false;
}
@Override
@@ -36,8 +36,8 @@ public class LxdContainerConsoleActionProvider implements HubLeafProvider<LxdCon
}
@Override
public boolean requiresValidStore() {
return false;
public Class<LxdContainerStore> getApplicableClass() {
return LxdContainerStore.class;
}
@Override
@@ -54,7 +54,11 @@ public class LxdContainerConsoleActionProvider implements HubLeafProvider<LxdCon
var d = ref.getStore();
var view = new LxdCommandView(
d.getCmd().getStore().getHost().getStore().getOrStartSession());
TerminalLauncher.open(ref.get().getName(), view.console(d.getContainerName()));
TerminalLaunch.builder()
.entry(ref.get())
.title("Console")
.command(view.console(d.getName()))
.launch();
}
}
}

View File

@@ -5,7 +5,7 @@ import io.xpipe.app.core.AppI18n;
import io.xpipe.app.hub.action.HubLeafProvider;
import io.xpipe.app.hub.action.StoreAction;
import io.xpipe.app.storage.DataStoreEntryRef;
import io.xpipe.app.terminal.TerminalLauncher;
import io.xpipe.app.terminal.TerminalLaunch;
import io.xpipe.app.util.LabelGraphic;
import javafx.beans.value.ObservableValue;
@@ -21,8 +21,8 @@ public class LxdContainerEditConfigActionProvider implements HubLeafProvider<Lxd
}
@Override
public Class<LxdContainerStore> getApplicableClass() {
return LxdContainerStore.class;
public boolean requiresValidStore() {
return false;
}
@Override
@@ -36,8 +36,8 @@ public class LxdContainerEditConfigActionProvider implements HubLeafProvider<Lxd
}
@Override
public boolean requiresValidStore() {
return false;
public Class<LxdContainerStore> getApplicableClass() {
return LxdContainerStore.class;
}
@Override
@@ -49,17 +49,21 @@ public class LxdContainerEditConfigActionProvider implements HubLeafProvider<Lxd
@SuperBuilder
public static class Action extends StoreAction<LxdContainerStore> {
@Override
public boolean isMutation() {
return true;
}
@Override
public void executeImpl() throws Exception {
var d = ref.getStore();
var view = new LxdCommandView(
d.getCmd().getStore().getHost().getStore().getOrStartSession());
TerminalLauncher.open(ref.get().getName(), view.configEdit(d.getContainerName()));
TerminalLaunch.builder()
.entry(ref.get())
.title("Config")
.command(view.configEdit(d.getName()))
.launch();
}
@Override
public boolean isMutation() {
return true;
}
}
}

View File

@@ -25,8 +25,8 @@ public class LxdContainerEditRunConfigActionProvider implements HubLeafProvider<
}
@Override
public Class<LxdContainerStore> getApplicableClass() {
return LxdContainerStore.class;
public boolean requiresValidStore() {
return false;
}
@Override
@@ -40,8 +40,8 @@ public class LxdContainerEditRunConfigActionProvider implements HubLeafProvider<
}
@Override
public boolean requiresValidStore() {
return false;
public Class<LxdContainerStore> getApplicableClass() {
return LxdContainerStore.class;
}
@Override
@@ -53,11 +53,6 @@ public class LxdContainerEditRunConfigActionProvider implements HubLeafProvider<
@SuperBuilder
public static class Action extends StoreAction<LxdContainerStore> {
@Override
public boolean isMutation() {
return true;
}
@Override
public void executeImpl() throws Exception {
var d = ref.getStore();
@@ -73,5 +68,10 @@ public class LxdContainerEditRunConfigActionProvider implements HubLeafProvider<
AppLayoutModel.get().selectBrowser();
BrowserFileOpener.openInTextEditor(model, found.get());
}
@Override
public boolean isMutation() {
return true;
}
}
}

View File

@@ -36,12 +36,6 @@ public class LxdContainerStore
String containerName;
IdentityValue identity;
@Override
public FixedChildStore merge(FixedChildStore other) {
var o = (LxdContainerStore) other;
return toBuilder().identity(identity != null ? identity : o.identity).build();
}
@Override
public String getName() {
return containerName;
@@ -68,15 +62,16 @@ public class LxdContainerStore
return OptionalInt.of(Objects.hash(containerName));
}
@Override
public FixedChildStore merge(FixedChildStore other) {
var o = (LxdContainerStore) other;
return toBuilder().identity(identity != null ? identity : o.identity).build();
}
@Override
public ShellControlFunction shellFunction() {
return new ShellControlParentStoreFunction() {
@Override
public ShellStore getParentStore() {
return getCmd().getStore().getHost().getStore();
}
@Override
public ShellControl control(ShellControl parent) throws Exception {
refreshContainerState(getCmd().getStore().getHost().getStore().getOrStartSession());
@@ -108,6 +103,11 @@ public class LxdContainerStore
});
return sc;
}
@Override
public ShellStore getParentStore() {
return getCmd().getStore().getHost().getStore();
}
};
}

View File

@@ -32,6 +32,14 @@ public class LxdContainerStoreProvider implements ShellStoreProvider {
}));
}
@Override
public ObservableValue<String> informationString(StoreSection section) {
var c = (ContainerStoreState) section.getWrapper().getPersistentState().getValue();
var missing = c.getShellMissing() != null && c.getShellMissing() ? "No shell available" : null;
return StoreStateFormat.shellStore(section, (ContainerStoreState s) ->
new String[] {missing, DataStoreFormatter.capitalize(s.getContainerState())});
}
@Override
public DocumentationLink getHelpLink() {
return DocumentationLink.LXC;
@@ -85,14 +93,6 @@ public class LxdContainerStoreProvider implements ShellStoreProvider {
return q;
}
@Override
public ObservableValue<String> informationString(StoreSection section) {
var c = (ContainerStoreState) section.getWrapper().getPersistentState().getValue();
var missing = c.getShellMissing() != null && c.getShellMissing() ? "No shell available" : null;
return StoreStateFormat.shellStore(section, (ContainerStoreState s) ->
new String[] {missing, DataStoreFormatter.capitalize(s.getContainerState())});
}
@Override
public String getId() {
return "lxd";

View File

@@ -24,11 +24,6 @@ public class PodmanCmdStoreProvider implements DataStoreProvider {
return DocumentationLink.PODMAN;
}
@Override
public DataStoreUsageCategory getUsageCategory() {
return DataStoreUsageCategory.GROUP;
}
@Override
public StoreEntryComp customEntryComp(StoreSection sec, boolean preferLarge) {
var nonRunning = StoreToggleComp.<PodmanCmdStore>childrenToggle(
@@ -49,6 +44,11 @@ public class PodmanCmdStoreProvider implements DataStoreProvider {
}));
}
@Override
public DataStoreUsageCategory getUsageCategory() {
return DataStoreUsageCategory.GROUP;
}
@Override
public DataStoreEntry getDisplayParent(DataStoreEntry store) {
PodmanCmdStore s = store.getStore().asNeeded();

View File

@@ -17,12 +17,6 @@ public class PodmanCommandView extends CommandViewBase {
super(shellControl);
}
@Override
public PodmanCommandView start() throws Exception {
shellControl.start();
return this;
}
private static String formatErrorMessage(String s) {
return "Podman connection failed:\n" + s;
}
@@ -37,6 +31,12 @@ public class PodmanCommandView extends CommandViewBase {
"OCI runtime attempted to invoke a command that was not found");
}
@Override
public PodmanCommandView start() throws Exception {
shellControl.start();
return this;
}
@Override
protected CommandControl build(Consumer<CommandBuilder> builder) {
var cmd = CommandBuilder.of().add("podman");
@@ -69,12 +69,6 @@ public class PodmanCommandView extends CommandViewBase {
public class Container extends CommandView {
@Override
public Container start() throws Exception {
shellControl.start();
return this;
}
public String queryState(String container) throws Exception {
return build(commandBuilder -> commandBuilder.add(
"ls", "-a", "-f", "name=\"^" + container + "$\"", "--format=\"{{.Status}}\""))
@@ -94,11 +88,10 @@ public class PodmanCommandView extends CommandViewBase {
return PodmanCommandView.this.getShellControl();
}
@Value
public static class ContainerEntry {
String name;
String image;
String status;
@Override
public Container start() throws Exception {
shellControl.start();
return this;
}
public List<ContainerEntry> listContainersAndStates() throws Exception {
@@ -172,5 +165,12 @@ public class PodmanCommandView extends CommandViewBase {
public CommandControl logs(String container) {
return build(commandBuilder -> commandBuilder.add("logs").add("-f").addQuoted(container));
}
@Value
public static class ContainerEntry {
String name;
String image;
String status;
}
}
}

View File

@@ -15,11 +15,6 @@ import java.util.List;
public class PodmanContainerActionProviderMenu implements HubBranchProvider<PodmanContainerStore> {
@Override
public Class<PodmanContainerStore> getApplicableClass() {
return PodmanContainerStore.class;
}
@Override
public boolean isMajor(DataStoreEntryRef<PodmanContainerStore> o) {
return true;
@@ -35,6 +30,11 @@ public class PodmanContainerActionProviderMenu implements HubBranchProvider<Podm
return new LabelGraphic.IconGraphic("mdi2p-package-variant-closed");
}
@Override
public Class<PodmanContainerStore> getApplicableClass() {
return PodmanContainerStore.class;
}
@Override
public List<HubMenuItemProvider<?>> getChildren(DataStoreEntryRef<PodmanContainerStore> store) {
return List.of(

View File

@@ -4,7 +4,7 @@ import io.xpipe.app.core.AppI18n;
import io.xpipe.app.hub.action.HubLeafProvider;
import io.xpipe.app.hub.action.StoreAction;
import io.xpipe.app.storage.DataStoreEntryRef;
import io.xpipe.app.terminal.TerminalLauncher;
import io.xpipe.app.terminal.TerminalLaunch;
import io.xpipe.app.util.LabelGraphic;
import javafx.beans.value.ObservableValue;
@@ -19,11 +19,6 @@ public class PodmanContainerAttachActionProvider implements HubLeafProvider<Podm
return Action.builder().ref(ref).build();
}
@Override
public Class<PodmanContainerStore> getApplicableClass() {
return PodmanContainerStore.class;
}
@Override
public ObservableValue<String> getName(DataStoreEntryRef<PodmanContainerStore> store) {
return AppI18n.observable("attachContainer");
@@ -34,6 +29,11 @@ public class PodmanContainerAttachActionProvider implements HubLeafProvider<Podm
return new LabelGraphic.IconGraphic("mdi2a-attachment");
}
@Override
public Class<PodmanContainerStore> getApplicableClass() {
return PodmanContainerStore.class;
}
@Override
public String getId() {
return "attachPodmanContainer";
@@ -47,7 +47,11 @@ public class PodmanContainerAttachActionProvider implements HubLeafProvider<Podm
public void executeImpl() throws Exception {
var d = ref.getStore();
var view = d.commandView(d.getCmd().getStore().getHost().getStore().getOrStartSession());
TerminalLauncher.open(ref.get().getName(), view.attach(d.getContainerName()));
TerminalLaunch.builder()
.entry(ref.get())
.title("Attach")
.command(view.attach(d.getContainerName()))
.launch();
}
}
}

View File

@@ -20,11 +20,6 @@ public class PodmanContainerInspectActionProvider implements HubLeafProvider<Pod
return Action.builder().ref(ref).build();
}
@Override
public Class<PodmanContainerStore> getApplicableClass() {
return PodmanContainerStore.class;
}
@Override
public ObservableValue<String> getName(DataStoreEntryRef<PodmanContainerStore> store) {
return AppI18n.observable("inspectContainer");
@@ -35,6 +30,11 @@ public class PodmanContainerInspectActionProvider implements HubLeafProvider<Pod
return new LabelGraphic.IconGraphic("mdi2i-information-outline");
}
@Override
public Class<PodmanContainerStore> getApplicableClass() {
return PodmanContainerStore.class;
}
@Override
public String getId() {
return "inspectPodmanContainer";

View File

@@ -5,7 +5,7 @@ import io.xpipe.app.core.AppI18n;
import io.xpipe.app.hub.action.HubLeafProvider;
import io.xpipe.app.hub.action.StoreAction;
import io.xpipe.app.storage.DataStoreEntryRef;
import io.xpipe.app.terminal.TerminalLauncher;
import io.xpipe.app.terminal.TerminalLaunch;
import io.xpipe.app.util.LabelGraphic;
import javafx.beans.value.ObservableValue;
@@ -20,11 +20,6 @@ public class PodmanContainerLogsActionProvider implements HubLeafProvider<Podman
return Action.builder().ref(ref).build();
}
@Override
public Class<PodmanContainerStore> getApplicableClass() {
return PodmanContainerStore.class;
}
@Override
public ObservableValue<String> getName(DataStoreEntryRef<PodmanContainerStore> store) {
return AppI18n.observable("containerLogs");
@@ -35,6 +30,11 @@ public class PodmanContainerLogsActionProvider implements HubLeafProvider<Podman
return new LabelGraphic.IconGraphic("mdi2v-view-list-outline");
}
@Override
public Class<PodmanContainerStore> getApplicableClass() {
return PodmanContainerStore.class;
}
@Override
public String getId() {
return "openPodmanContainerLogs";
@@ -48,7 +48,11 @@ public class PodmanContainerLogsActionProvider implements HubLeafProvider<Podman
public void executeImpl() throws Exception {
var d = (PodmanContainerStore) ref.getStore();
var view = d.commandView(d.getCmd().getStore().getHost().getStore().getOrStartSession());
TerminalLauncher.open(ref.get().getName(), view.logs(d.getContainerName()));
TerminalLaunch.builder()
.entry(ref.get())
.title("Logs")
.command(view.logs(d.getContainerName()))
.launch();
}
}
}

View File

@@ -125,11 +125,6 @@ public class PodmanContainerStore
public ShellControlFunction shellFunction() {
return new ShellControlParentStoreFunction() {
@Override
public ShellStore getParentStore() {
return getCmd().getStore().getHost().getStore();
}
@Override
public ShellControl control(ShellControl parent) throws Exception {
refreshContainerState(getCmd().getStore().getHost().getStore().getOrStartSession());
@@ -151,6 +146,11 @@ public class PodmanContainerStore
});
return pc;
}
@Override
public ShellStore getParentStore() {
return getCmd().getStore().getHost().getStore();
}
};
}

View File

@@ -24,18 +24,12 @@ public class PodmanContainerStoreProvider implements ShellStoreProvider {
return DocumentationLink.PODMAN;
}
public Comp<?> stateDisplay(StoreEntryWrapper w) {
return new OsLogoComp(w, BindingsHelper.map(w.getPersistentState(), o -> {
var state = (ContainerStoreState) o;
var cs = state.getContainerState();
if (cs != null && cs.toLowerCase().contains("exited")) {
return SystemStateComp.State.FAILURE;
} else if (cs != null && cs.toLowerCase().contains("up")) {
return SystemStateComp.State.SUCCESS;
} else {
return SystemStateComp.State.OTHER;
}
}));
@Override
public boolean shouldShow(StoreEntryWrapper w) {
PodmanContainerStore s = w.getEntry().getStore().asNeeded();
var state = s.getState();
return Boolean.TRUE.equals(state.getRunning())
|| s.getCmd().getStore().getState().isShowNonRunning();
}
public void onParentRefresh(DataStoreEntry entry) {
@@ -46,14 +40,6 @@ public class PodmanContainerStoreProvider implements ShellStoreProvider {
}
}
@Override
public boolean shouldShow(StoreEntryWrapper w) {
PodmanContainerStore s = w.getEntry().getStore().asNeeded();
var state = s.getState();
return Boolean.TRUE.equals(state.getRunning())
|| s.getCmd().getStore().getState().isShowNonRunning();
}
@Override
public boolean shouldShowScan() {
return false;
@@ -85,14 +71,6 @@ public class PodmanContainerStoreProvider implements ShellStoreProvider {
return new GuiDialog(q, val);
}
@Override
public ObservableValue<String> informationString(StoreSection section) {
var c = (ContainerStoreState) section.getWrapper().getPersistentState().getValue();
var missing = c.getShellMissing() != null && c.getShellMissing() ? "No shell available" : null;
return StoreStateFormat.shellStore(
section, (ContainerStoreState s) -> new String[] {missing, s.getContainerState()});
}
@Override
public String getDisplayIconFileName(DataStore store) {
return "system:podman_icon.svg";
@@ -107,4 +85,26 @@ public class PodmanContainerStoreProvider implements ShellStoreProvider {
public List<Class<?>> getStoreClasses() {
return List.of(PodmanContainerStore.class);
}
public Comp<?> stateDisplay(StoreEntryWrapper w) {
return new OsLogoComp(w, BindingsHelper.map(w.getPersistentState(), o -> {
var state = (ContainerStoreState) o;
var cs = state.getContainerState();
if (cs != null && cs.toLowerCase().contains("exited")) {
return SystemStateComp.State.FAILURE;
} else if (cs != null && cs.toLowerCase().contains("up")) {
return SystemStateComp.State.SUCCESS;
} else {
return SystemStateComp.State.OTHER;
}
}));
}
@Override
public ObservableValue<String> informationString(StoreSection section) {
var c = (ContainerStoreState) section.getWrapper().getPersistentState().getValue();
var missing = c.getShellMissing() != null && c.getShellMissing() ? "No shell available" : null;
return StoreStateFormat.shellStore(
section, (ContainerStoreState s) -> new String[] {missing, s.getContainerState()});
}
}