Skip to content

Commit

Permalink
Upgrade to bokeh 2 & robustify front-end tests (skyportal#1293)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanv authored Dec 3, 2020
1 parent 20844eb commit f81313f
Show file tree
Hide file tree
Showing 17 changed files with 288 additions and 444 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"test": "eslint --ext .jsx,.js static/js && make test"
},
"dependencies": {
"@babel/plugin-proposal-export-namespace-from": "7.12.1",
"@bokeh/bokehjs": "2.2.3",
"@date-io/dayjs": "1.3.13",
"@material-ui/core": "4.11.0",
"@material-ui/icons": "4.9.1",
Expand All @@ -14,7 +16,6 @@
"@rjsf/core": "2.4.0",
"@rjsf/material-ui": "2.4.0",
"autosuggest-highlight": "3.1.1",
"bokehjs": "0.12.13",
"check-dependencies": "1.1.0",
"clsx": "1.1.1",
"convert-css-length": "2.0.1",
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pandas>=0.17.0
dask>=0.15.0
joblib>=0.11
seaborn>=0.10.0
bokeh==0.12.13
bokeh==2.2.3
pytest-randomly>=2.1.1
factory-boy==2.11.1
astropy==4.0.1.post1
Expand Down
41 changes: 13 additions & 28 deletions skyportal/handlers/api/internal/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,46 +8,31 @@
import pandas as pd


# TODO this should distinguish between "no data to plot" and "plot failed"
class PlotPhotometryHandler(BaseHandler):
@auth_or_token
def get(self, obj_id):
height = self.get_query_argument("plotHeight", 300)
width = self.get_query_argument("plotWidth", 600)
docs_json, render_items, custom_model_js = plot.photometry_plot(
height = self.get_query_argument("height", 300)
width = self.get_query_argument("width", 600)
json = plot.photometry_plot(
obj_id, self.current_user, height=int(height), width=int(width),
)
if docs_json is None:
self.success(data={'docs_json': None, 'url': self.request.path})
else:
self.success(
data={
'docs_json': docs_json,
'render_items': render_items,
'custom_model_js': custom_model_js,
'url': self.request.uri,
}
)
self.success(data={'bokehJSON': json, 'url': self.request.uri})


class PlotSpectroscopyHandler(BaseHandler):
@auth_or_token
def get(self, obj_id):
height = self.get_query_argument("height", 300)
width = self.get_query_argument("width", 600)
spec_id = self.get_query_argument("spectrumID", None)
docs_json, render_items, custom_model_js = plot.spectroscopy_plot(
obj_id, self.associated_user_object, spec_id
json = plot.spectroscopy_plot(
obj_id,
self.associated_user_object,
spec_id,
height=int(height),
width=int(width),
)
if docs_json is None:
self.success(data={'docs_json': None, 'url': self.request.path})
else:
self.success(
data={
'docs_json': docs_json,
'render_items': render_items,
'custom_model_js': custom_model_js,
'url': self.request.uri,
}
)
self.success(data={'bokehJSON': json, 'url': self.request.uri})


class AirmassHandler(BaseHandler):
Expand Down
Loading

0 comments on commit f81313f

Please sign in to comment.