add: some util to dashboard
This commit is contained in:
170
pkgs/ui/src/data/dashboardData.tsx
Normal file
170
pkgs/ui/src/data/dashboardData.tsx
Normal file
@@ -0,0 +1,170 @@
|
||||
export const status = {
|
||||
online: "online",
|
||||
offline: "offline",
|
||||
pending: "pending",
|
||||
} as const;
|
||||
// Convert object keys in a union type
|
||||
export type Status = (typeof status)[keyof typeof status];
|
||||
|
||||
export type Network = {
|
||||
name: string;
|
||||
id: string;
|
||||
};
|
||||
|
||||
export type ClanDevice = {
|
||||
id: string;
|
||||
name: string;
|
||||
status: Status;
|
||||
ipv6: string;
|
||||
networks: Network[];
|
||||
};
|
||||
|
||||
export type ClanStatus = {
|
||||
self: ClanDevice;
|
||||
other: ClanDevice[];
|
||||
};
|
||||
export const clanStatus: ClanStatus = {
|
||||
self: {
|
||||
id: "1",
|
||||
name: "My Computer",
|
||||
ipv6: "",
|
||||
status: "online",
|
||||
networks: [
|
||||
{
|
||||
name: "Family",
|
||||
id: "1",
|
||||
},
|
||||
{
|
||||
name: "Fight-Club",
|
||||
id: "1",
|
||||
},
|
||||
],
|
||||
},
|
||||
// other: [],
|
||||
other: [
|
||||
{
|
||||
id: "2",
|
||||
name: "Daddies Computer",
|
||||
status: "online",
|
||||
networks: [
|
||||
{
|
||||
name: "Family",
|
||||
id: "1",
|
||||
},
|
||||
],
|
||||
ipv6: "",
|
||||
},
|
||||
{
|
||||
id: "3",
|
||||
name: "Lars Notebook",
|
||||
status: "offline",
|
||||
networks: [
|
||||
{
|
||||
name: "Family",
|
||||
id: "1",
|
||||
},
|
||||
],
|
||||
ipv6: "",
|
||||
},
|
||||
{
|
||||
id: "4",
|
||||
name: "Cassie Computer",
|
||||
status: "pending",
|
||||
networks: [
|
||||
{
|
||||
name: "Family",
|
||||
id: "1",
|
||||
},
|
||||
{
|
||||
name: "Fight-Club",
|
||||
id: "2",
|
||||
},
|
||||
],
|
||||
ipv6: "",
|
||||
},
|
||||
{
|
||||
id: "5",
|
||||
name: "Chuck Norris Computer",
|
||||
status: "online",
|
||||
networks: [
|
||||
{
|
||||
name: "Fight-Club",
|
||||
id: "2",
|
||||
},
|
||||
],
|
||||
ipv6: "",
|
||||
},
|
||||
{
|
||||
id: "6",
|
||||
name: "Ella Bright",
|
||||
status: "pending",
|
||||
networks: [
|
||||
{
|
||||
name: "Fight-Club",
|
||||
id: "2",
|
||||
},
|
||||
],
|
||||
ipv6: "",
|
||||
},
|
||||
{
|
||||
id: "7",
|
||||
name: "Ryan Flabberghast",
|
||||
status: "offline",
|
||||
networks: [
|
||||
{
|
||||
name: "Fight-Club",
|
||||
id: "2",
|
||||
},
|
||||
],
|
||||
ipv6: "",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const severity = {
|
||||
info: "info",
|
||||
success: "success",
|
||||
warning: "warning",
|
||||
error: "error",
|
||||
} as const;
|
||||
// Convert object keys in a union type
|
||||
export type Severity = (typeof severity)[keyof typeof severity];
|
||||
|
||||
export type Notification = {
|
||||
id: string;
|
||||
msg: string;
|
||||
source: string;
|
||||
date: string;
|
||||
severity: Severity;
|
||||
};
|
||||
|
||||
export const notificationData: Notification[] = [
|
||||
{
|
||||
id: "1",
|
||||
date: "2022-12-27 08:26:49.219717",
|
||||
severity: "success",
|
||||
msg: "Defeated zombie mob flawless",
|
||||
source: "Chuck Norris Computer",
|
||||
},
|
||||
{
|
||||
id: "2",
|
||||
date: "2022-12-27 08:26:49.219717",
|
||||
severity: "error",
|
||||
msg: "Application Crashed: my little pony",
|
||||
source: "Cassie Computer",
|
||||
},
|
||||
{
|
||||
id: "3",
|
||||
date: "2022-12-27 08:26:49.219717",
|
||||
severity: "warning",
|
||||
msg: "Security update necessary",
|
||||
source: "Daddies Computer",
|
||||
},
|
||||
{
|
||||
id: "4",
|
||||
date: "2022-12-27 08:26:49.219717",
|
||||
severity: "info",
|
||||
msg: "Decompressed snowflakes",
|
||||
source: "My Computer",
|
||||
},
|
||||
];
|
||||
97
pkgs/ui/src/data/nodeData.tsx
Normal file
97
pkgs/ui/src/data/nodeData.tsx
Normal file
@@ -0,0 +1,97 @@
|
||||
export interface TableData {
|
||||
name: string;
|
||||
id: string;
|
||||
status: NodeStatus;
|
||||
last_seen: number;
|
||||
}
|
||||
|
||||
export enum NodeStatus {
|
||||
Online,
|
||||
Offline,
|
||||
Pending,
|
||||
}
|
||||
|
||||
function createData(
|
||||
name: string,
|
||||
id: string,
|
||||
status: NodeStatus,
|
||||
last_seen: number,
|
||||
): TableData {
|
||||
return {
|
||||
name,
|
||||
id,
|
||||
status,
|
||||
last_seen: last_seen,
|
||||
};
|
||||
}
|
||||
|
||||
export const tableData = [
|
||||
createData(
|
||||
"Matchbox",
|
||||
"42:0:f21:6916:e333:c47e:4b5c:e74c",
|
||||
NodeStatus.Pending,
|
||||
0,
|
||||
),
|
||||
createData(
|
||||
"Ahorn",
|
||||
"42:0:3c46:b51c:b34d:b7e1:3b02:8d24",
|
||||
NodeStatus.Online,
|
||||
0,
|
||||
),
|
||||
createData(
|
||||
"Yellow",
|
||||
"42:0:3c46:98ac:9c80:4f25:50e3:1d8f",
|
||||
NodeStatus.Offline,
|
||||
16.0,
|
||||
),
|
||||
createData(
|
||||
"Rauter",
|
||||
"42:0:61ea:b777:61ea:803:f885:3523",
|
||||
NodeStatus.Offline,
|
||||
6.0,
|
||||
),
|
||||
createData(
|
||||
"Porree",
|
||||
"42:0:e644:4499:d034:895e:34c8:6f9a",
|
||||
NodeStatus.Offline,
|
||||
13,
|
||||
),
|
||||
createData(
|
||||
"Helsinki",
|
||||
"42:0:3c46:fd4a:acf9:e971:6036:8047",
|
||||
NodeStatus.Online,
|
||||
0,
|
||||
),
|
||||
createData(
|
||||
"Kelle",
|
||||
"42:0:3c46:362d:a9aa:4996:c78e:839a",
|
||||
NodeStatus.Online,
|
||||
0,
|
||||
),
|
||||
createData(
|
||||
"Shodan",
|
||||
"42:0:3c46:6745:adf4:a844:26c4:bf91",
|
||||
NodeStatus.Online,
|
||||
0.0,
|
||||
),
|
||||
createData(
|
||||
"Qubasa",
|
||||
"42:0:3c46:123e:bbea:3529:db39:6764",
|
||||
NodeStatus.Offline,
|
||||
7.0,
|
||||
),
|
||||
createData(
|
||||
"Green",
|
||||
"42:0:a46e:5af:632c:d2fe:a71d:cde0",
|
||||
NodeStatus.Offline,
|
||||
2,
|
||||
),
|
||||
createData("Gum", "42:0:e644:238d:3e46:c884:6ec5:16c", NodeStatus.Offline, 0),
|
||||
createData("Xu", "42:0:ca48:c2c2:19fb:a0e9:95b9:794f", NodeStatus.Online, 0),
|
||||
createData(
|
||||
"Zaatar",
|
||||
"42:0:3c46:156e:10b6:3bd6:6e82:b2cd",
|
||||
NodeStatus.Online,
|
||||
0,
|
||||
),
|
||||
];
|
||||
Reference in New Issue
Block a user