Custom Inputs
The SDK provides shortcut schema types for common Octopus inputs.
Import Set
import {
INPUT_FORMATTED_SCHEMA_TYPE,
INPUT_FORMATED_SCHEMA_TYPE,
INPUT_TANGO_ATTRIBUTES,
INPUT_MULTIPLE_TANGO_ATTRIBUTES,
INPUT_DB,
INPUT_MULTIPLE_DB,
INPUT_DEVICES,
INPUT_ATTRIBUTES,
INPUT_STRINGS,
WORKSPACES,
WORKSPACE,
VARIABLES,
VARIABLE,
} from "@ska-octopus-widget-sdk/widget-sdk";
Value Shapes
| Shortcut | Config value shape |
| ———————————————————— | ———————————————– | ——– | ———– | ——— |
| INPUT_FORMATTED_SCHEMA_TYPE / INPUT_FORMATED_SCHEMA_TYPE | string |
| INPUT_DB | string |
| INPUT_MULTIPLE_DB | string[] |
| INPUT_TANGO_ATTRIBUTES | Array<{ endpoint?: string; attribute: string } | string> |
| INPUT_MULTIPLE_TANGO_ATTRIBUTES | Array<{...} | string | Array<{...} | string>> |
| INPUT_DEVICES | Array<{ endpoint?: string; device: string } | string> |
| INPUT_ATTRIBUTES | string[] |
| INPUT_STRINGS | string[] |
| WORKSPACES / WORKSPACE | string |
| VARIABLES / VARIABLE | string |
Example: Components Table Schema
ska-octopus-components-table-widget uses:
INPUT_DEVICESfor row source device listINPUT_ATTRIBUTESfor visible table columnsINPUT_STRINGSfor custom row labels
Example: Grid Widget Schema
ska-octopus-grid-widget uses:
INPUT_TANGO_ATTRIBUTESfor main grid cellsINPUT_MULTIPLE_TANGO_ATTRIBUTESfor hover rowsWORKSPACESandVARIABLESfor click driven navigation/state updates
Runtime Normalization Helpers
Use SDK helpers instead of custom parsing logic:
import {
normalizeTangoAttributeInputs,
normalizeTangoAttributeRows,
formatInputFormattedTemplate,
stripRoutedAttributeEndpoint,
useVariables,
} from "@ska-octopus-widget-sdk/widget-sdk";
const { vars } = useVariables();
const fullNames = normalizeTangoAttributeInputs({
attributes: config.attributes,
fallbackEndpoint: config.endpoint,
variables: vars,
});
const hoverRows = normalizeTangoAttributeRows({
rows: config.hoverAttributes,
fallbackEndpoint: config.endpoint,
variables: vars,
});
const title = formatInputFormattedTemplate({
template: config.title,
variables: vars,
legendFullName: stripRoutedAttributeEndpoint(fullNames[0] ?? ""),
fallback: "",
});
Note
makeWidgetDef expands shortcut schema types automatically. Widgets should consume normalized values through SDK helpers rather than duplicating expansion/parsing code.
Formatted Input Tokens (Legend/Path Style)
For INPUT_FORMATTED_SCHEMA_TYPE / INPUT_FORMATED_SCHEMA_TYPE, the formatter supports legend/path tokens like:
{fullname}{split(0)}(same as{split('/',0)}){split(-1)}{split(1:3)}{match('subarray/(\\d+)')}{replace({split(3)},'_ErrorStatus_errErrorActive','')}
Example:
Input legendFullName:
mid-dish/ds-manager/SKA001/Azimuth_ErrorStatus_errErrorActive
{split(3)} -> Azimuth_ErrorStatus_errErrorActive
{replace({split(3)},'_ErrorStatus_errErrorActive','')} -> Azimuth
More Examples
For copy/paste schemas covering every input shortcut (including operation-style tokens like {0+1} and {{A}+{B}}), see Custom Input Examples.