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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | 3x 3x 3x 1x 3x 3x 1x 2x | import {
INPUT_TANGO_ATTRIBUTES,
INPUT_FORMATED_SCHEMA_TYPE,
INPUT_FORMATTED_PRESET_DESCRIPTIONS_TOKEN,
makeWidgetDef
} from '@ska-octopus-widget-sdk/widget-sdk';
import type { OctopusHost } from '@ska-octopus-widget-sdk/widget-sdk';
import AttributeDisplayWidget from './AttributeDisplayWidget';
import pkg from '../package.json';
const { version } = pkg;
export { AttributeDisplayWidget };
const schema = {
type: 'object',
properties: {
title: {
type: INPUT_FORMATED_SCHEMA_TYPE,
title: 'Title',
description: `Title string can use: ${INPUT_FORMATTED_PRESET_DESCRIPTIONS_TOKEN}`,
default: ''
},
attributes: {
type: INPUT_TANGO_ATTRIBUTES,
title: 'Tango attributes',
propertyType: 'functionality',
level: 2,
description:
'Define one attribute source. Pick a Tango DB and provide a full attribute name. Examples: low-mccs/station/s8-1 or use vars like low-mccs/station/{STATION_ID} or low-mccs/station/{{STATION_ID}+1}.',
items: {
properties: {
attribute: {
description: `Tango attribute path, ${INPUT_FORMATTED_PRESET_DESCRIPTIONS_TOKEN}`
}
}
},
minItems: 1,
default: [{ endpoint: '2', attribute: 'low-mccs/station/s8-1/state' }]
},
useLiveData: {
type: 'boolean',
title: 'Use Live Data (subscribe)',
propertyType: 'functionality',
level: 2,
description:
'If disabled, the widget performs a one-shot query (polling by dashboard refresh rate).',
default: false
},
useEnumLabels: {
type: 'boolean',
title: 'Show Enum Labels',
propertyType: 'functionality',
level: 2,
description:
'Map numeric values to enum labels using GraphQL metadata; when off, show raw values.',
default: true
},
devStringViewMode: {
type: 'select',
title: 'DevString View Mode',
propertyType: 'functionality',
level: 2,
description:
'How DevString values are shown: plain text, parsed JSON tree expanded, or parsed JSON tree collapsed.',
options: ['plain', 'json-tree-expanded', 'json-tree-collapsed'],
default: 'json-tree-expanded'
},
colorJsonValuesByType: {
type: 'boolean',
title: 'Color JSON Values by Type',
propertyType: 'functionality',
level: 2,
description:
'When JSON tree mode is enabled, color JSON values by type (string, number, boolean, null, object).',
default: true
},
backgroundColor: {
type: 'color',
title: 'Background Color',
propertyType: 'css',
level: 2,
description: 'CSS color for the attribute card backgrounds.',
default: '#00000000'
},
useStateBackgroundColor: {
type: 'boolean',
title: 'Use State Background Color',
propertyType: 'functionality',
level: 2,
description:
'If enabled, use SDK state colors based on the current value and auto-adjust text color for contrast.',
default: false
},
showStateChip: {
type: 'boolean',
title: 'Show State Chip',
propertyType: 'functionality',
level: 2,
description:
'If enabled, render SDK state chip for known state values (ON, OFF, FAULT, etc).',
default: false
},
conditionalBackgroundValue: {
type: INPUT_FORMATED_SCHEMA_TYPE,
title: 'Conditional Background Value',
propertyType: 'functionality',
level: 3,
description: `Value to compare against the selected attribute or expression result. ${INPUT_FORMATTED_PRESET_DESCRIPTIONS_TOKEN}`,
default: ''
},
conditionalBackgroundOperator: {
type: 'select',
title: 'Conditional Background Operator',
propertyType: 'functionality',
level: 3,
description: 'Comparison operator for conditional background styling.',
options: ['>=', '>', '<=', '<', '==', '!='],
default: '>='
},
conditionalBackgroundColor: {
type: 'color',
title: 'Conditional Background Color',
propertyType: 'functionality',
level: 3,
description: 'Background color when the condition matches.',
default: ''
},
valueColor: {
type: 'color',
title: 'Value Color',
propertyType: 'css',
level: 2,
description: 'CSS color for the value text.',
default: '#ffffffff'
},
titleColor: {
type: 'color',
title: 'Title Color',
propertyType: 'css',
level: 2,
description: 'CSS color for the title text shown with the value.',
default: '#ffffffff'
},
fontSize: {
type: 'string',
title: 'Font Size',
propertyType: 'css',
level: 2,
description: 'Base font size (e.g. 14px, 0.95rem).',
default: '14px'
},
labelPosition: {
type: 'select',
title: 'Title Placement',
propertyType: 'css',
level: 2,
description: 'Choose where the title appears relative to the value.',
options: ['top', 'center', 'left', 'right', 'bottom'],
default: 'left'
},
horizontalAlign: {
type: 'select',
title: 'Content Horizontal Alignment',
propertyType: 'css',
level: 3,
description: 'Align the whole label/value block horizontally inside the widget.',
options: ['left', 'center', 'right'],
default: 'center'
},
verticalAlign: {
type: 'select',
title: 'Content Vertical Alignment',
propertyType: 'css',
level: 3,
description: 'Align the whole label/value block vertically inside the widget.',
options: ['top', 'center', 'bottom'],
default: 'center'
}
}
} as const;
const widgetDef = makeWidgetDef({
key: 'attributeDisplay',
component: AttributeDisplayWidget,
label: 'AttributeDisplay',
layout: { x: 0, y: 0, w: 20, h: 10 },
config: { schema },
polls: true, // allow Octopus to supply dashboard refresh rate for polling
version,
docsUrl: 'https://developer.skao.int/projects/ska-octopus-attribute-display-widget/en/latest/'
});
function register(host: OctopusHost) {
host.registerWidget(widgetDef as any);
}
(function wait(h: any) {
if (typeof h.registerWidget === 'function') {
register(h as OctopusHost);
} else {
setTimeout(wait, 50, h);
}
})((globalThis as any).Octopus || ((globalThis as any).Octopus = {}));
|