seeder-st2110-components 1.7.13 → 1.7.14
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 +469 -471
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +469 -471
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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() 查看当前国际化状态
|
|
@@ -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: '
|
|
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
|
-
|
|
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 = "
|
|
1143
|
-
cancelText = "
|
|
1144
|
-
okText = "
|
|
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(
|
|
1155
|
-
|
|
1156
|
-
|
|
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,
|
|
1216
|
+
}, [AntdModal, confirmTitleText, cancelTextValue, okTextValue, onPowerOff, onRestart, intl]);
|
|
1174
1217
|
const getMenuItems = useCallback(() => [{
|
|
1175
1218
|
key: "poweroff",
|
|
1176
|
-
label:
|
|
1219
|
+
label: intl.formatMessage({
|
|
1220
|
+
id: 'system.poweroff'
|
|
1221
|
+
})
|
|
1177
1222
|
}, {
|
|
1178
1223
|
key: "restart",
|
|
1179
|
-
label:
|
|
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,23 @@ 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
|
-
|
|
1651
|
-
'
|
|
1652
|
-
'
|
|
1653
|
-
'
|
|
1654
|
-
|
|
1690
|
+
// 输入框占位符
|
|
1691
|
+
'input.placeholder.enterInteger': '请输入整数',
|
|
1692
|
+
'input.placeholder.enterPort': '请输入端口 (0-65535)',
|
|
1693
|
+
'input.placeholder.enterPayload': '请输入 Payload (96-127)',
|
|
1694
|
+
// 使用率显示
|
|
1695
|
+
'usage.memory': '内存使用率',
|
|
1696
|
+
'usage.totalMemory': '内存总量',
|
|
1697
|
+
'usage.cpu': 'CPU 使用率',
|
|
1698
|
+
'usage.disk': '磁盘使用率',
|
|
1699
|
+
'usage.cpuTemp': 'CPU 温度',
|
|
1700
|
+
'usage.memTemp': '内存温度',
|
|
1701
|
+
'usage.nicTemp': '网卡温度',
|
|
1702
|
+
'usage.diskTemp': '硬盘温度',
|
|
1703
|
+
'usage.gpu': 'GPU 使用率',
|
|
1704
|
+
'usage.gpuTemp': 'GPU 温度',
|
|
1655
1705
|
// 菜单
|
|
1656
1706
|
'menu.networkSettings': '网络设置',
|
|
1657
1707
|
'menu.ptp': 'PTP',
|
|
@@ -1662,6 +1712,7 @@ var zhCN = {
|
|
|
1662
1712
|
'menu.system': '系统',
|
|
1663
1713
|
// Network Settings Modal
|
|
1664
1714
|
'networkSettings.title': '网络设置',
|
|
1715
|
+
'networkSettings.name': '名称',
|
|
1665
1716
|
'networkSettings.ipAddress': 'IP 地址',
|
|
1666
1717
|
'networkSettings.subnetMask': '子网掩码',
|
|
1667
1718
|
'networkSettings.restartRequired': '配置已修改。是否重启以应用更改?',
|
|
@@ -1678,9 +1729,9 @@ var zhCN = {
|
|
|
1678
1729
|
'ptp.clockClass.gps': 'GPS ({value})',
|
|
1679
1730
|
'ptp.clockClass.slaveOnly': '仅从时钟 ({value})',
|
|
1680
1731
|
'ptp.clockAccuracy': '时钟精度',
|
|
1681
|
-
'ptp.offsetScaledLogVariance': '
|
|
1732
|
+
'ptp.offsetScaledLogVariance': '时钟偏移方差',
|
|
1682
1733
|
'ptp.portIdentity': '端口标识',
|
|
1683
|
-
'ptp.grandmasterIdentity': '
|
|
1734
|
+
'ptp.grandmasterIdentity': '主时钟 ID',
|
|
1684
1735
|
'ptp.utcOffset': 'UTC 偏移量',
|
|
1685
1736
|
'ptp.connected': '已连接',
|
|
1686
1737
|
'ptp.disconnected': '未连接',
|
|
@@ -1692,7 +1743,7 @@ var zhCN = {
|
|
|
1692
1743
|
'nmos.hostAddress': '主机地址',
|
|
1693
1744
|
'nmos.domain': '域',
|
|
1694
1745
|
'nmos.registrationPort': '注册端口',
|
|
1695
|
-
'nmos.registryAddress': '
|
|
1746
|
+
'nmos.registryAddress': '注册服务器地址',
|
|
1696
1747
|
'nmos.registryVersion': '注册版本',
|
|
1697
1748
|
'nmos.loggingLevel': '日志级别',
|
|
1698
1749
|
'nmos.placeholder.selectHostAddress': '选择主机地址',
|
|
@@ -1704,6 +1755,10 @@ var zhCN = {
|
|
|
1704
1755
|
'preset.categories': '分类',
|
|
1705
1756
|
'preset.description': '描述',
|
|
1706
1757
|
'preset.placeholder.enterName': '请输入名称',
|
|
1758
|
+
'preset.placeholder.enterDescription': '请输入描述',
|
|
1759
|
+
'preset.header.name': '名称',
|
|
1760
|
+
'preset.header.createTime': '创建时间',
|
|
1761
|
+
'preset.header.description': '描述',
|
|
1707
1762
|
'preset.button.new': '新建预设',
|
|
1708
1763
|
'preset.button.delete': '删除',
|
|
1709
1764
|
'preset.button.load': '加载',
|
|
@@ -1711,7 +1766,8 @@ var zhCN = {
|
|
|
1711
1766
|
'preset.button.edit': '编辑',
|
|
1712
1767
|
'preset.button.cancel': '取消',
|
|
1713
1768
|
'preset.empty.noData': '从列表中选择一个预设查看详情',
|
|
1714
|
-
'preset.
|
|
1769
|
+
'preset.empty.create': '创建新预设',
|
|
1770
|
+
'preset.untitled': '未命名',
|
|
1715
1771
|
'preset.delete.title': '删除预设',
|
|
1716
1772
|
'preset.delete.confirmMessage': '确定要删除预设',
|
|
1717
1773
|
'preset.load.title': '加载预设',
|
|
@@ -1735,8 +1791,9 @@ var zhCN = {
|
|
|
1735
1791
|
'license.status.invalid': '无效',
|
|
1736
1792
|
'license.status.expiresOn': '到期时间',
|
|
1737
1793
|
'license.validation.keyRequired': '许可证密钥不能为空',
|
|
1794
|
+
'license.error.authorizationFailed': '授权失败',
|
|
1738
1795
|
// 升级相关
|
|
1739
|
-
'upgrade.menu.download': '
|
|
1796
|
+
'upgrade.menu.download': '导出配置',
|
|
1740
1797
|
'upgrade.menu.softwareUpdate': '软件升级',
|
|
1741
1798
|
'upgrade.status.idle': '空闲',
|
|
1742
1799
|
'upgrade.status.uploading': '上传中',
|
|
@@ -1750,91 +1807,45 @@ var zhCN = {
|
|
|
1750
1807
|
// 系统操作
|
|
1751
1808
|
'system.poweroff': '关机',
|
|
1752
1809
|
'system.restart': '重启',
|
|
1753
|
-
'system.action.powerOff': '
|
|
1810
|
+
'system.action.powerOff': '关机',
|
|
1754
1811
|
'system.action.restart': '重启',
|
|
1755
1812
|
'system.confirm.title': '确认操作',
|
|
1756
1813
|
'system.confirm.message': '确定要{action}系统吗?此操作无法撤销。',
|
|
1757
1814
|
'system.button.cancel': '取消',
|
|
1758
1815
|
'system.button.confirm': '确认',
|
|
1759
|
-
//
|
|
1760
|
-
'maintenance.
|
|
1761
|
-
'maintenance.
|
|
1762
|
-
'maintenance.
|
|
1763
|
-
'maintenance.
|
|
1764
|
-
'maintenance.
|
|
1765
|
-
'maintenance.
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
'
|
|
1769
|
-
'
|
|
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': '筛选'
|
|
1816
|
+
// Maintenance page
|
|
1817
|
+
'maintenance.restarting': '系统正在重启...',
|
|
1818
|
+
'maintenance.poweredOff': '系统已关闭',
|
|
1819
|
+
'maintenance.waiting': '请等待系统启动...',
|
|
1820
|
+
'maintenance.redirecting.countdown': '将在 {countdown} 秒后自动跳转',
|
|
1821
|
+
'maintenance.waiting.long': '系统仍在启动中,这可能需要一些时间...',
|
|
1822
|
+
'maintenance.retry': '重试连接',
|
|
1823
|
+
'maintenance.offline.description': '系统当前处于离线状态,请联系管理员开启设备。',
|
|
1824
|
+
// LSM Label
|
|
1825
|
+
'lsm.label': '标签',
|
|
1826
|
+
'lsm.placeholder.select': '请选择标签'
|
|
1819
1827
|
};
|
|
1820
1828
|
|
|
1821
1829
|
// seeder-st2110-components component library English language pack
|
|
1822
1830
|
var enUS = {
|
|
1823
1831
|
// 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
1832
|
'button.close': 'Close',
|
|
1832
1833
|
'button.apply': 'Apply',
|
|
1833
|
-
|
|
1834
|
-
'
|
|
1835
|
-
'
|
|
1836
|
-
'
|
|
1837
|
-
|
|
1834
|
+
// Input placeholders
|
|
1835
|
+
'input.placeholder.enterInteger': 'Enter an integer',
|
|
1836
|
+
'input.placeholder.enterPort': ' Enter port (0-65535)',
|
|
1837
|
+
'input.placeholder.enterPayload': 'Enter payload (96-127)',
|
|
1838
|
+
// Usage display
|
|
1839
|
+
'usage.memory': 'Memory Usage',
|
|
1840
|
+
'usage.totalMemory': 'Total Memory',
|
|
1841
|
+
'usage.cpu': 'CPU Usage',
|
|
1842
|
+
'usage.disk': 'Disk Usage',
|
|
1843
|
+
'usage.cpuTemp': 'CPU Temperature',
|
|
1844
|
+
'usage.memTemp': 'Memory Temperature',
|
|
1845
|
+
'usage.nicTemp': 'NIC Temperature',
|
|
1846
|
+
'usage.diskTemp': 'Disk Temperature',
|
|
1847
|
+
'usage.gpu': 'GPU Usage',
|
|
1848
|
+
'usage.gpuTemp': 'GPU Temperature',
|
|
1838
1849
|
// Menu
|
|
1839
1850
|
'menu.networkSettings': 'Network Settings',
|
|
1840
1851
|
'menu.ptp': 'PTP',
|
|
@@ -1845,6 +1856,7 @@ var enUS = {
|
|
|
1845
1856
|
'menu.system': 'System',
|
|
1846
1857
|
// Network Settings Modal
|
|
1847
1858
|
'networkSettings.title': 'Network Settings',
|
|
1859
|
+
'networkSettings.name': 'Name',
|
|
1848
1860
|
'networkSettings.ipAddress': 'IP Address',
|
|
1849
1861
|
'networkSettings.subnetMask': 'Netmask',
|
|
1850
1862
|
'networkSettings.restartRequired': 'Configuration modified. Restart to apply changes?',
|
|
@@ -1878,7 +1890,7 @@ var enUS = {
|
|
|
1878
1890
|
'nmos.registrationPort': 'Registry Port',
|
|
1879
1891
|
'nmos.registryVersion': 'Registry Version',
|
|
1880
1892
|
'nmos.loggingLevel': 'Logging Level',
|
|
1881
|
-
'nmos.placeholder.selectHostAddress': 'Select
|
|
1893
|
+
'nmos.placeholder.selectHostAddress': 'Select IP address',
|
|
1882
1894
|
'nmos.placeholder.selectVersion': 'Select version',
|
|
1883
1895
|
'nmos.saveSuccess': 'Success',
|
|
1884
1896
|
// Preset Modal
|
|
@@ -1887,6 +1899,10 @@ var enUS = {
|
|
|
1887
1899
|
'preset.categories': 'Categories',
|
|
1888
1900
|
'preset.description': 'Description',
|
|
1889
1901
|
'preset.placeholder.enterName': 'Enter name',
|
|
1902
|
+
'preset.placeholder.enterDescription': 'Enter description',
|
|
1903
|
+
'preset.header.name': 'Name',
|
|
1904
|
+
'preset.header.createTime': 'Create Time',
|
|
1905
|
+
'preset.header.description': 'Description',
|
|
1890
1906
|
'preset.button.new': 'New Preset',
|
|
1891
1907
|
'preset.button.delete': 'Delete',
|
|
1892
1908
|
'preset.button.load': 'Load',
|
|
@@ -1894,7 +1910,8 @@ var enUS = {
|
|
|
1894
1910
|
'preset.button.edit': 'Edit',
|
|
1895
1911
|
'preset.button.cancel': 'Cancel',
|
|
1896
1912
|
'preset.empty.noData': 'Select a preset from the list to view details',
|
|
1897
|
-
'preset.
|
|
1913
|
+
'preset.empty.create': 'Create New Preset',
|
|
1914
|
+
'preset.untitled': 'Untitled',
|
|
1898
1915
|
'preset.delete.title': 'Delete Preset',
|
|
1899
1916
|
'preset.delete.confirmMessage': 'Are you sure you want to delete preset',
|
|
1900
1917
|
'preset.load.title': 'Load Preset',
|
|
@@ -1918,6 +1935,7 @@ var enUS = {
|
|
|
1918
1935
|
'license.status.invalid': 'Invalid',
|
|
1919
1936
|
'license.status.expiresOn': 'Expires on',
|
|
1920
1937
|
'license.validation.keyRequired': 'License key cannot be empty',
|
|
1938
|
+
'license.error.authorizationFailed': 'Authorization failed',
|
|
1921
1939
|
// Upgrade related
|
|
1922
1940
|
'upgrade.menu.download': 'Download Config File',
|
|
1923
1941
|
'upgrade.menu.softwareUpdate': 'Software Update',
|
|
@@ -1940,65 +1958,16 @@ var enUS = {
|
|
|
1940
1958
|
'system.button.cancel': 'Cancel',
|
|
1941
1959
|
'system.button.confirm': 'Confirm',
|
|
1942
1960
|
// Maintenance page
|
|
1943
|
-
'maintenance.
|
|
1944
|
-
'maintenance.
|
|
1945
|
-
'maintenance.
|
|
1946
|
-
'maintenance.
|
|
1947
|
-
'maintenance.
|
|
1948
|
-
'maintenance.
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
'
|
|
1952
|
-
'
|
|
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'
|
|
1961
|
+
'maintenance.restarting': 'System is restarting...',
|
|
1962
|
+
'maintenance.poweredOff': 'System is powered off',
|
|
1963
|
+
'maintenance.waiting': 'Please wait while the system is starting up...',
|
|
1964
|
+
'maintenance.redirecting.countdown': 'Redirecting automatically in {countdown} second{countdown, plural, one {} other {s}}',
|
|
1965
|
+
'maintenance.waiting.long': 'Still starting up... This may take a moment.',
|
|
1966
|
+
'maintenance.retry': 'Retry connection',
|
|
1967
|
+
'maintenance.offline.description': 'The system is currently offline. Please contact your administrator to power it on.',
|
|
1968
|
+
// LSM Label
|
|
1969
|
+
'lsm.label': 'Label',
|
|
1970
|
+
'lsm.placeholder.select': 'Select label'
|
|
2002
1971
|
};
|
|
2003
1972
|
|
|
2004
1973
|
const NetworkFieldGroup = _ref => {
|
|
@@ -2014,7 +1983,7 @@ const NetworkFieldGroup = _ref => {
|
|
|
2014
1983
|
const defaultFieldConfig = {
|
|
2015
1984
|
name: {
|
|
2016
1985
|
label: intl.formatMessage({
|
|
2017
|
-
id: '
|
|
1986
|
+
id: 'networkSettings.name'
|
|
2018
1987
|
}),
|
|
2019
1988
|
enabled: true
|
|
2020
1989
|
},
|
|
@@ -2725,10 +2694,21 @@ const LeftList = /*#__PURE__*/memo(_ref => {
|
|
|
2725
2694
|
onRemove,
|
|
2726
2695
|
hasPresets = dataSource.length > 0,
|
|
2727
2696
|
texts = {
|
|
2728
|
-
newButton: "
|
|
2729
|
-
removeButton: "
|
|
2697
|
+
newButton: "preset.button.new",
|
|
2698
|
+
removeButton: "preset.button.delete"
|
|
2730
2699
|
}
|
|
2731
2700
|
} = _ref;
|
|
2701
|
+
const intl = useIntl();
|
|
2702
|
+
|
|
2703
|
+
// 格式化文本的辅助函数
|
|
2704
|
+
const fmt = key => {
|
|
2705
|
+
if (typeof key === 'string' && key.includes('.')) {
|
|
2706
|
+
return intl.formatMessage({
|
|
2707
|
+
id: key
|
|
2708
|
+
});
|
|
2709
|
+
}
|
|
2710
|
+
return key;
|
|
2711
|
+
};
|
|
2732
2712
|
return /*#__PURE__*/jsxs("div", {
|
|
2733
2713
|
className: "h-full left-list-wrapper",
|
|
2734
2714
|
children: [/*#__PURE__*/jsx("div", {
|
|
@@ -2738,13 +2718,13 @@ const LeftList = /*#__PURE__*/memo(_ref => {
|
|
|
2738
2718
|
className: "grid grid-cols-3 gap-2 w-full list-header",
|
|
2739
2719
|
children: [/*#__PURE__*/jsx("div", {
|
|
2740
2720
|
className: "min-w-0",
|
|
2741
|
-
children:
|
|
2721
|
+
children: fmt('preset.header.name')
|
|
2742
2722
|
}), /*#__PURE__*/jsx("div", {
|
|
2743
2723
|
className: "min-w-0",
|
|
2744
|
-
children:
|
|
2724
|
+
children: fmt('preset.header.createTime')
|
|
2745
2725
|
}), /*#__PURE__*/jsx("div", {
|
|
2746
2726
|
className: "min-w-0",
|
|
2747
|
-
children:
|
|
2727
|
+
children: fmt('preset.header.description')
|
|
2748
2728
|
})]
|
|
2749
2729
|
}),
|
|
2750
2730
|
dataSource: dataSource,
|
|
@@ -2762,7 +2742,7 @@ const LeftList = /*#__PURE__*/memo(_ref => {
|
|
|
2762
2742
|
children: /*#__PURE__*/jsx(Typography.Text, {
|
|
2763
2743
|
ellipsis: true,
|
|
2764
2744
|
title: item.name,
|
|
2765
|
-
children: item.name ||
|
|
2745
|
+
children: item.name || fmt('preset.untitled')
|
|
2766
2746
|
})
|
|
2767
2747
|
}), /*#__PURE__*/jsx("div", {
|
|
2768
2748
|
className: "min-w-0",
|
|
@@ -2792,7 +2772,7 @@ const LeftList = /*#__PURE__*/memo(_ref => {
|
|
|
2792
2772
|
onClick: onAddNew,
|
|
2793
2773
|
className: "p-0 h-auto",
|
|
2794
2774
|
icon: /*#__PURE__*/jsx(PlusOutlined, {}),
|
|
2795
|
-
children:
|
|
2775
|
+
children: fmt('preset.empty.create')
|
|
2796
2776
|
})
|
|
2797
2777
|
})
|
|
2798
2778
|
})
|
|
@@ -2858,26 +2838,44 @@ const RightDetailForm = /*#__PURE__*/memo(_ref3 => {
|
|
|
2858
2838
|
originalPresetData,
|
|
2859
2839
|
fields = {
|
|
2860
2840
|
name: {
|
|
2861
|
-
label: "
|
|
2862
|
-
placeholder: "
|
|
2841
|
+
label: "preset.name",
|
|
2842
|
+
placeholder: "preset.placeholder.enterName",
|
|
2863
2843
|
required: true
|
|
2844
|
+
},
|
|
2845
|
+
category_list: {
|
|
2846
|
+
label: "preset.categories"
|
|
2847
|
+
},
|
|
2848
|
+
description: {
|
|
2849
|
+
label: "preset.description",
|
|
2850
|
+
placeholder: "preset.placeholder.enterDescription"
|
|
2864
2851
|
}
|
|
2865
2852
|
},
|
|
2866
2853
|
texts = {
|
|
2867
|
-
loadButton: "
|
|
2868
|
-
saveButton: "
|
|
2869
|
-
editButton: "
|
|
2870
|
-
cancelButton: "
|
|
2854
|
+
loadButton: "preset.button.load",
|
|
2855
|
+
saveButton: "preset.button.save",
|
|
2856
|
+
editButton: "preset.button.edit",
|
|
2857
|
+
cancelButton: "preset.button.cancel"
|
|
2871
2858
|
},
|
|
2872
2859
|
presetChanged,
|
|
2873
2860
|
// 作用:在切换选中预设时强制触发 Checkbox 的重新初始化
|
|
2874
2861
|
enableEdit = true
|
|
2875
2862
|
} = _ref3;
|
|
2863
|
+
const intl = useIntl();
|
|
2876
2864
|
const [initialSelected, setInitialSelected] = useState([]);
|
|
2877
2865
|
const [isEditMode, setIsEditMode] = useState(false); // 是否进入编辑模式
|
|
2878
2866
|
const currentSelected = Form.useWatch('category_list', form) || [];
|
|
2879
2867
|
|
|
2880
|
-
//
|
|
2868
|
+
// 格式化文本的辅助函数
|
|
2869
|
+
const fmt = key => {
|
|
2870
|
+
if (typeof key === 'string' && key.includes('.')) {
|
|
2871
|
+
return intl.formatMessage({
|
|
2872
|
+
id: key
|
|
2873
|
+
});
|
|
2874
|
+
}
|
|
2875
|
+
return key;
|
|
2876
|
+
};
|
|
2877
|
+
|
|
2878
|
+
// 检查是否包含 category_list 字段
|
|
2881
2879
|
const hasCategoryList = fields.category_list !== null && fields.category_list !== undefined;
|
|
2882
2880
|
|
|
2883
2881
|
// 初始化 category_list 的选择状态
|
|
@@ -2970,39 +2968,15 @@ const RightDetailForm = /*#__PURE__*/memo(_ref3 => {
|
|
|
2970
2968
|
},
|
|
2971
2969
|
children: [/*#__PURE__*/jsx(Form.Item, {
|
|
2972
2970
|
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
|
-
,
|
|
2971
|
+
label: fmt(fields.name.label),
|
|
2985
2972
|
required: true,
|
|
2986
2973
|
children: /*#__PURE__*/jsx(Input, {
|
|
2987
|
-
placeholder: fields.name.placeholder,
|
|
2974
|
+
placeholder: fmt(fields.name.placeholder),
|
|
2988
2975
|
disabled: shouldDisableNameAndDesc
|
|
2989
2976
|
})
|
|
2990
2977
|
}), hasCategoryList && /*#__PURE__*/jsx(Form.Item, {
|
|
2991
2978
|
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
|
-
,
|
|
2979
|
+
label: fmt(fields.category_list.label),
|
|
3006
2980
|
required: true,
|
|
3007
2981
|
children: /*#__PURE__*/jsx(Checkbox.Group, {
|
|
3008
2982
|
className: "grid grid-cols-2 gap-2",
|
|
@@ -3016,10 +2990,10 @@ const RightDetailForm = /*#__PURE__*/memo(_ref3 => {
|
|
|
3016
2990
|
})
|
|
3017
2991
|
}), fields.description && /*#__PURE__*/jsx(Form.Item, {
|
|
3018
2992
|
name: "description",
|
|
3019
|
-
label: fields.description.label,
|
|
2993
|
+
label: fmt(fields.description.label),
|
|
3020
2994
|
children: /*#__PURE__*/jsx(Input.TextArea, {
|
|
3021
2995
|
rows: 4,
|
|
3022
|
-
placeholder: fields.description.placeholder,
|
|
2996
|
+
placeholder: fmt(fields.description.placeholder),
|
|
3023
2997
|
disabled: shouldDisableNameAndDesc,
|
|
3024
2998
|
style: {
|
|
3025
2999
|
resize: 'none'
|
|
@@ -4712,7 +4686,7 @@ const SystemOperations = _ref => {
|
|
|
4712
4686
|
onRestartSuccess,
|
|
4713
4687
|
beforeAction,
|
|
4714
4688
|
// 在执行关机/重启前调用
|
|
4715
|
-
powerOffLabel = "system.
|
|
4689
|
+
powerOffLabel = "system.poweroff",
|
|
4716
4690
|
restartLabel = "system.restart",
|
|
4717
4691
|
iconClassName = "seeder-iconfont seeder-icon-guanji1 text-xl text-neutral-400",
|
|
4718
4692
|
confirmMessage = "system.confirm.message",
|
|
@@ -4729,12 +4703,7 @@ const SystemOperations = _ref => {
|
|
|
4729
4703
|
label: typeof powerOffLabel === 'string' && powerOffLabel.includes('.') ? intl.formatMessage({
|
|
4730
4704
|
id: powerOffLabel
|
|
4731
4705
|
}) : powerOffLabel
|
|
4732
|
-
},
|
|
4733
|
-
// {
|
|
4734
|
-
// key: "reboot",
|
|
4735
|
-
// label: rebootLabel, // 硬重启 物理重启
|
|
4736
|
-
// },
|
|
4737
|
-
{
|
|
4706
|
+
}, {
|
|
4738
4707
|
key: "restart",
|
|
4739
4708
|
label: typeof restartLabel === 'string' && restartLabel.includes('.') ? intl.formatMessage({
|
|
4740
4709
|
id: restartLabel
|
|
@@ -4960,9 +4929,10 @@ const CommonHeader = _ref => {
|
|
|
4960
4929
|
var CommonHeader$1 = CommonHeader;
|
|
4961
4930
|
|
|
4962
4931
|
const LSMLabelField = props => {
|
|
4932
|
+
const intl = useIntl();
|
|
4963
4933
|
const [lsmList, setLsmList] = useState([]);
|
|
4964
4934
|
const {
|
|
4965
|
-
label = "
|
|
4935
|
+
label = "lsm.label",
|
|
4966
4936
|
onLsmSelect,
|
|
4967
4937
|
fetchLsmData,
|
|
4968
4938
|
formItemProps = {},
|
|
@@ -4986,7 +4956,9 @@ const LSMLabelField = props => {
|
|
|
4986
4956
|
loadLsmData();
|
|
4987
4957
|
}, [fetchLsmData]);
|
|
4988
4958
|
return /*#__PURE__*/jsx(Form.Item, _objectSpread2$1(_objectSpread2$1({
|
|
4989
|
-
label: label
|
|
4959
|
+
label: typeof label === 'string' && label.includes('.') ? intl.formatMessage({
|
|
4960
|
+
id: label
|
|
4961
|
+
}) : label
|
|
4990
4962
|
}, formItemProps), {}, {
|
|
4991
4963
|
children: /*#__PURE__*/jsx(Select, _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, field), selectProps), {}, {
|
|
4992
4964
|
options: lsmList,
|
|
@@ -4998,7 +4970,9 @@ const LSMLabelField = props => {
|
|
|
4998
4970
|
field.onChange(value);
|
|
4999
4971
|
onLsmSelect === null || onLsmSelect === void 0 || onLsmSelect(value === undefined ? undefined : option);
|
|
5000
4972
|
},
|
|
5001
|
-
placeholder: selectProps.placeholder ||
|
|
4973
|
+
placeholder: selectProps.placeholder || intl.formatMessage({
|
|
4974
|
+
id: 'lsm.placeholder.select'
|
|
4975
|
+
})
|
|
5002
4976
|
}))
|
|
5003
4977
|
}));
|
|
5004
4978
|
};
|
|
@@ -13731,11 +13705,12 @@ const MaintenancePage = _ref => {
|
|
|
13731
13705
|
redirectPath = '/',
|
|
13732
13706
|
onRedirect,
|
|
13733
13707
|
maxRetries = 90,
|
|
13734
|
-
// 最多重试90次(约180秒)
|
|
13708
|
+
// 最多重试 90 次(约 180 秒)
|
|
13735
13709
|
checkInterval = 2000,
|
|
13736
|
-
// 每2秒重试
|
|
13710
|
+
// 每 2 秒重试
|
|
13737
13711
|
countdownSeconds = 30 // 倒计时初始值,单位秒
|
|
13738
13712
|
} = _ref;
|
|
13713
|
+
const intl = useIntl();
|
|
13739
13714
|
const [countdown, setCountdown] = useState(countdownSeconds);
|
|
13740
13715
|
const {
|
|
13741
13716
|
error,
|
|
@@ -13774,7 +13749,11 @@ const MaintenancePage = _ref => {
|
|
|
13774
13749
|
cleanup();
|
|
13775
13750
|
};
|
|
13776
13751
|
}, [isRestart, healthCheckUrl, startPolling, cleanup]);
|
|
13777
|
-
const title = isRestart ?
|
|
13752
|
+
const title = isRestart ? intl.formatMessage({
|
|
13753
|
+
id: 'maintenance.restarting'
|
|
13754
|
+
}) : intl.formatMessage({
|
|
13755
|
+
id: 'maintenance.poweredOff'
|
|
13756
|
+
});
|
|
13778
13757
|
const subTitle = isRestart ? /*#__PURE__*/jsxs(Space, {
|
|
13779
13758
|
direction: "vertical",
|
|
13780
13759
|
size: 8,
|
|
@@ -13782,13 +13761,21 @@ const MaintenancePage = _ref => {
|
|
|
13782
13761
|
alignItems: 'center'
|
|
13783
13762
|
},
|
|
13784
13763
|
children: [/*#__PURE__*/jsx(Typography.Text, {
|
|
13785
|
-
children:
|
|
13786
|
-
|
|
13764
|
+
children: intl.formatMessage({
|
|
13765
|
+
id: 'maintenance.waiting'
|
|
13766
|
+
})
|
|
13767
|
+
}), countdown > 0 && /*#__PURE__*/jsx(Typography.Text, {
|
|
13787
13768
|
type: "secondary",
|
|
13788
|
-
children:
|
|
13769
|
+
children: intl.formatMessage({
|
|
13770
|
+
id: 'maintenance.redirecting.countdown'
|
|
13771
|
+
}, {
|
|
13772
|
+
countdown
|
|
13773
|
+
})
|
|
13789
13774
|
}), countdown <= 0 && !error && /*#__PURE__*/jsx(Typography.Text, {
|
|
13790
13775
|
type: "secondary",
|
|
13791
|
-
children:
|
|
13776
|
+
children: intl.formatMessage({
|
|
13777
|
+
id: 'maintenance.waiting.long'
|
|
13778
|
+
})
|
|
13792
13779
|
}), error && /*#__PURE__*/jsxs(Fragment, {
|
|
13793
13780
|
children: [/*#__PURE__*/jsx(Alert, {
|
|
13794
13781
|
type: "error",
|
|
@@ -13800,11 +13787,15 @@ const MaintenancePage = _ref => {
|
|
|
13800
13787
|
}), /*#__PURE__*/jsx(Button, {
|
|
13801
13788
|
type: "link",
|
|
13802
13789
|
onClick: manualRetry,
|
|
13803
|
-
children:
|
|
13790
|
+
children: intl.formatMessage({
|
|
13791
|
+
id: 'maintenance.retry'
|
|
13792
|
+
})
|
|
13804
13793
|
})]
|
|
13805
13794
|
})]
|
|
13806
13795
|
}) : /*#__PURE__*/jsx(Typography.Text, {
|
|
13807
|
-
children:
|
|
13796
|
+
children: intl.formatMessage({
|
|
13797
|
+
id: 'maintenance.offline.description'
|
|
13798
|
+
})
|
|
13808
13799
|
});
|
|
13809
13800
|
return /*#__PURE__*/jsx("div", {
|
|
13810
13801
|
className: "maintenance-page",
|
|
@@ -14168,10 +14159,17 @@ const BoundedInput = _ref => {
|
|
|
14168
14159
|
min = 0,
|
|
14169
14160
|
max = 100,
|
|
14170
14161
|
autoCorrect = false,
|
|
14171
|
-
placeholder = '
|
|
14162
|
+
placeholder = 'input.placeholder.enterInteger',
|
|
14172
14163
|
disabled = false
|
|
14173
14164
|
} = _ref,
|
|
14174
14165
|
props = _objectWithoutProperties$1(_ref, _excluded);
|
|
14166
|
+
const intl = useIntl();
|
|
14167
|
+
|
|
14168
|
+
// 处理国际化文本
|
|
14169
|
+
const placeholderText = typeof placeholder === 'string' && placeholder.includes('.') ? intl.formatMessage({
|
|
14170
|
+
id: placeholder
|
|
14171
|
+
}) : placeholder;
|
|
14172
|
+
|
|
14175
14173
|
// 1. 处理输入变更:只管记录,不修正,不打断
|
|
14176
14174
|
const handleChange = val => {
|
|
14177
14175
|
if (val === null || val === undefined) {
|
|
@@ -14207,7 +14205,7 @@ const BoundedInput = _ref => {
|
|
|
14207
14205
|
value: value,
|
|
14208
14206
|
onChange: handleChange,
|
|
14209
14207
|
onBlur: handleBlur,
|
|
14210
|
-
placeholder:
|
|
14208
|
+
placeholder: placeholderText
|
|
14211
14209
|
// 只有开启自动修正时,才把 min/max 传给组件
|
|
14212
14210
|
,
|
|
14213
14211
|
min: autoCorrect ? min : undefined,
|
|
@@ -14233,7 +14231,7 @@ const BoundedInput = _ref => {
|
|
|
14233
14231
|
const PortInput = props => /*#__PURE__*/jsx(BoundedInput, _objectSpread2$1({
|
|
14234
14232
|
min: 0,
|
|
14235
14233
|
max: 65535,
|
|
14236
|
-
placeholder: "
|
|
14234
|
+
placeholder: "input.placeholder.enterPort"
|
|
14237
14235
|
}, props));
|
|
14238
14236
|
|
|
14239
14237
|
/**
|
|
@@ -14242,7 +14240,7 @@ const PortInput = props => /*#__PURE__*/jsx(BoundedInput, _objectSpread2$1({
|
|
|
14242
14240
|
const PayloadInput = props => /*#__PURE__*/jsx(BoundedInput, _objectSpread2$1({
|
|
14243
14241
|
min: 96,
|
|
14244
14242
|
max: 127,
|
|
14245
|
-
placeholder: "
|
|
14243
|
+
placeholder: "input.placeholder.enterPayload"
|
|
14246
14244
|
}, props));
|
|
14247
14245
|
|
|
14248
14246
|
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 };
|