Skip to content

Commit

Permalink
added some more docu
Browse files Browse the repository at this point in the history
  • Loading branch information
forman committed Nov 12, 2024
1 parent a160a12 commit efc7c6e
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 16 deletions.
13 changes: 13 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@
lazily and therefore supports chunk-wise, parallel processing. (#1


### Other changes

* Added experimental feature that allows for extending the xcube Viewer
user interface by _server-side panels_. For this to work, users can now
configure xcube Server to load one or more Python modules that provide
`xcube.webapi.viewer.contrib.Panel` UI-contributions.
Panel instances provide two decorators `layout()` and `callback()`
which are used to implement the UI and the interaction behaviour,
respectively. The functionality is provided by the
`https://github.com/bcdev/dashi/dashipy` Python library.
A working example can be found in `examples/serve/panels-demo`.


## Changes in 1.7.1

### Enhancements
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
DatasetAttribution:
- "© by Brockmann Consult GmbH 2024, contains modified Copernicus Data 2019, processed by ESA"
Viewer:
Augmentation:
Path: ""
Extensions:
- my_viewer_ext.ext

DatasetChunkCacheSize: 100M

Expand All @@ -21,12 +24,6 @@ DataStores:
Title: Lousiville S2
Style: louisville

Viewer:
Augmentation:
Path: ""
Extensions:
- my_viewer_ext.ext

Styles:
- Identifier: waddensea
ColorMappings:
Expand Down
12 changes: 11 additions & 1 deletion xcube/webapi/viewer/contrib/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@


class Panel(Contribution):
"""Panel contribution"""
"""Panel contribution.
A panel is a UI-contribution to xcube Viewer.
To become effective, instances of this class must be added
to a ``dashipy.Extension`` instance exported from your extension
module.
Args:
name: A name that is unique within the extension.
title: An initial title for the panel.
"""

def __init__(self, name: str, title: str | None = None):
super().__init__(name, visible=False, title=title)
13 changes: 6 additions & 7 deletions xcube/webapi/viewer/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,7 @@ def do_get_layout(self, contrib_point: str, contrib_index: str):
)

def do_get_callback_results(self):
self._write_response(
get_callback_results(self.ctx.ext_ctx, self.request.json)
)
self._write_response(get_callback_results(self.ctx.ext_ctx, self.request.json))

def _write_response(self, response: ExtResponse):
self.response.set_header("Content-Type", "text/json")
Expand Down Expand Up @@ -146,8 +144,8 @@ def get(self):
# noinspection PyPep8Naming
@api.route("/viewer/ext/layout/{contribPoint}/{contribIndex}")
class ViewerExtLayoutHandler(ViewerExtHandler):
# GET /dashi/layout/{contrib_point_name}/{contrib_index}
def get(self, contribPoint: str, contribIndex: str):
"""This endpoint is for testing only."""
self.do_get_layout(contribPoint, contribIndex)

# POST /dashi/layout/{contrib_point_name}/{contrib_index}
Expand Down Expand Up @@ -176,11 +174,12 @@ def post(self, contribPoint: str, contribIndex: str):
@api.route("/viewer/ext/callback")
class ViewerExtCallbackHandler(ViewerExtHandler):

# POST /dashi/callback
@api.operation(
operationId="getViewerContributionCallbackResults",
summary="Process the viewer contribution callback requests"
" and return state change requests.",
summary=(
"Process the viewer contribution callback requests"
" and return state change requests."
),
)
def post(self):
self.do_get_callback_results()

0 comments on commit efc7c6e

Please sign in to comment.