Skip to content

Commit

Permalink
Help text and screen shot for create log menu item
Browse files Browse the repository at this point in the history
  • Loading branch information
georgweiss committed Oct 29, 2024
1 parent 2ae4a94 commit 3a565d0
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 17 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 11 additions & 1 deletion app/save-and-restore/app/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,21 @@ For a multi-selection of nodes the same restrictions apply as for a drag-n-drop
Logging
-------

If a logbook implementation is available in the application, the optional logging module can be used to launch a log entry
If a logbook implementation is available, the optional logging module can be used to launch a log entry
editor for the purpose of logging when a new snapshot has been saved or restored.
Properties of the snapshot (name, date etc) are automatically set on the log entry rendered by the editor. If
a restore action has failed to write one or multiple PVs, a list of these PVs is also added to the log entry.

User may also launch the log entry editor from the context menu of the tree view:

.. image:: images/create_log.png
:width: 30%

In this case the log entry is empty save for a log entry property containing the name and path to
the selected item in the tree. Note that this context menu entry is not available if a logbook implementation
has not been configured. Moreover, the context menu entry is enabled only if a single node in the tree view
is selected.

Workflow
--------

Expand Down
5 changes: 5 additions & 0 deletions app/save-and-restore/app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
<artifactId>core-ui</artifactId>
<version>4.7.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.phoebus</groupId>
<artifactId>core-logbook</artifactId>
<version>4.7.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.phoebus</groupId>
<artifactId>save-and-restore-model</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
import org.phoebus.framework.preferences.PhoebusPreferenceService;
import org.phoebus.framework.selection.SelectionService;
import org.phoebus.framework.workbench.ApplicationService;
import org.phoebus.logbook.LogbookPreferences;
import org.phoebus.security.tokens.ScopedAuthenticationToken;
import org.phoebus.ui.application.ContextMenuService;
import org.phoebus.ui.dialog.DialogHelper;
Expand Down Expand Up @@ -1446,8 +1447,7 @@ private void openNode(String nodeId) {
unused -> copyUniqueNodeIdToClipboard()),
new SeparatorMenuItem(),
new ImportFromCSVMenuItem(this, selectedItemsProperty, unused -> importFromCSV()),
new ExportToCSVMenuItem(this, selectedItemsProperty, unused -> exportToCSV()),
new SeparatorMenuItem()
new ExportToCSVMenuItem(this, selectedItemsProperty, unused -> exportToCSV())
);

/**
Expand All @@ -1466,21 +1466,25 @@ public void configureContextMenu(ContextMenuEvent e) {
contextMenu.getItems().clear();
contextMenu.getItems().addAll(menuItems);

SelectionService.getInstance().setSelection(SaveAndRestoreApplication.NAME,
selectedItemsProperty.size() == 1 ? List.of(selectedItemsProperty.get(0)) : Collections.emptyList());
List<ContextMenuEntry> supported = ContextMenuService.getInstance().listSupportedContextMenuEntries();

supported.forEach(action -> {
MenuItem menuItem = new MenuItem(action.getName(), new ImageView(action.getIcon()));
menuItem.setOnAction((ee) -> {
try {
action.call(null, SelectionService.getInstance().getSelection());
} catch (Exception ex) {
logger.log(Level.WARNING, "Failed to execute " + action.getName() + " from save&restore", ex);
}
// If logbook has been configured, add the Create Log menu item
if(LogbookPreferences.is_supported){
contextMenu.getItems().add(new SeparatorMenuItem());
SelectionService.getInstance().setSelection(SaveAndRestoreApplication.NAME,
selectedItemsProperty.size() == 1 ? List.of(selectedItemsProperty.get(0)) : Collections.emptyList());
List<ContextMenuEntry> supported = ContextMenuService.getInstance().listSupportedContextMenuEntries();

supported.forEach(action -> {
MenuItem menuItem = new MenuItem(action.getName(), new ImageView(action.getIcon()));
menuItem.setOnAction((ee) -> {
try {
action.call(null, SelectionService.getInstance().getSelection());
} catch (Exception ex) {
logger.log(Level.WARNING, "Failed to execute " + action.getName() + " from save&restore", ex);
}
});
contextMenu.getItems().add(menuItem);
});
contextMenu.getItems().add(menuItem);
});
}

snapshotOrCompositeSnapshotOnlySelection.set(selectedItems.stream().filter(t ->
!t.getValue().getNodeType().equals(NodeType.SNAPSHOT) &&
Expand Down

0 comments on commit 3a565d0

Please sign in to comment.