"Doctor" said little about what it does: check the opened workflow's models and put back the ones this computer has. The rail, page, home card, help, tour, README, the unreleased changelog and the architecture docs now say Model Check (模型检查); the help paragraph now describes the check as it works today. Code, CSS and locale keys keep "doctor"; released changelog entries, audits and decisions keep the old name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
1.7 KiB
JavaScript
36 lines
1.7 KiB
JavaScript
/**
|
|
* The rail's tool buttons under the pages: scan, Model Check and Current node; settings
|
|
* at the rail's foot. Each opens its tool page; labels follow the language (the settings
|
|
* hub renders them again when it changes). The other tools live on their pages.
|
|
*/
|
|
|
|
import { translate as t } from './locales.js';
|
|
import { TOOL_ICONS } from './tool_registry.js';
|
|
import { setScanButtonState } from './scan_runner.js';
|
|
|
|
const TOOLS = Object.freeze([
|
|
{ id: 'anomalous-scan-btn', nameKey: 'sidebarScan', open: owner => owner.openScanPage() },
|
|
{ id: 'anomalous-doctor-btn', nameKey: 'sidebarDoctor', icon: TOOL_ICONS.DOCTOR, open: owner => owner.openDoctorPage() },
|
|
{ id: 'anomalous-assistant-btn', nameKey: 'sidebarAssistant', icon: TOOL_ICONS.ASSISTANT, open: owner => owner.openCurrentNode() },
|
|
]);
|
|
|
|
/** Fills `owner.railTools` and `owner.railFoot`; `isScanning()` sets the scan button's state. */
|
|
export function renderRailTools(owner, { isScanning, settingsButton }) {
|
|
owner.railTools.replaceChildren(...TOOLS.map((tool) => {
|
|
const button = document.createElement('button');
|
|
button.id = tool.id;
|
|
button.className = 'anomalous-tooltip-target';
|
|
button.setAttribute('aria-label', t(tool.nameKey));
|
|
button.setAttribute('data-tooltip', t(tool.nameKey));
|
|
button.setAttribute('data-tooltip-pos', 'right');
|
|
if (tool.icon) button.innerHTML = tool.icon; // static markup only
|
|
else setScanButtonState(button, isScanning());
|
|
button.onclick = (event) => {
|
|
event.stopPropagation();
|
|
tool.open(owner);
|
|
};
|
|
return button;
|
|
}));
|
|
owner.railFoot.replaceChildren(settingsButton);
|
|
}
|