diff --git a/app/src/main/java/io/xpipe/app/beacon/mcp/McpTools.java b/app/src/main/java/io/xpipe/app/beacon/mcp/McpTools.java index 632a90ba8..bb4772c17 100644 --- a/app/src/main/java/io/xpipe/app/beacon/mcp/McpTools.java +++ b/app/src/main/java/io/xpipe/app/beacon/mcp/McpTools.java @@ -4,6 +4,7 @@ import io.xpipe.app.beacon.AppBeaconServer; import io.xpipe.app.core.AppExtensionManager; import io.xpipe.app.core.AppNames; import io.xpipe.app.ext.*; +import io.xpipe.app.hub.comp.StoreViewState; import io.xpipe.app.process.ScriptHelper; import io.xpipe.app.process.ShellControl; import io.xpipe.app.process.TerminalInitScriptConfig; @@ -82,6 +83,10 @@ public final class McpTools { @NonNull String path; + + String information; + + String notes; } public static McpServerFeatures.SyncToolSpecification listSystems() throws IOException { @@ -104,9 +109,14 @@ public final class McpTools { continue; } + var section = StoreViewState.get().getSectionForWrapper(StoreViewState.get().getEntryWrapper(e)); + var info = section.isPresent() ? e.getProvider().informationString(section.get()).getValue() : null; + var r = ConnectionResource.builder() .name(e.getName()) .path(DataStorage.get().getStorePath(e).toString()) + .information(info) + .notes(e.getNotes()) .build(); list.add(r); } diff --git a/app/src/main/java/io/xpipe/app/comp/base/DialogComp.java b/app/src/main/java/io/xpipe/app/comp/base/DialogComp.java deleted file mode 100644 index 604402bc4..000000000 --- a/app/src/main/java/io/xpipe/app/comp/base/DialogComp.java +++ /dev/null @@ -1,88 +0,0 @@ -package io.xpipe.app.comp.base; - -import io.xpipe.app.comp.RegionBuilder; -import io.xpipe.app.core.AppI18n; - -import javafx.geometry.Pos; -import javafx.scene.control.ScrollPane; -import javafx.scene.layout.HBox; -import javafx.scene.layout.Priority; -import javafx.scene.layout.Region; -import javafx.scene.layout.VBox; - -import atlantafx.base.theme.Styles; -import org.int4.fx.builders.common.AbstractRegionBuilder; - -import java.util.List; - -public abstract class DialogComp extends RegionBuilder { - - protected Region createNavigation() { - HBox buttons = new HBox(); - buttons.setFillHeight(true); - var customButton = bottom(); - if (customButton != null) { - var c = customButton.build(); - buttons.getChildren().add(c); - HBox.setHgrow(c, Priority.ALWAYS); - } - var spacer = new Region(); - HBox.setHgrow(spacer, Priority.SOMETIMES); - buttons.getChildren().add(spacer); - buttons.getStyleClass().add("buttons"); - buttons.setSpacing(5); - buttons.setAlignment(Pos.CENTER_RIGHT); - - buttons.getChildren() - .addAll(customButtons().stream() - .map(buttonComp -> buttonComp.build()) - .toList()); - var nextButton = finishButton(); - buttons.getChildren().add(nextButton.build()); - return buttons; - } - - protected AbstractRegionBuilder finishButton() { - return new ButtonComp(AppI18n.observable(finishKey()), this::finish) - .style(Styles.ACCENT) - .style("next"); - } - - protected String finishKey() { - return "finishStep"; - } - - protected List> customButtons() { - return List.of(); - } - - @Override - public Region createSimple() { - var sp = pane(content()).style("dialog-content").build(); - VBox vbox = new VBox(); - vbox.getChildren().addAll(sp, createNavigation()); - vbox.getStyleClass().add("dialog-comp"); - vbox.setFillWidth(true); - VBox.setVgrow(sp, Priority.ALWAYS); - return vbox; - } - - protected abstract void finish(); - - public abstract AbstractRegionBuilder content(); - - protected AbstractRegionBuilder pane(AbstractRegionBuilder content) { - var entry = content; - return RegionBuilder.of(() -> { - var entryR = entry.build(); - var sp = new ScrollPane(entryR); - sp.setFitToWidth(true); - entryR.minHeightProperty().bind(sp.heightProperty()); - return sp; - }); - } - - public AbstractRegionBuilder bottom() { - return null; - } -} diff --git a/app/src/main/java/io/xpipe/app/hub/comp/StoreEntryComp.java b/app/src/main/java/io/xpipe/app/hub/comp/StoreEntryComp.java index 1c63cc46c..5e8b720af 100644 --- a/app/src/main/java/io/xpipe/app/hub/comp/StoreEntryComp.java +++ b/app/src/main/java/io/xpipe/app/hub/comp/StoreEntryComp.java @@ -459,10 +459,10 @@ public abstract class StoreEntryComp extends SimpleRegionBuilder { var notes = new MenuItem(AppI18n.get("addNotes"), new FontIcon("mdi2c-comment-text-outline")); notes.setOnAction(event -> { - getWrapper().getNotes().setValue(new StoreNotes(null, getDefaultNotes())); + StoreNotesComp.showDialog(getWrapper(), getDefaultNotes()); event.consume(); }); - notes.visibleProperty().bind(BindingsHelper.map(getWrapper().getNotes(), s -> s.getCommited() == null)); + notes.visibleProperty().bind(BindingsHelper.map(getWrapper().getNotes(), s -> s == null)); items.add(items.size(), notes); var freeze = new MenuItem(); diff --git a/app/src/main/java/io/xpipe/app/hub/comp/StoreEntryWrapper.java b/app/src/main/java/io/xpipe/app/hub/comp/StoreEntryWrapper.java index 61f6df75a..9c8c0618d 100644 --- a/app/src/main/java/io/xpipe/app/hub/comp/StoreEntryWrapper.java +++ b/app/src/main/java/io/xpipe/app/hub/comp/StoreEntryWrapper.java @@ -58,7 +58,7 @@ public class StoreEntryWrapper { private final Property color = new SimpleObjectProperty<>(); private final Property category = new SimpleObjectProperty<>(); private final Property summary = new SimpleObjectProperty<>(); - private final Property notes; + private final ObjectProperty notes; private final Property customIcon = new SimpleObjectProperty<>(); private final Property iconFile = new SimpleObjectProperty<>(); private final BooleanProperty sessionActive = new SimpleBooleanProperty(); @@ -117,7 +117,7 @@ public class StoreEntryWrapper { shownSummary, AppI18n.activeLanguage()); this.shownInformation = new SimpleObjectProperty<>(); - this.notes = new SimpleObjectProperty<>(new StoreNotes(entry.getNotes(), entry.getNotes())); + this.notes = new SimpleObjectProperty<>(entry.getNotes()); setupListeners(); } @@ -158,12 +158,6 @@ public class StoreEntryWrapper { entry.addListener(() -> PlatformThread.runLaterIfNeeded(() -> { update(); })); - - notes.addListener((observable, oldValue, newValue) -> { - if (newValue.isCommited()) { - entry.setNotes(newValue.getCurrent()); - } - }); } public void stopSession() { @@ -211,7 +205,7 @@ public class StoreEntryWrapper { } orderIndex.setValue(entry.getOrderIndex()); color.setValue(entry.getColor()); - notes.setValue(new StoreNotes(entry.getNotes(), entry.getNotes())); + notes.setValue(entry.getNotes()); customIcon.setValue(entry.getIcon()); readOnly.setValue(entry.isFreeze()); iconFile.setValue(entry.getEffectiveIconFile()); diff --git a/app/src/main/java/io/xpipe/app/hub/comp/StoreNotesComp.java b/app/src/main/java/io/xpipe/app/hub/comp/StoreNotesComp.java index c0a42703f..fcc8f1633 100644 --- a/app/src/main/java/io/xpipe/app/hub/comp/StoreNotesComp.java +++ b/app/src/main/java/io/xpipe/app/hub/comp/StoreNotesComp.java @@ -1,30 +1,43 @@ package io.xpipe.app.hub.comp; import io.xpipe.app.comp.*; -import io.xpipe.app.comp.base.ButtonComp; -import io.xpipe.app.comp.base.DialogComp; -import io.xpipe.app.comp.base.IconButtonComp; -import io.xpipe.app.comp.base.MarkdownEditorComp; +import io.xpipe.app.comp.base.*; import io.xpipe.app.core.AppFontSizes; -import io.xpipe.app.core.AppI18n; import io.xpipe.app.platform.BindingsHelper; -import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.storage.DataStorage; +import io.xpipe.app.util.FileOpener; import javafx.application.Platform; import javafx.beans.property.Property; +import javafx.beans.property.ReadOnlyStringWrapper; import javafx.beans.property.SimpleStringProperty; -import javafx.event.ActionEvent; import javafx.scene.control.Button; -import javafx.scene.paint.Color; +import javafx.scene.input.MouseButton; -import atlantafx.base.controls.Popover; -import org.int4.fx.builders.common.AbstractRegionBuilder; +import java.util.UUID; -import java.util.List; -import java.util.concurrent.atomic.AtomicReference; +public class StoreNotesComp extends RegionBuilder