Skip to content

Commit

Permalink
Create own jsroot website for geometry display. (#20)
Browse files Browse the repository at this point in the history
* Create static.yml

Publish a static webpage so we can use jsroot to display geometries.

* Create index.htm

Add the html file for jsroot.
  • Loading branch information
ast0815 authored Nov 23, 2023
1 parent 2bb86ae commit 1bae97d
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
# Upload entire repository
path: 'jsroot/index.htm'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
58 changes: 58 additions & 0 deletions jsroot/index.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Read a ROOT file</title>
<link rel="shortcut icon" href="img/RootIcon.ico"/>
</head>
<body>
<div id="simpleGUI">
loading scripts ...
</div>
<script type="module">
//import { buildGUI } from './modules/gui.mjs';
import { buildGUI } from 'https://root.cern/js/latest/modules/gui.mjs';
buildGUI('simpleGUI');
</script>
</body>
</html>

<!--
This is JSROOT main page, which aims to display content of ROOT files.
Several URL parameters could be specified when opening page:
file - name of the file(s), which will be automatically open with page loading
json - name of JSON file(s) with ROOT object, stored by TBufferJSON::ConvertToJSON method
item - object name in the file to display
items - object names in the file to display
opt - draw option for the item
opts - draw options for the items
layout - can be 'simple', 'flex' or gridNxM where N and M are integer values
nobrowser - only file item(s) will be displayed, browser will be disabled
inject - name of JavaScript(s), automatically injected at the beginning
mathjax - use MathJax for Latex output (automatically loaded for TMathText objects)
palette - id of default color palette, 51..123 - new ROOT6 palette (default 57)
style - TStyle object itemname or JSON file name
toolbar - configure position and orientation of pad toolbar, combine 'right','vert','off'
dark - enables dark mode
Example:
https://root.cern/js/latest/?file=../files/hsimple.root&layout=grid2x2&item=[hpx;1,hpxpy;1]&opts=[,colz]
Page can be used to open files from other web servers like:
https://root.cern/js/latest/?file=https://jsroot.gsi.de/files/hsimple.root
But one should be aware about Cross-Origin Request blocking.
Read https://developer.mozilla.org/en/http_access_control for more details.
To avoid problem at all, one can copy only index.htm on the web server where data files are located.
And specify full path to the use module like:
import { buildGUI } from 'https://root.cern/js/latest/modules/gui.mjs';
If necessary, complete JSROOT can be installed on the web server.
Project repository: https://github.com/root-project/jsroot.
-->

0 comments on commit 1bae97d

Please sign in to comment.