All files / src index.ts

87.5% Statements 7/8
50% Branches 2/4
100% Functions 2/2
87.5% Lines 7/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78                1x   1x                                                                                   1x                         1x 1x     1x 1x              
// ─────────────────────────────────────────────────────────────
// src/index.ts  ➜  widgetDef.polls = true
// ─────────────────────────────────────────────────────────────
import type { OctopusHost } from '@ska-octopus-widget-sdk/widget-sdk';
import { INPUT_MULTIPLE_DB, makeWidgetDef } from '@ska-octopus-widget-sdk/widget-sdk';
import TangoExplorerWidget from './TangoExplorerWidget';
import pkg from '../package.json';
 
const { version } = pkg;
 
const schema = {
  type: 'object',
  properties: {
    tangoDB: {
      type: INPUT_MULTIPLE_DB,
      title: 'Tango DB endpoints',
      propertyType: 'functionality',
      level: 2,
      description:
        'Select one or more Tango Database endpoints. The first selected endpoint is used for queries.',
      default: ['1', '2']
    },
    useEnumLabels: {
      type: 'boolean',
      title: 'Use enum labels for integer states',
      propertyType: 'functionality',
      level: 2,
      description: 'Use enum labels when available; otherwise keep raw state values.',
      default: true
    },
    groupByServer: {
      type: 'boolean',
      title: 'Group devices by server',
      propertyType: 'functionality',
      level: 2,
      description:
        'If disabled, devices are grouped directly by state (ON, FAULT, …) for a global view',
      default: false
    },
    stateColorMode: {
      type: 'string',
      title: 'State colors',
      propertyType: 'functionality',
      level: 2,
      description: 'Choose SDK state colors (default) or tango palette.',
      enum: ['state', 'tango'],
      enumNames: ['State colors (default)', 'Tango colors'],
      default: 'state'
    }
  }
};
 
const widgetDef = makeWidgetDef({
  key: 'tangoExplorer',
  component: TangoExplorerWidget,
  label: 'TangoExplorer',
  layout: { x: 0, y: 0, w: 20, h: 20 },
  requiredStreams: [],
  polls: true,
  docsUrl: 'https://developer.skao.int/projects/ska-octopus-tango-explorer-widget/en/latest/',
  config: { schema },
  version
});
 
function register(O: OctopusHost) {
  O.registerWidget(widgetDef as any);
}
 
(function wait(h: any) {
  if (typeof h.registerWidget === 'function') {
    register(h as OctopusHost);
  } else E{
    setTimeout(wait, 50, h);
  }
})((globalThis as any).Octopus || ((globalThis as any).Octopus = {}));
 
export default TangoExplorerWidget;