From 17d28d06420c45e9f5defc06b33332e3c15d8ff9 Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Thu, 21 Sep 2023 08:20:04 -0400 Subject: [PATCH] optionally disable moment map server-side saving --- .../configs/cubeviz/plugins/moment_maps/moment_maps.py | 9 +++++++++ .../configs/cubeviz/plugins/moment_maps/moment_maps.vue | 6 +++--- .../configs/cubeviz/plugins/tests/test_cubeviz_helper.py | 5 ++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.py b/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.py index 0aadf4797e..70211755ac 100644 --- a/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.py +++ b/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.py @@ -50,6 +50,11 @@ class MomentMap(PluginTemplateMixin, DatasetSelectMixin, SpectralSubsetSelectMix moment_available = Bool(False).tag(sync=True) overwrite_warn = Bool(False).tag(sync=True) + # export_enabled controls whether saving the moment map to a file is enabled via the UI. This + # is a temporary measure to allow server-installations to disable saving server-side until + # saving client-side is supported + export_enabled = Bool(True).tag(sync=True) + def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -138,6 +143,10 @@ def vue_overwrite_fits(self, *args): def _write_moment_to_fits(self, overwrite=False, *args): if self.moment is None or not self.filename: # pragma: no cover return + if not self.export_enabled: + # this should never be triggered since this is intended for UI-disabling and the + # UI section is hidden, but would prevent any JS-hacking + raise ValueError("_write_moment_to_fits is currently disabled") # Make sure file does not end up in weird places in standalone mode. path = os.path.dirname(self.filename) diff --git a/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.vue b/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.vue index c259128607..368842c4ee 100644 --- a/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.vue +++ b/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.vue @@ -49,11 +49,11 @@ @click:action="calculate_moment" > - Results + Results
-
+