Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ public class Preferences {
@Preference
public static String default_restore_mode;

/**
* Allow empty descriptions / comments in SaR nodes
*/
@Preference
public static boolean allow_empty_descriptions;

static {
AnnotatedPreferences.initialize(Preferences.class, "/save_and_restore_preferences.properties");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import javafx.util.StringConverter;
import javafx.util.converter.DoubleStringConverter;
import org.phoebus.applications.saveandrestore.Messages;
import org.phoebus.applications.saveandrestore.Preferences;
import org.phoebus.applications.saveandrestore.SaveAndRestoreApplication;
import org.phoebus.applications.saveandrestore.model.ComparisonMode;
import org.phoebus.applications.saveandrestore.model.ConfigPv;
Expand Down Expand Up @@ -349,7 +350,7 @@ public void commitEdit(Double value) {
descriptionChangeListener = (observableValue, oldValue, newValue) -> dirty.setValue(true);

saveButton.disableProperty().bind(Bindings.createBooleanBinding(() -> dirty.not().get() ||
configurationDescriptionProperty.isEmpty().get() ||
(!Preferences.allow_empty_descriptions && configurationDescriptionProperty.isEmpty().get()) ||
configurationNameProperty.isEmpty().get() ||
userIdentity.isNull().get(),
dirty, configurationDescriptionProperty, configurationNameProperty, userIdentity));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import javafx.stage.Stage;
import org.phoebus.applications.saveandrestore.DirectoryUtilities;
import org.phoebus.applications.saveandrestore.Messages;
import org.phoebus.applications.saveandrestore.Preferences;
import org.phoebus.applications.saveandrestore.filehandler.csv.CSVCommon;
import org.phoebus.applications.saveandrestore.model.ConfigPv;
import org.phoebus.applications.saveandrestore.model.Configuration;
Expand Down Expand Up @@ -243,8 +244,9 @@ public void initialize(URL location, ResourceBundle resources) {

// Cannot save until location, config name and description are set.
saveButton.disableProperty().bind(Bindings.createBooleanBinding(() -> targetNode.get() == null ||
configurationName.get() == null || configurationName.get().isEmpty() ||
description.get() == null || description.get().isEmpty(),
configurationName.get() == null || configurationName.get().isEmpty() || (
!Preferences.allow_empty_descriptions && (description.get() == null || description.get().isEmpty())
),
targetNode, configurationName, description));

// Make config name field non-editable if location is not set, or if user is updating existing configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import javafx.util.Callback;
import org.phoebus.applications.saveandrestore.DirectoryUtilities;
import org.phoebus.applications.saveandrestore.Messages;
import org.phoebus.applications.saveandrestore.Preferences;
import org.phoebus.applications.saveandrestore.SaveAndRestoreApplication;
import org.phoebus.applications.saveandrestore.model.CompositeSnapshot;
import org.phoebus.applications.saveandrestore.model.CompositeSnapshotData;
Expand Down Expand Up @@ -304,7 +305,7 @@ public void updateItem(Node item, boolean empty) {
descriptionChangeListener = (observableValue, oldValue, newValue) -> dirty.setValue(true);

saveButton.disableProperty().bind(Bindings.createBooleanBinding(() -> dirty.not().get() ||
compositeSnapshotDescriptionProperty.isEmpty().get() ||
(!Preferences.allow_empty_descriptions && compositeSnapshotDescriptionProperty.isEmpty().get()) ||
compositeSnapshotNameProperty.isEmpty().get() ||
userIdentity.isNull().get(),
dirty, compositeSnapshotDescriptionProperty, compositeSnapshotNameProperty, userIdentity));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ public void initialize() {
// TODO: support save (=update) a composite snapshot from the snapshot view. In the meanwhile, disable save button.
snapshotDataDirty.not().get() ||
snapshotNameProperty.isEmpty().get() ||
snapshotCommentProperty.isEmpty().get() ||
(!Preferences.allow_empty_descriptions && snapshotCommentProperty.isEmpty().get()) ||
userIdentity.isNull().get(),
snapshotDataDirty, snapshotNameProperty, snapshotCommentProperty, userIdentity));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@ default_snapshot_mode=READ_PVS
# Defines the default restore mode
# CLIENT_RESTORE: the restore operation is performed by the client
# SERVICE_RESTORE: the restore operation is performed by the server
default_restore_mode=CLIENT_RESTORE
default_restore_mode=CLIENT_RESTORE

# Allow leaving the description / comment field empty for Configs / (Composite)
# Snapshots
allow_empty_descriptions=false