Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
549be41
Adding initial code for save&restore web socket API
georgweiss Mar 8, 2025
f964711
Added missing web socket code, initial end-to-end test
georgweiss Mar 10, 2025
25a2e4a
Merge branch 'master' into CSSTUDIO-1967
georgweiss Mar 13, 2025
2905ea7
Ping/pong thread in web socket client
georgweiss Mar 17, 2025
29e98e9
Ping/pong thread in web socket client
georgweiss Mar 17, 2025
d1f1c0c
Some rework to handle data changes from save&restore
georgweiss Mar 25, 2025
316f8cf
Resolve merge conflict
georgweiss Apr 22, 2025
06e22fa
Put web socket client in core module
georgweiss Apr 22, 2025
e2560d8
Minor refactoring
georgweiss Apr 23, 2025
6b2eafc
Remove web socket reconnect logic
georgweiss Apr 23, 2025
fbcef08
Send web socket message when tagging/untagging
georgweiss Apr 23, 2025
80233d7
Let SaveAndRestoreController request web socket connection on initial…
georgweiss Apr 23, 2025
892196b
Web socket messages for filters (add/update/remove)
georgweiss Apr 23, 2025
749c278
Update unit tests
georgweiss Apr 24, 2025
a2be6e2
Fix unit test configuration
georgweiss Apr 24, 2025
ed7b628
Handle configuration update web socket messages, update unit tests
georgweiss Apr 24, 2025
206d724
Unregister listener when save&restore configuration UI is closed
georgweiss Apr 24, 2025
09f2fa2
Fix configuration changes in UI
georgweiss Apr 24, 2025
e8a7256
Fix issues in configuration update through web socket message
georgweiss Apr 24, 2025
ddb6afe
Resolve merge conflicts
georgweiss Apr 24, 2025
3bc9209
Fix update configuration issue
georgweiss Apr 28, 2025
5519ab8
Fix 'dirty' behavior
georgweiss Apr 28, 2025
cb7a5a9
Snapshot view dirty visualization: same as configuration view
georgweiss Apr 29, 2025
4a7c1bb
Move snapshot view icon handling to controller
georgweiss Apr 29, 2025
b6c4947
Web socket handling in snapshot view controller
georgweiss Apr 29, 2025
5c63f78
Fix build failure
georgweiss Apr 29, 2025
0f70202
Fix bug in snapshot update
georgweiss Apr 29, 2025
1a11d4e
Improved UI update when nodes are added/removed
georgweiss Apr 29, 2025
58db4e5
Simplified deletion of node server side
georgweiss Apr 30, 2025
7f1637e
Further simplifications to node deletion
georgweiss Apr 30, 2025
f59b888
Server side web socket message for composite snapshot
georgweiss Apr 30, 2025
0677e92
Allow change of composite snapshot name in snapshot view, several fixes
georgweiss Apr 30, 2025
9e7ffca
Add web socket handling in composite snapshot controller
georgweiss Apr 30, 2025
3fd9bc3
Handle concurrent load of composite snapshot
georgweiss May 1, 2025
6bcade6
Display web socket message when nodes are moved
georgweiss May 4, 2025
aa21840
Finalize web socket messages related to filters
georgweiss May 4, 2025
bc0a73d
Moved web socket client related code out of SaveAndRestoreService
georgweiss May 6, 2025
6219fba
Refacotring to improve maintainability
georgweiss May 6, 2025
ea1d316
Web socket messages when nodes are copied
georgweiss May 7, 2025
7a9d940
Code cleanup, javadoc and doc
georgweiss May 7, 2025
3616a97
Remove printout
georgweiss May 7, 2025
0ce1b00
Update logging of connection failure
georgweiss May 7, 2025
90b5dfa
Updates due to review feed-back
georgweiss May 9, 2025
7ea9f17
Refresh UI when web socket client reconnects
georgweiss May 12, 2025
939154f
Code cleanup
georgweiss May 12, 2025
503dd4c
Ping/pong mechanism to handle connection issues in web socket
georgweiss May 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions app/save-and-restore/app/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,13 @@ A word of caution
-----------------

Save-and-restore data is persisted in a central service and is therefore accessible by multiple
clients. Users should keep in mind that changes (e.g. new or deleted nodes) are not pushed to all clients.
Caution is therefore advocated when working on the nodes in the tree, in particular when changing the structure by
copying, deleting or moving nodes.
clients. Users should keep in mind that changes (e.g. new or deleted nodes) are pushed by the service to
all connected clients. If any other user is working in the save-and-restore app, saved changes may update
the current view. For instance, if a folder node is expanded and another user adds an object (folder
or configuration) to that folder, the new object will automatically be added to the expanded folder.

In other words, changes in the current view are triggered not only by the current user, but may be triggered as a result of
changes done by others.

Tree View Context Menu
----------------------
Expand Down
10 changes: 10 additions & 0 deletions app/save-and-restore/app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@
<artifactId>core-logbook</artifactId>
<version>5.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.phoebus</groupId>
<artifactId>core-ui</artifactId>
<version>5.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.phoebus</groupId>
<artifactId>core-websocket</artifactId>
<version>5.0.1-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 @@ -54,6 +54,8 @@ public FilterViewInstance(AppDescriptor appDescriptor) {
return CompletableFuture.completedFuture(true);
});

dockItem.setOnCloseRequest(e -> searchResultTableViewController.handleTabClosed());

DockPane.getActiveDockPane().addTab(dockItem);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,18 @@ public class Messages {
public static String toolTipConfigurationExists;
public static String toolTipConfigurationExistsOption;
public static String toolTipMultiplierSpinner;
public static String unnamedConfiguration;
public static String unnamedCompositeSnapshot;
public static String unnamedSnapshot;

public static String updateCompositeSnapshotFailed;
public static String updateConfigurationFailed;

public static String updateNodeFailed;

public static String webSocketConnected;
public static String webSocketDisconnected;

static {
NLS.initializeMessages(Messages.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public SaveAndRestoreInstance(AppDescriptor appDescriptor) {
loader.setLocation(SaveAndRestoreApplication.class.getResource("ui/SaveAndRestoreUI.fxml"));
dockItem = new DockItem(this, loader.load());
} catch (Exception e) {
Logger.getLogger(SaveAndRestoreApplication.class.getName()).log(Level.SEVERE, "Failed loading fxml", e);
Logger.getLogger(SaveAndRestoreInstance.class.getName()).log(Level.SEVERE, "Failed loading fxml", e);
}

saveAndRestoreController = loader.getController();
Expand All @@ -82,11 +82,11 @@ public void openResource(URI uri) {
saveAndRestoreController.openResource(uri);
}

public void secureStoreChanged(List<ScopedAuthenticationToken> validTokens){
public void secureStoreChanged(List<ScopedAuthenticationToken> validTokens) {
saveAndRestoreController.secureStoreChanged(validTokens);
}

public void raise(){
public void raise() {
dockItem.select();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@
import java.net.CookieManager;
import java.net.CookiePolicy;
import java.net.URI;
import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.Base64;
import java.util.List;
Expand Down Expand Up @@ -588,10 +586,10 @@ public UserData authenticate(String userName, String password) {
String stringBuilder = Preferences.jmasarServiceUrl +
"/login";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(stringBuilder))
.header("Content-Type", CONTENT_TYPE_JSON)
.POST(HttpRequest.BodyPublishers.ofString(OBJECT_MAPPER.writeValueAsString(new LoginCredentials(userName, password))))
.build();
.uri(URI.create(stringBuilder))
.header("Content-Type", CONTENT_TYPE_JSON)
.POST(HttpRequest.BodyPublishers.ofString(OBJECT_MAPPER.writeValueAsString(new LoginCredentials(userName, password))))
.build();
HttpResponse<String> response = CLIENT.send(request, HttpResponse.BodyHandlers.ofString());
return OBJECT_MAPPER.readValue(response.body(), UserData.class);
} catch (Exception e) {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package org.phoebus.applications.saveandrestore.ui;

import javafx.beans.property.SimpleStringProperty;
import org.phoebus.applications.saveandrestore.model.websocket.SaveAndRestoreWebSocketMessage;
import org.phoebus.security.store.SecureStore;
import org.phoebus.security.tokens.AuthenticationScope;
import org.phoebus.security.tokens.ScopedAuthenticationToken;
Expand All @@ -32,8 +33,12 @@
public abstract class SaveAndRestoreBaseController {

protected final SimpleStringProperty userIdentity = new SimpleStringProperty();
protected final WebSocketClientService webSocketClientService;
protected final SaveAndRestoreService saveAndRestoreService;

public SaveAndRestoreBaseController() {
this.webSocketClientService = WebSocketClientService.getInstance();
this.saveAndRestoreService = SaveAndRestoreService.getInstance();
try {
SecureStore secureStore = new SecureStore();
ScopedAuthenticationToken token =
Expand Down Expand Up @@ -63,4 +68,16 @@ public void secureStoreChanged(List<ScopedAuthenticationToken> validTokens) {
public SimpleStringProperty getUserIdentity() {
return userIdentity;
}

/**
* Default no-op implementation of a handler for {@link SaveAndRestoreWebSocketMessage}s.
* @param webSocketMessage See {@link SaveAndRestoreWebSocketMessage}
*/
protected void handleWebSocketMessage(SaveAndRestoreWebSocketMessage<?> webSocketMessage){
}


protected boolean handleTabClosed(){
return true;
}
}
Loading