dsh-ops-kit 0.4.9 → 0.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client.js +23 -8
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -687,6 +687,15 @@ window.__ModuleLoader__.load({
|
|
|
687
687
|
h('polyline', { points: d, fill: 'none', stroke: color, strokeWidth: 1.6 }))
|
|
688
688
|
}
|
|
689
689
|
|
|
690
|
+
/** 简单模式里把「(退出码 2)」这类技术尾巴去掉。 */
|
|
691
|
+
const plainCheckDetail = (detail) => {
|
|
692
|
+
const text = String(detail || '')
|
|
693
|
+
.replace(/[((]\s*退出码\s*\d+\s*[))]/g, '')
|
|
694
|
+
.replace(/[((]\s*exit(?:\s+code)?\s*\d+\s*[))]/gi, '')
|
|
695
|
+
.trim()
|
|
696
|
+
return text || L('检查不通过', 'Check failed')
|
|
697
|
+
}
|
|
698
|
+
|
|
690
699
|
const sizeText = (bytes, dir) => {
|
|
691
700
|
if (dir) return '—'
|
|
692
701
|
const n = Number(bytes) || 0
|
|
@@ -2078,15 +2087,15 @@ window.__ModuleLoader__.load({
|
|
|
2078
2087
|
}
|
|
2079
2088
|
|
|
2080
2089
|
/** 设置:主机、通道、模型、巡检配置;状态仍由 Panel 持有,视图独立。 */
|
|
2081
|
-
function SettingsTab({ adding, aiModels, audit, busy, chBusy, channelForm, channels, config, editName, form, health, hosts, info, loadingMap, notice, tab, uiMode, addHost, installKeyOn, removeChannelUi, removeHost, saveChannel, saveConfig, startEdit, testChannelUi, testHost, setAdding, setAiModels, setChannelForm, setConfig, setEditName, setForm, quickText, setQuickText,
|
|
2090
|
+
function SettingsTab({ adding, aiModels, audit, busy, chBusy, channelForm, channels, config, editName, form, health, hosts, info, loadingMap, notice, tab, uiMode, addHost, installKeyOn, removeChannelUi, removeHost, saveChannel, saveConfig, startEdit, testChannelUi, testHost, setAdding, setAiModels, setChannelForm, setConfig, setEditName, setForm, quickText, setQuickText, switchMode }) {
|
|
2082
2091
|
const settingsView = h('div', { style: { display: 'flex', flexDirection: 'column', gap: '12px' } },
|
|
2083
2092
|
h('div', { className: 'ops-card' },
|
|
2084
2093
|
h('div', { className: 'ops-card-h' }, h('span', null, T.uiMode),
|
|
2085
2094
|
h('button', { className: 'ops-btn ops-btn-primary ops-btn-sm', onClick: () => { void saveConfig() } }, T.save)),
|
|
2086
2095
|
h('div', { className: 'ops-card-b' },
|
|
2087
2096
|
h('div', { className: 'ops-chips' },
|
|
2088
|
-
h('button', { className: `ops-tab${uiMode === 'simple' ? ' on' : ''}`, onClick: () =>
|
|
2089
|
-
h('button', { className: `ops-tab${uiMode === 'pro' ? ' on' : ''}`, onClick: () =>
|
|
2097
|
+
h('button', { className: `ops-tab${uiMode === 'simple' ? ' on' : ''}`, onClick: () => { void switchMode('simple') } }, T.modeSimple),
|
|
2098
|
+
h('button', { className: `ops-tab${uiMode === 'pro' ? ' on' : ''}`, onClick: () => { void switchMode('pro') } }, T.modePro)),
|
|
2090
2099
|
h('p', { className: 'ops-sub', style: { margin: 0 } }, T.modeHint))),
|
|
2091
2100
|
h('div', { className: 'ops-card' },
|
|
2092
2101
|
h('div', { className: 'ops-card-h' }, h('span', null, T.patrol), notice ? h('span', { className: 'ops-ok' }, notice) : null),
|
|
@@ -2501,7 +2510,7 @@ window.__ModuleLoader__.load({
|
|
|
2501
2510
|
? h('div', { style: { marginTop: '6px' } }, ...state.failing.slice(0, 3).map(item => {
|
|
2502
2511
|
const tip = suggestionFor(item)
|
|
2503
2512
|
return h('div', { key: item.id, style: { fontSize: '12.5px', color: '#ff8a8a', lineHeight: 1.9 } },
|
|
2504
|
-
`· ${item.label || item.target}:${item.last?.detail
|
|
2513
|
+
`· ${item.label || item.target}:${plainCheckDetail(item.last?.detail)}`,
|
|
2505
2514
|
h('div', { style: { color: 'var(--dsw-alias-text-secondary,#9aa0a6)', paddingLeft: '10px' } },
|
|
2506
2515
|
`${T.suggestion}:${tip.text}`,
|
|
2507
2516
|
tip.action === 'restart'
|
|
@@ -2797,7 +2806,7 @@ window.__ModuleLoader__.load({
|
|
|
2797
2806
|
return hostDetailView
|
|
2798
2807
|
}
|
|
2799
2808
|
|
|
2800
|
-
function Panel({ initialHosts = [], initialDetailHost = null, initialDetailTab = 'summary' } = {}) {
|
|
2809
|
+
function Panel({ initialHosts = [], initialDetailHost = null, initialDetailTab = 'summary', initialUiMode = 'pro' } = {}) {
|
|
2801
2810
|
const [tab, setTab] = React.useState(0)
|
|
2802
2811
|
const [detailHost, setDetailHost] = React.useState(initialDetailHost)
|
|
2803
2812
|
const [detailTab, setDetailTab] = React.useState(initialDetailTab)
|
|
@@ -2840,7 +2849,7 @@ window.__ModuleLoader__.load({
|
|
|
2840
2849
|
const [monDialog, setMonDialog] = React.useState(null)
|
|
2841
2850
|
const [templates, setTemplates] = React.useState([])
|
|
2842
2851
|
const [services, setServices] = React.useState([])
|
|
2843
|
-
const [uiMode, setUiMode] = React.useState(
|
|
2852
|
+
const [uiMode, setUiMode] = React.useState(initialUiMode)
|
|
2844
2853
|
const [alerts, setAlerts] = React.useState([])
|
|
2845
2854
|
const [audit, setAudit] = React.useState([])
|
|
2846
2855
|
const [info, setInfo] = React.useState(null)
|
|
@@ -3845,9 +3854,15 @@ window.__ModuleLoader__.load({
|
|
|
3845
3854
|
}
|
|
3846
3855
|
|
|
3847
3856
|
const switchMode = async (next) => {
|
|
3857
|
+
const previous = uiMode
|
|
3848
3858
|
setUiMode(next)
|
|
3849
3859
|
if (next === 'simple') { setDetailHost(null); setTab(0) }
|
|
3850
|
-
try {
|
|
3860
|
+
try {
|
|
3861
|
+
await api('config', { method: 'POST', body: JSON.stringify({ uiMode: next }) }, 15_000)
|
|
3862
|
+
} catch (e) {
|
|
3863
|
+
setUiMode(previous)
|
|
3864
|
+
setError(String(e.message || e))
|
|
3865
|
+
}
|
|
3851
3866
|
}
|
|
3852
3867
|
|
|
3853
3868
|
const quickCommands = (Array.isArray(config.quickCommands) && config.quickCommands.length > 0)
|
|
@@ -3860,7 +3875,7 @@ window.__ModuleLoader__.load({
|
|
|
3860
3875
|
|
|
3861
3876
|
const topTabs = [[0, T.tabs[0]], [1, T.tabs[8]], [2, T.tabs[9]]]
|
|
3862
3877
|
|
|
3863
|
-
const body = detailHost ? subBody : [h(OverviewTab, { ackAlert, alerts, askAi, backupBusy, busy, cleanBusyHost, cleanRunBusy, cleanupHost, config, confirmDialog, conns, copyDiagnostics, copyReport, countOf, diag, diagnosticsText, doAction, error, hosts, info, loadBase, metricBox, monitors, openCleanPreview, openHost, overview, recheckHost, recheckOne, restartWebFor, sectionList, setAdding, setAlerts, setCHost, setChatNotice, setDetailHost, setDiag, setError, setHostCtx, setNotice, setSimpleCtx, setSimpleMonitors, setSimpleNotice, setTab, setUiMode, simpleCtx, simpleHostState, simpleMonitors, simpleNotice, statusOf, suggestionFor, switchMode, timeoutFor, uiMode }), h(AssistantTab, { picker: hostPicker(hosts, cHost, setCHost), askLog, askQuestion, setAskQuestion, askBusy, askHost, chatNotice, copyText, runNeedsConfirm, copyDiagnostics }), h(SettingsTab, { adding, aiModels, audit, busy, chBusy, channelForm, channels, config, editName, form, health, hosts, info, loadingMap, notice, tab, uiMode, addHost, installKeyOn, removeChannelUi, removeHost, saveChannel, saveConfig, startEdit, testChannelUi, testHost, setAdding, setAiModels, setChannelForm, setConfig, setEditName, setForm, quickText, setQuickText,
|
|
3878
|
+
const body = detailHost ? subBody : [h(OverviewTab, { ackAlert, alerts, askAi, backupBusy, busy, cleanBusyHost, cleanRunBusy, cleanupHost, config, confirmDialog, conns, copyDiagnostics, copyReport, countOf, diag, diagnosticsText, doAction, error, hosts, info, loadBase, metricBox, monitors, openCleanPreview, openHost, overview, recheckHost, recheckOne, restartWebFor, sectionList, setAdding, setAlerts, setCHost, setChatNotice, setDetailHost, setDiag, setError, setHostCtx, setNotice, setSimpleCtx, setSimpleMonitors, setSimpleNotice, setTab, setUiMode, simpleCtx, simpleHostState, simpleMonitors, simpleNotice, statusOf, suggestionFor, switchMode, timeoutFor, uiMode }), h(AssistantTab, { picker: hostPicker(hosts, cHost, setCHost), askLog, askQuestion, setAskQuestion, askBusy, askHost, chatNotice, copyText, runNeedsConfirm, copyDiagnostics }), h(SettingsTab, { adding, aiModels, audit, busy, chBusy, channelForm, channels, config, editName, form, health, hosts, info, loadingMap, notice, tab, uiMode, addHost, installKeyOn, removeChannelUi, removeHost, saveChannel, saveConfig, startEdit, testChannelUi, testHost, setAdding, setAiModels, setChannelForm, setConfig, setEditName, setForm, quickText, setQuickText, switchMode })][tab]
|
|
3864
3879
|
|
|
3865
3880
|
const header = h('div', { className: 'ops-top' },
|
|
3866
3881
|
h('div', null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-ops-kit",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.10",
|
|
4
4
|
"description": "OPC-运维工作台 (dsh-ops-kit) — Server operations kit for DeepSeek Harness: server cards, health charts, config browser, app manager and plain-language AI diagnosis — over SSH, no agent install.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|