This commit is contained in:
crschnick
2026-03-14 01:54:16 +00:00
parent 80d6b49cf4
commit 3abd5f1863
9 changed files with 14 additions and 62 deletions
@@ -19,7 +19,5 @@ public interface LauncherUrlProvider extends ActionProvider {
String getScheme();
String getPlaceholder();
AbstractAction createAction(URI uri) throws Exception;
}
@@ -9,11 +9,6 @@ public class XPipeUrlProvider implements LauncherUrlProvider {
return "xpipe";
}
@Override
public String getPlaceholder() {
return "xpipe://action?<name>";
}
@Override
public AbstractAction createAction(URI uri) throws Exception {
var a = uri.getHost();
@@ -38,6 +38,10 @@ public class ScanHubBatchProvider implements BatchHubProvider<ShellStore> {
@Override
public boolean isApplicable(DataStoreEntryRef<ShellStore> o) {
if (!o.get().getProvider().shouldShowScan()) {
return false;
}
var state = o.get().getStorePersistentState();
if (state instanceof SystemState systemState) {
return (systemState.getShellDialect() == null
@@ -27,6 +27,11 @@ public class ScanHubLeafProvider implements HubLeafProvider<ShellStore> {
return true;
}
@Override
public boolean isApplicable(DataStoreEntryRef<ShellStore> o) {
return o.get().getProvider().shouldShowScan();
}
@Override
public ObservableValue<String> getName(DataStoreEntryRef<ShellStore> store) {
return AppI18n.observable("scanConnections");
@@ -58,8 +58,8 @@ public class StoreCreationComp extends ModalOverlayContentComp {
var provider = model.getProvider().getValue() != null
? model.getProvider().getValue()
: providerChoice.getProviders().getFirst();
var showProviders = !model.isQuickConnect() && ((!model.isStaticDisplay() && provider.showProviderChoice())
|| (model.isStaticDisplay() && provider.showProviderChoice()));
var showProviders = (!model.isStaticDisplay() && provider.showProviderChoice())
|| (model.isStaticDisplay() && provider.showProviderChoice());
if (model.isStaticDisplay()) {
providerChoice.apply(struc -> struc.setDisable(true));
}
@@ -29,10 +29,6 @@ public class StoreFilterState {
private final DerivedObservableList<String> recentQuickConnections =
DerivedObservableList.synchronizedArrayList(true);
@Getter
private final DerivedObservableList<String> recentUrls =
DerivedObservableList.synchronizedArrayList(true);
@Getter
private final StringProperty rawText = new SimpleStringProperty();
@@ -76,18 +72,15 @@ public class StoreFilterState {
var type = TypeFactory.defaultInstance().constructType(new TypeReference<List<String>>() {});
List<String> recentSearches = AppCache.getNonNull("recentSearches", type, () -> List.of());
List<String> recentQuickConnections = AppCache.getNonNull("recentQuickConnections", type, () -> List.of());
List<String> recentUrls = AppCache.getNonNull("recentUrls", type, () -> List.of());
INSTANCE = new StoreFilterState();
INSTANCE.recentSearches.setContent(recentSearches);
INSTANCE.recentQuickConnections.setContent(recentQuickConnections);
INSTANCE.recentUrls.setContent(recentUrls);
}
public static void reset() {
AppCache.update("recentSearches", INSTANCE.recentSearches.getList());
AppCache.update("recentQuickConnections", INSTANCE.recentQuickConnections.getList());
AppCache.update("recentUrls", INSTANCE.recentUrls.getList());
INSTANCE = null;
}
@@ -121,19 +114,6 @@ public class StoreFilterState {
}
}
public void putUrl(String s) {
synchronized (recentUrls) {
var l = recentUrls.getList();
l.remove(s);
if (l.size() == 3) {
l.addFirst(s);
l.removeLast();
} else {
l.addFirst(s);
}
}
}
public boolean open() {
if (rawText.getValue() == null) {
return false;
@@ -153,7 +133,6 @@ public class StoreFilterState {
try {
var action = provider.get().createAction(URI.create(rawText.get()));
action.executeAsync();
putUrl(rawText.getValue());
return true;
} catch (Exception e) {
ErrorEventFactory.fromThrowable(e).handle();
@@ -3,6 +3,7 @@ package io.xpipe.app.hub.comp;
import atlantafx.base.theme.Styles;
import io.xpipe.app.action.LauncherUrlProvider;
import io.xpipe.app.action.QuickConnectProvider;
import io.xpipe.app.comp.RegionBuilder;
import io.xpipe.app.comp.SimpleRegionBuilder;
import io.xpipe.app.comp.base.ButtonComp;
import io.xpipe.app.comp.base.LabelComp;
@@ -53,42 +54,21 @@ public class StoreFilterStateComp extends SimpleRegionBuilder {
.toList());
var quickConnectionsEmptyList = new ListBoxViewComp<String>(quickConnectionsPlaceholders, quickConnectionsPlaceholders, s -> createButton(s, s.split(" ")[0] + " "), false);
var urls = state.getRecentUrls().getList();
var urlsEmpty = Bindings.isEmpty(urls);
var urlList = new ListBoxViewComp<String>(urls, urls, s -> createButton(s, s), false);
var urlPlaceholders = FXCollections.observableArrayList(LauncherUrlProvider.getAll().stream()
.map(p -> p.getPlaceholder())
.toList());
var urlEmptyList = new ListBoxViewComp<String>(urlPlaceholders, urlPlaceholders, s -> createButton(s, null), false);
var options = new OptionsBuilder()
.addComp(new LabelComp(AppI18n.observable("recentSearches")))
.hide(searchesEmpty)
.addComp(searchesList)
.hide(searchesEmpty)
.addComp(new LabelComp(AppI18n.observable("recentSearchesDescription")))
.hide(searchesEmpty.not())
.addComp(searchesEmptyList)
.hide(searchesEmpty.not())
.addComp(RegionBuilder.hseparator())
.addComp(new LabelComp(AppI18n.observable("recentQuickConnections")))
.hide(quickConnectionsEmpty)
.addComp(quickConnectionsList)
.hide(quickConnectionsEmpty)
.addComp(new LabelComp(AppI18n.observable("recentQuickConnectionsDescription")))
.hide(quickConnectionsEmpty.not())
.addComp(quickConnectionsEmptyList)
.hide(quickConnectionsEmpty.not())
.addComp(new LabelComp(AppI18n.observable("recentUrls")))
.hide(urlsEmpty)
.addComp(urlList)
.hide(urlsEmpty)
.addComp(new LabelComp(AppI18n.observable("recentUrlsDescription")))
.hide(urlsEmpty.not())
.addComp(urlEmptyList)
.hide(urlsEmpty.not())
.build();
options.getStyleClass().add("store-filter-state-comp");
return options;
@@ -98,7 +98,7 @@ public class StoreQuickConnect {
return true;
}
var model = StoreCreationDialog.showEdit(quickConnectEntry, newStore, false, finished -> {
StoreCreationDialog.showEdit(quickConnectEntry, newStore, false, finished -> {
update(finished.getStore());
ThreadHelper.runAsync(() -> {
try {
@@ -112,14 +112,6 @@ public class StoreQuickConnect {
});
});
var wasCached = AppCache.getNonNull("quickConnect", DataStore.class, () -> null) != null;
if (newStore.isComplete() && wasCached) {
GlobalTimer.delay(() -> {
Platform.runLater(() -> {
model.finish();
});
}, Duration.ofMillis(100));
}
return true;
}
}
@@ -84,7 +84,6 @@ public class VaultCategory extends AppPrefsCategory {
.description("vaultTypeContent" + vaultTypeKey)
.documentationLink(DocumentationLink.TEAM_VAULTS)
.addComp(RegionBuilder.empty())
.licenseRequirement("team")
.nameAndDescription("vaultAuthentication")
.addComp(authChoice, prefs.vaultAuthentication)
.nameAndDescription(Bindings.createStringBinding(