Add PluginsContext to web_ui

Add a React context to access the plugins loaded in the web interface.
The info, /api/plugins metadata and webpack container is provided for
each plugin.
This commit is contained in:
Hornwitser committed 2021-03-01 15:03:25 +01:00
1 parent d0befe5944
commit 3a3a7597bf
3 files changed
+28 -16

No files matched your search

+6 -3
View File
@@ -7,6 +7,7 @@ import { logger } from "@clusterio/lib/logging";
import basename from "../basename";
import SiteLayout from "./SiteLayout";
import ControlContext from "./ControlContext";
import PluginsContext from "./PluginsContext";
import LoginForm from "./LoginForm";
import { Card, Spin } from "antd";
@@ -77,9 +78,11 @@ export default function App(props) {
return (
<ControlContext.Provider value={props.control}>
<BrowserRouter basename={basename}>
{page}
</BrowserRouter>
<PluginsContext.Provider value={props.plugins}>
<BrowserRouter basename={basename}>
{page}
</BrowserRouter>
</PluginsContext.Provider>
</ControlContext.Provider>
);
}
@@ -0,0 +1,3 @@
import React from "react";
export default React.createContext();