Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

manual backport of PR #3096 #3105

Merged
merged 1 commit into from
Jul 22, 2024
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
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Bug Fixes

- Fixes overwrite behavior for plugin plots, and properly closes overwrite warning overlay after confirmation. [#3094]

- Disable all non-image exporting when the server is not running locally, to avoid confusion with the file being saved on the server. [#3096]

Cubeviz
^^^^^^^

Expand Down
9 changes: 9 additions & 0 deletions jdaviz/configs/default/plugins/export/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ class Export(PluginTemplateMixin, ViewerSelectMixin, SubsetSelectMixin,

overwrite_warn = Bool(False).tag(sync=True)

# This is a temporary measure to allow server-installations to disable saving server-side until
# saving client-side is supported for all exports.
serverside_enabled = Bool(True).tag(sync=True)

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

Expand Down Expand Up @@ -175,6 +179,11 @@ def __init__(self, *args, **kwargs):
self.session.hub.subscribe(self, SubsetDeleteMessage,
handler=self._set_subset_not_supported_msg)

if self.app.state.settings.get('server_is_remote', False):
# when the server is remote, saving the file in python would save on the server, not
# on the user's machine, so export support in cubeviz should be disabled
self.serverside_enabled = False

@property
def user_api(self):
# TODO: backwards compat for save_figure, save_movie,
Expand Down
7 changes: 3 additions & 4 deletions jdaviz/configs/default/plugins/export/export.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
</div>
</div>

<div v-if="dataset_items.length > 0">
<div v-if="dataset_items.length > 0 && serverside_enabled">
<span class="export-category">Generated Data</span>
<v-row>
<span class="category-content v-messages v-messages__message text--secondary">Export data generated by plugins.</span>
Expand Down Expand Up @@ -125,7 +125,7 @@
</v-row>
</div>

<div v-if="subset_items.length > 0">
<div v-if="subset_items.length > 0 && serverside_enabled">
<span class="export-category">Subsets</span>
<v-row>
<span class="category-content v-messages v-messages__message text--secondary">Export spatial subset as astropy region or spectral subset as specutils SpectralRegion.</span>
Expand Down Expand Up @@ -162,7 +162,7 @@
</v-row>
</div>

<div v-if="plugin_table_items.length > 0">
<div v-if="plugin_table_items.length > 0 && serverside_enabled">
<span class="export-category">Plugin Tables</span>
<v-row>
<span class="category-content v-messages v-messages__message text--secondary">Export table from a plugin to a file.</span>
Expand Down Expand Up @@ -221,7 +221,6 @@
</v-select>
</v-row>
</div>

<div style="display: grid; position: relative"> <!-- overlay container -->
<div style="grid-area: 1/1">

Expand Down
Loading