dsh-ops-kit 0.4.5 → 0.4.6

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.
Files changed (2) hide show
  1. package/client.js +25 -4
  2. package/package.json +1 -1
package/client.js CHANGED
@@ -697,6 +697,19 @@ window.__ModuleLoader__.load({
697
697
  }, host.name)))
698
698
 
699
699
  /** 监控:CPU/内存/磁盘/网络/IO 曲线;自己加载采样,不牵动其它 tab。 */
700
+ /** 只有这类 unit 值得推荐给普通用户;dbus/getty/gssproxy 等系统服务不提示。 */
701
+ const BUSINESS_SERVICE = /(nginx|apache|httpd|mysql|mariadb|postgres|redis|mongo|elasticsearch|php|java|tomcat|node|pm2|gunicorn|uwsgi|docker|containerd|supervisor|frp|traefik|caddy|haproxy|kafka|rabbit|memcached|minio|baota)/i
702
+ const BUSINESS_PORTS = new Set([80, 443, 3000, 3306, 5432, 6379, 8000, 8080, 8443, 9000, 9200, 27017])
703
+ /** 操作系统自带的服务:默认不推荐、不打扰用户。其余 unit 视为业务程序。 */
704
+ const SYSTEM_UNIT = /^(dbus|dbus-|getty|gssproxy|chronyd|cloudmonitor|aegis|aliyun|atd|crond|cron|firewalld|sshd|systemd|polkit|udisks|accounts-daemon|networkmanager|wpa_supplicant|rpc|rpcbind|irqbalance|rsyslog|auditd|tuned|kdump|kmod|bluetooth|avahi|cups|modemmanager|thermald|upower|multipathd|lvm2|dracut|nscd|sssd|oddjob|certmonger|abrt|packagekit|serial-getty|console-getty|user@|postfix|nfs|iscsid|iscsi|target|kubelet|bt-|baota|bt_tool)/i
705
+
706
+ function isBusinessService(name) {
707
+ const unit = String(name || '').toLowerCase().replace(/\.service$/, '')
708
+ if (!unit) return false
709
+ if (BUSINESS_SERVICE.test(unit)) return true
710
+ return !SYSTEM_UNIT.test(unit)
711
+ }
712
+
700
713
  function MonitorTab({ hosts, detailHost, detailTab, loadingMap, markLoading, setError }) {
701
714
  const [mHost, setMHost] = React.useState('')
702
715
  const [mHours, setMHours] = React.useState(6)
@@ -2184,13 +2197,17 @@ window.__ModuleLoader__.load({
2184
2197
  h('button', { className: 'ops-btn ops-btn-sm', onClick: () => { void loadInv(cHost || hosts[0]?.name, true) } }, busy === 'scan' ? T.rescanning : T.rescan)),
2185
2198
  h('div', { className: 'ops-card' },
2186
2199
  h('div', { className: 'ops-card-h' },
2187
- h('span', null, T.suggest, h('span', { className: 'ops-chip', style: { marginLeft: '6px' } }, String(monitorSuggestions.length))),
2200
+ h('span', null, L('建议监控(只列业务程序)', 'Suggested monitors (business apps only)'),
2201
+ h('span', { className: 'ops-chip', style: { marginLeft: '6px' } }, String(monitorSuggestions.length))),
2188
2202
  h('button', {
2189
2203
  className: 'ops-btn ops-btn-primary ops-btn-sm',
2190
2204
  disabled: monitorSuggestions.length === 0 || monBusy === 'suggest',
2191
2205
  onClick: () => { void addSuggestions(monitorSuggestions) },
2192
2206
  }, monBusy === 'suggest' ? T.reading : T.suggestAll)),
2193
2207
  h('div', { className: 'ops-card-b' },
2208
+ h('p', { className: 'ops-sub', style: { margin: '0 0 8px' } },
2209
+ L('只会列出 nginx、mysql、redis 这类业务程序;dbus、getty 等系统服务默认不出现,也不需要你管。',
2210
+ 'Only business apps such as nginx, mysql and redis are listed. System units (dbus, getty…) are left alone.')),
2194
2211
  monitorSuggestions.length === 0
2195
2212
  ? h('p', { className: 'ops-empty' }, T.suggestNone)
2196
2213
  : h('div', null, ...monitorSuggestions.slice(0, 12).map(item => h('div', {
@@ -2205,7 +2222,10 @@ window.__ModuleLoader__.load({
2205
2222
  h('span', { style: { display: 'flex', justifyContent: 'flex-end' } },
2206
2223
  h('button', { className: 'ops-btn ops-btn-sm', onClick: () => { void addSuggestions([item]) } }, T.suggestAdd))))))),
2207
2224
  h('div', { className: 'ops-card' },
2208
- h('div', { className: 'ops-card-h' }, h('span', null, T.tabs[3]), h('span', { className: 'ops-chip' }, String((inv?.apps || []).length))),
2225
+ h('div', { className: 'ops-card-h' }, h('span', null, L('你的业务程序', 'Your apps')), h('span', { className: 'ops-chip' }, String((inv?.apps || []).length))),
2226
+ h('p', { className: 'ops-sub', style: { margin: '8px 14px 0' } },
2227
+ L('「日志」看运行记录;「重启」会中断服务几秒。系统自带的程序不在这里。',
2228
+ 'Logs shows recent output; Restart briefly interrupts the service. System units are not listed.')),
2209
2229
  (inv?.apps || []).length === 0 ? h('p', { className: 'ops-empty' }, T.empty)
2210
2230
  : h('div', { className: 'ops-list' }, ...(inv.apps || []).map(app => h('div', { key: app.kind + app.name, className: 'ops-row' },
2211
2231
  h('span', null, h('span', { className: 'ops-chip', style: { marginRight: '6px' } }, app.kind), h('span', { className: 'ops-name' }, app.name)),
@@ -3255,11 +3275,12 @@ window.__ModuleLoader__.load({
3255
3275
  const items = []
3256
3276
  for (const row of inv.services || []) {
3257
3277
  const unit = String(row).trim().split(/\s+/)[0]
3258
- if (!unit) continue
3278
+ if (!unit || !isBusinessService(unit)) continue
3259
3279
  items.push({ type: 'service', target: unit, label: serviceLabel(row) || unit })
3260
3280
  }
3261
3281
  for (const port of inv.portsParsed || []) {
3262
3282
  if (!port?.port) continue
3283
+ if (!BUSINESS_PORTS.has(Number(port.port)) && !isBusinessService(port.process)) continue
3263
3284
  items.push({ type: 'port', target: `127.0.0.1:${port.port}`, label: `${port.process || L('端口', 'Port')} :${port.port}` })
3264
3285
  }
3265
3286
  for (const line of inv.nginx || []) {
@@ -4024,6 +4045,6 @@ window.__ModuleLoader__.load({
4024
4045
  ctx.slots.inject('main', () => ctx.slots.register({ name: 'main', key: PANEL }, PanelRoot))
4025
4046
  }
4026
4047
 
4027
- return { isPlugin: true, inject: ['slots'], apply, __test: { PanelRoot, Panel, MonitorTab, BackupsTab, CronTab, DeployTab, FilesTab, LogsTab, AssistantTab, TerminalTab, SettingsTab, ConfigTab, AppsTab, OverviewTab, HostDetailTab, Chart } }
4048
+ return { isPlugin: true, inject: ['slots'], apply, __test: { PanelRoot, Panel, isBusinessService, MonitorTab, BackupsTab, CronTab, DeployTab, FilesTab, LogsTab, AssistantTab, TerminalTab, SettingsTab, ConfigTab, AppsTab, OverviewTab, HostDetailTab, Chart } }
4028
4049
  },
4029
4050
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-ops-kit",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
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",