forked from github-starred/komodo
0.1.6
This commit is contained in:
32
Cargo.lock
generated
32
Cargo.lock
generated
@@ -408,8 +408,8 @@ dependencies = [
|
||||
"hex",
|
||||
"hmac",
|
||||
"jwt",
|
||||
"monitor_helpers 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"monitor_types 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"monitor_helpers 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"monitor_types 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mungos",
|
||||
"periphery_client",
|
||||
"serde",
|
||||
@@ -647,7 +647,7 @@ name = "db_client"
|
||||
version = "0.1.4"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"monitor_types 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"monitor_types 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mungos",
|
||||
]
|
||||
|
||||
@@ -1492,7 +1492,7 @@ version = "0.1.5"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"futures-util",
|
||||
"monitor_types 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"monitor_types 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"reqwest",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
@@ -1504,7 +1504,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "monitor_helpers"
|
||||
version = "0.1.5"
|
||||
version = "0.1.6"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async_timing_util",
|
||||
@@ -1512,7 +1512,7 @@ dependencies = [
|
||||
"bollard",
|
||||
"futures",
|
||||
"futures-util",
|
||||
"monitor_types 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"monitor_types 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand",
|
||||
"run_command",
|
||||
"serde",
|
||||
@@ -1523,9 +1523,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "monitor_helpers"
|
||||
version = "0.1.5"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3bd93c7b3cc694e97bd465b0aeee9ae469abf034f12ec29fcc8c8a3de9fd3734"
|
||||
checksum = "978656d0bdc785700d9330ffe4ee2a51c1df03c6104de442ac9256b19e4913c3"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async_timing_util",
|
||||
@@ -1533,7 +1533,7 @@ dependencies = [
|
||||
"bollard",
|
||||
"futures",
|
||||
"futures-util",
|
||||
"monitor_types 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"monitor_types 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand",
|
||||
"run_command",
|
||||
"serde",
|
||||
@@ -1555,8 +1555,8 @@ dependencies = [
|
||||
"dotenv",
|
||||
"envy",
|
||||
"futures-util",
|
||||
"monitor_helpers 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"monitor_types 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"monitor_helpers 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"monitor_types 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"run_command",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
@@ -1570,7 +1570,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "monitor_types"
|
||||
version = "0.1.5"
|
||||
version = "0.1.6"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bollard",
|
||||
@@ -1587,9 +1587,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "monitor_types"
|
||||
version = "0.1.5"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "58e0d8bdd2e64ed2d4253d69ec0816b57205c5f4fc0a831aa0a4ce3b0122a006"
|
||||
checksum = "7d8dd4e96a045558096645f2d7f99c4b8d0ddab3591f315f5f7f8238fcdd819d"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bollard",
|
||||
@@ -1843,8 +1843,8 @@ version = "0.1.4"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"futures-util",
|
||||
"monitor_helpers 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"monitor_types 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"monitor_helpers 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"monitor_types 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"reqwest",
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
||||
@@ -8,8 +8,8 @@ edition = "2021"
|
||||
[dependencies]
|
||||
# helpers = { package = "monitor_helpers", path = "../lib/helpers" }
|
||||
# types = { package = "monitor_types", path = "../lib/types" }
|
||||
helpers = { package = "monitor_helpers", version = "0.1.5" }
|
||||
types = { package = "monitor_types", version = "0.1.5" }
|
||||
helpers = { package = "monitor_helpers", version = "0.1.6" }
|
||||
types = { package = "monitor_types", version = "0.1.6" }
|
||||
db = { package = "db_client", path = "../lib/db_client" }
|
||||
periphery = { package = "periphery_client", path = "../lib/periphery_client" }
|
||||
axum_oauth2 = { path = "../lib/axum_oauth2" }
|
||||
|
||||
@@ -1,7 +1,18 @@
|
||||
import { useParams } from "@solidjs/router";
|
||||
import { Accessor, Component, createSignal, Match, Setter, Show, Signal, Switch } from "solid-js";
|
||||
import {
|
||||
Accessor,
|
||||
Component,
|
||||
createResource,
|
||||
createSignal,
|
||||
Match,
|
||||
Resource,
|
||||
Setter,
|
||||
Show,
|
||||
Switch,
|
||||
} from "solid-js";
|
||||
import { client } from "../..";
|
||||
import { useAppState } from "../../state/StateProvider";
|
||||
import { Timelength } from "../../types";
|
||||
import { SystemInformation, Timelength } from "../../types";
|
||||
import { useLocalStorage } from "../../util/hooks";
|
||||
import Circle from "../shared/Circle";
|
||||
import Icon from "../shared/Icon";
|
||||
@@ -13,11 +24,6 @@ import CurrentStats from "./CurrentStats";
|
||||
import HistoricalStats from "./HistoricalStats";
|
||||
import s from "./stats.module.scss";
|
||||
|
||||
const VIEWS = [
|
||||
"current",
|
||||
"historical"
|
||||
];
|
||||
|
||||
const TIMELENGTHS = [
|
||||
Timelength.OneMinute,
|
||||
Timelength.FiveMinutes,
|
||||
@@ -29,6 +35,7 @@ const TIMELENGTHS = [
|
||||
];
|
||||
|
||||
const Stats: Component<{}> = () => {
|
||||
const params = useParams();
|
||||
const [view, setView] = useLocalStorage("current", "stats-view-v1");
|
||||
const [timelength, setTimelength] = useLocalStorage(
|
||||
Timelength.OneMinute,
|
||||
@@ -36,6 +43,9 @@ const Stats: Component<{}> = () => {
|
||||
);
|
||||
const [page, setPage] = createSignal(0);
|
||||
const [wsOpen, setWsOpen] = createSignal(false);
|
||||
const [sysInfo] = createResource<SystemInformation>(() =>
|
||||
client.get_server_system_info(params.id)
|
||||
);
|
||||
return (
|
||||
<Grid class={s.Content}>
|
||||
<Grid class={s.HeaderArea}>
|
||||
@@ -54,14 +64,9 @@ const Stats: Component<{}> = () => {
|
||||
/>
|
||||
</Flex>
|
||||
</Show>
|
||||
{/* <Selector
|
||||
containerStyle={{ "place-self": "center end" }}
|
||||
targetClass="grey"
|
||||
selected={view()}
|
||||
items={VIEWS}
|
||||
onSelect={setView}
|
||||
position="bottom right"
|
||||
/> */}
|
||||
<Flex alignItems="center">
|
||||
|
||||
</Flex>
|
||||
</Grid>
|
||||
<Switch>
|
||||
<Match when={view() === "current"}>
|
||||
@@ -75,7 +80,11 @@ const Stats: Component<{}> = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export const Header: Component<{ view: string, setView: (view: string) => void; open: boolean }> = (p) => {
|
||||
export const Header: Component<{
|
||||
view: string;
|
||||
setView: (view: string) => void;
|
||||
open: boolean;
|
||||
}> = (p) => {
|
||||
const { servers } = useAppState();
|
||||
const params = useParams();
|
||||
const server = () => servers.get(params.id);
|
||||
@@ -113,11 +122,18 @@ export const Header: Component<{ view: string, setView: (view: string) => void;
|
||||
</Show>
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const PageManager: Component<{ page: Accessor<number>, setPage: Setter<number> }> = (p) => {
|
||||
const PageManager: Component<{
|
||||
page: Accessor<number>;
|
||||
setPage: Setter<number>;
|
||||
}> = (p) => {
|
||||
return (
|
||||
<Flex class="card light shadow" alignItems="center" style={{ padding: "0.5rem" }}>
|
||||
<Flex
|
||||
class="card light shadow"
|
||||
alignItems="center"
|
||||
style={{ padding: "0.5rem" }}
|
||||
>
|
||||
<button
|
||||
class="darkgrey"
|
||||
onClick={() => {
|
||||
@@ -145,6 +161,6 @@ const PageManager: Component<{ page: Accessor<number>, setPage: Setter<number> }
|
||||
<div>page: {p.page() + 1}</div>
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default Stats;
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
Server,
|
||||
ServerActionState,
|
||||
ServerWithStatus,
|
||||
SystemInformation,
|
||||
SystemStats,
|
||||
SystemStatsQuery,
|
||||
SystemStatsRecord,
|
||||
@@ -227,6 +228,14 @@ export class Client {
|
||||
return this.get(`/api/server/${id}/docker_accounts`);
|
||||
}
|
||||
|
||||
get_server_version(id: string): Promise<string> {
|
||||
return this.get(`/api/server/${id}/version`);
|
||||
}
|
||||
|
||||
get_server_system_info(id: string): Promise<SystemInformation> {
|
||||
return this.get(`/api/server/${id}/system_information`)
|
||||
}
|
||||
|
||||
create_server(body: CreateServerBody): Promise<Server> {
|
||||
return this.post("/api/server/create", body);
|
||||
}
|
||||
@@ -305,8 +314,9 @@ export class Client {
|
||||
get_build_action_state(id: string): Promise<BuildActionState> {
|
||||
return this.get(`/api/build/${id}/action_state`);
|
||||
}
|
||||
|
||||
get_build_versions(id: string, query?: BuildVersionsQuery): Promise<BuildVersionsReponse> {
|
||||
return this.get(`/api/build/${id}/versions${generateQuery(query)}`);
|
||||
return this.get(`/api/build/${id}/versions${generateQuery(query as any)}`);
|
||||
}
|
||||
|
||||
create_build(body: CreateBuildBody): Promise<Build> {
|
||||
|
||||
@@ -8,7 +8,7 @@ export function inPx(num: number) {
|
||||
return `${num}px`;
|
||||
}
|
||||
|
||||
export type QueryObject = Record<string, string | number | undefined>;
|
||||
export type QueryObject = Record<string, string | number | boolean | undefined>;
|
||||
|
||||
export function generateQuery(query?: QueryObject) {
|
||||
if (query) {
|
||||
|
||||
@@ -6,7 +6,7 @@ edition = "2021"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
types = { package = "monitor_types", version = "0.1.5" }
|
||||
types = { package = "monitor_types", version = "0.1.6" }
|
||||
# types = { package = "monitor_types", path = "../types" }
|
||||
mungos = "0.3.0"
|
||||
anyhow = "1.0"
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "monitor_helpers"
|
||||
version = "0.1.5"
|
||||
version = "0.1.6"
|
||||
edition = "2021"
|
||||
authors = ["MoghTech"]
|
||||
description = "helpers used as dependency for mogh tech monitor"
|
||||
@@ -10,7 +10,7 @@ license = "GPL-3.0-or-later"
|
||||
|
||||
[dependencies]
|
||||
# types = { package = "monitor_types", path = "../types" }
|
||||
types = { package = "monitor_types", version = "0.1.5" }
|
||||
types = { package = "monitor_types", version = "0.1.6" }
|
||||
async_timing_util = "0.1.12"
|
||||
bollard = "0.13"
|
||||
anyhow = "1.0"
|
||||
|
||||
@@ -9,7 +9,7 @@ license = "GPL-3.0-or-later"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
monitor_types = "0.1.5"
|
||||
monitor_types = "0.1.6"
|
||||
# monitor_types = { path = "../types" }
|
||||
reqwest = { version = "0.11", features = ["json"] }
|
||||
tokio-tungstenite = { version = "0.18", features=["native-tls"] }
|
||||
|
||||
@@ -6,8 +6,8 @@ edition = "2021"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
helpers = { package = "monitor_helpers", version = "0.1.5" }
|
||||
types = { package = "monitor_types", version = "0.1.5" }
|
||||
helpers = { package = "monitor_helpers", version = "0.1.6" }
|
||||
types = { package = "monitor_types", version = "0.1.6" }
|
||||
# types = { package = "monitor_types", path = "../types" }
|
||||
# helpers = { package = "monitor_helpers", path = "../helpers" }
|
||||
tokio-tungstenite = { version = "0.18", features=["native-tls"] }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "monitor_types"
|
||||
version = "0.1.5"
|
||||
version = "0.1.6"
|
||||
edition = "2021"
|
||||
authors = ["MoghTech"]
|
||||
description = "types for the mogh tech monitor"
|
||||
|
||||
@@ -260,8 +260,10 @@ pub struct SystemStatsRecord {
|
||||
pub id: String,
|
||||
pub server_id: String,
|
||||
pub ts: f64, // unix ts milliseconds
|
||||
#[serde(default)]
|
||||
pub system_load: f64,
|
||||
pub cpu_perc: f32, // in %
|
||||
#[serde(default)]
|
||||
pub cpu_freq_mhz: f64, // in MHz
|
||||
pub mem_used_gb: f64, // in GB
|
||||
pub mem_total_gb: f64, // in GB
|
||||
|
||||
@@ -15,8 +15,8 @@ path = "src/main.rs"
|
||||
[dependencies]
|
||||
# helpers = { package = "monitor_helpers", path = "../lib/helpers" }
|
||||
# types = { package = "monitor_types", path = "../lib/types" }
|
||||
helpers = { package = "monitor_helpers", version = "0.1.5" }
|
||||
types = { package = "monitor_types", version = "0.1.5" }
|
||||
helpers = { package = "monitor_helpers", version = "0.1.6" }
|
||||
types = { package = "monitor_types", version = "0.1.6" }
|
||||
run_command = { version = "0.0.5", features = ["async_tokio"] }
|
||||
async_timing_util = "0.1.12"
|
||||
tokio = { version = "1.24", features = ["full"] }
|
||||
|
||||
Reference in New Issue
Block a user