-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add entry point for observable visualizations
- Loading branch information
Showing
6 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
config/plugins/visualizations/common/templates/observable_entry_point.mako
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# -*- coding: utf-8 -*- | ||
<%inherit file="visualization_base.mako"/> | ||
|
||
## Create a container, attach data and import script file | ||
<%def name="get_body()"> | ||
<% | ||
from markupsafe import escape | ||
## Collect incoming data | ||
data_incoming = { | ||
"root": h.url_for("/"), | ||
"visualization_id": visualization_id, | ||
"visualization_name": visualization_name, | ||
"visualization_plugin": visualization_plugin, | ||
"visualization_title": escape(title), | ||
"visualization_config": config } | ||
## Load script source | ||
script_src = script_attributes.get("src") | ||
%> | ||
## Create container and initialize notebook | ||
<div id="app" data-incoming='${h.dumps(data_incoming)}'></div> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@observablehq/inspector@5/dist/inspector.css"> | ||
<script type="module"> | ||
import {Runtime, Inspector} from "https://cdn.jsdelivr.net/npm/@observablehq/runtime@5/dist/runtime.js"; | ||
import define from "https://api.observablehq.com/d/${script_src}"; | ||
new Runtime().module(define, Inspector.into("#app")); | ||
</script> | ||
</%def> |
16 changes: 16 additions & 0 deletions
16
config/plugins/visualizations/example_observable/config/example_observable.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE visualization SYSTEM "../../visualization.dtd"> | ||
<visualization name="Example: Observable" embeddable="false"> | ||
<description>Welcome to the Observable Example Plugin.</description> | ||
<data_sources> | ||
<data_source> | ||
<model_class>HistoryDatasetAssociation</model_class> | ||
<test test_attr="ext" result_type="datatype">csv</test> | ||
<to_param param_attr="id">dataset_id</to_param> | ||
</data_source> | ||
</data_sources> | ||
<params> | ||
<param type="dataset" var_name_in_template="hda" required="true">dataset_id</param> | ||
</params> | ||
<entry_point entry_point_type="observable" src="[email protected]?v=3" /> | ||
</visualization> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters