Skip to content

Commit ec4028d

Browse files
author
lxfight
committed
feat(webui): add direct WebUI access button on plugin cards
- Add "open-webui" button on plugin cards when plugin has pages - Navigate to plugin's first page directly from the card - Adjust PluginPagePage iframe height for better UX - Add i18n labels (zh-CN/en-US/ru-RU)
1 parent cbe424d commit ec4028d

6 files changed

Lines changed: 40 additions & 2 deletions

File tree

dashboard/src/components/shared/ExtensionCard.vue

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,13 @@ const emit = defineEmits([
3838
"view-readme",
3939
"view-changelog",
4040
"toggle-pin",
41+
"open-webui",
4142
]);
4243
44+
const hasPages = computed(() => {
45+
return Array.isArray(props.extension?.pages) && props.extension.pages.length > 0;
46+
});
47+
4348
const showUninstallDialog = ref(false);
4449
4550
const attrs = useAttrs();
@@ -130,6 +135,10 @@ const togglePin = () => {
130135
emit("toggle-pin", props.extension);
131136
};
132137
138+
const openWebui = () => {
139+
emit("open-webui", props.extension);
140+
};
141+
133142
</script>
134143

135144
<template>
@@ -322,6 +331,19 @@ const togglePin = () => {
322331
</template>
323332
</v-tooltip>
324333

334+
<v-tooltip v-if="hasPages" location="top" :text="tm('buttons.openWebui')">
335+
<template v-slot:activator="{ props: actionProps }">
336+
<v-btn
337+
v-bind="actionProps"
338+
icon="mdi-monitor-dashboard"
339+
size="small"
340+
variant="tonal"
341+
color="primary"
342+
@click.stop="openWebui"
343+
></v-btn>
344+
</template>
345+
</v-tooltip>
346+
325347
<v-tooltip location="top" :text="tm('card.actions.pluginConfig')">
326348
<template v-slot:activator="{ props: actionProps }">
327349
<v-btn

dashboard/src/i18n/locales/en-US/features/extension.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"viewRepo": "Repository",
4646
"openPages": "Pages",
4747
"openPage": "Open",
48+
"openWebui": "Open Plugin UI",
4849
"close": "Close",
4950
"save": "Save",
5051
"saveAndClose": "Save and Close",

dashboard/src/i18n/locales/ru-RU/features/extension.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"viewRepo": "Репозиторий",
4646
"openPages": "Pages",
4747
"openPage": "Открыть",
48+
"openWebui": "Открыть UI плагина",
4849
"close": "Закрыть",
4950
"save": "Сохранить",
5051
"saveAndClose": "Сохранить и закрыть",

dashboard/src/i18n/locales/zh-CN/features/extension.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"viewRepo": "仓库",
4646
"openPages": "Pages",
4747
"openPage": "打开",
48+
"openWebui": "打开插件UI界面",
4849
"close": "关闭",
4950
"save": "保存",
5051
"saveAndClose": "保存并关闭",

dashboard/src/views/PluginPagePage.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,13 +513,13 @@ watch(locale, () => {
513513
514514
.plugin-page-frame {
515515
width: 100%;
516-
min-height: calc(100vh - 220px);
516+
min-height: calc(100vh - 140px);
517517
border: 0;
518518
background: transparent;
519519
}
520520
521521
.plugin-page-state {
522-
min-height: calc(100vh - 220px);
522+
min-height: calc(100vh - 140px);
523523
display: flex;
524524
align-items: center;
525525
justify-content: center;

dashboard/src/views/extension/InstalledPluginsTab.vue

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,18 @@ const openPluginDetail = (extension) => {
152152
});
153153
};
154154
155+
const openPluginWebui = (extension) => {
156+
const pages = extension?.pages;
157+
if (!Array.isArray(pages) || pages.length === 0 || !extension?.name) return;
158+
router.push({
159+
name: "PluginPage",
160+
params: {
161+
pluginName: extension.name,
162+
pageName: pages[0],
163+
},
164+
});
165+
};
166+
155167
const pinnedExtensionNames = ref(readPinnedExtensions());
156168
157169
const pinnedExtensionOrder = computed(() => {
@@ -344,6 +356,7 @@ const togglePinnedExtension = (extension) => {
344356
@view-handlers="showPluginInfo(extension)"
345357
@view-readme="viewReadme(extension)"
346358
@view-changelog="viewChangelog(extension)"
359+
@open-webui="openPluginWebui(extension)"
347360
>
348361
</ExtensionCard>
349362
</v-col>

0 commit comments

Comments
 (0)