seeder-st2110-components 1.7.13 → 1.7.15

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/dist/index.esm.js CHANGED
@@ -69,234 +69,6 @@ function _toPropertyKey$1(t) {
69
69
  return "symbol" == typeof i ? i : i + "";
70
70
  }
71
71
 
72
- const formatBytes = function (bytes) {
73
- let decimals = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
74
- if (bytes === 0 || !bytes || bytes < 0) return '0 Bytes';
75
- const k = 1024;
76
- const dm = decimals < 0 ? 0 : decimals;
77
- const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
78
- const i = Math.floor(Math.log(bytes) / Math.log(k));
79
- return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
80
- };
81
- const UsageItem = /*#__PURE__*/memo(_ref => {
82
- let {
83
- title,
84
- iconClass,
85
- children,
86
- memTotal
87
- } = _ref;
88
- return /*#__PURE__*/jsx(Tooltip, {
89
- title: /*#__PURE__*/jsxs(Fragment, {
90
- children: [/*#__PURE__*/jsx("div", {
91
- children: title
92
- }), title === 'Memory Usage' && memTotal !== undefined && /*#__PURE__*/jsxs("div", {
93
- children: ["Total Memory: ", formatBytes(memTotal)]
94
- })]
95
- }),
96
- destroyOnHidden: false,
97
- children: /*#__PURE__*/jsxs("div", {
98
- className: "usage-item",
99
- children: [/*#__PURE__*/jsx("i", {
100
- className: "seeder-iconfont ".concat(iconClass, " text-xl")
101
- }), /*#__PURE__*/jsx("span", {
102
- className: "usage-value",
103
- children: children
104
- })]
105
- })
106
- });
107
- });
108
- var UsageItem$1 = UsageItem;
109
-
110
- const useHardwareWebSocket = socketUrl => {
111
- const [systemStatus, setSystemStatus] = useState();
112
- const handleMessage = useCallback(message => {
113
- try {
114
- if (message) {
115
- setSystemStatus(prev => _objectSpread2$1(_objectSpread2$1({}, prev), message));
116
- }
117
- } catch (error) {
118
- console.error('Message processing error:', error);
119
- }
120
- }, []);
121
-
122
- // ## 获取系统资源使用情况
123
- useWebSocket(socketUrl, {
124
- onMessage: event => {
125
- // 处理实时消息
126
- try {
127
- const parsedMessage = JSON.parse(event.data);
128
- handleMessage(parsedMessage);
129
- } catch (error) {
130
- console.error('Message parsing error:', error);
131
- console.debug('Raw message:', event.data);
132
- }
133
- }
134
- });
135
-
136
- // // 监听消息 latestMessage 只用于非实时需求
137
- // useEffect(() => {
138
- // if (!latestMessage?.data) return;
139
-
140
- // try {
141
- // const parsedMessage = JSON.parse(latestMessage.data);
142
- // handleMessage(parsedMessage);
143
- // } catch (error) {
144
- // console.error('Message parsing error:', error);
145
- // console.debug('Raw message:', latestMessage.data);
146
- // }
147
- // }, [latestMessage?.data, handleMessage]);
148
-
149
- return {
150
- ps_status: systemStatus
151
- };
152
- };
153
- var useHardwareWebSocket$1 = useHardwareWebSocket;
154
-
155
- const getMaxNicTemp = function (sensors) {
156
- let priorityFields = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ["i350bb", "r8169_0_8300:00"];
157
- const temps = priorityFields.flatMap(field => {
158
- var _sensors$field;
159
- return (sensors === null || sensors === void 0 || (_sensors$field = sensors[field]) === null || _sensors$field === void 0 ? void 0 : _sensors$field.map(item => item.current)) || [];
160
- }).filter(temp => typeof temp === 'number');
161
- return temps.length ? Math.max(...temps) : null;
162
- };
163
-
164
- // 获取数组类型传感器最高温度(如内存、硬盘)
165
- const getMaxSensorTemp = sensorData => {
166
- const temps = (sensorData || []).map(item => item.current).filter(temp => typeof temp === 'number');
167
- return temps.length ? Math.max(...temps) : null;
168
- };
169
- const getDetail = function () {
170
- var _sensors_temperatures, _sensors_temperatures2, _mem$total, _mem$percent, _getMaxNicTemp, _gpu_stats$0$utilizat, _gpu_stats$, _gpu_stats$0$temperat, _gpu_stats$2;
171
- let status = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
172
- const {
173
- cpu_percent,
174
- mem,
175
- sensors_temperatures,
176
- gpu_stats
177
- } = status;
178
- return {
179
- cpu_usage: cpu_percent !== null && cpu_percent !== void 0 ? cpu_percent : null,
180
- cpu_temp: (_sensors_temperatures = sensors_temperatures === null || sensors_temperatures === void 0 || (_sensors_temperatures2 = sensors_temperatures.coretemp) === null || _sensors_temperatures2 === void 0 || (_sensors_temperatures2 = _sensors_temperatures2[0]) === null || _sensors_temperatures2 === void 0 ? void 0 : _sensors_temperatures2.current) !== null && _sensors_temperatures !== void 0 ? _sensors_temperatures : null,
181
- mem_total: (_mem$total = mem === null || mem === void 0 ? void 0 : mem.total) !== null && _mem$total !== void 0 ? _mem$total : null,
182
- mem_usage: (_mem$percent = mem === null || mem === void 0 ? void 0 : mem.percent) !== null && _mem$percent !== void 0 ? _mem$percent : null,
183
- mem_temp: getMaxSensorTemp(sensors_temperatures === null || sensors_temperatures === void 0 ? void 0 : sensors_temperatures.spd5118),
184
- nic_temp: (_getMaxNicTemp = getMaxNicTemp(sensors_temperatures)) !== null && _getMaxNicTemp !== void 0 ? _getMaxNicTemp : null,
185
- hd_temp: getMaxSensorTemp(sensors_temperatures === null || sensors_temperatures === void 0 ? void 0 : sensors_temperatures.nvme),
186
- gpu_usage: (_gpu_stats$0$utilizat = gpu_stats === null || gpu_stats === void 0 || (_gpu_stats$ = gpu_stats[0]) === null || _gpu_stats$ === void 0 ? void 0 : _gpu_stats$["utilization.gpu"]) !== null && _gpu_stats$0$utilizat !== void 0 ? _gpu_stats$0$utilizat : null,
187
- gpu_temp: (_gpu_stats$0$temperat = gpu_stats === null || gpu_stats === void 0 || (_gpu_stats$2 = gpu_stats[0]) === null || _gpu_stats$2 === void 0 ? void 0 : _gpu_stats$2["temperature.gpu"]) !== null && _gpu_stats$0$temperat !== void 0 ? _gpu_stats$0$temperat : null
188
- };
189
- };
190
-
191
- // 提取公共逻辑
192
- const createMetricItem = (title, iconClass, value, unit) => {
193
- const numValue = typeof value === 'string' ? parseFloat(value) : value;
194
- return {
195
- title,
196
- iconClass,
197
- valueString: "".concat(numValue).concat(unit),
198
- value: numValue
199
- };
200
- };
201
- const getItems = details => {
202
- const items = [];
203
- if (details.cpu_usage !== null && details.cpu_usage !== undefined) {
204
- items.push(createMetricItem('CPU Usage', 'seeder-icon-CPU', details.cpu_usage, '%'));
205
- }
206
- if (details.cpu_temp !== null && details.cpu_temp !== undefined) {
207
- items.push(createMetricItem('CPU Temperature', 'seeder-icon-CPUwendu', details.cpu_temp, '℃'));
208
- }
209
- if (details.mem_usage !== null && details.mem_usage !== undefined) {
210
- items.push(_objectSpread2$1(_objectSpread2$1({}, createMetricItem('Memory Usage', 'seeder-icon-shiyongshuai', details.mem_usage, '%')), {}, {
211
- memTotal: details.mem_total
212
- }));
213
- }
214
- if (details.mem_temp !== null && details.mem_temp !== undefined) {
215
- items.push(createMetricItem('Memory Temperature', 'seeder-icon-wendu', details.mem_temp, '℃'));
216
- }
217
- if (details.nic_temp !== null && details.nic_temp !== undefined) {
218
- items.push(createMetricItem('NIC Temperature', 'seeder-icon-wuliwangka', details.nic_temp, '℃'));
219
- }
220
- if (details.hd_temp !== null && details.hd_temp !== undefined) {
221
- items.push(createMetricItem('Disk Temperature', 'seeder-icon-yingpan', details.hd_temp, '℃'));
222
- }
223
- if (details.gpu_usage !== null && details.gpu_usage !== undefined) {
224
- items.push(createMetricItem('GPU Usage', 'seeder-icon-gpufuwu', details.gpu_usage, '%'));
225
- }
226
- if (details.gpu_temp !== null && details.gpu_temp !== undefined) {
227
- items.push(createMetricItem('GPU Temperature', 'seeder-icon-CPUwendu', details.gpu_temp, '℃'));
228
- }
229
- return items;
230
- };
231
- const useHardwareUsage = socketUrl => {
232
- const {
233
- ps_status
234
- } = useHardwareWebSocket$1(socketUrl);
235
- return useMemo(() => {
236
- if (!ps_status || typeof ps_status !== 'object') return null;
237
- const statusItems = getItems(getDetail(ps_status));
238
- return /*#__PURE__*/jsx("div", {
239
- className: "usage-container",
240
- children: statusItems.map((item, index) => /*#__PURE__*/jsx("div", {
241
- className: "usage-item-wrapper",
242
- children: /*#__PURE__*/jsx(UsageItem$1, {
243
- title: item.title,
244
- iconClass: item.iconClass,
245
- memTotal: item.memTotal,
246
- children: item.valueString
247
- })
248
- }, item.title))
249
- });
250
- }, [ps_status]);
251
- };
252
- var useHardwareUsage$1 = useHardwareUsage;
253
-
254
- const _excluded$4 = ["width", "okText", "cancelText", "styles"];
255
- const StyledModal$2 = props => {
256
- const {
257
- width = "520px",
258
- okText = "Apply",
259
- cancelText = "Close",
260
- styles: propStyles = {}
261
- } = props,
262
- restProps = _objectWithoutProperties$1(props, _excluded$4);
263
-
264
- // 基础样式配置
265
- const baseStyles = {
266
- content: {
267
- padding: 0
268
- // background: "#282828"
269
- },
270
- header: {
271
- marginBottom: 0,
272
- padding: 0,
273
- paddingBlock: 16,
274
- paddingInlineStart: 24,
275
- background: "#000000"
276
- },
277
- body: {
278
- paddingBlock: 20,
279
- paddingInline: 24
280
- },
281
- footer: {
282
- marginTop: 0,
283
- padding: 0,
284
- paddingBlockEnd: 20,
285
- paddingInline: 24
286
- }
287
- };
288
-
289
- // 合并样式
290
- const styles = _objectSpread2$1(_objectSpread2$1({}, baseStyles), propStyles);
291
- return /*#__PURE__*/jsx(Modal, _objectSpread2$1({
292
- width: width,
293
- okText: okText,
294
- cancelText: cancelText,
295
- styles: styles
296
- }, restProps));
297
- };
298
- var StyledModal$3 = StyledModal$2;
299
-
300
72
  /**
301
73
  * 国际化调试工具
302
74
  * 在浏览器控制台运行 window.debugI18n() 查看当前国际化状态
@@ -400,8 +172,8 @@ const getLocale = () => {
400
172
  return window.__COMPONENT_LOCALE__;
401
173
  }
402
174
  }
403
- // 默认语言
404
- return 'zh-CN';
175
+ // 默认语言:英文(与 Umi 配置一致)
176
+ return 'en-US';
405
177
  };
406
178
 
407
179
  /**
@@ -532,12 +304,7 @@ const initI18n = () => {
532
304
  'button.add': '添加',
533
305
  'button.confirm': '确认',
534
306
  'button.close': '关闭',
535
- 'button.apply': '应用',
536
- 'menu.networkSettings': '网络设置',
537
- 'menu.ptp': 'PTP',
538
- 'menu.nmos': 'NMOS',
539
- 'menu.preset': '预设',
540
- 'menu.license': '许可证'
307
+ 'button.apply': '应用'
541
308
  // ... 其他默认翻译
542
309
  });
543
310
 
@@ -551,16 +318,270 @@ const initI18n = () => {
551
318
  'button.add': 'Add',
552
319
  'button.confirm': 'Confirm',
553
320
  'button.close': 'Close',
554
- 'button.apply': 'Apply',
555
- 'menu.networkSettings': 'Network Settings',
556
- 'menu.ptp': 'PTP',
557
- 'menu.nmos': 'NMOS',
558
- 'menu.preset': 'Preset',
559
- 'menu.license': 'License'
321
+ 'button.apply': 'Apply'
560
322
  // ... 其他默认翻译
561
323
  });
562
324
  };
563
325
 
326
+ const formatBytes = function (bytes) {
327
+ let decimals = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
328
+ if (bytes === 0 || !bytes || bytes < 0) return '0 Bytes';
329
+ const k = 1024;
330
+ const dm = decimals < 0 ? 0 : decimals;
331
+ const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
332
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
333
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
334
+ };
335
+ const UsageItem = /*#__PURE__*/memo(_ref => {
336
+ let {
337
+ title,
338
+ iconClass,
339
+ children,
340
+ memTotal
341
+ } = _ref;
342
+ const intl = useIntl();
343
+ return /*#__PURE__*/jsx(Tooltip, {
344
+ title: /*#__PURE__*/jsxs(Fragment, {
345
+ children: [/*#__PURE__*/jsx("div", {
346
+ children: title
347
+ }), title === intl.formatMessage({
348
+ id: 'usage.memory'
349
+ }) && memTotal !== undefined && /*#__PURE__*/jsxs("div", {
350
+ children: [intl.formatMessage({
351
+ id: 'usage.totalMemory'
352
+ }), ": ", formatBytes(memTotal)]
353
+ })]
354
+ }),
355
+ destroyOnHidden: false,
356
+ children: /*#__PURE__*/jsxs("div", {
357
+ className: "usage-item",
358
+ children: [/*#__PURE__*/jsx("i", {
359
+ className: "seeder-iconfont ".concat(iconClass, " text-xl")
360
+ }), /*#__PURE__*/jsx("span", {
361
+ className: "usage-value",
362
+ children: children
363
+ })]
364
+ })
365
+ });
366
+ });
367
+ var UsageItem$1 = UsageItem;
368
+
369
+ const useHardwareWebSocket = socketUrl => {
370
+ const [systemStatus, setSystemStatus] = useState();
371
+ const handleMessage = useCallback(message => {
372
+ try {
373
+ if (message) {
374
+ setSystemStatus(prev => _objectSpread2$1(_objectSpread2$1({}, prev), message));
375
+ }
376
+ } catch (error) {
377
+ console.error('Message processing error:', error);
378
+ }
379
+ }, []);
380
+
381
+ // ## 获取系统资源使用情况
382
+ useWebSocket(socketUrl, {
383
+ onMessage: event => {
384
+ // 处理实时消息
385
+ try {
386
+ const parsedMessage = JSON.parse(event.data);
387
+ handleMessage(parsedMessage);
388
+ } catch (error) {
389
+ console.error('Message parsing error:', error);
390
+ console.debug('Raw message:', event.data);
391
+ }
392
+ }
393
+ });
394
+
395
+ // // 监听消息 latestMessage 只用于非实时需求
396
+ // useEffect(() => {
397
+ // if (!latestMessage?.data) return;
398
+
399
+ // try {
400
+ // const parsedMessage = JSON.parse(latestMessage.data);
401
+ // handleMessage(parsedMessage);
402
+ // } catch (error) {
403
+ // console.error('Message parsing error:', error);
404
+ // console.debug('Raw message:', latestMessage.data);
405
+ // }
406
+ // }, [latestMessage?.data, handleMessage]);
407
+
408
+ return {
409
+ ps_status: systemStatus
410
+ };
411
+ };
412
+ var useHardwareWebSocket$1 = useHardwareWebSocket;
413
+
414
+ const getMaxNicTemp = function (sensors) {
415
+ let priorityFields = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ["i350bb", "r8169_0_8300:00"];
416
+ const temps = priorityFields.flatMap(field => {
417
+ var _sensors$field;
418
+ return (sensors === null || sensors === void 0 || (_sensors$field = sensors[field]) === null || _sensors$field === void 0 ? void 0 : _sensors$field.map(item => item.current)) || [];
419
+ }).filter(temp => typeof temp === 'number');
420
+ return temps.length ? Math.max(...temps) : null;
421
+ };
422
+
423
+ // 获取数组类型传感器最高温度(如内存、硬盘)
424
+ const getMaxSensorTemp = sensorData => {
425
+ const temps = (sensorData || []).map(item => item.current).filter(temp => typeof temp === 'number');
426
+ return temps.length ? Math.max(...temps) : null;
427
+ };
428
+ const getDetail = function () {
429
+ var _sensors_temperatures, _sensors_temperatures2, _mem$total, _mem$percent, _getMaxNicTemp, _gpu_stats$0$utilizat, _gpu_stats$, _gpu_stats$0$temperat, _gpu_stats$2;
430
+ let status = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
431
+ const {
432
+ cpu_percent,
433
+ mem,
434
+ sensors_temperatures,
435
+ gpu_stats
436
+ } = status;
437
+ return {
438
+ cpu_usage: cpu_percent !== null && cpu_percent !== void 0 ? cpu_percent : null,
439
+ cpu_temp: (_sensors_temperatures = sensors_temperatures === null || sensors_temperatures === void 0 || (_sensors_temperatures2 = sensors_temperatures.coretemp) === null || _sensors_temperatures2 === void 0 || (_sensors_temperatures2 = _sensors_temperatures2[0]) === null || _sensors_temperatures2 === void 0 ? void 0 : _sensors_temperatures2.current) !== null && _sensors_temperatures !== void 0 ? _sensors_temperatures : null,
440
+ mem_total: (_mem$total = mem === null || mem === void 0 ? void 0 : mem.total) !== null && _mem$total !== void 0 ? _mem$total : null,
441
+ mem_usage: (_mem$percent = mem === null || mem === void 0 ? void 0 : mem.percent) !== null && _mem$percent !== void 0 ? _mem$percent : null,
442
+ mem_temp: getMaxSensorTemp(sensors_temperatures === null || sensors_temperatures === void 0 ? void 0 : sensors_temperatures.spd5118),
443
+ nic_temp: (_getMaxNicTemp = getMaxNicTemp(sensors_temperatures)) !== null && _getMaxNicTemp !== void 0 ? _getMaxNicTemp : null,
444
+ hd_temp: getMaxSensorTemp(sensors_temperatures === null || sensors_temperatures === void 0 ? void 0 : sensors_temperatures.nvme),
445
+ gpu_usage: (_gpu_stats$0$utilizat = gpu_stats === null || gpu_stats === void 0 || (_gpu_stats$ = gpu_stats[0]) === null || _gpu_stats$ === void 0 ? void 0 : _gpu_stats$["utilization.gpu"]) !== null && _gpu_stats$0$utilizat !== void 0 ? _gpu_stats$0$utilizat : null,
446
+ gpu_temp: (_gpu_stats$0$temperat = gpu_stats === null || gpu_stats === void 0 || (_gpu_stats$2 = gpu_stats[0]) === null || _gpu_stats$2 === void 0 ? void 0 : _gpu_stats$2["temperature.gpu"]) !== null && _gpu_stats$0$temperat !== void 0 ? _gpu_stats$0$temperat : null
447
+ };
448
+ };
449
+
450
+ // 提取公共逻辑
451
+ const createMetricItem = (title, iconClass, value, unit) => {
452
+ const numValue = typeof value === 'string' ? parseFloat(value) : value;
453
+ return {
454
+ title,
455
+ iconClass,
456
+ valueString: "".concat(numValue).concat(unit),
457
+ value: numValue
458
+ };
459
+ };
460
+ const getItems = (details, intl) => {
461
+ const items = [];
462
+ if (details.cpu_usage !== null && details.cpu_usage !== undefined) {
463
+ items.push(createMetricItem(intl.formatMessage({
464
+ id: 'usage.cpu'
465
+ }), 'seeder-icon-CPU', details.cpu_usage, '%'));
466
+ }
467
+ if (details.cpu_temp !== null && details.cpu_temp !== undefined) {
468
+ items.push(createMetricItem(intl.formatMessage({
469
+ id: 'usage.cpuTemp'
470
+ }), 'seeder-icon-CPUwendu', details.cpu_temp, '℃'));
471
+ }
472
+ if (details.mem_usage !== null && details.mem_usage !== undefined) {
473
+ items.push(_objectSpread2$1(_objectSpread2$1({}, createMetricItem(intl.formatMessage({
474
+ id: 'usage.memory'
475
+ }), 'seeder-icon-shiyongshuai', details.mem_usage, '%')), {}, {
476
+ memTotal: details.mem_total
477
+ }));
478
+ }
479
+ if (details.mem_temp !== null && details.mem_temp !== undefined) {
480
+ items.push(createMetricItem(intl.formatMessage({
481
+ id: 'usage.memTemp'
482
+ }), 'seeder-icon-wendu', details.mem_temp, '℃'));
483
+ }
484
+ if (details.nic_temp !== null && details.nic_temp !== undefined) {
485
+ items.push(createMetricItem(intl.formatMessage({
486
+ id: 'usage.nicTemp'
487
+ }), 'seeder-icon-wuliwangka', details.nic_temp, '℃'));
488
+ }
489
+ if (details.hd_temp !== null && details.hd_temp !== undefined) {
490
+ items.push(createMetricItem(intl.formatMessage({
491
+ id: 'usage.diskTemp'
492
+ }), 'seeder-icon-yingpan', details.hd_temp, '℃'));
493
+ }
494
+ if (details.gpu_usage !== null && details.gpu_usage !== undefined) {
495
+ items.push(createMetricItem(intl.formatMessage({
496
+ id: 'usage.gpu'
497
+ }), 'seeder-icon-gpufuwu', details.gpu_usage, '%'));
498
+ }
499
+ if (details.gpu_temp !== null && details.gpu_temp !== undefined) {
500
+ items.push(createMetricItem(intl.formatMessage({
501
+ id: 'usage.gpuTemp'
502
+ }), 'seeder-icon-CPUwendu', details.gpu_temp, '℃'));
503
+ }
504
+ return items;
505
+ };
506
+ const useHardwareUsage = socketUrl => {
507
+ const intl = useIntl();
508
+ const {
509
+ ps_status
510
+ } = useHardwareWebSocket$1(socketUrl);
511
+ return useMemo(() => {
512
+ if (!ps_status || typeof ps_status !== 'object') return null;
513
+ const statusItems = getItems(getDetail(ps_status), intl);
514
+ return /*#__PURE__*/jsx("div", {
515
+ className: "usage-container",
516
+ children: statusItems.map((item, index) => /*#__PURE__*/jsx("div", {
517
+ className: "usage-item-wrapper",
518
+ children: /*#__PURE__*/jsx(UsageItem$1, {
519
+ title: item.title,
520
+ iconClass: item.iconClass,
521
+ memTotal: item.memTotal,
522
+ children: item.valueString
523
+ })
524
+ }, item.title))
525
+ });
526
+ }, [ps_status]);
527
+ };
528
+ var useHardwareUsage$1 = useHardwareUsage;
529
+
530
+ const _excluded$4 = ["width", "okText", "cancelText", "styles"];
531
+ const StyledModal$2 = props => {
532
+ const intl = useIntl();
533
+ const {
534
+ width = "520px",
535
+ okText = "button.apply",
536
+ cancelText = "button.close",
537
+ styles: propStyles = {}
538
+ } = props,
539
+ restProps = _objectWithoutProperties$1(props, _excluded$4);
540
+
541
+ // 处理国际化文本
542
+ const okButtonText = typeof okText === 'string' && okText.includes('.') ? intl.formatMessage({
543
+ id: okText
544
+ }) : okText;
545
+ const cancelButtonText = typeof cancelText === 'string' && cancelText.includes('.') ? intl.formatMessage({
546
+ id: cancelText
547
+ }) : cancelText;
548
+
549
+ // 基础样式配置
550
+ const baseStyles = {
551
+ content: {
552
+ padding: 0
553
+ // background: "#282828"
554
+ },
555
+ header: {
556
+ marginBottom: 0,
557
+ padding: 0,
558
+ paddingBlock: 16,
559
+ paddingInlineStart: 24,
560
+ background: "#000000"
561
+ },
562
+ body: {
563
+ paddingBlock: 20,
564
+ paddingInline: 24
565
+ },
566
+ footer: {
567
+ marginTop: 0,
568
+ padding: 0,
569
+ paddingBlockEnd: 20,
570
+ paddingInline: 24
571
+ }
572
+ };
573
+
574
+ // 合并样式
575
+ const styles = _objectSpread2$1(_objectSpread2$1({}, baseStyles), propStyles);
576
+ return /*#__PURE__*/jsx(Modal, _objectSpread2$1({
577
+ width: width,
578
+ okText: okButtonText,
579
+ cancelText: cancelButtonText,
580
+ styles: styles
581
+ }, restProps));
582
+ };
583
+ var StyledModal$3 = StyledModal$2;
584
+
564
585
  const AuthorizationModal = _ref => {
565
586
  let {
566
587
  onCancel,
@@ -693,12 +714,13 @@ const DEFAULT_AUTH = {
693
714
  accredit_status: false,
694
715
  // 授权状态
695
716
  bios_id: '',
696
- // 主机id
697
- message: 'Unactivated',
717
+ // 主机 id
718
+ message: 'license.status.unactivated',
698
719
  // 激活信息
699
720
  expires_time: '' // 授权到期时间
700
721
  };
701
722
  const useAuth = options => {
723
+ const intl = useIntl();
702
724
  const {
703
725
  fetchAuthInfo,
704
726
  authorize,
@@ -751,7 +773,12 @@ const useAuth = options => {
751
773
  setAuthData(commands);
752
774
  closeModal();
753
775
  } else {
754
- messageApi.error(commands.ciphertext_status || 'Authorization failed');
776
+ // 处理错误消息的国际化
777
+ const errorMsg = commands.ciphertext_status || 'license.error.authorizationFailed';
778
+ const errorMessage = typeof errorMsg === 'string' && errorMsg.includes('.') ? intl.formatMessage({
779
+ id: errorMsg
780
+ }) : errorMsg;
781
+ messageApi.error(errorMessage);
755
782
  }
756
783
  }
757
784
  } catch (error) {
@@ -1139,21 +1166,37 @@ const useSystemOperations = function () {
1139
1166
  let {
1140
1167
  onPowerOff,
1141
1168
  onRestart,
1142
- confirmTitle = "Confirm",
1143
- cancelText = "No",
1144
- okText = "Yes",
1169
+ confirmTitle = "system.confirm.title",
1170
+ cancelText = "system.button.cancel",
1171
+ okText = "system.button.confirm",
1145
1172
  run
1146
1173
  } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1174
+ const intl = useIntl();
1147
1175
  const {
1148
1176
  modal: AntdModal
1149
1177
  } = App.useApp();
1178
+
1179
+ // 处理国际化文本
1180
+ const confirmTitleText = typeof confirmTitle === 'string' && confirmTitle.includes('.') ? intl.formatMessage({
1181
+ id: confirmTitle
1182
+ }) : confirmTitle;
1183
+ const cancelTextValue = typeof cancelText === 'string' && cancelText.includes('.') ? intl.formatMessage({
1184
+ id: cancelText
1185
+ }) : cancelText;
1186
+ const okTextValue = typeof okText === 'string' && okText.includes('.') ? intl.formatMessage({
1187
+ id: okText
1188
+ }) : okText;
1150
1189
  const doAction = useCallback(action => {
1151
1190
  try {
1152
1191
  AntdModal.confirm({
1153
1192
  icon: /*#__PURE__*/jsx(ExclamationCircleFilled, {}),
1154
- title: "".concat(confirmTitle, " ").concat(action, "?"),
1155
- cancelText,
1156
- okText,
1193
+ title: "".concat(confirmTitleText, " ").concat(action === 'poweroff' ? intl.formatMessage({
1194
+ id: 'system.action.powerOff'
1195
+ }) : intl.formatMessage({
1196
+ id: 'system.action.restart'
1197
+ }), "?"),
1198
+ cancelText: cancelTextValue,
1199
+ okText: okTextValue,
1157
1200
  onOk: () => {
1158
1201
  if (action === 'poweroff' && onPowerOff) {
1159
1202
  onPowerOff();
@@ -1170,14 +1213,18 @@ const useSystemOperations = function () {
1170
1213
  } catch (error) {
1171
1214
  console.error("".concat(action.toUpperCase(), " ERROR: "), error);
1172
1215
  }
1173
- }, [AntdModal, confirmTitle, cancelText, okText, onPowerOff, onRestart]);
1216
+ }, [AntdModal, confirmTitleText, cancelTextValue, okTextValue, onPowerOff, onRestart, intl]);
1174
1217
  const getMenuItems = useCallback(() => [{
1175
1218
  key: "poweroff",
1176
- label: "Power Off"
1219
+ label: intl.formatMessage({
1220
+ id: 'system.poweroff'
1221
+ })
1177
1222
  }, {
1178
1223
  key: "restart",
1179
- label: "Restart"
1180
- }], []);
1224
+ label: intl.formatMessage({
1225
+ id: 'system.restart'
1226
+ })
1227
+ }], [intl]);
1181
1228
  const handleMenuClick = useCallback(_ref => {
1182
1229
  let {
1183
1230
  key
@@ -1638,20 +1685,25 @@ var useWebSocketWithFeatures$1 = useWebSocketWithFeatures;
1638
1685
  // seeder-st2110-components 组件库中文语言包
1639
1686
  var zhCN = {
1640
1687
  // 通用按钮
1641
- 'button.ok': '确定',
1642
- 'button.cancel': '取消',
1643
- 'button.save': '保存',
1644
- 'button.delete': '删除',
1645
- 'button.edit': '编辑',
1646
- 'button.add': '添加',
1647
- 'button.confirm': '确认',
1648
1688
  'button.close': '关闭',
1649
1689
  'button.apply': '应用',
1650
- 'button.submit': '提交',
1651
- 'button.next': '下一步',
1652
- 'button.previous': '上一步',
1653
- 'button.refresh': '刷新',
1654
- 'button.retry': '重试',
1690
+ 'button.cancel': '取消',
1691
+ 'button.delete': '删除',
1692
+ // 输入框占位符
1693
+ 'input.placeholder.enterInteger': '请输入整数',
1694
+ 'input.placeholder.enterPort': '请输入端口 (0-65535)',
1695
+ 'input.placeholder.enterPayload': '请输入 Payload (96-127)',
1696
+ // 使用率显示
1697
+ 'usage.memory': '内存使用率',
1698
+ 'usage.totalMemory': '内存总量',
1699
+ 'usage.cpu': 'CPU 使用率',
1700
+ 'usage.disk': '磁盘使用率',
1701
+ 'usage.cpuTemp': 'CPU 温度',
1702
+ 'usage.memTemp': '内存温度',
1703
+ 'usage.nicTemp': '网卡温度',
1704
+ 'usage.diskTemp': '硬盘温度',
1705
+ 'usage.gpu': 'GPU 使用率',
1706
+ 'usage.gpuTemp': 'GPU 温度',
1655
1707
  // 菜单
1656
1708
  'menu.networkSettings': '网络设置',
1657
1709
  'menu.ptp': 'PTP',
@@ -1662,6 +1714,7 @@ var zhCN = {
1662
1714
  'menu.system': '系统',
1663
1715
  // Network Settings Modal
1664
1716
  'networkSettings.title': '网络设置',
1717
+ 'networkSettings.name': '名称',
1665
1718
  'networkSettings.ipAddress': 'IP 地址',
1666
1719
  'networkSettings.subnetMask': '子网掩码',
1667
1720
  'networkSettings.restartRequired': '配置已修改。是否重启以应用更改?',
@@ -1678,10 +1731,10 @@ var zhCN = {
1678
1731
  'ptp.clockClass.gps': 'GPS ({value})',
1679
1732
  'ptp.clockClass.slaveOnly': '仅从时钟 ({value})',
1680
1733
  'ptp.clockAccuracy': '时钟精度',
1681
- 'ptp.offsetScaledLogVariance': '时钟稳定性',
1734
+ 'ptp.offsetScaledLogVariance': '时钟偏移方差',
1682
1735
  'ptp.portIdentity': '端口标识',
1683
- 'ptp.grandmasterIdentity': '主时钟标识',
1684
- 'ptp.utcOffset': 'UTC 偏移量',
1736
+ 'ptp.grandmasterIdentity': '主时钟 ID',
1737
+ 'ptp.utcOffset': 'UTC 偏移',
1685
1738
  'ptp.connected': '已连接',
1686
1739
  'ptp.disconnected': '未连接',
1687
1740
  'ptp.locked': '已锁定',
@@ -1690,9 +1743,9 @@ var zhCN = {
1690
1743
  // NMOS Modal
1691
1744
  'nmos.title': 'NMOS 设置',
1692
1745
  'nmos.hostAddress': '主机地址',
1693
- 'nmos.domain': '',
1746
+ 'nmos.domain': '域名',
1694
1747
  'nmos.registrationPort': '注册端口',
1695
- 'nmos.registryAddress': '注册地址',
1748
+ 'nmos.registryAddress': '注册服务器地址',
1696
1749
  'nmos.registryVersion': '注册版本',
1697
1750
  'nmos.loggingLevel': '日志级别',
1698
1751
  'nmos.placeholder.selectHostAddress': '选择主机地址',
@@ -1704,6 +1757,10 @@ var zhCN = {
1704
1757
  'preset.categories': '分类',
1705
1758
  'preset.description': '描述',
1706
1759
  'preset.placeholder.enterName': '请输入名称',
1760
+ 'preset.placeholder.enterDescription': '请输入描述',
1761
+ 'preset.header.name': '名称',
1762
+ 'preset.header.createTime': '创建时间',
1763
+ 'preset.header.description': '描述',
1707
1764
  'preset.button.new': '新建预设',
1708
1765
  'preset.button.delete': '删除',
1709
1766
  'preset.button.load': '加载',
@@ -1711,7 +1768,8 @@ var zhCN = {
1711
1768
  'preset.button.edit': '编辑',
1712
1769
  'preset.button.cancel': '取消',
1713
1770
  'preset.empty.noData': '从列表中选择一个预设查看详情',
1714
- 'preset.untitled': '未命名预设',
1771
+ 'preset.empty.create': '创建新预设',
1772
+ 'preset.untitled': '未命名',
1715
1773
  'preset.delete.title': '删除预设',
1716
1774
  'preset.delete.confirmMessage': '确定要删除预设',
1717
1775
  'preset.load.title': '加载预设',
@@ -1735,8 +1793,9 @@ var zhCN = {
1735
1793
  'license.status.invalid': '无效',
1736
1794
  'license.status.expiresOn': '到期时间',
1737
1795
  'license.validation.keyRequired': '许可证密钥不能为空',
1796
+ 'license.error.authorizationFailed': '授权失败',
1738
1797
  // 升级相关
1739
- 'upgrade.menu.download': '下载配置文件',
1798
+ 'upgrade.menu.download': '导出配置',
1740
1799
  'upgrade.menu.softwareUpdate': '软件升级',
1741
1800
  'upgrade.status.idle': '空闲',
1742
1801
  'upgrade.status.uploading': '上传中',
@@ -1756,85 +1815,41 @@ var zhCN = {
1756
1815
  'system.confirm.message': '确定要{action}系统吗?此操作无法撤销。',
1757
1816
  'system.button.cancel': '取消',
1758
1817
  'system.button.confirm': '确认',
1759
- // 维护页面
1760
- 'maintenance.title': '系统维护',
1761
- 'maintenance.description': '设备正在维护中,请稍候...',
1762
- 'maintenance.restart': '设备正在重启',
1763
- 'maintenance.poweroff': '设备已关闭',
1764
- 'maintenance.redirecting': '页面跳转中...',
1765
- 'maintenance.backToHome': '返回首页',
1766
- // 表单验证
1767
- 'validation.required': '此项为必填项',
1768
- 'validation.invalidIP': 'IP 地址格式不正确',
1769
- 'validation.invalidPort': '端口号范围应为 1-65535',
1770
- 'validation.invalidEmail': '邮箱格式不正确',
1771
- 'validation.minLength': '最少需要 {min} 个字符',
1772
- 'validation.maxLength': '最多只能有 {max} 个字符',
1773
- 'validation.min': '最小值为 {min}',
1774
- 'validation.max': '最大值为 {max}',
1775
- 'validation.pattern': '格式不正确',
1776
- 'validation.unique': '该值已存在',
1777
- // 状态消息
1778
- 'status.loading': '加载中...',
1779
- 'status.saving': '保存中...',
1780
- 'status.deleting': '删除中...',
1781
- 'status.updating': '更新中...',
1782
- 'status.submitting': '提交中...',
1783
- 'status.success': '成功',
1784
- 'status.failed': '失败',
1785
- 'status.error': '错误',
1786
- 'status.pending': '等待中',
1787
- 'status.processing': '处理中',
1788
- 'status.completed': '已完成',
1789
- 'status.cancelled': '已取消',
1790
- // 确认对话框
1791
- 'confirm.title': '确认操作',
1792
- 'confirm.message': '确定要执行此操作吗?',
1793
- 'confirm.cancel': '取消',
1794
- 'confirm.ok': '确定',
1795
- // 空状态
1796
- 'empty.noData': '暂无数据',
1797
- 'empty.noResults': '暂无结果',
1798
- 'empty.noItems': '暂无项目',
1799
- // 通用标签
1800
- 'label.name': '名称',
1801
- 'label.description': '描述',
1802
- 'label.status': '状态',
1803
- 'label.type': '类型',
1804
- 'label.action': '操作',
1805
- 'label.actions': '操作',
1806
- 'label.settings': '设置',
1807
- 'label.configuration': '配置',
1808
- 'label.information': '信息',
1809
- 'label.version': '版本',
1810
- 'label.time': '时间',
1811
- 'label.date': '日期',
1812
- 'label.enable': '启用',
1813
- 'label.disable': '禁用',
1814
- // 占位符
1815
- 'placeholder.select': '请选择',
1816
- 'placeholder.enter': '请输入',
1817
- 'placeholder.search': '搜索',
1818
- 'placeholder.filter': '筛选'
1818
+ // Maintenance page
1819
+ 'maintenance.restarting': '系统正在重启...',
1820
+ 'maintenance.poweredOff': '系统已关闭',
1821
+ 'maintenance.waiting': '请等待系统启动...',
1822
+ 'maintenance.redirecting.countdown': '将在 {countdown} 秒后自动跳转',
1823
+ 'maintenance.waiting.long': '系统仍在启动中,这可能需要一些时间...',
1824
+ 'maintenance.retry': '重试连接',
1825
+ 'maintenance.offline.description': '系统当前处于离线状态,请联系管理员开启设备。',
1826
+ // LSM Label
1827
+ 'lsm.label': '标签',
1828
+ 'lsm.placeholder.select': '请选择标签'
1819
1829
  };
1820
1830
 
1821
1831
  // seeder-st2110-components component library English language pack
1822
1832
  var enUS = {
1823
1833
  // General buttons
1824
- 'button.ok': 'OK',
1825
- 'button.cancel': 'Cancel',
1826
- 'button.save': 'Save',
1827
- 'button.delete': 'Delete',
1828
- 'button.edit': 'Edit',
1829
- 'button.add': 'Add',
1830
- 'button.confirm': 'Confirm',
1831
1834
  'button.close': 'Close',
1832
1835
  'button.apply': 'Apply',
1833
- 'button.submit': 'Submit',
1834
- 'button.next': 'Next',
1835
- 'button.previous': 'Previous',
1836
- 'button.refresh': 'Refresh',
1837
- 'button.retry': 'Retry',
1836
+ 'button.cancel': 'Cancel',
1837
+ 'button.delete': 'Delete',
1838
+ // Input placeholders
1839
+ 'input.placeholder.enterInteger': 'Enter an integer',
1840
+ 'input.placeholder.enterPort': ' Enter port (0-65535)',
1841
+ 'input.placeholder.enterPayload': 'Enter payload (96-127)',
1842
+ // Usage display
1843
+ 'usage.memory': 'Memory Usage',
1844
+ 'usage.totalMemory': 'Total Memory',
1845
+ 'usage.cpu': 'CPU Usage',
1846
+ 'usage.disk': 'Disk Usage',
1847
+ 'usage.cpuTemp': 'CPU Temperature',
1848
+ 'usage.memTemp': 'Memory Temperature',
1849
+ 'usage.nicTemp': 'NIC Temperature',
1850
+ 'usage.diskTemp': 'Disk Temperature',
1851
+ 'usage.gpu': 'GPU Usage',
1852
+ 'usage.gpuTemp': 'GPU Temperature',
1838
1853
  // Menu
1839
1854
  'menu.networkSettings': 'Network Settings',
1840
1855
  'menu.ptp': 'PTP',
@@ -1845,6 +1860,7 @@ var enUS = {
1845
1860
  'menu.system': 'System',
1846
1861
  // Network Settings Modal
1847
1862
  'networkSettings.title': 'Network Settings',
1863
+ 'networkSettings.name': 'Name',
1848
1864
  'networkSettings.ipAddress': 'IP Address',
1849
1865
  'networkSettings.subnetMask': 'Netmask',
1850
1866
  'networkSettings.restartRequired': 'Configuration modified. Restart to apply changes?',
@@ -1878,7 +1894,7 @@ var enUS = {
1878
1894
  'nmos.registrationPort': 'Registry Port',
1879
1895
  'nmos.registryVersion': 'Registry Version',
1880
1896
  'nmos.loggingLevel': 'Logging Level',
1881
- 'nmos.placeholder.selectHostAddress': 'Select host address',
1897
+ 'nmos.placeholder.selectHostAddress': 'Select IP address',
1882
1898
  'nmos.placeholder.selectVersion': 'Select version',
1883
1899
  'nmos.saveSuccess': 'Success',
1884
1900
  // Preset Modal
@@ -1887,6 +1903,10 @@ var enUS = {
1887
1903
  'preset.categories': 'Categories',
1888
1904
  'preset.description': 'Description',
1889
1905
  'preset.placeholder.enterName': 'Enter name',
1906
+ 'preset.placeholder.enterDescription': 'Enter description',
1907
+ 'preset.header.name': 'Name',
1908
+ 'preset.header.createTime': 'Create Time',
1909
+ 'preset.header.description': 'Description',
1890
1910
  'preset.button.new': 'New Preset',
1891
1911
  'preset.button.delete': 'Delete',
1892
1912
  'preset.button.load': 'Load',
@@ -1894,7 +1914,8 @@ var enUS = {
1894
1914
  'preset.button.edit': 'Edit',
1895
1915
  'preset.button.cancel': 'Cancel',
1896
1916
  'preset.empty.noData': 'Select a preset from the list to view details',
1897
- 'preset.untitled': 'Untitled Preset',
1917
+ 'preset.empty.create': 'Create New Preset',
1918
+ 'preset.untitled': 'Untitled',
1898
1919
  'preset.delete.title': 'Delete Preset',
1899
1920
  'preset.delete.confirmMessage': 'Are you sure you want to delete preset',
1900
1921
  'preset.load.title': 'Load Preset',
@@ -1918,6 +1939,7 @@ var enUS = {
1918
1939
  'license.status.invalid': 'Invalid',
1919
1940
  'license.status.expiresOn': 'Expires on',
1920
1941
  'license.validation.keyRequired': 'License key cannot be empty',
1942
+ 'license.error.authorizationFailed': 'Authorization failed',
1921
1943
  // Upgrade related
1922
1944
  'upgrade.menu.download': 'Download Config File',
1923
1945
  'upgrade.menu.softwareUpdate': 'Software Update',
@@ -1940,65 +1962,16 @@ var enUS = {
1940
1962
  'system.button.cancel': 'Cancel',
1941
1963
  'system.button.confirm': 'Confirm',
1942
1964
  // Maintenance page
1943
- 'maintenance.title': 'System Maintenance',
1944
- 'maintenance.description': 'Device is under maintenance, please wait...',
1945
- 'maintenance.restart': 'Device is restarting',
1946
- 'maintenance.poweroff': 'Device is powered off',
1947
- 'maintenance.redirecting': 'Redirecting...',
1948
- 'maintenance.backToHome': 'Back to Home',
1949
- // Form validation
1950
- 'validation.required': 'This field is required',
1951
- 'validation.invalidIP': 'Invalid IP address format',
1952
- 'validation.invalidPort': 'Port number should be 1-65535',
1953
- 'validation.invalidEmail': 'Invalid email format',
1954
- 'validation.minLength': 'Minimum {min} characters required',
1955
- 'validation.maxLength': 'Maximum {max} characters allowed',
1956
- 'validation.min': 'Minimum value is {min}',
1957
- 'validation.max': 'Maximum value is {max}',
1958
- 'validation.pattern': 'Invalid format',
1959
- 'validation.unique': 'This value already exists',
1960
- // Status messages
1961
- 'status.loading': 'Loading...',
1962
- 'status.saving': 'Saving...',
1963
- 'status.deleting': 'Deleting...',
1964
- 'status.updating': 'Updating...',
1965
- 'status.submitting': 'Submitting...',
1966
- 'status.success': 'Success',
1967
- 'status.failed': 'Failed',
1968
- 'status.error': 'Error',
1969
- 'status.pending': 'Pending',
1970
- 'status.processing': 'Processing',
1971
- 'status.completed': 'Completed',
1972
- 'status.cancelled': 'Cancelled',
1973
- // Confirmation dialogs
1974
- 'confirm.title': 'Confirm Action',
1975
- 'confirm.message': 'Are you sure you want to proceed?',
1976
- 'confirm.cancel': 'Cancel',
1977
- 'confirm.ok': 'OK',
1978
- // Empty states
1979
- 'empty.noData': 'No Data',
1980
- 'empty.noResults': 'No Results',
1981
- 'empty.noItems': 'No Items',
1982
- // General labels
1983
- 'label.name': 'Name',
1984
- 'label.description': 'Description',
1985
- 'label.status': 'Status',
1986
- 'label.type': 'Type',
1987
- 'label.action': 'Action',
1988
- 'label.actions': 'Actions',
1989
- 'label.settings': 'Settings',
1990
- 'label.configuration': 'Configuration',
1991
- 'label.information': 'Information',
1992
- 'label.version': 'Version',
1993
- 'label.time': 'Time',
1994
- 'label.date': 'Date',
1995
- 'label.enable': 'Enable',
1996
- 'label.disable': 'Disable',
1997
- // Placeholders
1998
- 'placeholder.select': 'Please select',
1999
- 'placeholder.enter': 'Please enter',
2000
- 'placeholder.search': 'Search',
2001
- 'placeholder.filter': 'Filter'
1965
+ 'maintenance.restarting': 'System is restarting...',
1966
+ 'maintenance.poweredOff': 'System is powered off',
1967
+ 'maintenance.waiting': 'Please wait while the system is starting up...',
1968
+ 'maintenance.redirecting.countdown': 'Redirecting automatically in {countdown} second{countdown, plural, one {} other {s}}',
1969
+ 'maintenance.waiting.long': 'Still starting up... This may take a moment.',
1970
+ 'maintenance.retry': 'Retry connection',
1971
+ 'maintenance.offline.description': 'The system is currently offline. Please contact your administrator to power it on.',
1972
+ // LSM Label
1973
+ 'lsm.label': 'Label',
1974
+ 'lsm.placeholder.select': 'Select label'
2002
1975
  };
2003
1976
 
2004
1977
  const NetworkFieldGroup = _ref => {
@@ -2014,7 +1987,7 @@ const NetworkFieldGroup = _ref => {
2014
1987
  const defaultFieldConfig = {
2015
1988
  name: {
2016
1989
  label: intl.formatMessage({
2017
- id: 'label.name'
1990
+ id: 'networkSettings.name'
2018
1991
  }),
2019
1992
  enabled: true
2020
1993
  },
@@ -2725,10 +2698,21 @@ const LeftList = /*#__PURE__*/memo(_ref => {
2725
2698
  onRemove,
2726
2699
  hasPresets = dataSource.length > 0,
2727
2700
  texts = {
2728
- newButton: "New Preset",
2729
- removeButton: "Delete"
2701
+ newButton: "preset.button.new",
2702
+ removeButton: "preset.button.delete"
2730
2703
  }
2731
2704
  } = _ref;
2705
+ const intl = useIntl();
2706
+
2707
+ // 格式化文本的辅助函数
2708
+ const fmt = key => {
2709
+ if (typeof key === 'string' && key.includes('.')) {
2710
+ return intl.formatMessage({
2711
+ id: key
2712
+ });
2713
+ }
2714
+ return key;
2715
+ };
2732
2716
  return /*#__PURE__*/jsxs("div", {
2733
2717
  className: "h-full left-list-wrapper",
2734
2718
  children: [/*#__PURE__*/jsx("div", {
@@ -2738,13 +2722,13 @@ const LeftList = /*#__PURE__*/memo(_ref => {
2738
2722
  className: "grid grid-cols-3 gap-2 w-full list-header",
2739
2723
  children: [/*#__PURE__*/jsx("div", {
2740
2724
  className: "min-w-0",
2741
- children: "Name"
2725
+ children: fmt('preset.header.name')
2742
2726
  }), /*#__PURE__*/jsx("div", {
2743
2727
  className: "min-w-0",
2744
- children: "Create Time"
2728
+ children: fmt('preset.header.createTime')
2745
2729
  }), /*#__PURE__*/jsx("div", {
2746
2730
  className: "min-w-0",
2747
- children: "Description"
2731
+ children: fmt('preset.header.description')
2748
2732
  })]
2749
2733
  }),
2750
2734
  dataSource: dataSource,
@@ -2762,7 +2746,7 @@ const LeftList = /*#__PURE__*/memo(_ref => {
2762
2746
  children: /*#__PURE__*/jsx(Typography.Text, {
2763
2747
  ellipsis: true,
2764
2748
  title: item.name,
2765
- children: item.name || "Untitled Preset"
2749
+ children: item.name || fmt('preset.untitled')
2766
2750
  })
2767
2751
  }), /*#__PURE__*/jsx("div", {
2768
2752
  className: "min-w-0",
@@ -2792,7 +2776,7 @@ const LeftList = /*#__PURE__*/memo(_ref => {
2792
2776
  onClick: onAddNew,
2793
2777
  className: "p-0 h-auto",
2794
2778
  icon: /*#__PURE__*/jsx(PlusOutlined, {}),
2795
- children: "Create New Preset"
2779
+ children: fmt('preset.empty.create')
2796
2780
  })
2797
2781
  })
2798
2782
  })
@@ -2858,26 +2842,44 @@ const RightDetailForm = /*#__PURE__*/memo(_ref3 => {
2858
2842
  originalPresetData,
2859
2843
  fields = {
2860
2844
  name: {
2861
- label: "Name",
2862
- placeholder: "Enter name",
2845
+ label: "preset.name",
2846
+ placeholder: "preset.placeholder.enterName",
2863
2847
  required: true
2848
+ },
2849
+ category_list: {
2850
+ label: "preset.categories"
2851
+ },
2852
+ description: {
2853
+ label: "preset.description",
2854
+ placeholder: "preset.placeholder.enterDescription"
2864
2855
  }
2865
2856
  },
2866
2857
  texts = {
2867
- loadButton: "Load",
2868
- saveButton: "Save",
2869
- editButton: "Edit",
2870
- cancelButton: "Cancel"
2858
+ loadButton: "preset.button.load",
2859
+ saveButton: "preset.button.save",
2860
+ editButton: "preset.button.edit",
2861
+ cancelButton: "preset.button.cancel"
2871
2862
  },
2872
2863
  presetChanged,
2873
2864
  // 作用:在切换选中预设时强制触发 Checkbox 的重新初始化
2874
2865
  enableEdit = true
2875
2866
  } = _ref3;
2867
+ const intl = useIntl();
2876
2868
  const [initialSelected, setInitialSelected] = useState([]);
2877
2869
  const [isEditMode, setIsEditMode] = useState(false); // 是否进入编辑模式
2878
2870
  const currentSelected = Form.useWatch('category_list', form) || [];
2879
2871
 
2880
- // 检查是否包含category_list字段
2872
+ // 格式化文本的辅助函数
2873
+ const fmt = key => {
2874
+ if (typeof key === 'string' && key.includes('.')) {
2875
+ return intl.formatMessage({
2876
+ id: key
2877
+ });
2878
+ }
2879
+ return key;
2880
+ };
2881
+
2882
+ // 检查是否包含 category_list 字段
2881
2883
  const hasCategoryList = fields.category_list !== null && fields.category_list !== undefined;
2882
2884
 
2883
2885
  // 初始化 category_list 的选择状态
@@ -2970,39 +2972,15 @@ const RightDetailForm = /*#__PURE__*/memo(_ref3 => {
2970
2972
  },
2971
2973
  children: [/*#__PURE__*/jsx(Form.Item, {
2972
2974
  name: "name",
2973
- label: fields.name.label
2974
- // rules={[
2975
- // {
2976
- // required: fields.name.required,
2977
- // validator: async (_, value) => {
2978
- // if (!value || value.trim() === '') {
2979
- // return Promise.reject(new Error('Preset name cannot be empty or spaces only'));
2980
- // }
2981
- // }
2982
- // }
2983
- // ]}
2984
- ,
2975
+ label: fmt(fields.name.label),
2985
2976
  required: true,
2986
2977
  children: /*#__PURE__*/jsx(Input, {
2987
- placeholder: fields.name.placeholder,
2978
+ placeholder: fmt(fields.name.placeholder),
2988
2979
  disabled: shouldDisableNameAndDesc
2989
2980
  })
2990
2981
  }), hasCategoryList && /*#__PURE__*/jsx(Form.Item, {
2991
2982
  name: "category_list",
2992
- label: fields.category_list.label
2993
- // rules={[
2994
- // {
2995
- // required: fields.category_list.required,
2996
- // message: 'Please select at least one category',
2997
- // validator: (_, value) => {
2998
- // if (value && value.length > 0) {
2999
- // return Promise.resolve();
3000
- // }
3001
- // return Promise.reject(new Error('Please select at least one category'));
3002
- // }
3003
- // }
3004
- // ]}
3005
- ,
2983
+ label: fmt(fields.category_list.label),
3006
2984
  required: true,
3007
2985
  children: /*#__PURE__*/jsx(Checkbox.Group, {
3008
2986
  className: "grid grid-cols-2 gap-2",
@@ -3016,10 +2994,10 @@ const RightDetailForm = /*#__PURE__*/memo(_ref3 => {
3016
2994
  })
3017
2995
  }), fields.description && /*#__PURE__*/jsx(Form.Item, {
3018
2996
  name: "description",
3019
- label: fields.description.label,
2997
+ label: fmt(fields.description.label),
3020
2998
  children: /*#__PURE__*/jsx(Input.TextArea, {
3021
2999
  rows: 4,
3022
- placeholder: fields.description.placeholder,
3000
+ placeholder: fmt(fields.description.placeholder),
3023
3001
  disabled: shouldDisableNameAndDesc,
3024
3002
  style: {
3025
3003
  resize: 'none'
@@ -4712,7 +4690,7 @@ const SystemOperations = _ref => {
4712
4690
  onRestartSuccess,
4713
4691
  beforeAction,
4714
4692
  // 在执行关机/重启前调用
4715
- powerOffLabel = "system.powerOff",
4693
+ powerOffLabel = "system.poweroff",
4716
4694
  restartLabel = "system.restart",
4717
4695
  iconClassName = "seeder-iconfont seeder-icon-guanji1 text-xl text-neutral-400",
4718
4696
  confirmMessage = "system.confirm.message",
@@ -4729,12 +4707,7 @@ const SystemOperations = _ref => {
4729
4707
  label: typeof powerOffLabel === 'string' && powerOffLabel.includes('.') ? intl.formatMessage({
4730
4708
  id: powerOffLabel
4731
4709
  }) : powerOffLabel
4732
- },
4733
- // {
4734
- // key: "reboot",
4735
- // label: rebootLabel, // 硬重启 物理重启
4736
- // },
4737
- {
4710
+ }, {
4738
4711
  key: "restart",
4739
4712
  label: typeof restartLabel === 'string' && restartLabel.includes('.') ? intl.formatMessage({
4740
4713
  id: restartLabel
@@ -4960,9 +4933,10 @@ const CommonHeader = _ref => {
4960
4933
  var CommonHeader$1 = CommonHeader;
4961
4934
 
4962
4935
  const LSMLabelField = props => {
4936
+ const intl = useIntl();
4963
4937
  const [lsmList, setLsmList] = useState([]);
4964
4938
  const {
4965
- label = "Label",
4939
+ label = "lsm.label",
4966
4940
  onLsmSelect,
4967
4941
  fetchLsmData,
4968
4942
  formItemProps = {},
@@ -4986,7 +4960,9 @@ const LSMLabelField = props => {
4986
4960
  loadLsmData();
4987
4961
  }, [fetchLsmData]);
4988
4962
  return /*#__PURE__*/jsx(Form.Item, _objectSpread2$1(_objectSpread2$1({
4989
- label: label
4963
+ label: typeof label === 'string' && label.includes('.') ? intl.formatMessage({
4964
+ id: label
4965
+ }) : label
4990
4966
  }, formItemProps), {}, {
4991
4967
  children: /*#__PURE__*/jsx(Select, _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, field), selectProps), {}, {
4992
4968
  options: lsmList,
@@ -4998,7 +4974,9 @@ const LSMLabelField = props => {
4998
4974
  field.onChange(value);
4999
4975
  onLsmSelect === null || onLsmSelect === void 0 || onLsmSelect(value === undefined ? undefined : option);
5000
4976
  },
5001
- placeholder: selectProps.placeholder || 'Please select label'
4977
+ placeholder: selectProps.placeholder || intl.formatMessage({
4978
+ id: 'lsm.placeholder.select'
4979
+ })
5002
4980
  }))
5003
4981
  }));
5004
4982
  };
@@ -13731,11 +13709,12 @@ const MaintenancePage = _ref => {
13731
13709
  redirectPath = '/',
13732
13710
  onRedirect,
13733
13711
  maxRetries = 90,
13734
- // 最多重试90次(约180秒)
13712
+ // 最多重试 90 次(约 180 秒)
13735
13713
  checkInterval = 2000,
13736
- // 每2秒重试
13714
+ // 每 2 秒重试
13737
13715
  countdownSeconds = 30 // 倒计时初始值,单位秒
13738
13716
  } = _ref;
13717
+ const intl = useIntl();
13739
13718
  const [countdown, setCountdown] = useState(countdownSeconds);
13740
13719
  const {
13741
13720
  error,
@@ -13774,7 +13753,11 @@ const MaintenancePage = _ref => {
13774
13753
  cleanup();
13775
13754
  };
13776
13755
  }, [isRestart, healthCheckUrl, startPolling, cleanup]);
13777
- const title = isRestart ? "System is restarting..." : "System is powered off";
13756
+ const title = isRestart ? intl.formatMessage({
13757
+ id: 'maintenance.restarting'
13758
+ }) : intl.formatMessage({
13759
+ id: 'maintenance.poweredOff'
13760
+ });
13778
13761
  const subTitle = isRestart ? /*#__PURE__*/jsxs(Space, {
13779
13762
  direction: "vertical",
13780
13763
  size: 8,
@@ -13782,13 +13765,21 @@ const MaintenancePage = _ref => {
13782
13765
  alignItems: 'center'
13783
13766
  },
13784
13767
  children: [/*#__PURE__*/jsx(Typography.Text, {
13785
- children: "Please wait while the system is starting up..."
13786
- }), countdown > 0 && /*#__PURE__*/jsxs(Typography.Text, {
13768
+ children: intl.formatMessage({
13769
+ id: 'maintenance.waiting'
13770
+ })
13771
+ }), countdown > 0 && /*#__PURE__*/jsx(Typography.Text, {
13787
13772
  type: "secondary",
13788
- children: ["Redirecting automatically in ", countdown, " second", countdown !== 1 ? 's' : '']
13773
+ children: intl.formatMessage({
13774
+ id: 'maintenance.redirecting.countdown'
13775
+ }, {
13776
+ countdown
13777
+ })
13789
13778
  }), countdown <= 0 && !error && /*#__PURE__*/jsx(Typography.Text, {
13790
13779
  type: "secondary",
13791
- children: "Still starting up... This may take a moment."
13780
+ children: intl.formatMessage({
13781
+ id: 'maintenance.waiting.long'
13782
+ })
13792
13783
  }), error && /*#__PURE__*/jsxs(Fragment, {
13793
13784
  children: [/*#__PURE__*/jsx(Alert, {
13794
13785
  type: "error",
@@ -13800,11 +13791,15 @@ const MaintenancePage = _ref => {
13800
13791
  }), /*#__PURE__*/jsx(Button, {
13801
13792
  type: "link",
13802
13793
  onClick: manualRetry,
13803
- children: "Retry connection"
13794
+ children: intl.formatMessage({
13795
+ id: 'maintenance.retry'
13796
+ })
13804
13797
  })]
13805
13798
  })]
13806
13799
  }) : /*#__PURE__*/jsx(Typography.Text, {
13807
- children: "The system is currently offline. Please contact your administrator to power it on."
13800
+ children: intl.formatMessage({
13801
+ id: 'maintenance.offline.description'
13802
+ })
13808
13803
  });
13809
13804
  return /*#__PURE__*/jsx("div", {
13810
13805
  className: "maintenance-page",
@@ -14168,10 +14163,17 @@ const BoundedInput = _ref => {
14168
14163
  min = 0,
14169
14164
  max = 100,
14170
14165
  autoCorrect = false,
14171
- placeholder = 'Enter an integer',
14166
+ placeholder = 'input.placeholder.enterInteger',
14172
14167
  disabled = false
14173
14168
  } = _ref,
14174
14169
  props = _objectWithoutProperties$1(_ref, _excluded);
14170
+ const intl = useIntl();
14171
+
14172
+ // 处理国际化文本
14173
+ const placeholderText = typeof placeholder === 'string' && placeholder.includes('.') ? intl.formatMessage({
14174
+ id: placeholder
14175
+ }) : placeholder;
14176
+
14175
14177
  // 1. 处理输入变更:只管记录,不修正,不打断
14176
14178
  const handleChange = val => {
14177
14179
  if (val === null || val === undefined) {
@@ -14207,7 +14209,7 @@ const BoundedInput = _ref => {
14207
14209
  value: value,
14208
14210
  onChange: handleChange,
14209
14211
  onBlur: handleBlur,
14210
- placeholder: placeholder
14212
+ placeholder: placeholderText
14211
14213
  // 只有开启自动修正时,才把 min/max 传给组件
14212
14214
  ,
14213
14215
  min: autoCorrect ? min : undefined,
@@ -14233,7 +14235,7 @@ const BoundedInput = _ref => {
14233
14235
  const PortInput = props => /*#__PURE__*/jsx(BoundedInput, _objectSpread2$1({
14234
14236
  min: 0,
14235
14237
  max: 65535,
14236
- placeholder: "Enter port (0-65535)"
14238
+ placeholder: "input.placeholder.enterPort"
14237
14239
  }, props));
14238
14240
 
14239
14241
  /**
@@ -14242,7 +14244,7 @@ const PortInput = props => /*#__PURE__*/jsx(BoundedInput, _objectSpread2$1({
14242
14244
  const PayloadInput = props => /*#__PURE__*/jsx(BoundedInput, _objectSpread2$1({
14243
14245
  min: 96,
14244
14246
  max: 127,
14245
- placeholder: "Enter payload (96-127)"
14247
+ placeholder: "input.placeholder.enterPayload"
14246
14248
  }, props));
14247
14249
 
14248
14250
  export { AuthorizationModal$1 as AuthorizationModal, CommonHeader$1 as CommonHeader, DraggableNumberInput, LSMLabelField$1 as LSMLabelField, MaintenancePage, NetworkSettingsModal$1 as NetworkSettingsModal, NmosModal$1 as NmosModal, PayloadInput, PortInput, PresetModal, PtpModal$1 as PtpModal, StyledModal$3 as StyledModal, SystemOperations$1 as SystemOperations, UpgradeManager$1 as UpgradeManager, addMessages, debugI18n, initI18n, enUS as localesEnUS, zhCN as localesZhCN, setLocale, useAuth, useHardwareUsage$1 as useHardwareUsage, useIntl, usePageReload$1 as usePageReload, useSystemOperations$1 as useSystemOperations, useUpgrade$1 as useUpgrade, useWebSocketWithFeatures$1 as useWebSocketWithFeatures };