Add Plugins page to web interface

Add page listing the plugins installed on the master along with a
detailed page for each plugin with fields from their package.json.
Failure to load the module and version missmatch is also reported.
This adds ./packages.json as required part of the webpack module.
This commit is contained in:
Hornwitser committed 2021-03-01 15:03:25 +01:00
1 parent 3a3a7597bf
commit 6c9d3d8893
11 files changed
+150 -2

No files matched your search

@@ -0,0 +1,52 @@
import React, { useContext } from "react";
import { useHistory } from "react-router-dom";
import { Table } from "antd";
import PluginsContext from "./PluginsContext";
import PageLayout from "./PageLayout";
export default function PluginsPage() {
let plugins = useContext(PluginsContext);
let history = useHistory();
return <PageLayout nav={[{ name: "Plugins" }]}>
<h2>Plugins</h2>
<Table
columns={[
{
title: "Name",
key: "name",
render: plugin => plugin.info ? plugin.info.title : plugin.meta.name,
},
{
title: "Version",
key: "version",
render: plugin => {
if (!plugin.package) {
return "Error loading module";
}
if (plugin.package.version !== plugin.meta.version) {
return "Version missmatched";
}
return plugin.package.version;
}
},
{
title: "Enabled",
dataIndex: ["meta", "enabled"],
render: enabled => enabled ? "Yes" : null,
responsive: ["sm"],
},
]}
dataSource={plugins}
rowKey={plugin => plugin.meta.name}
pagination={false}
onRow={plugin => ({
onClick: event => {
history.push(`/plugins/${plugin.meta.name}/view`);
}
})}
/>
</PageLayout>;
}