mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-25 00:50:31 +00:00
Script fixes
This commit is contained in:
parent
4640e10ac0
commit
b2a988ac06
14 changed files with 74 additions and 6 deletions
|
@ -40,8 +40,7 @@ public class StoreCreationMenu {
|
|||
menu.getItems()
|
||||
.add(category("addTunnel", "mdi2v-vector-polyline-plus", DataStoreCreationCategory.TUNNEL, null));
|
||||
|
||||
menu.getItems()
|
||||
.add(category("addCommand", "mdi2c-code-greater-than", DataStoreCreationCategory.COMMAND, "cmd"));
|
||||
// menu.getItems().add(category("addCommand", "mdi2c-code-greater-than", DataStoreCreationCategory.COMMAND, "cmd"));
|
||||
|
||||
menu.getItems().add(category("addDatabase", "mdi2d-database-plus", DataStoreCreationCategory.DATABASE, null));
|
||||
}
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package io.xpipe.ext.base.action;
|
||||
|
||||
import io.xpipe.app.comp.store.StoreViewState;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.ext.ActionProvider;
|
||||
import io.xpipe.app.storage.DataStoreEntryRef;
|
||||
import io.xpipe.app.util.TerminalLauncher;
|
||||
import io.xpipe.core.process.ShellStoreState;
|
||||
import io.xpipe.core.store.LocalStore;
|
||||
import io.xpipe.core.store.ShellStore;
|
||||
import io.xpipe.ext.base.script.ScriptHierarchy;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
|
@ -16,7 +18,7 @@ import java.util.List;
|
|||
public class RunScriptActionMenu implements ActionProvider {
|
||||
|
||||
@Value
|
||||
private static class ScriptAction implements ActionProvider {
|
||||
private static class ScriptActionProvider implements ActionProvider {
|
||||
|
||||
ScriptHierarchy hierarchy;
|
||||
|
||||
|
@ -96,7 +98,43 @@ public class RunScriptActionMenu implements ActionProvider {
|
|||
|
||||
@Override
|
||||
public List<? extends ActionProvider> getChildren(DataStoreEntryRef<ShellStore> store) {
|
||||
return hierarchy.getChildren().stream().map(c -> new ScriptAction(c)).toList();
|
||||
return hierarchy.getChildren().stream().map(c -> new ScriptActionProvider(c)).toList();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private static class NoScriptsActionProvider implements ActionProvider {
|
||||
|
||||
private static class Action implements ActionProvider.Action {
|
||||
|
||||
@Override
|
||||
public void execute() throws Exception {
|
||||
StoreViewState.get().getAllScriptsCategory().select();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public LeafDataStoreCallSite<?> getLeafDataStoreCallSite() {
|
||||
return new LeafDataStoreCallSite<ShellStore>() {
|
||||
@Override
|
||||
public Action createAction(DataStoreEntryRef<ShellStore> store) {
|
||||
return new Action();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(DataStoreEntryRef<ShellStore> store) {
|
||||
return AppI18n.observable("noScriptsAvailable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIcon(DataStoreEntryRef<ShellStore> store) {
|
||||
return "mdi2i-image-filter-none";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getApplicableClass() {
|
||||
return ShellStore.class;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -131,11 +169,25 @@ public class RunScriptActionMenu implements ActionProvider {
|
|||
return "mdi2p-play-box-multiple-outline";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(DataStoreEntryRef<ShellStore> o) {
|
||||
if (o.getStore() instanceof LocalStore) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var state = o.getEntry().getStorePersistentState();
|
||||
if (!(state instanceof ShellStoreState shellStoreState) || shellStoreState.getShellDialect() == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends ActionProvider> getChildren(DataStoreEntryRef<ShellStore> store) {
|
||||
var state = store.getEntry().getStorePersistentState();
|
||||
if (!(state instanceof ShellStoreState shellStoreState) || shellStoreState.getShellDialect() == null) {
|
||||
return List.of();
|
||||
return List.of(new NoScriptsActionProvider());
|
||||
}
|
||||
|
||||
var hierarchy = ScriptHierarchy.buildEnabledHierarchy(ref -> {
|
||||
|
@ -149,7 +201,12 @@ public class RunScriptActionMenu implements ActionProvider {
|
|||
|
||||
return true;
|
||||
});
|
||||
return hierarchy.getChildren().stream().map(c -> new ScriptAction(c)).toList();
|
||||
var list = hierarchy.getChildren().stream().map(c -> new ScriptActionProvider(c)).toList();
|
||||
if (list.isEmpty()) {
|
||||
return List.of(new NoScriptsActionProvider());
|
||||
} else {
|
||||
return list;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -173,3 +173,4 @@ hasServices=$COUNT$ tilgængelige tjenester
|
|||
hasService=$COUNT$ tilgængelig tjeneste
|
||||
openHttp=Åben HTTP-tjeneste
|
||||
openHttps=Åben HTTPS-tjeneste
|
||||
noScriptsAvailable=Ingen tilgængelige scripts
|
||||
|
|
|
@ -164,3 +164,4 @@ hasServices=$COUNT$ verfügbare Dienste
|
|||
hasService=$COUNT$ verfügbarer Dienst
|
||||
openHttp=Offener HTTP-Dienst
|
||||
openHttps=HTTPS-Dienst öffnen
|
||||
noScriptsAvailable=Keine Skripte verfügbar
|
||||
|
|
|
@ -162,5 +162,6 @@ hasServices=$COUNT$ available services
|
|||
hasService=$COUNT$ available service
|
||||
openHttp=Open HTTP service
|
||||
openHttps=Open HTTPS service
|
||||
noScriptsAvailable=No scripts available
|
||||
|
||||
|
||||
|
|
|
@ -162,3 +162,4 @@ hasServices=$COUNT$ servicios disponibles
|
|||
hasService=$COUNT$ servicio disponible
|
||||
openHttp=Servicio HTTP abierto
|
||||
openHttps=Abrir servicio HTTPS
|
||||
noScriptsAvailable=No hay guiones disponibles
|
||||
|
|
|
@ -162,3 +162,4 @@ hasServices=$COUNT$ services disponibles
|
|||
hasService=$COUNT$ service disponible
|
||||
openHttp=Service HTTP ouvert
|
||||
openHttps=Service HTTPS ouvert
|
||||
noScriptsAvailable=Pas de scripts disponibles
|
||||
|
|
|
@ -162,3 +162,4 @@ hasServices=$COUNT$ servizi disponibili
|
|||
hasService=$COUNT$ servizio disponibile
|
||||
openHttp=Servizio HTTP aperto
|
||||
openHttps=Servizio HTTPS aperto
|
||||
noScriptsAvailable=Non sono disponibili script
|
||||
|
|
|
@ -162,3 +162,4 @@ hasServices=$COUNT$ 利用可能なサービス
|
|||
hasService=$COUNT$ 利用可能なサービス
|
||||
openHttp=オープンHTTPサービス
|
||||
openHttps=HTTPSサービスを開く
|
||||
noScriptsAvailable=スクリプトはない
|
||||
|
|
|
@ -162,3 +162,4 @@ hasServices=$COUNT$ beschikbare diensten
|
|||
hasService=$COUNT$ beschikbare dienst
|
||||
openHttp=Open HTTP service
|
||||
openHttps=Open HTTPS service
|
||||
noScriptsAvailable=Geen scripts beschikbaar
|
||||
|
|
|
@ -162,3 +162,4 @@ hasServices=$COUNT$ serviços disponíveis
|
|||
hasService=$COUNT$ serviço disponível
|
||||
openHttp=Abre o serviço HTTP
|
||||
openHttps=Abre o serviço HTTPS
|
||||
noScriptsAvailable=Não há scripts disponíveis
|
||||
|
|
|
@ -162,3 +162,4 @@ hasServices=$COUNT$ доступные сервисы
|
|||
hasService=$COUNT$ доступный сервис
|
||||
openHttp=Открытый HTTP-сервис
|
||||
openHttps=Открытая служба HTTPS
|
||||
noScriptsAvailable=Нет доступных скриптов
|
||||
|
|
|
@ -162,3 +162,4 @@ hasServices=$COUNT$ mevcut hi̇zmetler
|
|||
hasService=$COUNT$ mevcut hizmet
|
||||
openHttp=Açık HTTP hizmeti
|
||||
openHttps=HTTPS hizmetini açın
|
||||
noScriptsAvailable=Mevcut senaryo yok
|
||||
|
|
|
@ -162,3 +162,4 @@ hasServices=$COUNT$ 可用服务
|
|||
hasService=$COUNT$ 可用服务
|
||||
openHttp=开放式 HTTP 服务
|
||||
openHttps=打开 HTTPS 服务
|
||||
noScriptsAvailable=无脚本可用
|
||||
|
|
Loading…
Reference in a new issue