diff --git a/app/save-and-restore/app/doc/images/snapshot-with-references.png b/app/save-and-restore/app/doc/images/snapshot-with-references.png new file mode 100644 index 0000000000..7761baad5a Binary files /dev/null and b/app/save-and-restore/app/doc/images/snapshot-with-references.png differ diff --git a/app/save-and-restore/app/doc/images/snapshot-with-tag.png b/app/save-and-restore/app/doc/images/snapshot-with-tag.png new file mode 100644 index 0000000000..d792c17fa9 Binary files /dev/null and b/app/save-and-restore/app/doc/images/snapshot-with-tag.png differ diff --git a/app/save-and-restore/app/doc/images/tree_view_context_menu.png b/app/save-and-restore/app/doc/images/tree_view_context_menu.png deleted file mode 100644 index 8dd94fae56..0000000000 Binary files a/app/save-and-restore/app/doc/images/tree_view_context_menu.png and /dev/null differ diff --git a/app/save-and-restore/app/doc/images/treeview-context-menu.png b/app/save-and-restore/app/doc/images/treeview-context-menu.png new file mode 100644 index 0000000000..cddc21cfa0 Binary files /dev/null and b/app/save-and-restore/app/doc/images/treeview-context-menu.png differ diff --git a/app/save-and-restore/app/doc/index.rst b/app/save-and-restore/app/doc/index.rst index 449e42075c..5753aeaef7 100644 --- a/app/save-and-restore/app/doc/index.rst +++ b/app/save-and-restore/app/doc/index.rst @@ -43,6 +43,21 @@ Below screen shot shows the tree structure and a configuration editor. .. image:: images/screenshot1.png :width: 80% +Annotations on nodes +-------------------- + +Snapshots and composite snapshots may be tagged with user defined tags, see :ref:`tagging`. Presence of one or multiple +tags is indicated with a symbol to the right of the node name: + +.. image:: images/snapshot-with-tag.png + +Similarly, snapshots and composite snapshots referenced in other composite snapshots are annotated with a symbol to the +right of the node name: + +.. image:: images/snapshot-with-references.png + + + Node names and ordering ----------------------- @@ -71,7 +86,7 @@ Tree View Context Menu Most actions performed in the client UI are invoked from the tree view's context menu, which appears like so: -.. image:: images/tree_view_context_menu.png +.. image:: images/treeview-context-menu.png :width: 30% Since the set of applicable actions varies between node types, items in the context menu enabled/disabled @@ -453,6 +468,8 @@ still interact with non-matching items. There may be additional nodes matching the current filter, but these will be rendered and highlighted only when their parent nodes are expanded. To easily find *all* matching items user will need to use the search tool. +.. _tagging: + Tagging ------- diff --git a/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/ui/BrowserTreeCell.java b/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/ui/BrowserTreeCell.java index 71a8a1a5b0..0c43aa11b8 100644 --- a/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/ui/BrowserTreeCell.java +++ b/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/ui/BrowserTreeCell.java @@ -18,6 +18,7 @@ package org.phoebus.applications.saveandrestore.ui; +import javafx.application.Platform; import javafx.scene.control.Label; import javafx.scene.control.Tooltip; import javafx.scene.control.TreeCell; @@ -38,9 +39,13 @@ import org.phoebus.applications.saveandrestore.model.Node; import org.phoebus.applications.saveandrestore.model.NodeType; import org.phoebus.applications.saveandrestore.model.Tag; +import org.phoebus.applications.saveandrestore.model.search.SearchResult; +import org.phoebus.framework.jobs.JobManager; import org.phoebus.ui.javafx.ImageCache; import org.phoebus.util.time.TimestampFormats; +import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.MultivaluedMap; import java.util.ArrayList; import java.util.List; @@ -183,6 +188,7 @@ public void updateItem(Node node, boolean empty) { tagImage.setPreserveRatio(true); hBox.getChildren().add(tagImage); } + annotateContainedInCompositeSnapshot(node, hBox); break; case COMPOSITE_SNAPSHOT: hBox.getChildren().add(new ImageView(ImageRepository.COMPOSITE_SNAPSHOT)); @@ -193,6 +199,7 @@ public void updateItem(Node node, boolean empty) { tagImage.setPreserveRatio(true); getChildren().add(tagImage); } + annotateContainedInCompositeSnapshot(node, hBox); break; case CONFIGURATION: hBox.getChildren().add(new ImageView(ImageRepository.CONFIGURATION)); @@ -209,4 +216,17 @@ public void updateItem(Node node, boolean empty) { setGraphic(hBox); } + + private void annotateContainedInCompositeSnapshot(Node node, HBox hbox) { + JobManager.schedule("Annotate contained in snapshot", monitor -> { + MultivaluedMap multivaluedMap = new MultivaluedHashMap<>(); + multivaluedMap.put("referenced", List.of(node.getUniqueId())); + SearchResult searchResult = saveAndRestoreController.saveAndRestoreService.search(multivaluedMap); + if (searchResult.getHitCount() > 0) { + Platform.runLater(() -> { + hbox.getChildren().add(new ImageView(ImageRepository.LINK)); + }); + } + }); + } } diff --git a/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/ui/ImageRepository.java b/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/ui/ImageRepository.java index 01b98a567b..a9e3eb8e16 100644 --- a/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/ui/ImageRepository.java +++ b/app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/ui/ImageRepository.java @@ -43,4 +43,7 @@ public class ImageRepository { ImageCache.getImage(ImageRepository.class, "/icons/save-and-restore/edit-configuration.png"); public static final Image SNAPSHOT_ADD_TAG = ImageCache.getImage(ImageRepository.class, "/icons/save-and-restore/snapshot-add_tag.png"); + public static final Image LINK = + ImageCache.getImage(ImageRepository.class, "/icons/save-and-restore/link.png"); + } diff --git a/app/save-and-restore/app/src/main/resources/icons/save-and-restore/link.png b/app/save-and-restore/app/src/main/resources/icons/save-and-restore/link.png new file mode 100644 index 0000000000..4e1703d7ce Binary files /dev/null and b/app/save-and-restore/app/src/main/resources/icons/save-and-restore/link.png differ diff --git a/app/save-and-restore/app/src/main/resources/icons/save-and-restore/link@2.png b/app/save-and-restore/app/src/main/resources/icons/save-and-restore/link@2.png new file mode 100644 index 0000000000..9dbda90fda Binary files /dev/null and b/app/save-and-restore/app/src/main/resources/icons/save-and-restore/link@2.png differ diff --git a/app/save-and-restore/app/src/main/resources/icons/save-and-restore/link@3.png b/app/save-and-restore/app/src/main/resources/icons/save-and-restore/link@3.png new file mode 100644 index 0000000000..c57ac8a3dd Binary files /dev/null and b/app/save-and-restore/app/src/main/resources/icons/save-and-restore/link@3.png differ