Skip to content

Commit

Permalink
Merge pull request #3125 from ControlSystemStudio/fix_sar_date_picker
Browse files Browse the repository at this point in the history
Bug fix for save&restore snapshot date/time picker
  • Loading branch information
georgweiss authored Aug 30, 2024
2 parents 59e0874 + cb2799a commit 77356d2
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -416,22 +416,22 @@ public void addSnapshotFromArchiver(Node configurationNode){
}
return null;
});
Instant time = timePickerDialog.showAndWait().get();
if(time == null){ // User cancels date/time picker dialog
Optional<Instant> time = timePickerDialog.showAndWait();
if(time.isEmpty()){ // User cancels date/time picker dialog
return;
}
disabledUi.set(true);
JobManager.schedule("Add snapshot from archiver", monitor -> {
List<SnapshotItem> snapshotItems;
try {
snapshotItems = SaveAndRestoreService.getInstance().takeSnapshot(configurationNode.getUniqueId(), time);
snapshotItems = SaveAndRestoreService.getInstance().takeSnapshot(configurationNode.getUniqueId(), time.get());
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Failed to query archiver for data", e);
disabledUi.set(false);
return;
}
Snapshot snapshot = new Snapshot();
snapshot.setSnapshotNode(Node.builder().nodeType(NodeType.SNAPSHOT).name(Messages.archiver).created(new Date(time.toEpochMilli())).build());
snapshot.setSnapshotNode(Node.builder().nodeType(NodeType.SNAPSHOT).name(Messages.archiver).created(new Date(time.get().toEpochMilli())).build());
SnapshotData snapshotData = new SnapshotData();
snapshotData.setUniqueId("anonymous");
snapshotData.setSnapshotItems(snapshotItems);
Expand Down

0 comments on commit 77356d2

Please sign in to comment.