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

allow downstream apps to override docs link #2416

Merged
merged 1 commit into from
Sep 1, 2023
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
@@ -1,7 +1,7 @@
<template>
<j-tray-plugin
description='Create a 2D image from a data cube.'
:link="'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#moment-maps'"
:link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#moment-maps'"
:popout_button="popout_button">

<plugin-dataset-select
Expand Down
2 changes: 1 addition & 1 deletion jdaviz/configs/cubeviz/plugins/slice/slice.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<j-tray-plugin
description='Select slice (or wavelength) of the cube to show in the image viewers and highlighted in the spectrum viewer. The slice can also be changed interactively in the spectrum viewer by activating the slice tool.'
:link="'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#slice'"
:link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#slice'"
:popout_button="popout_button">

<v-row>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<j-tray-plugin
description='Extract a spectrum from a spectral cube.'
:link="'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#spectral-extraction'"
:link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#spectral-extraction'"
:popout_button="popout_button"
:disabled_msg="disabled_msg">

Expand Down
2 changes: 1 addition & 1 deletion jdaviz/configs/default/plugins/collapse/collapse.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<j-tray-plugin
description='Collapse a spectral cube along one axis.'
:link="'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#collapse'"
:link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#collapse'"
:popout_button="popout_button">

<plugin-dataset-select
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<j-tray-plugin
description='Export viewer plot as an image.'
:link="'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#export-plot'"
:link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#export-plot'"
:popout_button="popout_button">

<plugin-viewer-select
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<j-tray-plugin
:description="config==='cubeviz' ? 'Smooth data cube spatially or spectrally with a Gaussian kernel.' : 'Smooth data with a Gaussian kernel.'"
:link="'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#gaussian-smooth'"
:link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#gaussian-smooth'"
:popout_button="popout_button">

<!-- for mosviz, the entries change on row change, so we want to always show the dropdown
Expand Down
2 changes: 1 addition & 1 deletion jdaviz/configs/default/plugins/line_lists/line_lists.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<j-tray-plugin
description='Plot lines from preset or custom line lists.'
:link="'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#line-lists'"
:link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#line-lists'"
:disabled_msg="disabled_msg"
:popout_button="popout_button">

Expand Down
2 changes: 1 addition & 1 deletion jdaviz/configs/default/plugins/markers/markers.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<j-tray-plugin
description='Create and export markers. Press "m" with the cursor over a viewer to log the mouseover information. To change the selected layer, click the layer cycler in the mouseover information section of the app-level toolbar.'
:link="'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#markers'"
:link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#markers'"
:uses_active_status="uses_active_status"
@plugin-ping="plugin_ping($event)"
:keep_active.sync="keep_active"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<j-tray-plugin
description='View metadata.'
:link="'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#metadata-viewer'"
:link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#metadata-viewer'"
:popout_button="popout_button">

<!-- for specviz, we'll allow this to hide for a single entry, but since filters are being
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<j-tray-plugin
description='Fit an analytic model to data or a subset.'
:link="'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#model-fitting'"
:link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#model-fitting'"
:popout_button="popout_button">

<!-- for mosviz, the entries change on row change, so we want to always show the dropdown
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<j-tray-plugin
description='Viewer and data/layer options.'
:link="'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#plot-options'"
:link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#plot-options'"
:uses_active_status="uses_active_status"
@plugin-ping="plugin_ping($event)"
:popout_button="popout_button">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<j-tray-plugin
description='Tools for selecting and interacting with subsets.'
:link="'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#subset-tools'"
:link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#subset-tools'"
:popout_button="popout_button">

<v-row align=center>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<j-tray-plugin
description='Perform aperture photometry for a single region.'
:link="'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#simple-aperture-photometry'"
:link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#simple-aperture-photometry'"
:popout_button="popout_button">

<plugin-dataset-select
Expand Down
2 changes: 1 addition & 1 deletion jdaviz/configs/imviz/plugins/catalogs/catalogs.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<j-tray-plugin
description='Queries an area encompassed by the viewer using a specified catalog and marks all the objects found within the area.'
:link="'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#catalog-search'"
:link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#catalog-search'"
:popout_button="popout_button">

<plugin-viewer-select
Expand Down
2 changes: 1 addition & 1 deletion jdaviz/configs/imviz/plugins/compass/compass.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<j-tray-plugin
description='Show active data label, compass, and zoom box.'
:link="'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#compass'"
:link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#compass'"
:uses_active_status="uses_active_status"
@plugin-ping="plugin_ping($event)"
:popout_button="popout_button">
Expand Down
2 changes: 1 addition & 1 deletion jdaviz/configs/imviz/plugins/footprints/footprints.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<j-tray-plugin
description='Show instrument footprints as overlays on image viewers.'
:link="'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#footprints'"
:link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#footprints'"
:uses_active_status="uses_active_status"
@plugin-ping="plugin_ping($event)"
:keep_active.sync="keep_active"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<j-tray-plugin
description='Press l to plot line profiles across X and Y under cursor. You can also manually enter X, Y and then click PLOT.'
:link="'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#line-profiles'"
:link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#line-profiles'"
:uses_active_status="uses_active_status"
@plugin-ping="plugin_ping($event)"
:popout_button="popout_button">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<j-tray-plugin
description='Re-link images by WCS or pixels.'
:link="'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#link-control'"
:link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#link-control'"
:popout_button="popout_button">

<div style="display: grid"> <!-- overlay container -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<j-tray-plugin
description="Rotate viewer canvas to any orientation (note: this does not affect the underlying data)."
:link="'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#canvas-rotation'"
:link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#canvas-rotation'"
:disabled_msg="isChromium() ? '' : 'Image rotation is not supported by your browser. Please see our docs for more information.'"
:popout_button="popout_button">
<plugin-viewer-select
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<j-tray-plugin
description='Add a slit to the image viewer.'
:link="'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#slit-overlay'"
:link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#slit-overlay'"
:popout_button="popout_button">

<v-row>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<j-tray-plugin
description="Return statistics for a single spectral line."
:link="'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#line-analysis'"
:link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#line-analysis'"
:uses_active_status="uses_active_status"
@plugin-ping="plugin_ping($event)"
:keep_active.sync="keep_active"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!-- To re-enable plugin, use :disabled_msg="disabled_msg" -->
<j-tray-plugin
description='Convert the spectral flux density and spectral axis units.'
:link="'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#unit-conversion'"
:link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#unit-conversion'"
:disabled_msg="disabled_msg"
:popout_button="popout_button">

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<j-tray-plugin
description="2D to 1D spectral extraction."
:link="'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#spectral-extraction'"
:link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#spectral-extraction'"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here in Jdaviz, can we just define the URL in the mixin? Then we don't need all the || operations?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about that, the downside is in order to have access to vdocs/config it would need to be in the init, after calling super (I think), which might be a bit more subtle to remember to do for future plugins that this... but I was on the fence, so if you think that would be cleaner, I can easily switch to that instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Maybe this is okay for now then.

Copy link
Member Author

@kecnry kecnry Sep 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revisiting this - one advantage to moving the docs link to the plugin class would be that we could programmatically open a new tab from the API... plugin.open_docs(), or similar 🤔 🐱

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

programmatically open a new tab

Oh, dear. Astronomers have enough tabs open as it is. Do we really want to encourage that even more?

:uses_active_status="uses_active_status"
@plugin-ping="plugin_ping($event)"
:keep_active.sync="keep_active"
Expand Down
1 change: 1 addition & 0 deletions jdaviz/core/template_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ class PluginTemplateMixin(TemplateMixin):
This base class can be inherited by all sidebar/tray plugins to expose common functionality.
"""
disabled_msg = Unicode("").tag(sync=True)
docs_link = Unicode("").tag(sync=True) # set to non-empty to override value in vue file
plugin_opened = Bool(False).tag(sync=True) # noqa any instance of the plugin is open (recently sent an "alive" ping)
uses_active_status = Bool(False).tag(sync=True) # noqa whether the plugin has live-preview marks, set to True in plugins to expose keep_active switch
keep_active = Bool(False).tag(sync=True) # noqa whether the live-preview marks show regardless of active state, inapplicable unless uses_active_status is True
Expand Down
Loading