seeder-st2110-components 1.3.6 → 1.3.7

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.js CHANGED
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  var react = require('react');
4
- var ahooks = require('ahooks');
5
4
  var antd = require('antd');
6
5
  var jsxRuntime = require('react/jsx-runtime');
6
+ var ahooks = require('ahooks');
7
7
  var icons = require('@ant-design/icons');
8
8
  var axios = require('axios');
9
9
 
@@ -71,6 +71,44 @@ function _toPropertyKey(t) {
71
71
  return "symbol" == typeof i ? i : i + "";
72
72
  }
73
73
 
74
+ const formatBytes = function (bytes) {
75
+ let decimals = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
76
+ if (bytes === 0 || !bytes || bytes < 0) return '0 Bytes';
77
+ const k = 1024;
78
+ const dm = decimals < 0 ? 0 : decimals;
79
+ const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
80
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
81
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
82
+ };
83
+ const UsageItem = /*#__PURE__*/react.memo(_ref => {
84
+ let {
85
+ title,
86
+ iconClass,
87
+ children,
88
+ memTotal
89
+ } = _ref;
90
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
91
+ title: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
92
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
93
+ children: title
94
+ }), title === 'Memory Usage' && memTotal !== undefined && /*#__PURE__*/jsxRuntime.jsxs("div", {
95
+ children: ["Total Memory: ", formatBytes(memTotal)]
96
+ })]
97
+ }),
98
+ destroyOnHidden: false,
99
+ children: /*#__PURE__*/jsxRuntime.jsxs(antd.Space, {
100
+ size: 4,
101
+ children: [/*#__PURE__*/jsxRuntime.jsx("i", {
102
+ className: "iconfont ".concat(iconClass, " text-xl")
103
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
104
+ className: "inline-block w-10 text-center",
105
+ children: children
106
+ })]
107
+ })
108
+ });
109
+ });
110
+ var UsageItem$1 = UsageItem;
111
+
74
112
  const useHardwareWebSocket = socketUrl => {
75
113
  // cpu_percent cpu使用率
76
114
  // cpu_freq.current cpu频率
@@ -114,44 +152,6 @@ const useHardwareWebSocket = socketUrl => {
114
152
  };
115
153
  var useHardwareWebSocket$1 = useHardwareWebSocket;
116
154
 
117
- const formatBytes = function (bytes) {
118
- let decimals = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
119
- if (bytes === 0 || !bytes || bytes < 0) return '0 Bytes';
120
- const k = 1024;
121
- const dm = decimals < 0 ? 0 : decimals;
122
- const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
123
- const i = Math.floor(Math.log(bytes) / Math.log(k));
124
- return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
125
- };
126
- const UsageItem = /*#__PURE__*/react.memo(_ref => {
127
- let {
128
- title,
129
- iconClass,
130
- children,
131
- memTotal
132
- } = _ref;
133
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
134
- title: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
135
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
136
- children: title
137
- }), title === 'Memory Usage' && memTotal !== undefined && /*#__PURE__*/jsxRuntime.jsxs("div", {
138
- children: ["Total Memory: ", formatBytes(memTotal)]
139
- })]
140
- }),
141
- destroyOnHidden: false,
142
- children: /*#__PURE__*/jsxRuntime.jsxs(antd.Space, {
143
- size: 4,
144
- children: [/*#__PURE__*/jsxRuntime.jsx("i", {
145
- className: "iconfont ".concat(iconClass, " text-xl")
146
- }), /*#__PURE__*/jsxRuntime.jsx("span", {
147
- className: "inline-block w-10 text-center",
148
- children: children
149
- })]
150
- })
151
- });
152
- });
153
- var UsageItem$1 = UsageItem;
154
-
155
155
  const getMaxNicTemp = function (sensors) {
156
156
  let priorityFields = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ["i350bb", "r8169_0_8300:00"];
157
157
  const temps = priorityFields.flatMap(field => {
@@ -228,7 +228,10 @@ const getItems = details => {
228
228
  }
229
229
  return items;
230
230
  };
231
- const useHardwareUsage = ps_status => {
231
+ const useHardwareUsage = socketUrl => {
232
+ const {
233
+ ps_status
234
+ } = useHardwareWebSocket$1(socketUrl);
232
235
  return react.useMemo(() => {
233
236
  if (!ps_status || typeof ps_status !== 'object') return null;
234
237
  const statusItems = getItems(getDetail(ps_status));
@@ -3191,7 +3194,6 @@ exports.SystemOperations = SystemOperations$1;
3191
3194
  exports.UpgradeManager = UpgradeManager$1;
3192
3195
  exports.useAuth = useAuth;
3193
3196
  exports.useHardwareUsage = useHardwareUsage$1;
3194
- exports.useHardwareWebSocket = useHardwareWebSocket$1;
3195
3197
  exports.useSystemOperations = useSystemOperations$1;
3196
3198
  exports.useUpgrade = useUpgrade$1;
3197
3199
  //# sourceMappingURL=index.js.map