Make web pages pluggable

Refactor the page handling of the web interface to allow plugins to add
their own pages.
This commit is contained in:
Hornwitser committed 2021-03-20 03:35:05 +01:00
1 parent 73c713462c
commit 3d26371fa9
3 files changed
+67 -41

No files matched your search

+22
View File
@@ -439,6 +439,21 @@ class BaseControlPlugin {
* form.
*/
/**
* Plugin supplied pages
* @typedef {Object} module:Lib/plugin~Page
* @property {string} path - URL path to this page.
* @property {string=} sidebarPath -
* If present and this path matches one of the pages in the sidebar it
* will cause that sidebar entry to be highlighted as active.
* @property {string=} sidebarName -
* If present creates an entry in the sidebar for this page with the
* given text.
* @property {ReactNode} content -
* A react node which is rendered when this page is navigated to.
* Should render a PageLayout.
*/
/**
* Base class for web interface plugins
*
@@ -477,6 +492,13 @@ class BaseWebPlugin {
* @type {Array<module:lib/plugin~LoginForm>}
*/
this.loginForms = [];
/**
* List of pages provided by this plugin
*
* @type {Array<module:lib/plugin~Page>}
*/
this.pages = [];
}
/**