Skip to content

Commit 8c89c4c

Browse files
blueos: Extend external widget API to include extra attributes
1 parent 56d6c71 commit 8c89c4c

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
@@ -879,6 +879,9 @@ const allAvailableWidgets = computed(() => {
879879
isExternal: true,
880880
options: {
881881
source: widget.iframeUrl,
882+
containerName: widget.collapsibleContainerName,
883+
startCollapsed: widget.startCollapsed,
884+
useVehicleAddressAsBase: widget.useVehicleAddressAsBaseUrl,
882885
},
883886
defaultSize: widgetDefaultSizes[WidgetType.IFrame],
884887
})),

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+
collapsibleContainerName: 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
@@ -21,6 +21,26 @@ export interface ExternalWidgetSetupInfo {
2121
* The icon of the widget, this is displayed on the widget browser
2222
*/
2323
iframeIcon: string
24+
25+
/**
26+
* The name of the collapsed container, this is displayed on the widget browser
27+
*/
28+
collapsibleContainerName?: string
29+
30+
/**
31+
* Version of the widget (optional)
32+
*/
33+
version?: string
34+
35+
/**
36+
* Whether the widget should start collapsed (optional)
37+
*/
38+
startCollapsed?: boolean
39+
40+
/**
41+
* Whether to use vehicle address as base URL for the widget (optional)
42+
*/
43+
useVehicleAddressAsBaseUrl?: boolean
2444
}
2545

2646
/**

0 commit comments

Comments
 (0)