ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
feat(marketplace): merge installed tabs and move manual install into a modal
Juan Denise65f4e2845bf
diff --git a/frontend/src/components/marketplace/ManualInstallModal.jsx b/frontend/src/components/marketplace/ManualInstallModal.jsxnew file mode 100644index 00000000..eae6ea07--- /dev/null+++ b/frontend/src/components/marketplace/ManualInstallModal.jsx@@ -0,0 +1,168 @@+import { useState } from 'react';+import { DownloadCloud, FileArchive, FolderOpen, Globe2, PlugZap } from 'lucide-react';+import api from '../../services/api';+import { useToast } from '../../contexts/ToastContext';+import Modal from '@/components/Modal';+import { Button } from '@/components/ui/button';+import { Input } from '@/components/ui/input';++const INSTALL_SOURCES = [+ { id: 'url', label: 'URL', icon: Globe2 },+ { id: 'path', label: 'Folder', icon: FolderOpen },+ { id: 'upload', label: 'Zip', icon: FileArchive },+];++const SourceInput = ({+ description,+ placeholder,+ value,+ onChange,+ onInstall,+ disabled,+ installDisabled,+}) => (+ <div className="plugin-install-source">+ <p className="text-muted">{description}</p>+ <div className="plugin-install-row">+ <Input+ placeholder={placeholder}+ value={value}+ onChange={(event) => onChange(event.target.value)}+ onKeyDown={(event) => event.key === 'Enter' && onInstall()}+ disabled={disabled}+ />+ <Button onClick={onInstall} disabled={installDisabled}>+ <DownloadCloud aria-hidden="true" />+ {disabled ? 'Installing...' : 'Install'}+ </Button>+ </div>+ </div>+);++// Manual extension install (URL / host folder / zip upload). An occasional+// operator action, so it lives in a modal off the topbar rather than a tab.+const ManualInstallModal = ({ defaultSource = 'url', onClose, onInstalled }) => {+ const toast = useToast();+ const [installSource, setInstallSource] = useState(defaultSource);+ const [pluginUrl, setPluginUrl] = useState('');+ const [pluginPath, setPluginPath] = useState('');+ const [pluginFile, setPluginFile] = useState(null);+ const [installing, setInstalling] = useState(false);++ const handleInstall = async () => {+ let action;+ if (installSource === 'url') {+ if (!pluginUrl.trim()) return;+ action = () => api.installPlugin(pluginUrl.trim());+ } else if (installSource === 'path') {+ if (!pluginPath.trim()) return;+ action = () => api.installPluginFromPath(pluginPath.trim());+ } else if (installSource === 'upload') {+ if (!pluginFile) return;+ action = () => api.installPluginFromZip(pluginFile);+ } else {+ return;+ }++ setInstalling(true);+ try {+ const result = await action();+ toast.success(`Extension "${result.display_name}" installed. Restart backend to activate routes.`);+ onInstalled();+ } catch (err) {+ toast.error(err.message || 'Extension installation failed');+ } finally {+ setInstalling(false);+ }+ };++ return (+ <Modal open onClose={onClose} title="Install extension manually" size="md">+ <div className="plugin-install-form">+ <div className="plugin-install-form__heading">+ <div className="plugin-install-form__icon">+ <PlugZap aria-hidden="true" />+ </div>+ <div>+ <h3>Extension source</h3>+ <p className="text-muted">Load extension packages from a repository, host folder, or zip archive.</p>+ </div>+ </div>++ <div className="plugin-install-tabs" role="tablist" aria-label="Extension install source">+ {INSTALL_SOURCES.map((source) => {+ const SourceIcon = source.icon;+ return (+ <button+ key={source.id}+ role="tab"+ type="button"+ aria-selected={installSource === source.id}+ className={`plugin-install-tab ${installSource === source.id ? 'plugin-install-tab--active' : ''}`}+ onClick={() => setInstallSource(source.id)}+ >+ <SourceIcon aria-hidden="true" />+ {source.label}+ </button>+ );+ })}+ </div>++ {installSource === 'url' && (+ <SourceInput+ description="Paste a GitHub repo URL, release URL, or direct zip link."+ placeholder="https://github.com/user/serverkit-plugin"+ value={pluginUrl}+ onChange={setPluginUrl}+ onInstall={handleInstall}+ disabled={installing}+ installDisabled={installing || !pluginUrl.trim()}+ />+ )}++ {installSource === 'path' && (+ <SourceInput+ description="Use an absolute path that exists on the backend host or inside the backend container."+ placeholder="/opt/serverkit/plugins/my-plugin"+ value={pluginPath}+ onChange={setPluginPath}+ onInstall={handleInstall}+ disabled={installing}+ installDisabled={installing || !pluginPath.trim()}+ />+ )}++ {installSource === 'upload' && (+ <div className="plugin-install-source">+ <p className="text-muted">+ Upload an extension zip with <code>plugin.json</code> at the top level or one folder deep.+ </p>+ <div className="plugin-install-row">+ <Input+ type="file"+ className="marketplace-file-input"+ accept=".zip,application/zip,application/x-zip-compressed"+ disabled={installing}+ onChange={(event) => setPluginFile(event.target.files?.[0] || null)}+ />+ <Button+ onClick={handleInstall}+ disabled={installing || !pluginFile}+ >+ <DownloadCloud aria-hidden="true" />+ {installing ? 'Installing...' : 'Install'}+ </Button>+ </div>+ {pluginFile && (+ <div className="plugin-file-note">+ {pluginFile.name} | {(pluginFile.size / 1024).toFixed(1)} KB+ </div>+ )}+ </div>+ )}+ </div>+ </Modal>+ );+};++export default ManualInstallModal;diff --git a/frontend/src/pages/Marketplace.jsx b/frontend/src/pages/Marketplace.jsxindex a30f4d2c..22414d9c 100644--- a/frontend/src/pages/Marketplace.jsx+++ b/frontend/src/pages/Marketplace.jsx@@ -1,12 +1,8 @@import { useState, useEffect, useCallback } from 'react';import {Activity,- Archive,CheckCircle2,DownloadCloud,- FileArchive,- FolderOpen,- Globe2,LayoutGrid,Package,PackageCheck,@@ -29,6 +25,7 @@ import { Input } from '@/components/ui/input';import { Badge } from '@/components/ui/badge';import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';import { useTopbarActions } from '@/hooks/useTopbarActions';+import ManualInstallModal from '../components/marketplace/ManualInstallModal';const CATEGORIES = ['ai', 'monitoring', 'security', 'deployment', 'integration', 'ui', 'utility'];@@ -42,12 +39,6 @@ const CATEGORY_ICONS = {utility: Package,};-const PLUGIN_INSTALL_SOURCES = [- { id: 'url', label: 'URL', icon: Globe2 },- { id: 'path', label: 'Folder', icon: FolderOpen },- { id: 'upload', label: 'Zip', icon: FileArchive },-];-const titleCase = (value = '') => {const cleaned = String(value || 'utility').replace(/[-_]/g, ' ');return cleaned@@ -153,10 +144,9 @@ const Marketplace = () => {const [search, setSearch] = useState('');const [category, setCategory] = useState('');const [activeTab, setActiveTab] = useState('browse');- const [pluginUrl, setPluginUrl] = useState('');- const [pluginPath, setPluginPath] = useState('');- const [pluginFile, setPluginFile] = useState(null);- const [installSource, setInstallSource] = useState('url');+ // Manual install modal (URL / folder / zip); null when closed, otherwise+ // the source sub-tab to preselect.+ const [manualInstallSource, setManualInstallSource] = useState(null);const [installing, setInstalling] = useState(false);const [detailEntry, setDetailEntry] = useState(null);// Plugin pending uninstall — drives the keep-vs-purge data-policy dialog.@@ -219,34 +209,12 @@ const Marketplace = () => {}};- const handlePluginInstall = async () => {- let action;- if (installSource === 'url') {- if (!pluginUrl.trim()) return;- action = () => api.installPlugin(pluginUrl.trim());- } else if (installSource === 'path') {- if (!pluginPath.trim()) return;- action = () => api.installPluginFromPath(pluginPath.trim());- } else if (installSource === 'upload') {- if (!pluginFile) return;- action = () => api.installPluginFromZip(pluginFile);- } else {- return;- }-- setInstalling(true);- try {- const result = await action();- toast.success(`Plugin "${result.display_name}" installed. Restart backend to activate routes.`);- setPluginUrl('');- setPluginPath('');- setPluginFile(null);- loadExtensions();- } catch (err) {- toast.error(err.message || 'Plugin installation failed');- } finally {- setInstalling(false);- }+ // Land on Installed after a manual install so the new row (and its+ // actions) is immediately visible.+ const handleManualInstalled = () => {+ setManualInstallSource(null);+ loadExtensions();+ setActiveTab('installed');};// Open the data-policy dialog instead of uninstalling immediately, so the@@ -295,11 +263,6 @@ const Marketplace = () => {setCategory('');};- const openZipInstaller = () => {- setInstallSource('upload');- setActiveTab('plugins');- };-const pluginStatusVariant = (status) => {if (status === 'active') return 'success';if (status === 'error') return 'destructive';@@ -308,9 +271,9 @@ const Marketplace = () => {useTopbarActions(() =><>- <Button variant="outline" size="sm" onClick={openZipInstaller}>+ <Button variant="outline" size="sm" onClick={() => setManualInstallSource('url')}><UploadCloud aria-hidden="true" />- Import ZIP+ Install manually</Button></>,[],@@ -320,8 +283,6 @@ const Marketplace = () => {const localCatalogEntries = builtins.map(getLocalCatalogEntry);const registryCatalogEntries = registryExtensions.map(getRegistryCatalogEntry);- const installedCatalogEntries = localCatalogEntries.filter((entry) => entry.installed);- const installedCatalogCount = installedCatalogEntries.length;// Update descriptors keyed by both plugin_id and slug so PluginRow can match// whichever identifier it has on hand.const updatesByKey = new Map();@@ -345,11 +306,7 @@ const Marketplace = () => {</TabsTrigger><TabsTrigger value="installed"><PackageCheck aria-hidden="true" />- Installed ({installedCatalogCount})- </TabsTrigger>- <TabsTrigger value="plugins">- <PlugZap aria-hidden="true" />- ServerKit Plugins ({plugins.length})+ Installed ({plugins.length})</TabsTrigger></TabsList>@@ -431,151 +388,43 @@ const Marketplace = () => {<SectionHeaderkicker="Installed"title="Installed extensions"- meta={`${installedCatalogCount} installed`}+ meta={`${plugins.length} installed`}/>- {installedCatalogEntries.length > 0 ? (+ {plugins.length > 0 ? (<div className="installed-list">- {installedCatalogEntries.map((entry) => (- <InstalledCatalogRow key={entry.key} entry={entry} />+ {plugins.map((plugin) => (+ <PluginRow+ key={plugin.id}+ plugin={plugin}+ update={updatesByKey.get(String(plugin.id))}+ installing={installing}+ onToggle={handlePluginToggle}+ onUpdate={handlePluginUpdate}+ onUninstall={requestPluginUninstall}+ onConfigure={setConfigTarget}+ statusVariant={pluginStatusVariant}+ />))}</div>) : (<EmptyStateicon={PackageCheck}title="No extensions installed"- description="Install a built-in or registry extension to see it here."+ description="Install one from Browse or use Install manually."/>)}</section></TabsContent>-- <TabsContent value="plugins">- <div className="plugins-section">- <section className="marketplace-section">- <SectionHeader- kicker="Installer"- title="Install ServerKit plugin"- meta={titleCase(installSource)}- />- <div className="plugin-install-form">- <div className="plugin-install-form__heading">- <div className="plugin-install-form__icon">- <PlugZap aria-hidden="true" />- </div>- <div>- <h3>Plugin source</h3>- <p className="text-muted">Load plugin packages from a repository, host folder, or zip archive.</p>- </div>- </div>-- <div className="plugin-install-tabs" role="tablist" aria-label="Plugin install source">- {PLUGIN_INSTALL_SOURCES.map((source) => {- const SourceIcon = source.icon;- return (- <button- key={source.id}- role="tab"- type="button"- aria-selected={installSource === source.id}- className={`plugin-install-tab ${installSource === source.id ? 'plugin-install-tab--active' : ''}`}- onClick={() => setInstallSource(source.id)}- >- <SourceIcon aria-hidden="true" />- {source.label}- </button>- );- })}- </div>-- {installSource === 'url' && (- <PluginInstallInput- description="Paste a GitHub repo URL, release URL, or direct zip link."- placeholder="https://github.com/user/serverkit-plugin"- value={pluginUrl}- onChange={setPluginUrl}- onInstall={handlePluginInstall}- disabled={installing}- installDisabled={installing || !pluginUrl.trim()}- />- )}-- {installSource === 'path' && (- <PluginInstallInput- description="Use an absolute path that exists on the backend host or inside the backend container."- placeholder="/opt/serverkit/plugins/my-plugin"- value={pluginPath}- onChange={setPluginPath}- onInstall={handlePluginInstall}- disabled={installing}- installDisabled={installing || !pluginPath.trim()}- />- )}-- {installSource === 'upload' && (- <div className="plugin-install-source">- <p className="text-muted">- Upload a plugin zip with <code>plugin.json</code> at the top level or one folder deep.- </p>- <div className="plugin-install-row">- <Input- type="file"- className="marketplace-file-input"- accept=".zip,application/zip,application/x-zip-compressed"- disabled={installing}- onChange={(event) => setPluginFile(event.target.files?.[0] || null)}- />- <Button- onClick={handlePluginInstall}- disabled={installing || !pluginFile}- >- <DownloadCloud aria-hidden="true" />- {installing ? 'Installing...' : 'Install'}- </Button>- </div>- {pluginFile && (- <div className="plugin-file-note">- {pluginFile.name} | {(pluginFile.size / 1024).toFixed(1)} KB- </div>- )}- </div>- )}- </div>- </section>-- <section className="marketplace-section">- <SectionHeader- kicker="Runtime"- title="Installed ServerKit plugins"- meta={`${plugins.length} plugins`}- />- {plugins.length > 0 ? (- <div className="installed-list">- {plugins.map((plugin) => (- <PluginRow- key={plugin.id}- plugin={plugin}- update={updatesByKey.get(String(plugin.id))}- installing={installing}- onToggle={handlePluginToggle}- onUpdate={handlePluginUpdate}- onUninstall={requestPluginUninstall}- onConfigure={setConfigTarget}- statusVariant={pluginStatusVariant}- />- ))}- </div>- ) : (- <EmptyState- icon={PlugZap}- title="No ServerKit plugins installed"- description="Install a plugin package to extend the panel runtime."- />- )}- </section>- </div>- </TabsContent></Tabs>+ {manualInstallSource && (+ <ManualInstallModal+ defaultSource={manualInstallSource}+ onClose={() => setManualInstallSource(null)}+ onInstalled={handleManualInstalled}+ />+ )}+{detailEntry && (<ExtensionDetailModalentry={detailEntry}@@ -800,28 +649,12 @@ const ExtensionDetailModal = ({ entry, installing, statusVariant, onClose, onIns);};-// Installed catalog entries are builtin installs (the legacy "published"-// lane was retired, #51); their manage/uninstall actions live on the-// ServerKit Plugins tab, so this row is informational.-const InstalledCatalogRow = ({ entry }) => (- <article className="installed-item card">- <div className="installed-item__main">- <div className="installed-item__icon installed-item__icon--local">- <Archive aria-hidden="true" />- </div>- <div className="installed-item__content">- <div className="installed-item__title-line">- <strong>{entry.displayName}</strong>- <span className="text-muted">v{entry.version}</span>- <Badge variant="warning">{entry.sourceLabel}</Badge>- </div>- </div>- </div>- <div className="installed-item__actions">- <Badge variant="success">Installed</Badge>- </div>- </article>-);+// Install-origin badge for installed rows. url/local/upload all collapse to+// "Manual" — the raw origin lives in the tooltip.+const PLUGIN_SOURCE_BADGES = {+ builtin: { label: 'Built-in', variant: 'warning' },+ registry: { label: 'Registry', variant: 'info' },+};const PluginRow = ({ plugin, update, installing, onToggle, onUpdate, onUninstall, onConfigure, statusVariant }) => {const updateAvailable = Boolean(update?.update_available);@@ -829,6 +662,8 @@ const PluginRow = ({ plugin, update, installing, onToggle, onUpdate, onUninstallconst configurable = plugin.config_schema&& typeof plugin.config_schema === 'object'&& Object.keys(plugin.config_schema).length > 0;+ const sourceBadge = PLUGIN_SOURCE_BADGES[plugin.source_type]+ || { label: 'Manual', variant: 'outline', title: plugin.source_url || undefined };return (<article className={`installed-item installed-item--plugin card ${plugin.status === 'error' ? 'installed-item--error' : ''}`}>@@ -841,6 +676,7 @@ const PluginRow = ({ plugin, update, installing, onToggle, onUpdate, onUninstall<strong>{plugin.display_name}</strong><span className="text-muted">v{plugin.version}</span><Badge variant={statusVariant(plugin.status)}>{plugin.status}</Badge>+ <Badge variant={sourceBadge.variant} title={sourceBadge.title}>{sourceBadge.label}</Badge>{plugin.has_backend && <Badge variant="secondary">Backend</Badge>}{plugin.has_frontend && <Badge variant="secondary">Frontend</Badge>}{updateAvailable && (@@ -1018,31 +854,4 @@ const PluginUninstallDialog = ({ plugin, onCancel, onConfirm }) => (</Modal>);-const PluginInstallInput = ({- description,- placeholder,- value,- onChange,- onInstall,- disabled,- installDisabled,-}) => (- <div className="plugin-install-source">- <p className="text-muted">{description}</p>- <div className="plugin-install-row">- <Input- placeholder={placeholder}- value={value}- onChange={(event) => onChange(event.target.value)}- onKeyDown={(event) => event.key === 'Enter' && onInstall()}- disabled={disabled}- />- <Button onClick={onInstall} disabled={installDisabled}>- <DownloadCloud aria-hidden="true" />- {disabled ? 'Installing...' : 'Install'}- </Button>- </div>- </div>-);-export default Marketplace;diff --git a/frontend/src/styles/pages/_marketplace.scss b/frontend/src/styles/pages/_marketplace.scssindex 06ec94fb..29b810b6 100644--- a/frontend/src/styles/pages/_marketplace.scss+++ b/frontend/src/styles/pages/_marketplace.scss@@ -136,13 +136,6 @@}}- .plugins-section {- display: flex;- flex-direction: column;- gap: $space-8;- min-width: 0;- }-.marketplace-section {min-width: 0;}@@ -441,123 +434,6 @@font-weight: $font-weight-semibold;}- .plugin-install-form {- padding: $space-5;- border: 1px solid $border-subtle;- border-radius: $radius-lg;- background: fade($bg-card-raw, 92%);- }-- .plugin-install-form__heading {- display: flex;- align-items: flex-start;- gap: $space-3;- margin-bottom: $space-4;-- h3 {- margin: 0 0 $space-1;- color: $text-primary;- font-size: $font-size-md;- font-weight: $font-weight-semibold;- }-- p {- margin: 0;- }- }-- .plugin-install-form__icon {- display: inline-flex;- align-items: center;- justify-content: center;- width: 38px;- height: 38px;- flex: 0 0 38px;- border-radius: $radius-lg;- color: $accent-primary;- background: fade($accent-primary-raw, 12%);-- svg {- width: 19px;- height: 19px;- }- }-- .plugin-install-tabs {- display: inline-flex;- gap: $space-1;- margin-bottom: $space-4;- padding: $space-1;- border: 1px solid $border-subtle;- border-radius: $radius-lg;- background: $bg-body;- }-- .plugin-install-tab {- display: inline-flex;- align-items: center;- gap: $space-2;- height: 32px;- padding: 0 $space-3;- border: 1px solid transparent;- border-radius: $radius-md;- background: transparent;- color: $text-secondary;- font-family: inherit;- font-size: $font-size-sm + 1;- font-weight: $font-weight-semibold;- cursor: pointer;- transition:- background $transition-base,- color $transition-base,- border-color $transition-base;-- svg {- width: 14px;- height: 14px;- }-- &:hover {- color: $text-primary;- }-- &--active {- border-color: $accent-primary;- background: fade($accent-primary-raw, 12%);- color: $text-primary;- }- }-- .plugin-install-source {- p {- margin: 0 0 $space-3;- font-size: $font-size-sm;- }- }-- .plugin-install-row {- display: flex;- align-items: center;- gap: $space-3;-- .ui-input,- input[type='text'] {- flex: 1;- min-width: 0;- }- }-- .marketplace-file-input {- flex: 1;- min-width: 0;- }-- .plugin-file-note {- margin-top: $space-2;- color: $text-tertiary;- font-size: $font-size-sm;- }-.marketplace-empty {border-radius: $radius-lg;@@ -601,16 +477,6 @@flex: 1;}}-- .plugin-install-row {- align-items: stretch;- flex-direction: column;-- .btn {- width: 100%;- }- }-}@media (max-width: $breakpoint-sm) {@@ -765,6 +631,128 @@}}+// Manual extension installer (URL / folder / zip). Rendered inside the+// Install-manually Modal — a Radix Dialog portal outside .marketplace-page —+// so these live at the root.+.plugin-install-form__heading {+ display: flex;+ align-items: flex-start;+ gap: $space-3;+ margin-bottom: $space-4;++ h3 {+ margin: 0 0 $space-1;+ color: $text-primary;+ font-size: $font-size-md;+ font-weight: $font-weight-semibold;+ }++ p {+ margin: 0;+ }+}++.plugin-install-form__icon {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ width: 38px;+ height: 38px;+ flex: 0 0 38px;+ border-radius: $radius-lg;+ color: $accent-primary;+ background: fade($accent-primary-raw, 12%);++ svg {+ width: 19px;+ height: 19px;+ }+}++.plugin-install-tabs {+ display: inline-flex;+ gap: $space-1;+ margin-bottom: $space-4;+ padding: $space-1;+ border: 1px solid $border-subtle;+ border-radius: $radius-lg;+ background: $bg-body;+}++.plugin-install-tab {+ display: inline-flex;+ align-items: center;+ gap: $space-2;+ height: 32px;+ padding: 0 $space-3;+ border: 1px solid transparent;+ border-radius: $radius-md;+ background: transparent;+ color: $text-secondary;+ font-family: inherit;+ font-size: $font-size-sm + 1;+ font-weight: $font-weight-semibold;+ cursor: pointer;+ transition:+ background $transition-base,+ color $transition-base,+ border-color $transition-base;++ svg {+ width: 14px;+ height: 14px;+ }++ &:hover {+ color: $text-primary;+ }++ &--active {+ border-color: $accent-primary;+ background: fade($accent-primary-raw, 12%);+ color: $text-primary;+ }+}++.plugin-install-source {+ p {+ margin: 0 0 $space-3;+ font-size: $font-size-sm;+ }+}++.plugin-install-row {+ display: flex;+ align-items: center;+ gap: $space-3;++ .ui-input,+ input[type='text'] {+ flex: 1;+ min-width: 0;+ }++ @media (max-width: $breakpoint-md) {+ align-items: stretch;+ flex-direction: column;++ .btn {+ width: 100%;+ }+ }+}++.marketplace-file-input {+ flex: 1;+ min-width: 0;+}++.plugin-file-note {+ margin-top: $space-2;+ color: $text-tertiary;+ font-size: $font-size-sm;+}+// Keep-vs-purge data policy dialog on plugin uninstall..plugin-uninstall-dialog {display: flex;