import React, { useEffect, useContext, useState } from "react"; import { useHistory, useParams } from "react-router-dom"; import { Alert, Descriptions, Spin } from "antd"; import ControlContext from "./ControlContext"; import PageLayout from "./PageLayout"; import { notifyErrorHandler } from "../util/notify"; export default function PluginViewPage() { let params = useParams(); let plugins = useContext(ControlContext).plugins; let [pluginList, setPluginList] = useState(null); let pluginName = params.name; useEffect(() => { (async () => { let response = await fetch(`${webRoot}api/plugins`); if (response.ok) { setPluginList(await response.json()); } else { notify("Failed to load plugin list"); } })(); }, []); let plugin = plugins.get(pluginName); let pluginTitle = plugin ? plugin.info.title : pluginName; let nav = [{ name: "Plugins", path: "/plugins" }, { name: pluginTitle }]; if (!pluginList) { return ; } let pluginMeta = pluginList.find(p => p.name === pluginName); if (!pluginMeta) { return Plugin not found Plugin with name {pluginName} was not found on the master server. ; } if (!plugin) { return {pluginMeta.version} {pluginMeta.loaded ? "Yes" : "No"} ; } return {pluginMeta.version} {pluginMeta.loaded ? "Yes" : "No"} {plugin.info.description} {plugin.package.homepage ? {plugin.package.homepage} : null} {plugin.package.author ? {plugin.package.author} : null} {plugin.package.license} {pluginMeta.version !== plugin.package.version ? : null} ; }
Plugin with name {pluginName} was not found on the master server.