From 102b92370c87ee649c4acfe7945325e9d2e7875f Mon Sep 17 00:00:00 2001 From: francoismg Date: Mon, 18 Nov 2024 06:14:29 +0100 Subject: [PATCH] moved from mako to js plugin --- .../config/fits_graph_viewer.xml | 2 +- .../fits_graph_viewer/package.json | 8 +++-- .../fits_graph_viewer/src/index.js | 10 +++++- .../templates/fits_graph_viewer.mako | 36 ------------------- 4 files changed, 15 insertions(+), 41 deletions(-) delete mode 100644 config/plugins/visualizations/fits_graph_viewer/templates/fits_graph_viewer.mako diff --git a/config/plugins/visualizations/fits_graph_viewer/config/fits_graph_viewer.xml b/config/plugins/visualizations/fits_graph_viewer/config/fits_graph_viewer.xml index 420eb0aee3a6..4d67c16da013 100644 --- a/config/plugins/visualizations/fits_graph_viewer/config/fits_graph_viewer.xml +++ b/config/plugins/visualizations/fits_graph_viewer/config/fits_graph_viewer.xml @@ -12,5 +12,5 @@ dataset_id - + diff --git a/config/plugins/visualizations/fits_graph_viewer/package.json b/config/plugins/visualizations/fits_graph_viewer/package.json index 0ae40f629b17..94523876cb51 100644 --- a/config/plugins/visualizations/fits_graph_viewer/package.json +++ b/config/plugins/visualizations/fits_graph_viewer/package.json @@ -8,9 +8,11 @@ "main": "index.js", "license": "AFL-3.0", "dependencies": { - "webpack": "^5.94.0", - "webpack-cli": "^5.1.4", - "astrovisjs": "0.9.92" + "astrovisjs": "0.9.92", + "webpack": "^5.94.0" + }, + "devDependencies": { + "webpack-cli": "^5.1.4" }, "scripts": { "build": "npx webpack build --config webpack.prod.js --output-path=./static" diff --git a/config/plugins/visualizations/fits_graph_viewer/src/index.js b/config/plugins/visualizations/fits_graph_viewer/src/index.js index 6834805533cf..87bf33349263 100644 --- a/config/plugins/visualizations/fits_graph_viewer/src/index.js +++ b/config/plugins/visualizations/fits_graph_viewer/src/index.js @@ -1,5 +1,13 @@ import {init} from 'astrovisjs/dist/astrovis/astrovis'; document.addEventListener('DOMContentLoaded', () => { - init('astrovisdiv', file_url); + + const {root, visualization_config} = JSON.parse( + document.getElementById("app") + .getAttribute("data-incoming") || "{}"); + + const dataset_id = visualization_config.dataset_id; + const file_url = root + "datasets/" + dataset_id + "/display" + + init('app', file_url); }); \ No newline at end of file diff --git a/config/plugins/visualizations/fits_graph_viewer/templates/fits_graph_viewer.mako b/config/plugins/visualizations/fits_graph_viewer/templates/fits_graph_viewer.mako deleted file mode 100644 index b8f491b739dc..000000000000 --- a/config/plugins/visualizations/fits_graph_viewer/templates/fits_graph_viewer.mako +++ /dev/null @@ -1,36 +0,0 @@ - -<% - import os - - root = h.url_for('', qualified=True) - - hdadict = trans.security.encode_dict_ids( hda.to_dict() ) - file_url = os.path.join(root, 'datasets', hdadict['id'], "display?to_ext="+hda.ext) - - app_root = root + '/static/plugins/visualizations/fits_graph_viewer/static/' -%> - - - - - - - FITS Graph Viewer - - - -
-
-
-
-
- - - - - ${h.javascript_link( app_root + 'fits_graph_viewer.js' )} - - -