Skip to content

Commit ef56bf9

Browse files
committed
Update visualization example
1 parent aa2657e commit ef56bf9

File tree

4 files changed

+52
-22
lines changed

4 files changed

+52
-22
lines changed

config/plugins/visualizations/example/static/example.xml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!DOCTYPE visualization SYSTEM "../../visualization.dtd">
33
<visualization name="Minimal Example" hidden="true">
4-
<description>Welcome to the Minimal JS-Based Example Plugin.</description>
4+
<description>Welcome to the Minimal Plugin</description>
55
<data_sources>
66
<data_source>
77
<model_class>HistoryDatasetAssociation</model_class>
8-
<test type="isinstance" test_attr="datatype" result_type="datatype">tabular.Tabular</test>
9-
<to_param param_attr="id">dataset_id</to_param>
8+
<test test_attr="ext">tabular</test>
109
</data_source>
1110
</data_sources>
1211
<params>
13-
<param type="dataset" var_name_in_template="hda" required="true">dataset_id</param>
12+
<param required="true">dataset_id</param>
1413
</params>
1514
<entry_point entry_point_type="script" src="script.js" />
1615
<settings>
@@ -30,4 +29,13 @@
3029
<specs>
3130
<spec_name>spec_value</spec_name>
3231
</specs>
32+
<tests>
33+
<test>
34+
<param name="dataset_id" value="http://cdn.jsdelivr.net/gh/galaxyproject/galaxy-test-data/1.tabular" ftype="tabular" />
35+
</test>
36+
</tests>
37+
<help format="markdown"><![CDATA[
38+
Learn more at:
39+
[https://charts.galaxyproject.org](https://charts.galaxyproject.org)
40+
]]></help>
3341
</visualization>
-7.26 KB
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Loading
Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,48 @@
11
const { root, visualization_config, visualization_plugin } = JSON.parse(document.getElementById("app").dataset.incoming);
22

3-
const div = Object.assign(document.createElement("div"), {
4-
style: "border: 2px solid #25537b; border-radius: 1rem; padding: 1rem"
3+
const container = Object.assign(document.createElement("div"), {
4+
style: `
5+
font-family: sans-serif;
6+
max-width: 600px;
7+
margin: 0rem auto;
8+
line-height: 1.5;
9+
font-size: 14px;
10+
position: relative;
11+
padding: 1rem;
12+
background-image: url(${root + visualization_plugin.logo});
13+
background-size: 50px;
14+
background-repeat: repeat;
15+
background-position: center;
16+
opacity: 0.5;
17+
`
518
});
619

7-
const img = Object.assign(document.createElement("img"), {
8-
src: root + visualization_plugin.logo,
9-
style: "height: 3rem"
20+
const content = Object.assign(document.createElement("div"), {
21+
style: "position: relative; z-index: 1; background: rgba(255, 255, 255, 0.9); padding: 1rem; border-radius: 0.5rem; word-wrap: break-word; overflow-wrap: break-word; word-break: break-all;"
1022
});
11-
div.appendChild(img);
23+
24+
const dataset = Object.assign(document.createElement("div"), {
25+
innerText: `You have selected dataset: ${visualization_config.dataset_id}`,
26+
style: "margin-bottom: 1rem; font-weight: 600;"
27+
});
28+
content.appendChild(dataset);
1229

1330
Object.entries(visualization_plugin).forEach(([key, value]) => {
14-
const row = document.createElement("div");
31+
const row = Object.assign(document.createElement("div"), {
32+
style: "display: flex; margin-bottom: 0.25rem;"
33+
});
1534
const spanKey = Object.assign(document.createElement("span"), {
16-
innerText: `${key}: `,
17-
style: "font-weight: bold"
35+
innerText: key,
36+
style: "font-weight: 600; width: 150px; flex-shrink: 0;"
1837
});
1938
const spanValue = Object.assign(document.createElement("span"), {
20-
innerText: JSON.stringify(value)
39+
innerText: JSON.stringify(value),
40+
style: "color: #444;"
2141
});
2242
row.appendChild(spanKey);
2343
row.appendChild(spanValue);
24-
div.appendChild(row);
25-
});
26-
27-
const dataset = Object.assign(document.createElement("div"), {
28-
innerText: `You have selected dataset: ${visualization_config.dataset_id}.`,
29-
style: "font-weight: bold; padding-top: 1rem;"
44+
content.appendChild(row);
3045
});
31-
div.appendChild(dataset);
3246

33-
document.body.appendChild(div);
47+
container.appendChild(content);
48+
document.body.appendChild(container);

0 commit comments

Comments
 (0)