seeder-st2110-components 1.4.4 → 1.5.1
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 +31 -29
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +30 -28
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -99,7 +99,7 @@ const UsageItem = /*#__PURE__*/react.memo(_ref => {
|
|
|
99
99
|
children: /*#__PURE__*/jsxRuntime.jsxs(antd.Space, {
|
|
100
100
|
size: 4,
|
|
101
101
|
children: [/*#__PURE__*/jsxRuntime.jsx("i", {
|
|
102
|
-
className: "iconfont ".concat(iconClass, " text-xl")
|
|
102
|
+
className: "seeder-iconfont ".concat(iconClass, " text-xl")
|
|
103
103
|
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
104
104
|
className: "inline-block w-10 text-center",
|
|
105
105
|
children: children
|
|
@@ -110,42 +110,44 @@ const UsageItem = /*#__PURE__*/react.memo(_ref => {
|
|
|
110
110
|
var UsageItem$1 = UsageItem;
|
|
111
111
|
|
|
112
112
|
const useHardwareWebSocket = socketUrl => {
|
|
113
|
-
// cpu_percent cpu使用率
|
|
114
|
-
// cpu_freq.current cpu频率
|
|
115
|
-
// mem.percent 内存使用率
|
|
116
|
-
// sensors_temperatures.coretemp[0].current cpu温度
|
|
117
|
-
// gpu_stats[0]["utilization.gpu"] gpu使用率
|
|
118
|
-
// 若机器没有显卡,gpu_stats数组为空
|
|
119
|
-
|
|
120
113
|
const [systemStatus, setSystemStatus] = react.useState();
|
|
121
|
-
|
|
122
|
-
// ## 获取系统资源使用情况
|
|
123
|
-
const {
|
|
124
|
-
latestMessage
|
|
125
|
-
} = ahooks.useWebSocket(socketUrl);
|
|
126
114
|
const handleMessage = react.useCallback(message => {
|
|
127
115
|
try {
|
|
128
116
|
if (message) {
|
|
129
|
-
setSystemStatus(prev => _objectSpread2(_objectSpread2(
|
|
130
|
-
lastUpdated: Date.now() // 添加更新时间戳
|
|
131
|
-
}));
|
|
117
|
+
setSystemStatus(prev => _objectSpread2(_objectSpread2({}, prev), message));
|
|
132
118
|
}
|
|
133
119
|
} catch (error) {
|
|
134
120
|
console.error('Message processing error:', error);
|
|
135
121
|
}
|
|
136
122
|
}, []);
|
|
137
123
|
|
|
138
|
-
//
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
124
|
+
// ## 获取系统资源使用情况
|
|
125
|
+
ahooks.useWebSocket(socketUrl, {
|
|
126
|
+
onMessage: event => {
|
|
127
|
+
// 处理实时消息
|
|
128
|
+
try {
|
|
129
|
+
const parsedMessage = JSON.parse(event.data);
|
|
130
|
+
handleMessage(parsedMessage);
|
|
131
|
+
} catch (error) {
|
|
132
|
+
console.error('Message parsing error:', error);
|
|
133
|
+
console.debug('Raw message:', event.data);
|
|
134
|
+
}
|
|
147
135
|
}
|
|
148
|
-
}
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
// // 监听消息 latestMessage 只用于非实时需求
|
|
139
|
+
// useEffect(() => {
|
|
140
|
+
// if (!latestMessage?.data) return;
|
|
141
|
+
|
|
142
|
+
// try {
|
|
143
|
+
// const parsedMessage = JSON.parse(latestMessage.data);
|
|
144
|
+
// handleMessage(parsedMessage);
|
|
145
|
+
// } catch (error) {
|
|
146
|
+
// console.error('Message parsing error:', error);
|
|
147
|
+
// console.debug('Raw message:', latestMessage.data);
|
|
148
|
+
// }
|
|
149
|
+
// }, [latestMessage?.data, handleMessage]);
|
|
150
|
+
|
|
149
151
|
return {
|
|
150
152
|
ps_status: systemStatus
|
|
151
153
|
};
|
|
@@ -710,7 +712,7 @@ const useUpgrade = _ref => {
|
|
|
710
712
|
children: /*#__PURE__*/jsxRuntime.jsx("a", {
|
|
711
713
|
onClick: e => e.preventDefault(),
|
|
712
714
|
children: /*#__PURE__*/jsxRuntime.jsx("i", {
|
|
713
|
-
className: "iconfont seeder-icon-liebiao2 text-2xl text-neutral-400"
|
|
715
|
+
className: "seeder-iconfont seeder-icon-liebiao2 text-2xl text-neutral-400"
|
|
714
716
|
})
|
|
715
717
|
})
|
|
716
718
|
}), /*#__PURE__*/jsxRuntime.jsx("input", {
|
|
@@ -2036,7 +2038,7 @@ const SystemOperations = _ref => {
|
|
|
2036
2038
|
onRestart,
|
|
2037
2039
|
powerOffLabel = "Power Off",
|
|
2038
2040
|
restartLabel = "Restart",
|
|
2039
|
-
iconClassName = "iconfont seeder-icon-guanji1 text-2xl text-neutral-400",
|
|
2041
|
+
iconClassName = "seeder-iconfont seeder-icon-guanji1 text-2xl text-neutral-400",
|
|
2040
2042
|
confirmTitle = "Confirm",
|
|
2041
2043
|
cancelText = "No",
|
|
2042
2044
|
okText = "Yes",
|