Skip to content

Commit 095c873

Browse files
authored
Merge pull request #2316 from ControlSystemStudio/CSSTUDIO-1582
Save & restore logging
2 parents 2455aa8 + 8022e22 commit 095c873

File tree

26 files changed

+874
-165
lines changed

26 files changed

+874
-165
lines changed

app/logbook/elog/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
<artifactId>core-logbook</artifactId>
1717
<version>4.6.10-SNAPSHOT</version>
1818
</dependency>
19+
<dependency>
20+
<groupId>org.phoebus</groupId>
21+
<artifactId>core-security</artifactId>
22+
<version>4.6.10-SNAPSHOT</version>
23+
</dependency>
1924
<dependency>
2025
<groupId>net.dongliu</groupId>
2126
<artifactId>requests</artifactId>

app/logbook/olog/client-es/src/main/java/org/phoebus/olog/es/api/OlogClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public class OlogClient implements LogClient {
5858

5959
private static final String OLOG_CLIENT_INFO_HEADER = "X-Olog-Client-Info";
6060
private static final String CLIENT_INFO =
61-
"CS Studio " + org.phoebus.ui.application.Messages.AppVersion + " on " + System.getProperty("os.name");
61+
"CS Studio " + Messages.AppVersion + " on " + System.getProperty("os.name");
6262

6363
/**
6464
* Builder Class to help create a olog client.

app/logbook/olog/client/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
<artifactId>core-security</artifactId>
2525
<version>4.6.10-SNAPSHOT</version>
2626
</dependency>
27+
<dependency>
28+
<groupId>org.phoebus</groupId>
29+
<artifactId>core-util</artifactId>
30+
<version>4.6.10-SNAPSHOT</version>
31+
</dependency>
2732
<dependency>
2833
<groupId>com.fasterxml.jackson.core</groupId>
2934
<artifactId>jackson-core</artifactId>

app/logbook/olog/ui/src/main/java/org/phoebus/logbook/olog/ui/menu/SendLogbookAction.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
package org.phoebus.logbook.olog.ui.menu;
99

1010
import javafx.application.Platform;
11-
import javafx.scene.Node;
1211
import javafx.scene.control.MenuItem;
1312
import javafx.scene.image.Image;
1413
import org.phoebus.framework.jobs.JobManager;
@@ -43,19 +42,6 @@ public class SendLogbookAction extends MenuItem {
4342
/**
4443
* Constructor.
4544
*
46-
* @param parent JavaFX parent that context menu is called from.
47-
* @param title Initial title or <code>null</code>
48-
* @param body Initial body text or <code>null</code>
49-
* @param get_image Supplier for image to attach, or <code>null</code>
50-
*/
51-
public SendLogbookAction(final String title, final String body, final Supplier<Image> get_image) {
52-
this(title, body == null ? null : () -> body, get_image);
53-
}
54-
55-
/**
56-
* Constructor.
57-
*
58-
* @param parent JavaFX parent that context menu is called from.
5945
* @param title Initial title or <code>null</code>
6046
* @param get_body Supplier for initial body text or <code>null</code>
6147
* @param get_image Supplier for image to attach, or <code>null</code>

app/logbook/olog/ui/src/main/java/org/phoebus/logbook/olog/ui/menu/SendToLogBookApp.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@
88
package org.phoebus.logbook.olog.ui.menu;
99

1010
import javafx.scene.image.Image;
11+
import org.phoebus.framework.adapter.AdapterService;
12+
import org.phoebus.framework.selection.Selection;
13+
import org.phoebus.framework.selection.SelectionService;
1114
import org.phoebus.framework.spi.AppDescriptor;
1215
import org.phoebus.framework.spi.AppInstance;
13-
import org.phoebus.logbook.olog.ui.LogbookAvailabilityChecker;
16+
import org.phoebus.logbook.LogEntry;
1417
import org.phoebus.logbook.olog.ui.write.LogEntryEditorStage;
1518
import org.phoebus.olog.es.api.model.OlogLog;
1619
import org.phoebus.ui.javafx.ImageCache;
@@ -37,10 +40,15 @@ public String getName() {
3740

3841
@Override
3942
public AppInstance create() {
40-
if (!LogbookAvailabilityChecker.isLogbookAvailable()) {
41-
return null;
43+
Selection selection = SelectionService.getInstance().getSelection();
44+
LogEntry ologLog;
45+
if(selection.getSelections().isEmpty()){
46+
ologLog = new OlogLog();
4247
}
43-
new LogEntryEditorStage(new OlogLog()).show();
48+
else{
49+
ologLog = AdapterService.adapt(selection.getSelections().get(0), LogEntry.class).get();
50+
}
51+
new LogEntryEditorStage(ologLog).show();
4452
return null;
4553
}
4654

app/save-and-restore/app/doc/index.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ Once a selection of nodes have been copied or moved successfully, the target fol
6565
**NOTE**: Copying a large number of nodes and/or nodes with deep sub-trees is discouraged as this is an expensive operation.
6666
Moving nodes on the other hand is lightweight as only references in the tree structure are updated.
6767

68+
Logging
69+
-------
70+
71+
If a logbook implementation is available in the application, the optional logging module can be used to launch a log entry
72+
editor for the purpose of logging when a new snapshot has been saved, or when a snapshot has been restored.
73+
Properties of the snapshot (name, date etc) are automatically set on the log entry rendered by the editor. If
74+
a restore action has failed to write one or multiple PVs, a list of these PVs is also added to the log entry.
75+
6876
Script Support
6977
--------------
7078

app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/Messages.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ public class Messages {
5555
public static String jmasarServiceUnavailable;
5656
public static String labelMultiplier;
5757
public static String labelThreshold;
58+
public static String loggingFailedTitle;
59+
public static String loggingFailed;
60+
public static String loggingFailedCauseUnknown;
5861
public static String menuItemDeleteSelectedPVs;
5962
public static String openResourceFailedTitle;
6063
public static String openResourceFailedHeader;

0 commit comments

Comments
 (0)