All files index.ts

75% Statements 6/8
75% Branches 3/4
50% Functions 1/2
75% Lines 6/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                    1x       1x                             1x                         1x     1x     1x      
import type { OctopusHost } from '@ska-octopus-widget-sdk/widget-sdk';
import {
  INPUT_FORMATED_SCHEMA_TYPE,
  INPUT_FORMATTED_PRESET_DESCRIPTIONS,
  INPUT_FORMATTED_PRESET_EXPRESSION,
  makeWidgetDef
} from '@ska-octopus-widget-sdk/widget-sdk';
import IframeWidget from './IframeWidget';
import pkg from '../package.json';
 
const { version } = pkg as any;
 
export { IframeWidget };
 
const schema = {
  type: 'object',
  properties: {
    url: {
      type: INPUT_FORMATED_SCHEMA_TYPE,
      formatPreset: INPUT_FORMATTED_PRESET_EXPRESSION,
      title: 'URL',
      propertyType: 'functionality',
      level: 2,
      description: `Iframe source URL. ${INPUT_FORMATTED_PRESET_DESCRIPTIONS[INPUT_FORMATTED_PRESET_EXPRESSION]}`,
      default: 'https://www.openstreetmap.org/export/embed.html'
    }
  }
};
 
const widgetDef = makeWidgetDef({
  key: 'iframe',
  component: IframeWidget,
  label: 'Iframe',
  layout: { x: 0, y: 0, w: 40, h: 60 },
  config: { schema },
  polls: true,
  docsUrl: 'https://developer.skao.int/projects/ska-octopus-iframe-widget/en/latest/',
  version
});
 
function register(O: OctopusHost) {
  O.registerWidget(widgetDef as any);
}
 
(function wait(h: any) {
  Iif (typeof h.registerWidget === 'function') {
    register(h as OctopusHost);
  } else {
    setTimeout(wait, 50, h);
  }
})((globalThis as any).Octopus || ((globalThis as any).Octopus = {}));