feat(gui): group menu under a shared 'Backups' category with a per-plugin icon
Move the admin and site menu entries into a shared 'Backups' sidebar category (created idempotently by each sibling plugin) with a distinct icon per engine, instead of a top-level link. Each plugin tags its category+link lines with an apiscp-borg marker so its uninstaller removes only its own, leaving the shared category for any other backup plugin still installed.
This commit is contained in:
parent
b9e8694c61
commit
5c2da48c64
3 changed files with 20 additions and 30 deletions
|
|
@ -58,8 +58,8 @@ if [ -f "$DEST" ]; then
|
|||
else
|
||||
cat >> "$DEST" <<'PHP'
|
||||
|
||||
// apiscp-borg
|
||||
$templateClass->create_link('Borg Backups', '/apps/borg', true, null, null);
|
||||
$templateClass->create_category('Backups', true, '<svg role="img" fill="currentColor" class="ui-menu-icon" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M17 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V7l-4-4zm-5 16a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm3-10H5V5h10v4z"/></svg>', 'backups'); // apiscp-borg
|
||||
$templateClass->create_link('Borg', '/apps/borg', true, '<svg role="img" fill="currentColor" class="ui-menu-inline-icon" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4zm0 10.99h7c-.53 4.12-3.28 7.79-7 8.94V12H5V6.3l7-3.11v8.8z"/></svg>', 'backups'); // apiscp-borg
|
||||
PHP
|
||||
fi
|
||||
fi
|
||||
|
|
@ -79,8 +79,8 @@ if [ -f "$SITE_DEST" ]; then
|
|||
echo " appending create_link() to existing $SITE_DEST"
|
||||
cat >> "$SITE_DEST" <<'PHP'
|
||||
|
||||
// apiscp-borg (site-owner)
|
||||
$templateClass->create_link('My Borg Backups', '/apps/myborgbackups', true, null, 'account');
|
||||
$templateClass->create_category('Backups', true, '<svg role="img" fill="currentColor" class="ui-menu-icon" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M17 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V7l-4-4zm-5 16a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm3-10H5V5h10v4z"/></svg>', 'backups'); // apiscp-borg
|
||||
$templateClass->create_link('Borg', '/apps/myborgbackups', true, '<svg role="img" fill="currentColor" class="ui-menu-inline-icon" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4zm0 10.99h7c-.53 4.12-3.28 7.79-7 8.94V12H5V6.3l7-3.11v8.8z"/></svg>', 'backups'); // apiscp-borg
|
||||
PHP
|
||||
fi
|
||||
else
|
||||
|
|
|
|||
|
|
@ -2,17 +2,13 @@
|
|||
/**
|
||||
* apiscp-borg menu registration (appliance-admin panel).
|
||||
*
|
||||
* Installed upgrade-safe at config/custom/templates/admin.php, which
|
||||
* lib/Template/Engine.php::load_configuration() includes with $templateClass
|
||||
* in scope after the core admin menu. Adds the "Borg Backups" link.
|
||||
* Adds a shared "Backups" category (sidebar section) and a "Borg" link with an
|
||||
* icon under it. The category is shared with the sibling apiscp-kopia /
|
||||
* apiscp-bacula plugins: each creates it (harmless to repeat) and tags its own
|
||||
* lines with an "apiscp-<engine>" marker so its uninstaller removes only its
|
||||
* own, leaving the category for any other backup plugin still installed.
|
||||
*
|
||||
* If you already maintain a custom admin.php, copy just the create_link()
|
||||
* call below into it instead of overwriting your file.
|
||||
* If you already maintain a custom admin.php, copy just the two calls below.
|
||||
*/
|
||||
$templateClass->create_link(
|
||||
'Borg Backups', // label
|
||||
'/apps/borg', // href -> config/custom/apps/borg
|
||||
true, // assertion: always visible within the admin menu
|
||||
null, // icon
|
||||
'services' // category: "System" (internal id 'services')
|
||||
);
|
||||
$templateClass->create_category('Backups', true, '<svg role="img" fill="currentColor" class="ui-menu-icon" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M17 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V7l-4-4zm-5 16a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm3-10H5V5h10v4z"/></svg>', 'backups'); // apiscp-borg
|
||||
$templateClass->create_link('Borg', '/apps/borg', true, '<svg role="img" fill="currentColor" class="ui-menu-inline-icon" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4zm0 10.99h7c-.53 4.12-3.28 7.79-7 8.94V12H5V6.3l7-3.11v8.8z"/></svg>', 'backups'); // apiscp-borg
|
||||
|
|
|
|||
|
|
@ -2,19 +2,13 @@
|
|||
/**
|
||||
* apiscp-borg menu registration (site-owner panel).
|
||||
*
|
||||
* Installed upgrade-safe at config/custom/templates/site.php, which
|
||||
* lib/Template/Engine.php::load_configuration() includes with $templateClass
|
||||
* in scope after the core site menu. Adds a "My Borg Backups" link that
|
||||
* opens the site-owner GUI app (config/custom/apps/myborgbackups), scoped
|
||||
* to the signed-in account's own site only.
|
||||
* Adds a shared "Backups" category and a "Borg" link (with an icon) that opens
|
||||
* the site-owner GUI (config/custom/apps/myborgbackups), scoped to the
|
||||
* signed-in account's own site only. The category is shared with the sibling
|
||||
* plugins; each tags its own lines with an "apiscp-<engine>" marker so its
|
||||
* uninstaller removes only its own.
|
||||
*
|
||||
* If you already maintain a custom site.php, copy just the create_link()
|
||||
* call below into it instead of overwriting your file.
|
||||
* If you already maintain a custom site.php, copy just the two calls below.
|
||||
*/
|
||||
$templateClass->create_link(
|
||||
'My Borg Backups', // label
|
||||
'/apps/myborgbackups', // href -> config/custom/apps/myborgbackups
|
||||
true, // assertion: visible to the site administrator
|
||||
null, // icon
|
||||
'account' // category (site panel "Account" section)
|
||||
);
|
||||
$templateClass->create_category('Backups', true, '<svg role="img" fill="currentColor" class="ui-menu-icon" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M17 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V7l-4-4zm-5 16a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm3-10H5V5h10v4z"/></svg>', 'backups'); // apiscp-borg
|
||||
$templateClass->create_link('Borg', '/apps/myborgbackups', true, '<svg role="img" fill="currentColor" class="ui-menu-inline-icon" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4zm0 10.99h7c-.53 4.12-3.28 7.79-7 8.94V12H5V6.3l7-3.11v8.8z"/></svg>', 'backups'); // apiscp-borg
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue