Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EditMenu: differentiate external widgets from Cockpit's own #1508

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions src/components/EditMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -487,17 +487,26 @@
<div
v-for="widget in allAvailableWidgets"
:key="widget.name"
class="flex flex-col items-center justify-between rounded-md bg-[#273842] hover:brightness-125 h-[90%] aspect-square cursor-pointer elevation-4"
class="flex flex-col items-center justify-between rounded-md bg-[#273842] hover:brightness-125 h-[90%] aspect-square cursor-pointer elevation-4 relative"
:class="{ 'border-2 border-[#135da3]': widget.isExternal }"
draggable="true"
@dragstart="onRegularWidgetDragStart"
@dragend="onRegularWidgetDragEnd(widget)"
>
<div
v-if="widget.isExternal"
class="absolute top-0 left-0 bg-[#135da3] text-white text-xs px-1 py-0.5 rounded-tl-md rounded-br-md"
>
External
</div>

<v-tooltip text="Drag to add" location="top" theme="light">
<template #activator="{ props: tooltipProps }">
<div />
<img v-bind="tooltipProps" :src="widget.icon" alt="widget-icon" class="p-4 max-h-[75%] max-w-[95%]" />
<div
class="flex items-center justify-center w-full p-1 transition-all bg-[#3B78A8] rounded-b-md text-white"
class="flex items-center justify-center w-full p-1 transition-all rounded-b-md text-white"
:class="{ 'bg-[#135da3]': widget.isExternal, 'bg-[#4fa483]': !widget.isExternal }"
>
<span class="whitespace-normal text-center">{{
widget.name.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/^./, (str) => str.toUpperCase())
Expand Down Expand Up @@ -758,11 +767,15 @@ const allAvailableWidgets = computed(() => {
component: WidgetType.IFrame,
icon: widget.iframe_icon,
name: widget.name,
isExternal: true,
options: {
source: widget.iframe_url,
},
})),
...availableInternalWidgets.value,
...availableInternalWidgets.value.map((widget) => ({
...widget,
isExternal: false,
})),
]
})

Expand Down
Loading