@axium/sysadmin 0.2.2 → 0.2.4
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/db.json +4 -4
- package/dist/client/web.d.ts +1 -0
- package/dist/client/web.js +12 -0
- package/dist/common.d.ts +7 -0
- package/dist/server/socket.js +10 -4
- package/package.json +1 -1
- package/routes/sysadmin/+page.svelte +2 -2
- package/routes/sysadmin/systems/+page.svelte +2 -2
- package/routes/sysadmin/users/[id]/+page.svelte +2 -2
package/db.json
CHANGED
|
@@ -5,20 +5,20 @@
|
|
|
5
5
|
{
|
|
6
6
|
"delta": false,
|
|
7
7
|
"tables": {
|
|
8
|
-
"
|
|
8
|
+
"system_users": {
|
|
9
9
|
"columns": {
|
|
10
10
|
"id": { "type": "uuid", "required": true, "primary": true, "default": "gen_random_uuid()" },
|
|
11
11
|
"userId": { "type": "uuid", "required": true, "references": "users.id", "onDelete": "cascade" },
|
|
12
12
|
"name": { "type": "text", "required": true },
|
|
13
|
-
"
|
|
13
|
+
"username": { "type": "text", "required": true }
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
|
-
"
|
|
16
|
+
"systems": {
|
|
17
17
|
"columns": {
|
|
18
18
|
"id": { "type": "uuid", "required": true, "primary": true, "default": "gen_random_uuid()" },
|
|
19
19
|
"userId": { "type": "uuid", "required": true, "references": "users.id", "onDelete": "cascade" },
|
|
20
20
|
"name": { "type": "text", "required": true },
|
|
21
|
-
"
|
|
21
|
+
"hostname": { "type": "text", "required": true }
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"acl.systems": {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getOnlineHosts(): Promise<string[]>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { socket } from '@axium/client/socket';
|
|
2
|
+
export async function getOnlineHosts() {
|
|
3
|
+
if (!socket)
|
|
4
|
+
return [];
|
|
5
|
+
try {
|
|
6
|
+
const systems = await socket.emitWithAck('sysadmin:ping');
|
|
7
|
+
return systems.map(s => s.hostname);
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
}
|
package/dist/common.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export declare const System: z.ZodObject<{
|
|
|
26
26
|
user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
27
27
|
id: z.ZodUUID;
|
|
28
28
|
name: z.ZodString;
|
|
29
|
+
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
29
30
|
email: z.ZodOptional<z.ZodEmail>;
|
|
30
31
|
emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
|
|
31
32
|
preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
|
|
@@ -80,6 +81,7 @@ declare const SysadminAPI: {
|
|
|
80
81
|
user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
81
82
|
id: z.ZodUUID;
|
|
82
83
|
name: z.ZodString;
|
|
84
|
+
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
83
85
|
email: z.ZodOptional<z.ZodEmail>;
|
|
84
86
|
emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
|
|
85
87
|
preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
|
|
@@ -115,6 +117,7 @@ declare const SysadminAPI: {
|
|
|
115
117
|
user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
116
118
|
id: z.ZodUUID;
|
|
117
119
|
name: z.ZodString;
|
|
120
|
+
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
118
121
|
email: z.ZodOptional<z.ZodEmail>;
|
|
119
122
|
emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
|
|
120
123
|
preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
|
|
@@ -164,6 +167,7 @@ declare const SysadminAPI: {
|
|
|
164
167
|
user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
165
168
|
id: z.ZodUUID;
|
|
166
169
|
name: z.ZodString;
|
|
170
|
+
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
167
171
|
email: z.ZodOptional<z.ZodEmail>;
|
|
168
172
|
emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
|
|
169
173
|
preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
|
|
@@ -199,6 +203,7 @@ declare const SysadminAPI: {
|
|
|
199
203
|
user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
200
204
|
id: z.ZodUUID;
|
|
201
205
|
name: z.ZodString;
|
|
206
|
+
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
202
207
|
email: z.ZodOptional<z.ZodEmail>;
|
|
203
208
|
emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
|
|
204
209
|
preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
|
|
@@ -229,6 +234,7 @@ declare const SysadminAPI: {
|
|
|
229
234
|
user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
230
235
|
id: z.ZodUUID;
|
|
231
236
|
name: z.ZodString;
|
|
237
|
+
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
232
238
|
email: z.ZodOptional<z.ZodEmail>;
|
|
233
239
|
emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
|
|
234
240
|
preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
|
|
@@ -284,6 +290,7 @@ declare const SysadminAPI: {
|
|
|
284
290
|
user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
285
291
|
id: z.ZodUUID;
|
|
286
292
|
name: z.ZodString;
|
|
293
|
+
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
287
294
|
email: z.ZodOptional<z.ZodEmail>;
|
|
288
295
|
emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
|
|
289
296
|
preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
|
package/dist/server/socket.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { addListener, io } from '@axium/server/socket';
|
|
2
2
|
addListener('sysadmin:ping', async (socket, cb) => {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
cb(await io
|
|
4
|
+
.in(`local:${socket.data.user.id}`)
|
|
5
|
+
.timeout(5000)
|
|
6
|
+
.emitWithAck('sysadmin:ping')
|
|
7
|
+
.catch(e => e.responses || []));
|
|
5
8
|
});
|
|
6
9
|
addListener('sysadmin:getSystemInfo', async (socket, cb) => {
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
cb(await io
|
|
11
|
+
.in(`local:${socket.data.user.id}`)
|
|
12
|
+
.timeout(5000)
|
|
13
|
+
.emitWithAck('sysadmin:getSystemInfo')
|
|
14
|
+
.catch(e => e.responses || []));
|
|
9
15
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { text } from '@axium/client';
|
|
3
3
|
import { Icon } from '@axium/client/components';
|
|
4
|
-
import {
|
|
4
|
+
import { getOnlineHosts } from '@axium/sysadmin/client/web';
|
|
5
5
|
import { SystemCard, SystemInitDialog, UserCard, UserInitDialog } from '@axium/sysadmin/components';
|
|
6
6
|
|
|
7
7
|
const { data } = $props();
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
let systems = $state(data.systems);
|
|
10
10
|
let users = $state(data.users);
|
|
11
11
|
|
|
12
|
-
const onlineHosts = $derived(await
|
|
12
|
+
const onlineHosts = $derived(await getOnlineHosts());
|
|
13
13
|
</script>
|
|
14
14
|
|
|
15
15
|
<svelte:head>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { text } from '@axium/client';
|
|
3
3
|
import { Icon } from '@axium/client/components';
|
|
4
|
-
import {
|
|
4
|
+
import { getOnlineHosts } from '@axium/sysadmin/client/web';
|
|
5
5
|
import { SystemCard, SystemInitDialog } from '@axium/sysadmin/components';
|
|
6
6
|
|
|
7
7
|
const { data } = $props();
|
|
8
8
|
|
|
9
9
|
let systems = $state(data.systems);
|
|
10
10
|
|
|
11
|
-
const onlineHosts = $derived(await
|
|
11
|
+
const onlineHosts = $derived(await getOnlineHosts());
|
|
12
12
|
</script>
|
|
13
13
|
|
|
14
14
|
<svelte:head>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { goto } from '$app/navigation';
|
|
3
3
|
import { fetchAPI, text } from '@axium/client';
|
|
4
4
|
import { Icon } from '@axium/client/components';
|
|
5
|
-
import {
|
|
5
|
+
import { getOnlineHosts } from '@axium/sysadmin/client/web';
|
|
6
6
|
import { toastStatus } from '@axium/client/toast';
|
|
7
7
|
import { SystemCard, UserInitDialog } from '@axium/sysadmin/components';
|
|
8
8
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
let systems = $state(data.systems);
|
|
13
13
|
let editDialog = $state<HTMLDialogElement>();
|
|
14
14
|
|
|
15
|
-
const onlineHosts = $derived(await
|
|
15
|
+
const onlineHosts = $derived(await getOnlineHosts());
|
|
16
16
|
|
|
17
17
|
function remove() {
|
|
18
18
|
toastStatus(
|