Files
common_pages/README.md
mathis_s eab406d5cf Applied Edwards review suggestions
Removed some unused functions, changed var to let / const whereever
possible, adjusted README so it is in sync with the actual code, fixed a
logic bug when checking if sequencer.js is loaded, removed last globalThis instance from Voltage_tab.js.
2026-09-18 16:15:38 +02:00

2.9 KiB

Common pages

Custom MIDAS webpages shared across multiple SuS experiments.

This repository is meant to be included as a submodule in the instrument-specific pages repository such as https://gitea.psi.ch/lin-midas-pages/vms_pages.

Using common.js in a custom MIDAS UI

pages/common.js is an ES module that holds the shared front-end logic of the "Mudas" (MIDAS User interface) page. It contains no instrument specific information; that is supplied by the instrument repository. To reuse it in a custom MIDAS UI you need the following things:

  1. an ES-module init file that imports common.js, supplies the instrument configuration and drives the page, and
  2. (optionally) per-tab markup/JS files under a tabs/ directory.

After installing the files live in the MIDAS pages directory (the CMake install prefix), which MIDAS serves and advertises to the browser via the /ODB/Custom/Path ODB entry.

Tabs

instrTabs is an object keyed by an arbitrary tab name. Each value describes one tab; the full field reference is in the fill_tabs() docstring in common.js. In short:

  • htmlFile (required) — markup file under tabs/. It is pure HTML (no <script> tags); it is fetched and its <body> children are moved into the tab container.
  • jsFile (optional) — JS module under tabs/, imported into the page. A jsFile shared by several tabs is imported only once.
  • init (optional) — export (or global) function name(s) run once after the tab's markup and JS are in place; initArgs are passed to it.
  • onOpen (optional) — export/global function name(s) run every time the tab is opened.
  • style — "Tab" (top bar) or "Menu" (grouped under "More ...").
  • order / label — placement and caption.

Optional hooks

  • Run control — common.start_run(), common.pause_run(), common.resume_run() and common.stop_run() issue the corresponding cm_transition after a confirmation prompt; wire them to your run buttons.
  • PySequencer — common.run_pysequencer_script(name) loads a setup script (it needs sequencer.js loaded for dlgParam / checkODBValue).

Beamline_elements

It is possible to show an image to the right or to the bottom of the table in the Beamline_elements page by providing a custom beamline_overview_images.json manifest file (it is recommended to automate this as part of the installation routine). The default beamline_overview_images.json looks like this:

{
}

To put an image to the right of the table, the custom file should like this:

{
    "right": "image_to_the_right",
}

Similarily, for an image at the bottom:

{
    "bottom": "image_at_the_bottom",
}

And for both right and bottom:

{
    "right": "image_to_the_right",
    "bottom": "image_at_the_bottom",
}

The VMS pages repository has an example.

Contact

alexander.soederqvist@psi.ch edward.wall@psi.ch stefan.mathis@psi.ch