Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

feat(dashboard): flag newer plugin versions on the Plugins page

Yudhi Armyndharis4b9913659c60
diff --git a/dashboard/src/pages/Plugins.css b/dashboard/src/pages/Plugins.css
index a2135cd11..58e9c3d08 100644
--- a/dashboard/src/pages/Plugins.css
+++ b/dashboard/src/pages/Plugins.css
@@ -100,6 +100,43 @@
color: var(--text-muted);
}
+/* Newer-version chip on an installed plugin's card. Clickable: opens the Install drawer's
+ catalog tab pre-filtered to this plugin, where the actual Update button lives. */
+.plugins-page .plugin-update-chip {
+ display: inline-flex;
+ align-items: center;
+ gap: 3px;
+ margin-left: 8px;
+ padding: 0.0625rem 0.4375rem;
+ font-size: 0.6875rem;
+ font-weight: 600;
+ color: var(--primary, #25d366);
+ background: color-mix(in srgb, var(--primary, #25d366) 12%, transparent);
+ border: 1px solid color-mix(in srgb, var(--primary, #25d366) 35%, transparent);
+ border-radius: 999px;
+ cursor: pointer;
+}
+
+.plugins-page .plugin-update-chip:hover {
+ background: color-mix(in srgb, var(--primary, #25d366) 20%, transparent);
+}
+
+/* Pending-update counter on the Install button, so updates are visible without opening it. */
+.plugins-page .install-update-count {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ min-width: 1.25rem;
+ height: 1.25rem;
+ padding: 0 0.3125rem;
+ margin-left: 6px;
+ font-size: 0.6875rem;
+ font-weight: 700;
+ color: var(--primary, #25d366);
+ background: color-mix(in srgb, var(--primary, #25d366) 18%, transparent);
+ border-radius: 999px;
+}
+
.plugins-page .plugin-builtin-badge {
padding: 0.1875rem 0.5rem;
background: var(--bg-light);
diff --git a/dashboard/src/pages/Plugins.tsx b/dashboard/src/pages/Plugins.tsx
index a877251c5..7b58cfaa1 100644
--- a/dashboard/src/pages/Plugins.tsx
+++ b/dashboard/src/pages/Plugins.tsx
@@ -1,4 +1,4 @@
-import { useState, useEffect, useRef } from 'react';
+import { useState, useEffect, useRef, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { localizePlugin } from '../utils/localizePlugin';
import { configUiSafeConfig, missingRequiredConfig, sparseSessionOverride } from '../utils/pluginConfigRules';
@@ -24,6 +24,7 @@ import {
Download,
Plus,
Search,
+ ArrowUpCircle,
} from 'lucide-react';
import { pluginsApi } from '../services/api';
import type { Plugin, CatalogPlugin, PluginConfigField } from '../services/api';
@@ -675,13 +676,17 @@ export default function Plugins() {
}
};
- const loadCatalog = async () => {
+ const loadCatalog = async (silent = false) => {
setCatalogLoading(true);
setCatalogError(null);
try {
setCatalog(await pluginsApi.catalog());
} catch (err) {
- setCatalogError(err instanceof Error ? err.message : String(err));
+ // Silent mode is the page-mount prefetch that powers the update chips: a catalog that
+ // cannot be reached just means no chips, so the failure is not surfaced here — the
+ // drawer's own lazy-load effect (which skips while an error is set) retries loudly
+ // when the user actually opens the Catalog tab.
+ if (!silent) setCatalogError(err instanceof Error ? err.message : String(err));
} finally {
setCatalogLoading(false);
}
@@ -695,6 +700,19 @@ export default function Plugins() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [showInstallModal, installMode]);
+ // Prefetch once on mount so installed-plugin cards can flag newer catalog versions without the
+ // user having to open the Install drawer first. Silent: an unreachable catalog hides the chips.
+ useEffect(() => {
+ void loadCatalog(true);
+ }, []);
+
+ // Catalog entries with a strictly newer version than the installed one, keyed by plugin id —
+ // drives both the per-card update chip and the counter on the Install button.
+ const updatesById = useMemo(
+ () => new Map(catalog.filter(entry => entry.updateAvailable).map(entry => [entry.id, entry])),
+ [catalog],
+ );
+
const handleInstallFromCatalog = async (entry: CatalogPlugin) => {
if (!entry.download) {
toast.error(
@@ -782,6 +800,11 @@ export default function Plugins() {
<button className="btn-primary" onClick={() => setShowInstallModal(true)}>
<Upload size={16} />
{t('plugins.install', 'Install plugin')}
+ {updatesById.size > 0 && (
+ <span className="install-update-count" title={t('plugins.catalog.updateAvailable', 'Update available')}>
+ {updatesById.size}
+ </span>
+ )}
</button>
</>
}
@@ -842,6 +865,23 @@ export default function Plugins() {
<div>
<h3 className="plugin-name">{lz.name}</h3>
<span className="plugin-version">v{plugin.version}</span>
+ {updatesById.has(plugin.id) && (
+ <button
+ type="button"
+ className="plugin-update-chip"
+ title={`${t('plugins.catalog.updateAvailable', 'Update available')} (v${plugin.version} → v${updatesById.get(plugin.id)!.version})`}
+ aria-label={t('plugins.catalog.updateAvailable', 'Update available')}
+ onClick={() => {
+ // Land the user directly on this plugin's catalog entry, where the
+ // existing Update button (and its confirmation flow) lives.
+ setInstallMode('catalog');
+ setCatalogSearch(plugin.id);
+ setShowInstallModal(true);
+ }}
+ >
+ <ArrowUpCircle size={12} />v{updatesById.get(plugin.id)!.version}
+ </button>
+ )}
</div>
</div>
{plugin.builtIn && <span className="plugin-builtin-badge">{t('plugins.builtIn')}</span>}