diff --git a/dev/presets/brewblox-ui-store.redis.json b/dev/presets/brewblox-ui-store.redis.json index 46f12554a..1a5971951 100644 --- a/dev/presets/brewblox-ui-store.redis.json +++ b/dev/presets/brewblox-ui-store.redis.json @@ -85,6 +85,21 @@ "blockId": "Sequence" } }, + { + "namespace": "brewblox-ui-store:dashboard-items", + "id": "2-UtLY_8z24JlcbI8oLrF", + "title": "Old OneWire", + "feature": "OneWireGpioModule", + "cols": 4, + "order": 20, + "pinnedPosition": null, + "rows": 4, + "dashboard": "dashboard-home", + "config": { + "serviceId": "sparkey", + "blockId": "gpio-1" + } + }, { "namespace": "brewblox-ui-store:logged-sessions", "id": "3d15296d-0abd-4d45-383c-0bec436ae319", diff --git a/src/plugins/spark/features/GpioModule/index.ts b/src/plugins/spark/features/GpioModule/index.ts index 380918994..4d000adfb 100644 --- a/src/plugins/spark/features/GpioModule/index.ts +++ b/src/plugins/spark/features/GpioModule/index.ts @@ -7,8 +7,9 @@ import { import { Plugin } from 'vue'; import { discoveredBlockFeature } from '@/plugins/spark/generic'; import { useBlockSpecStore } from '@/plugins/spark/store'; -import { BlockSpec } from '@/plugins/spark/types'; +import { BlockConfig, BlockSpec } from '@/plugins/spark/types'; import { useFeatureStore, WidgetFeature } from '@/store/features'; +import { Widget } from '@/store/widgets'; import { cref } from '@/utils/component-ref'; import widget from './GpioModuleWidget.vue'; @@ -69,8 +70,22 @@ const plugin: Plugin = { }, }; + const renamedFeature: WidgetFeature = { + ...discoveredBlockFeature, + id: 'OneWireGpioModule', + title: 'OneWire GPIO Module (renamed)', + role: 'Output', + component: '', + widgetSize: { cols: 0, rows: 0 }, + upgrade: (widget: Widget): Widget | null => { + return { ...widget, feature: type } as Widget; + }, + experimental: true, + }; + specStore.addBlockSpec(blockSpec); featureStore.addWidgetFeature(feature); + featureStore.addWidgetFeature(renamedFeature); }, };