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.esm.js CHANGED
@@ -1,7 +1,7 @@
1
- import { useState, useCallback, useEffect, memo, useMemo, useRef } from 'react';
2
- import { useWebSocket, useInterval } from 'ahooks';
1
+ import { memo, useState, useCallback, useEffect, useMemo, useRef } from 'react';
3
2
  import { Tooltip, Space, Flex, Divider, App, Modal, Form, Input, Alert, message, Dropdown, Spin, InputNumber, ConfigProvider, Badge, Switch, Select, Typography, List, Empty, Button, Checkbox, Row, Col } from 'antd';
4
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
+ import { useWebSocket, useInterval } from 'ahooks';
5
5
  import { LoadingOutlined, ExclamationCircleFilled, PlusOutlined } from '@ant-design/icons';
6
6
  import axios from 'axios';
7
7
 
@@ -69,6 +69,44 @@ function _toPropertyKey(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(Space, {
98
+ size: 4,
99
+ children: [/*#__PURE__*/jsx("i", {
100
+ className: "iconfont ".concat(iconClass, " text-xl")
101
+ }), /*#__PURE__*/jsx("span", {
102
+ className: "inline-block w-10 text-center",
103
+ children: children
104
+ })]
105
+ })
106
+ });
107
+ });
108
+ var UsageItem$1 = UsageItem;
109
+
72
110
  const useHardwareWebSocket = socketUrl => {
73
111
  // cpu_percent cpu使用率
74
112
  // cpu_freq.current cpu频率
@@ -112,44 +150,6 @@ const useHardwareWebSocket = socketUrl => {
112
150
  };
113
151
  var useHardwareWebSocket$1 = useHardwareWebSocket;
114
152
 
115
- const formatBytes = function (bytes) {
116
- let decimals = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
117
- if (bytes === 0 || !bytes || bytes < 0) return '0 Bytes';
118
- const k = 1024;
119
- const dm = decimals < 0 ? 0 : decimals;
120
- const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
121
- const i = Math.floor(Math.log(bytes) / Math.log(k));
122
- return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
123
- };
124
- const UsageItem = /*#__PURE__*/memo(_ref => {
125
- let {
126
- title,
127
- iconClass,
128
- children,
129
- memTotal
130
- } = _ref;
131
- return /*#__PURE__*/jsx(Tooltip, {
132
- title: /*#__PURE__*/jsxs(Fragment, {
133
- children: [/*#__PURE__*/jsx("div", {
134
- children: title
135
- }), title === 'Memory Usage' && memTotal !== undefined && /*#__PURE__*/jsxs("div", {
136
- children: ["Total Memory: ", formatBytes(memTotal)]
137
- })]
138
- }),
139
- destroyOnHidden: false,
140
- children: /*#__PURE__*/jsxs(Space, {
141
- size: 4,
142
- children: [/*#__PURE__*/jsx("i", {
143
- className: "iconfont ".concat(iconClass, " text-xl")
144
- }), /*#__PURE__*/jsx("span", {
145
- className: "inline-block w-10 text-center",
146
- children: children
147
- })]
148
- })
149
- });
150
- });
151
- var UsageItem$1 = UsageItem;
152
-
153
153
  const getMaxNicTemp = function (sensors) {
154
154
  let priorityFields = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ["i350bb", "r8169_0_8300:00"];
155
155
  const temps = priorityFields.flatMap(field => {
@@ -226,7 +226,10 @@ const getItems = details => {
226
226
  }
227
227
  return items;
228
228
  };
229
- const useHardwareUsage = ps_status => {
229
+ const useHardwareUsage = socketUrl => {
230
+ const {
231
+ ps_status
232
+ } = useHardwareWebSocket$1(socketUrl);
230
233
  return useMemo(() => {
231
234
  if (!ps_status || typeof ps_status !== 'object') return null;
232
235
  const statusItems = getItems(getDetail(ps_status));
@@ -3181,5 +3184,5 @@ const Preset = _ref => {
3181
3184
  };
3182
3185
  var PresetModal = /*#__PURE__*/memo(Preset);
3183
3186
 
3184
- export { AuthorizationModal$1 as AuthorizationModal, NetworkSettingsModal$1 as NetworkSettingsModal, PresetModal, PtpModal$1 as PtpModal, SystemOperations$1 as SystemOperations, UpgradeManager$1 as UpgradeManager, useAuth, useHardwareUsage$1 as useHardwareUsage, useHardwareWebSocket$1 as useHardwareWebSocket, useSystemOperations$1 as useSystemOperations, useUpgrade$1 as useUpgrade };
3187
+ export { AuthorizationModal$1 as AuthorizationModal, NetworkSettingsModal$1 as NetworkSettingsModal, PresetModal, PtpModal$1 as PtpModal, SystemOperations$1 as SystemOperations, UpgradeManager$1 as UpgradeManager, useAuth, useHardwareUsage$1 as useHardwareUsage, useSystemOperations$1 as useSystemOperations, useUpgrade$1 as useUpgrade };
3185
3188
  //# sourceMappingURL=index.esm.js.map