Skip to content

Commit c4a0434

Browse files
blueos: Extend external widget API to include extra attributes
1 parent c8ad877 commit c4a0434

File tree

4 files changed

+29
-1
lines changed

4 files changed

+29
-1
lines changed

src/components/EditMenu.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,9 @@ const allAvailableWidgets = computed(() => {
870870
isExternal: true,
871871
options: {
872872
source: widget.iframeUrl,
873+
containerName: widget.collapsedContainerName,
874+
startCollapsed: widget.startCollapsed,
875+
useVehicleAddressAsBase: widget.useVehicleAddressAsBaseUrl,
873876
},
874877
})),
875878
...availableInternalWidgets.value.map((widget) => ({

src/components/widgets/IFrame.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
mdi-drag
1616
</v-icon>
1717
<div class="select-none">
18-
{{ widget.options.containerName || 'iframe' }}
18+
{{ widget.options.containerName }}
1919
</div>
2020
<v-btn
2121
:icon="widget.options.startCollapsed ? 'mdi-chevron-down' : 'mdi-chevron-up'"
@@ -254,6 +254,7 @@ onBeforeMount((): void => {
254254
source: 'http://' + defaultBlueOsAddress,
255255
useVehicleAddressAsBase: false,
256256
startCollapsed: false,
257+
containerName: 'iframe',
257258
}
258259
widget.value.options = { ...defaultOptions, ...widget.value.options }
259260

src/libs/blueos/schemas.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ const ExternalWidgetSetupInfoSchema = z.object({
4848
name: z.string(),
4949
iframeUrl: z.string(),
5050
iframeIcon: z.string(),
51+
collapsedContainerName: z.string().optional(),
52+
version: z.string().optional(),
53+
startCollapsed: z.boolean().optional(),
54+
useVehicleAddressAsBaseUrl: z.boolean().optional(),
5155
})
5256

5357
const HttpRequestActionConfigSchema = z.object({

src/types/widgets.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,26 @@ export interface ExternalWidgetSetupInfo {
2020
* The icon of the widget, this is displayed on the widget browser
2121
*/
2222
iframeIcon: string
23+
24+
/**
25+
* The name of the collapsed container, this is displayed on the widget browser
26+
*/
27+
collapsedContainerName?: string
28+
29+
/**
30+
* Version of the widget (optional)
31+
*/
32+
version?: string
33+
34+
/**
35+
* Whether the widget should start collapsed (optional)
36+
*/
37+
startCollapsed?: boolean
38+
39+
/**
40+
* Whether to use vehicle address as base URL for the widget (optional)
41+
*/
42+
useVehicleAddressAsBaseUrl?: boolean
2343
}
2444

2545
/**

0 commit comments

Comments
 (0)