Skip to content

Commit b9830cf

Browse files
committed
react 1.0.12
1 parent 6003f68 commit b9830cf

File tree

5 files changed

+47
-17
lines changed

5 files changed

+47
-17
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Openmesh Network
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

ts/package/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"type": "git",
66
"url": "git+https://github.com/Openmesh-Network/xnode-manager-sdk.git"
77
},
8+
"license": "MIT",
89
"type": "module",
910
"main": "dist/index.cjs",
1011
"module": "dist/index.js",

ts/react/package-lock.json

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ts/react/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
22
"name": "@openmesh-network/xnode-manager-sdk-react",
3-
"version": "1.0.11",
3+
"version": "1.0.12",
44
"repository": {
55
"type": "git",
66
"url": "git+https://github.com/Openmesh-Network/xnode-manager-sdk.git"
77
},
8+
"license": "MIT",
89
"type": "module",
910
"main": "dist/index.cjs",
1011
"module": "dist/index.js",
@@ -16,7 +17,7 @@
1617
"prepublishOnly": "tsc && rollup -c"
1718
},
1819
"peerDependencies": {
19-
"@openmesh-network/xnode-manager-sdk": "^1.0.5",
20+
"@openmesh-network/xnode-manager-sdk": "^1.0.6",
2021
"@tanstack/react-query": "^5",
2122
"react": "^18 || ^19",
2223
"typescript": ">=5.0.4"

ts/react/src/usage.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,25 @@ import { xnode } from "@openmesh-network/xnode-manager-sdk";
33

44
export function useUsageCpu({
55
session,
6+
scope,
67
overrides,
78
}: UseQueryInput<
89
xnode.usage.cpu_input,
910
xnode.usage.cpu_output
1011
>): UseQueryOutput<xnode.usage.cpu_output> {
1112
return useQuery(
1213
{
13-
queryKey: ["useUsageCpu", session?.baseUrl ?? ""],
14-
enabled: !!session,
14+
queryKey: ["useUsageCpu", session?.baseUrl ?? "", scope ?? ""],
15+
enabled: !!session && !!scope,
1516
refetchInterval: 1000, // 1 second
1617
queryFn: async () => {
17-
if (!session) {
18+
if (!session || !scope) {
1819
return undefined;
1920
}
2021

2122
return await xnode.usage.cpu({
2223
session,
24+
path: { scope },
2325
});
2426
},
2527
},
@@ -29,23 +31,25 @@ export function useUsageCpu({
2931

3032
export function useUsageMemory({
3133
session,
34+
scope,
3235
overrides,
3336
}: UseQueryInput<
3437
xnode.usage.memory_input,
3538
xnode.usage.memory_output
3639
>): UseQueryOutput<xnode.usage.memory_output> {
3740
return useQuery(
3841
{
39-
queryKey: ["useUsageMemory", session?.baseUrl ?? ""],
40-
enabled: !!session,
42+
queryKey: ["useUsageMemory", session?.baseUrl ?? "", scope ?? ""],
43+
enabled: !!session && !!scope,
4144
refetchInterval: 1000, // 1 second
4245
queryFn: async () => {
43-
if (!session) {
46+
if (!session || !scope) {
4447
return undefined;
4548
}
4649

4750
return await xnode.usage.memory({
4851
session,
52+
path: { scope },
4953
});
5054
},
5155
},
@@ -55,23 +59,25 @@ export function useUsageMemory({
5559

5660
export function useUsageDisk({
5761
session,
62+
scope,
5863
overrides,
5964
}: UseQueryInput<
6065
xnode.usage.disk_input,
6166
xnode.usage.disk_output
6267
>): UseQueryOutput<xnode.usage.disk_output> {
6368
return useQuery(
6469
{
65-
queryKey: ["useUsageDisk", session?.baseUrl ?? ""],
66-
enabled: !!session,
70+
queryKey: ["useUsageDisk", session?.baseUrl ?? "", scope ?? ""],
71+
enabled: !!session && !!scope,
6772
refetchInterval: 1000, // 1 second
6873
queryFn: async () => {
69-
if (!session) {
74+
if (!session || !scope) {
7075
return undefined;
7176
}
7277

7378
return await xnode.usage.disk({
7479
session,
80+
path: { scope },
7581
});
7682
},
7783
},

0 commit comments

Comments
 (0)