oncdw.ui

Classes

UI

Module Contents

class oncdw.ui.UI
static import_custom_badge_css(sticky_device=False, sticky_location=False)

Include a custom css to make badge look bigger.

Example

>>> client = ONCDW()
>>> client.ui.import_custom_badge_css()
static h1_badge(left: str, right: str, href: str = '', anchor: str = '', color: str = 'aqua')
static h2_badge(left: str, right: str, href: str = '', anchor: str = '', color: str = 'aqua')
static h3_badge(left: str, right: str, href: str = '', anchor: str = '', color: str = 'aqua')
static location(location: dict)

Location badge wrapped inside a h1 tag.

The href is a link to the Data Search page for the location code. The anchor is matched with the href of location_sidebar().

Parameters:

location (dict) – A dictionary containing the location code and name. Usually it is a device dict that has location info inside.

Example

>>> client = ONCDW()
>>> device = {
...     "location_code": "CODE",
...     "location_name": "Location Name",
... }
>>> client.ui.location(device)
static location_sidebar(location: dict)

Location badge for the sidebar wrapped inside a h1 tag.

The href is a link to the anchor of location().

Parameters:

location (dict) – A dictionary containing the location code and name. Usually it is a device dict that has location info inside.

Example

>>> client = ONCDW()
>>> device = {
...     "location_code": "CODE",
...     "location_name": "Location Name",
... }
>>> client.ui.location_sidebar(device)
static device(device: dict)

Device badge wrapped inside a h2 tag.

The href is a link to the Data Details page for the device id. The anchor is matched with the href of device_sidebar(). Device name is used as the right side of the badge if present, otherwise device code is used.

Parameters:

device (dict) – A dictionary containing the device id, device code and device name.

Example

>>> client = ONCDW()
>>> device = {
...     "device_id": "12345",
...     "device_name": "Device Name",
... }
>>> client.ui.device(device)
static device_sidebar(device: dict)

Device badge for the sidebar wrapped inside a h2 tag.

The href a link to the anchor of device().

Parameters:

device (dict) – A dictionary containing the device id and device code.

Example

>>> client = ONCDW()
>>> device = {
...     "device_id": "12345",
...     "device_code": "CODE"
... }
>>> client.ui.device_sidebar(device)
static sensor(sensor: dict, anchor: str = '')

Sensor badge wrapped inside a h3 tag.

The href is a link to the Sensor Details page for the sensor id. The anchor is matched with the href of sensor_sidebar().

Parameters:
  • sensor (dict) – A dictionary containing the sensor id and sensor name.

  • anchor (str) – The anchor link of the badge.

Example

>>> client = ONCDW()
>>> sensor = {
...     "sensor_id": "67900",
...     "sensor_name": "Sensor Name"
... }
>>> client.ui.sensor_sidebar(sensor)
static sensor_sidebar(sensor: dict, href: str | None = None)

Sensor badge for the sidebar wrapped inside a h3 tag.

The href a link to the anchor of sensor().

Parameters:
  • sensor (dict) – A dictionary containing the sensor id and sensor name.

  • href (str or None, optional) – The href link of the badge.

Example

>>> client = ONCDW()
>>> sensor = {
...     "sensor_id": "67900",
...     "sensor_name": "Sensor Name"
... }
>>> client.ui.sensor_sidebar(sensor)
static sensors_two(sensor1: dict, sensor2: dict)

Two sensor badges for two sensors wrapped inside a h3 tag.

The href is a link to the Sensor Details page for the individual sensor id. The anchor is matched with the href of sensors_two_sidebar().

Parameters:
  • sensor1 (dict) – A dictionary containing the sensor id and sensor name.

  • sensor2 (dict) – A dictionary containing the sensor id and sensor name.

Example

>>> client = ONCDW()
>>> sensor1 = {
...     "sensor_id": "167900",
...     "sensor_name": "Sensor Name 1"
... }
>>> sensor2 = {
...     "sensor_id": "267900",
...     "sensor_name": "Sensor Name 2"
... }
>>> client.ui.sensor_sidebar(sensor1, sensor2)
static sensors_two_sidebar(sensor1: dict, sensor2: dict)

One sensor badge for two sensors for the sidebar wrapped inside a h3 tag.

The href a link to the anchor of sensors_two().

Parameters:
  • sensor1 (dict) – A dictionary containing the sensor id and sensor name.

  • sensor2 (dict) – A dictionary containing the sensor id and sensor name.

Example

>>> client = ONCDW()
>>> sensor1 = {
...     "sensor_id": "167900",
...     "sensor_name": "Sensor Name 1"
... }
>>> sensor2 = {
...     "sensor_id": "267900",
...     "sensor_name": "Sensor Name 2"
... }
>>> client.ui.sensors_two_sidebar(sensor1, sensor2)