diff --git a/app/src/main/java/io/xpipe/app/ext/ActionProvider.java b/app/src/main/java/io/xpipe/app/ext/ActionProvider.java index 94c8b49bd..5bf8986f0 100644 --- a/app/src/main/java/io/xpipe/app/ext/ActionProvider.java +++ b/app/src/main/java/io/xpipe/app/ext/ActionProvider.java @@ -1,8 +1,10 @@ package io.xpipe.app.ext; +import io.xpipe.app.core.AppI18n; import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.storage.DataStoreEntryRef; import io.xpipe.core.store.DataStore; +import io.xpipe.core.util.FailableConsumer; import io.xpipe.core.util.ModuleLayerLoader; import javafx.beans.value.ObservableValue; @@ -130,6 +132,49 @@ public interface ActionProvider { interface LeafDataStoreCallSite extends DataStoreCallSite { + default ActionProvider provider() { + return new ActionProvider() { + @Override + public LeafDataStoreCallSite getLeafDataStoreCallSite() { + return LeafDataStoreCallSite.this; + } + }; + } + + static LeafDataStoreCallSite simple(boolean major, String nameKey, String icon, Class applicableClass, FailableConsumer, Exception> action) { + return new LeafDataStoreCallSite() { + @Override + public boolean isMajor(DataStoreEntryRef o) { + return major; + } + + @Override + public Action createAction(DataStoreEntryRef store) { + return new Action() { + @Override + public void execute() throws Exception { + action.accept(store); + } + }; + } + + @Override + public ObservableValue getName(DataStoreEntryRef store) { + return AppI18n.observable(nameKey); + } + + @Override + public String getIcon(DataStoreEntryRef store) { + return icon; + } + + @Override + public Class getApplicableClass() { + return applicableClass; + } + }; + } + default boolean canLinkTo() { return false; } @@ -149,6 +194,10 @@ public interface ActionProvider { .map(actionProviderProvider -> actionProviderProvider.get()) .toList()); + for (var p : DataStoreProviders.getAll()) { + ALL.addAll(p.getActionProviders()); + } + var menuProviders = ALL.stream() .map(actionProvider -> actionProvider.getBranchDataStoreCallSite() != null && !actionProvider diff --git a/app/src/main/java/io/xpipe/app/ext/DataStoreProvider.java b/app/src/main/java/io/xpipe/app/ext/DataStoreProvider.java index 778479ff0..d0f3097f6 100644 --- a/app/src/main/java/io/xpipe/app/ext/DataStoreProvider.java +++ b/app/src/main/java/io/xpipe/app/ext/DataStoreProvider.java @@ -234,4 +234,8 @@ public interface DataStoreProvider { String getId(); List> getStoreClasses(); + + default List getActionProviders() { + return List.of(); + } } diff --git a/img/proc/tailscale_icon-dark.svg b/img/proc/tailscale_icon-dark.svg new file mode 100644 index 000000000..a0d192491 --- /dev/null +++ b/img/proc/tailscale_icon-dark.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/img/proc/tailscale_icon.svg b/img/proc/tailscale_icon.svg new file mode 100644 index 000000000..572e54385 --- /dev/null +++ b/img/proc/tailscale_icon.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + diff --git a/lang/strings/fixed_en.properties b/lang/strings/fixed_en.properties index 8eea14e33..63f1d2f56 100644 --- a/lang/strings/fixed_en.properties +++ b/lang/strings/fixed_en.properties @@ -99,3 +99,4 @@ ghostty=Ghostty http=HTTP https=HTTPS servicePort=Port $PORT$ +tailscaleNodeScan=Tailscale