Remove the web UI status column from the plugin pages

Users don't need the web UI load state apart from the plugin's own state now
that the web UI reloads itself. A web load error now shows under the plugin's
versions and on its view page, only for enabled plugins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 committed 2026-10-28 23:35:35 +00:00
1 parent 188de979b6
commit 82b7c16dba
2 files changed
+32 -87

No files matched your search

@@ -48,22 +48,25 @@ function PluginMachines(props: PluginMachinesProps) {
type ControllerPluginProps = { type ControllerPluginProps = {
pluginMeta: PluginWebApi, pluginMeta: PluginWebApi,
pluginInfo?: lib.PluginWebEnvInfo, pluginInfo?: lib.PluginWebEnvInfo,
loadedPlugin?: lib.PluginWebEnvInfo,
title: string, title: string,
}; };
/** What the controller and web UI have loaded of the plugin */
function ControllerPlugin(props: ControllerPluginProps) { function ControllerPlugin(props: ControllerPluginProps) {
const { pluginMeta, pluginInfo, loadedPlugin } = props; const { pluginMeta, pluginInfo } = props;
const pluginError = pluginMeta.web.error ?? pluginInfo?.error; const pkg = pluginInfo?.package;
const hasWebModule = Boolean(pluginMeta.web.main || pluginMeta.web.error); const pluginError = pluginMeta.enabled ? pluginMeta.web.error ?? pluginInfo?.error : undefined;
if (!loadedPlugin) { const homepageUrl = lib.safeExternalUrl(pkg?.homepage);
return <> return <>
<Descriptions bordered size="small" title={props.title}> <Descriptions bordered size="small" title={props.title}>
<Descriptions.Item label="Version">{pluginMeta.version}</Descriptions.Item> <Descriptions.Item label="Version" span={3}>{pluginMeta.version}</Descriptions.Item>
<Descriptions.Item label="Loaded in Web UI" span={2}> {pluginInfo?.description ? <Descriptions.Item label="Description" span={3}>
{hasWebModule ? "No" : "No web module"} {pluginInfo.description}
</Descriptions.Item> </Descriptions.Item> : null}
{pkg?.homepage ? <Descriptions.Item label="Homepage" span={3}>
{homepageUrl ? <a href={homepageUrl}>{pkg.homepage}</a> : pkg.homepage}
</Descriptions.Item> : null}
{pkg?.author ? <Descriptions.Item label="Author" span={3}>{pkg.author}</Descriptions.Item> : null}
{pkg?.license ? <Descriptions.Item label="License" span={3}>{pkg.license}</Descriptions.Item> : null}
</Descriptions> </Descriptions>
{pluginError && <Alert {pluginError && <Alert
style={{ style={{
@@ -71,8 +74,8 @@ function ControllerPlugin(props: ControllerPluginProps) {
}} }}
message={pluginError} message={pluginError}
description={ description={
"The web interface was unable to load the web module for this plugin. This is "+ "The web interface was unable to load the webpack module for this plugin. This is "+
"usually due to an incorrect or missing web build for the plugin. Due to the "+ "usually due to an incorrect or missing webpack build for the plugin. Due to the "+
"module not being loaded, the configs and web controls defined by this plugin may "+ "module not being loaded, the configs and web controls defined by this plugin may "+
"not be available in the web interface." "not be available in the web interface."
} }
@@ -82,39 +85,6 @@ function ControllerPlugin(props: ControllerPluginProps) {
</>; </>;
} }
const homepageUrl = lib.safeExternalUrl(loadedPlugin.package.homepage);
return <>
<Descriptions bordered size="small" title={props.title}>
<Descriptions.Item label="Version">{pluginMeta.version}</Descriptions.Item>
<Descriptions.Item label="Loaded in Web UI" span={2}>Yes</Descriptions.Item>
<Descriptions.Item label="Description" span={3}>{loadedPlugin.description}</Descriptions.Item>
{loadedPlugin.package.homepage ? <Descriptions.Item label="Homepage" span={3}>
{homepageUrl
? <a href={homepageUrl}>{loadedPlugin.package.homepage}</a>
: loadedPlugin.package.homepage}
</Descriptions.Item> : null}
{loadedPlugin.package.author ? <Descriptions.Item label="Author" span={3}>
{loadedPlugin.package.author}
</Descriptions.Item> : null}
<Descriptions.Item label="License" span={3}>{loadedPlugin.package.license}</Descriptions.Item>
</Descriptions>
{pluginMeta.version !== loadedPlugin.package.version ? <Alert
style={{
marginTop: "1em",
}}
message="Version missmatch detected"
description={
`The version of the web interface module for this plugin (${loadedPlugin.package.version}) `+
`does not match the version running on the controller (${pluginMeta.version}), `+
"spurious errors may occur. This usually happens when the plugin is updated but the "+
"controller has not been restarted yet, but may also be due to an outdated build."
}
type="warning"
showIcon
/> : null}
</>;
}
export default function PluginViewPage() { export default function PluginViewPage() {
let params = useParams(); let params = useParams();
const control = useContext(ControlContext); const control = useContext(ControlContext);
@@ -160,7 +130,6 @@ export default function PluginViewPage() {
? <ControllerPlugin ? <ControllerPlugin
pluginMeta={pluginMeta} pluginMeta={pluginMeta}
pluginInfo={pluginInfo} pluginInfo={pluginInfo}
loadedPlugin={control.loadedPlugins.get(pluginName)}
title={pluginTitle} title={pluginTitle}
/> />
: <Descriptions bordered size="small" title={pluginTitle}> : <Descriptions bordered size="small" title={pluginTitle}>
+17 -41
View File
@@ -1,9 +1,8 @@
import React, { useContext, useEffect, useState } from "react"; import React, { useContext, useEffect, useState } from "react";
import { Space, Table, Typography } from "antd"; import { Space, Table, Tooltip, Typography } from "antd";
import CloseCircleFilled from "@ant-design/icons/CloseCircleFilled"; import CloseCircleFilled from "@ant-design/icons/CloseCircleFilled";
import InfoCircleFilled from "@ant-design/icons/InfoCircleFilled";
import type { PluginWebApi, PluginWebEnvInfo } from "@clusterio/lib"; import type { PluginWebApi } from "@clusterio/lib";
import notify from "../util/notify"; import notify from "../util/notify";
import { useAccount } from "../model/account"; import { useAccount } from "../model/account";
@@ -28,8 +27,7 @@ type PluginRow = {
title: string; title: string;
/** Not present for plugins the controller hasn't loaded */ /** Not present for plugins the controller hasn't loaded */
meta?: PluginWebApi; meta?: PluginWebApi;
info?: PluginWebEnvInfo; webError?: string;
package?: any;
status?: PluginStatus; status?: PluginStatus;
}; };
@@ -38,30 +36,14 @@ function pluginPath(plugin: PluginRow) {
return `/plugins/${encodeURIComponent(plugin.meta?.name ?? plugin.key)}/view`; return `/plugins/${encodeURIComponent(plugin.meta?.name ?? plugin.key)}/view`;
} }
function WebUiStatus(props: { plugin: PluginRow }) { /** Shown with the versions when the plugin's web code failed to load */
const control = useContext(ControlContext); function WebError(props: { error: string }) {
const { meta } = props.plugin; return <div>
if (!meta) { <Tooltip title={props.error}>
return <Typography.Text type="secondary">Not on controller</Typography.Text>; <Typography.Text type="danger"><CloseCircleFilled /> Web interface failed to load</Typography.Text>
</Tooltip>
</div>;
} }
if (!meta.enabled) {
return <><InfoCircleFilled style={{ color: "#1668dc" }} /> Disabled on controller</>;
}
if (!meta.web.main && !meta.web.error) {
return <Typography.Text type="secondary">No web module</Typography.Text>;
}
if (!meta.web.error && !control.pluginInfos.has(meta.name)) {
return <><InfoCircleFilled style={{ color: "#1668dc" }} /> Reload page to load</>;
}
if (!props.plugin.package) {
return <><CloseCircleFilled style={{ color: "#dc4446" }} /> Error loading module</>;
}
if (props.plugin.package.version !== meta.version) {
return <><CloseCircleFilled style={{ color: "#dc4446" }} /> Version mis-matched</>;
}
return <>Loaded {meta.version}</>;
}
export default function PluginsPage() { export default function PluginsPage() {
const control = useContext(ControlContext); const control = useContext(ControlContext);
@@ -95,14 +77,12 @@ export default function PluginsPage() {
let tableContents: PluginRow[] = []; let tableContents: PluginRow[] = [];
for (let meta of pluginList) { for (let meta of pluginList) {
const key = pluginStatusKey(meta); const key = pluginStatusKey(meta);
const loaded = control.loadedPlugins.get(meta.name); const info = control.pluginInfos.get(meta.name);
const info = loaded ?? control.pluginInfos.get(meta.name);
tableContents.push({ tableContents.push({
key, key,
title: info ? info.title : meta.name, title: info ? info.title : meta.name,
meta, meta,
info, webError: meta.enabled ? meta.web.error ?? info?.error : undefined,
package: loaded?.package,
status: statuses.get(key), status: statuses.get(key),
}); });
} }
@@ -151,16 +131,12 @@ export default function PluginsPage() {
{ {
title: "Versions", title: "Versions",
key: "versions", key: "versions",
render: (_, plugin) => (plugin.status render: (_, plugin) => <>
{plugin.status
? <PluginVersions status={plugin.status} latest={latestOf(plugin)} /> ? <PluginVersions status={plugin.status} latest={latestOf(plugin)} />
: plugin.meta?.version : plugin.meta?.version}
), {plugin.webError && <WebError error={plugin.webError} />}
}, </>,
{
title: "Web UI Status",
key: "web",
render: (_, plugin) => <WebUiStatus plugin={plugin} />,
responsive: ["sm"],
}, },
{ {
key: "actions", key: "actions",