diff --git a/app/src/main/java/io/xpipe/app/comp/store/StoreEntryWrapper.java b/app/src/main/java/io/xpipe/app/comp/store/StoreEntryWrapper.java index efd436fa2..44ed9823f 100644 --- a/app/src/main/java/io/xpipe/app/comp/store/StoreEntryWrapper.java +++ b/app/src/main/java/io/xpipe/app/comp/store/StoreEntryWrapper.java @@ -153,8 +153,7 @@ public class StoreEntryWrapper { summary.setValue(null); } else { try { - summary.setValue( - entry.getProvider() != null ? entry.getProvider().summaryString(this) : null); + summary.setValue(entry.getProvider() != null ? entry.getProvider().summaryString(this) : null); } catch (Exception ex) { // Summary creation might fail or have a bug ErrorEvent.fromThrowable(ex).handle(); diff --git a/app/src/main/resources/io/xpipe/app/resources/style/store-entry-comp.css b/app/src/main/resources/io/xpipe/app/resources/style/store-entry-comp.css index 406b10d0f..9b6a58bf5 100644 --- a/app/src/main/resources/io/xpipe/app/resources/style/store-entry-comp.css +++ b/app/src/main/resources/io/xpipe/app/resources/style/store-entry-comp.css @@ -41,6 +41,7 @@ .store-entry-grid .icon:hover { -fx-background-color: -color-bg-inset; + -fx-background-radius: 5px; } .root.nord .store-entry-grid .icon { diff --git a/ext/base/src/main/java/io/xpipe/ext/base/script/SimpleScriptQuickEditAction.java b/ext/base/src/main/java/io/xpipe/ext/base/script/SimpleScriptQuickEditAction.java index 0016ef618..5be14e445 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/script/SimpleScriptQuickEditAction.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/script/SimpleScriptQuickEditAction.java @@ -1,12 +1,16 @@ package io.xpipe.ext.base.script; +import io.xpipe.app.comp.store.StoreCreationComp; import io.xpipe.app.ext.ActionProvider; +import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStoreEntryRef; import io.xpipe.app.util.FileOpener; import io.xpipe.core.process.OsType; import lombok.Value; +import java.util.Arrays; + public class SimpleScriptQuickEditAction implements ActionProvider { @Override public DefaultDataStoreCallSite getDefaultDataStoreCallSite() { @@ -30,6 +34,16 @@ public class SimpleScriptQuickEditAction implements ActionProvider { @Override public void execute() { + var predefined = DataStorage.get().getStoreCategoryIfPresent(ref.get().getCategoryUuid()) + .map(category -> category.getUuid().equals(DataStorage.PREDEFINED_SCRIPTS_CATEGORY_UUID)) + .orElse(false) && + Arrays.stream(PredefinedScriptStore.values()) + .anyMatch(predefinedScriptStore -> predefinedScriptStore.getName().equals(ref.get().getName())); + if (predefined) { + StoreCreationComp.showEdit(ref.get()); + return; + } + var script = ref.getStore(); var dialect = script.getMinimumDialect(); var ext = dialect.getScriptFileEnding(); diff --git a/ext/base/src/main/java/io/xpipe/ext/base/script/SimpleScriptStoreProvider.java b/ext/base/src/main/java/io/xpipe/ext/base/script/SimpleScriptStoreProvider.java index c04af1825..5f51cbc65 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/script/SimpleScriptStoreProvider.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/script/SimpleScriptStoreProvider.java @@ -4,7 +4,6 @@ import io.xpipe.app.comp.base.IntegratedTextAreaComp; import io.xpipe.app.comp.base.ListSelectorComp; import io.xpipe.app.comp.base.SystemStateComp; import io.xpipe.app.comp.store.StoreEntryWrapper; -import io.xpipe.app.comp.store.StoreSection; import io.xpipe.app.comp.store.StoreViewState; import io.xpipe.app.core.AppExtensionManager; import io.xpipe.app.core.AppI18n; @@ -16,27 +15,25 @@ import io.xpipe.app.fxcomps.Comp; import io.xpipe.app.fxcomps.impl.DataStoreChoiceComp; import io.xpipe.app.fxcomps.impl.DataStoreListChoiceComp; import io.xpipe.app.storage.DataStoreEntry; +import io.xpipe.app.util.DataStoreFormatter; import io.xpipe.app.util.MarkdownBuilder; import io.xpipe.app.util.OptionsBuilder; import io.xpipe.app.util.Validator; import io.xpipe.core.process.ShellDialect; import io.xpipe.core.store.DataStore; import io.xpipe.core.util.Identifiers; - import javafx.beans.binding.Bindings; import javafx.beans.property.Property; import javafx.beans.property.SimpleListProperty; import javafx.beans.property.SimpleObjectProperty; -import javafx.beans.property.SimpleStringProperty; -import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; - import lombok.SneakyThrows; import java.util.ArrayList; import java.util.List; import java.util.function.Function; import java.util.stream.Collectors; +import java.util.stream.Stream; public class SimpleScriptStoreProvider implements EnabledParentStoreProvider, DataStoreProvider { @@ -210,13 +207,25 @@ public class SimpleScriptStoreProvider implements EnabledParentStoreProvider, Da } @Override - public ObservableValue informationString(StoreSection section) { - SimpleScriptStore scriptStore = - section.getWrapper().getEntry().getStore().asNeeded(); - return new SimpleStringProperty((scriptStore.getMinimumDialect() != null - ? scriptStore.getMinimumDialect().getDisplayName() + " " - : "") - + " snippet"); + public boolean alwaysShowSummary() { + return true; + } + + @Override + public String summaryString(StoreEntryWrapper wrapper) { + SimpleScriptStore st = wrapper.getEntry().getStore().asNeeded(); + var init = st.isInitScript() ? AppI18n.get("init") : null; + var file = st.isRunnableScript() ? AppI18n.get("file") : null; + var shell = st.isRunnableScript() ? AppI18n.get("shell") : null; + var runnable = st.isRunnableScript() ? AppI18n.get("hub") : null; + var type = st.getMinimumDialect() != null ? st.getMinimumDialect().getDisplayName() + " " + AppI18n.get("script") : null; + var suffix = String.join(" / ", Stream.of(init, shell, file, runnable).filter(s -> s != null).toList()); + if (!suffix.isEmpty()) { + suffix = "(" + suffix + ")"; + } else { + suffix = null; + } + return DataStoreFormatter.join(type, suffix); } @SneakyThrows diff --git a/lang/base/strings/translations_da.properties b/lang/base/strings/translations_da.properties index 356fcb9e7..56f8886dd 100644 --- a/lang/base/strings/translations_da.properties +++ b/lang/base/strings/translations_da.properties @@ -174,3 +174,7 @@ openHttp=Åben HTTP-tjeneste openHttps=Åben HTTPS-tjeneste noScriptsAvailable=Ingen tilgængelige scripts changeIcon=Skift ikon +init=Indlæg +shell=Skal +hub=Hub +script=script diff --git a/lang/base/strings/translations_de.properties b/lang/base/strings/translations_de.properties index 8794b86f8..9b6038304 100644 --- a/lang/base/strings/translations_de.properties +++ b/lang/base/strings/translations_de.properties @@ -165,3 +165,7 @@ openHttp=Offener HTTP-Dienst openHttps=HTTPS-Dienst öffnen noScriptsAvailable=Keine Skripte verfügbar changeIcon=Symbol ändern +init=Init +shell=Shell +hub=Hub +script=skript diff --git a/lang/base/strings/translations_en.properties b/lang/base/strings/translations_en.properties index e85fec446..7c1af8e59 100644 --- a/lang/base/strings/translations_en.properties +++ b/lang/base/strings/translations_en.properties @@ -163,5 +163,11 @@ openHttp=Open HTTP service openHttps=Open HTTPS service noScriptsAvailable=No scripts available changeIcon=Change icon +init=Init +shell=Shell +hub=Hub +#context: Computer script +#force +script=script diff --git a/lang/base/strings/translations_es.properties b/lang/base/strings/translations_es.properties index 7321b607e..5996607cd 100644 --- a/lang/base/strings/translations_es.properties +++ b/lang/base/strings/translations_es.properties @@ -163,3 +163,7 @@ openHttp=Servicio HTTP abierto openHttps=Abrir servicio HTTPS noScriptsAvailable=No hay guiones disponibles changeIcon=Cambiar icono +init=Init +shell=Shell +hub=Hub +script=script diff --git a/lang/base/strings/translations_fr.properties b/lang/base/strings/translations_fr.properties index e15efb6fc..2b1ed3572 100644 --- a/lang/base/strings/translations_fr.properties +++ b/lang/base/strings/translations_fr.properties @@ -163,3 +163,7 @@ openHttp=Service HTTP ouvert openHttps=Service HTTPS ouvert noScriptsAvailable=Pas de scripts disponibles changeIcon=Changer d'icône +init=Init +shell=Coquille +hub=Hub +script=script diff --git a/lang/base/strings/translations_it.properties b/lang/base/strings/translations_it.properties index 400e235ba..1a40b2ce8 100644 --- a/lang/base/strings/translations_it.properties +++ b/lang/base/strings/translations_it.properties @@ -163,3 +163,7 @@ openHttp=Servizio HTTP aperto openHttps=Servizio HTTPS aperto noScriptsAvailable=Non sono disponibili script changeIcon=Cambia icona +init=Init +shell=Conchiglia +hub=Hub +script=script diff --git a/lang/base/strings/translations_ja.properties b/lang/base/strings/translations_ja.properties index 0cbc77033..e5aab3171 100644 --- a/lang/base/strings/translations_ja.properties +++ b/lang/base/strings/translations_ja.properties @@ -163,3 +163,7 @@ openHttp=オープンHTTPサービス openHttps=HTTPSサービスを開く noScriptsAvailable=スクリプトはない changeIcon=アイコンの変更 +init=イニシャル +shell=シェル +hub=ハブ +script=スクリプト diff --git a/lang/base/strings/translations_nl.properties b/lang/base/strings/translations_nl.properties index e1ee18f68..f8734d078 100644 --- a/lang/base/strings/translations_nl.properties +++ b/lang/base/strings/translations_nl.properties @@ -163,3 +163,7 @@ openHttp=Open HTTP service openHttps=Open HTTPS service noScriptsAvailable=Geen scripts beschikbaar changeIcon=Pictogram wijzigen +init=Init +shell=Shell +hub=Hub +script=script diff --git a/lang/base/strings/translations_pt.properties b/lang/base/strings/translations_pt.properties index bad3c7099..4e8c2c7e3 100644 --- a/lang/base/strings/translations_pt.properties +++ b/lang/base/strings/translations_pt.properties @@ -163,3 +163,7 @@ openHttp=Abre o serviço HTTP openHttps=Abre o serviço HTTPS noScriptsAvailable=Não há scripts disponíveis changeIcon=Altera o ícone +init=Init +shell=Concha +hub=Hub +script=guião diff --git a/lang/base/strings/translations_ru.properties b/lang/base/strings/translations_ru.properties index 0ee728ea5..21fd099ab 100644 --- a/lang/base/strings/translations_ru.properties +++ b/lang/base/strings/translations_ru.properties @@ -163,3 +163,7 @@ openHttp=Открытый HTTP-сервис openHttps=Открытая служба HTTPS noScriptsAvailable=Нет доступных скриптов changeIcon=Значок изменения +init=Init +shell=Shell +hub=Хаб +script=скрипт diff --git a/lang/base/strings/translations_tr.properties b/lang/base/strings/translations_tr.properties index 512561400..57bbe223f 100644 --- a/lang/base/strings/translations_tr.properties +++ b/lang/base/strings/translations_tr.properties @@ -163,3 +163,7 @@ openHttp=Açık HTTP hizmeti openHttps=HTTPS hizmetini açın noScriptsAvailable=Mevcut senaryo yok changeIcon=Simge değiştir +init=Başlangıç +shell=Kabuk +hub=Hub +script=senaryo diff --git a/lang/base/strings/translations_zh.properties b/lang/base/strings/translations_zh.properties index b8ce581ca..d2acd5ac5 100644 --- a/lang/base/strings/translations_zh.properties +++ b/lang/base/strings/translations_zh.properties @@ -163,3 +163,7 @@ openHttp=开放式 HTTP 服务 openHttps=打开 HTTPS 服务 noScriptsAvailable=无脚本可用 changeIcon=更改图标 +init=启动 +shell=外壳 +hub=枢纽 +script=脚本