forked from github-starred/komodo
Compare commits
41 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1cd0018b93 | ||
|
|
359789ee29 | ||
|
|
e79c860c0f | ||
|
|
765f53f30e | ||
|
|
3c3c21d7f5 | ||
|
|
eb700cb500 | ||
|
|
b3b723a717 | ||
|
|
555c230d2e | ||
|
|
adf4b97aef | ||
|
|
32c38d796b | ||
|
|
c8829e15ed | ||
|
|
453df417d0 | ||
|
|
02a7741a9c | ||
|
|
96fc5b0ca8 | ||
|
|
b13e624a66 | ||
|
|
6a8f66f272 | ||
|
|
0c638a08fd | ||
|
|
b07f8af8e5 | ||
|
|
3bbb2a985f | ||
|
|
afdf71c545 | ||
|
|
8de8d2df9a | ||
|
|
1dffdbddc2 | ||
|
|
11fff633b0 | ||
|
|
61bc44d1f4 | ||
|
|
e8fabb8cfa | ||
|
|
7a50885847 | ||
|
|
6239da45f4 | ||
|
|
af597eb3c7 | ||
|
|
d66cda068c | ||
|
|
91fcd07c1c | ||
|
|
85aa470da1 | ||
|
|
6f0d5f37a5 | ||
|
|
1b4d604404 | ||
|
|
a7f6cbe0b9 | ||
|
|
9cf28bf123 | ||
|
|
c92e04294a | ||
|
|
36f059b455 | ||
|
|
4aac301852 | ||
|
|
b375708bbd | ||
|
|
10b6a9482b | ||
|
|
84d45c5df8 |
327
Cargo.lock
generated
327
Cargo.lock
generated
@@ -37,6 +37,46 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstream"
|
||||
version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "342258dd14006105c2b75ab1bd7543a03bdf0cfc94383303ac212a04939dff6f"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"anstyle-parse",
|
||||
"anstyle-wincon",
|
||||
"concolor-override",
|
||||
"concolor-query",
|
||||
"is-terminal",
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23ea9e81bd02e310c216d080f6223c179012256e5151c41db88d12c88a1684d2"
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-parse"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7d1bb534e9efed14f3e5f44e7dd1a4f709384023a4165199a4241e18dff0116"
|
||||
dependencies = [
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-wincon"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3127af6145b149f3287bb9a0d10ad9c5692dba8c53ad48285e5bec4063834fa"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"windows-sys 0.45.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.69"
|
||||
@@ -51,7 +91,7 @@ checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -86,9 +126,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
|
||||
[[package]]
|
||||
name = "aws-config"
|
||||
version = "0.54.1"
|
||||
version = "0.55.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3c3d1e2a1f1ab3ac6c4b884e37413eaa03eb9d901e4fc68ee8f5c1d49721680e"
|
||||
checksum = "1854be4730cc87602316707045a5c0585287419d54f293bbb52a82c895d9086a"
|
||||
dependencies = [
|
||||
"aws-credential-types",
|
||||
"aws-http",
|
||||
@@ -102,6 +142,7 @@ dependencies = [
|
||||
"aws-smithy-types",
|
||||
"aws-types",
|
||||
"bytes",
|
||||
"fastrand",
|
||||
"hex",
|
||||
"http",
|
||||
"hyper",
|
||||
@@ -115,12 +156,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "aws-credential-types"
|
||||
version = "0.54.1"
|
||||
version = "0.55.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb0696a0523a39a19087747e4dafda0362dc867531e3d72a3f195564c84e5e08"
|
||||
checksum = "f4232d3729eefc287adc0d5a8adc97b7d94eefffe6bbe94312cc86c7ab6b06ce"
|
||||
dependencies = [
|
||||
"aws-smithy-async",
|
||||
"aws-smithy-types",
|
||||
"fastrand",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"zeroize",
|
||||
@@ -128,9 +170,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "aws-endpoint"
|
||||
version = "0.54.1"
|
||||
version = "0.55.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80a4f935ab6a1919fbfd6102a80c4fccd9ff5f47f94ba154074afe1051903261"
|
||||
checksum = "87f04ab03b3f1cca91f7cccaa213056d732accb14e2e65debfacc1d28627d162"
|
||||
dependencies = [
|
||||
"aws-smithy-http",
|
||||
"aws-smithy-types",
|
||||
@@ -142,9 +184,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "aws-http"
|
||||
version = "0.54.1"
|
||||
version = "0.55.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "82976ca4e426ee9ca3ffcf919d9b2c8d14d0cd80d43cc02173737a8f07f28d4d"
|
||||
checksum = "e5ad8c53f7560baaf635b6aa811f3213d39b50555d100f83e43801652d4e318e"
|
||||
dependencies = [
|
||||
"aws-credential-types",
|
||||
"aws-smithy-http",
|
||||
@@ -161,9 +203,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "aws-sdk-ec2"
|
||||
version = "0.24.0"
|
||||
version = "0.26.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b40ee2d853d8300a49513778beb79b1574ff9e9c94b30b1531bc0171d730ad64"
|
||||
checksum = "74a7d11843d7b0234b874ed430cba258ac272aec352508371944eceb64d57dd0"
|
||||
dependencies = [
|
||||
"aws-credential-types",
|
||||
"aws-endpoint",
|
||||
@@ -189,9 +231,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "aws-sdk-sso"
|
||||
version = "0.24.0"
|
||||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca0119bacf0c42f587506769390983223ba834e605f049babe514b2bd646dbb2"
|
||||
checksum = "f4c10657158e12163d6b3fb1e0c9154e43656843794a3071d9ee63ec82a4de2d"
|
||||
dependencies = [
|
||||
"aws-credential-types",
|
||||
"aws-endpoint",
|
||||
@@ -209,13 +251,14 @@ dependencies = [
|
||||
"regex",
|
||||
"tokio-stream",
|
||||
"tower",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aws-sdk-sts"
|
||||
version = "0.24.0"
|
||||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "270b6a33969ebfcb193512fbd5e8ee5306888ad6c6d5d775cdbfb2d50d94de26"
|
||||
checksum = "706a308b7277ac9aac78ab37933509659c6f978a8473e95d8e7a8103093133c3"
|
||||
dependencies = [
|
||||
"aws-credential-types",
|
||||
"aws-endpoint",
|
||||
@@ -239,9 +282,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "aws-sig-auth"
|
||||
version = "0.54.1"
|
||||
version = "0.55.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "660a02a98ab1af83bd8d714afbab2d502ba9b18c49e7e4cddd6bf8837ff778cb"
|
||||
checksum = "24d77d879ab210e958ba65a6d3842969a596738c024989cd3e490cf9f9b560ec"
|
||||
dependencies = [
|
||||
"aws-credential-types",
|
||||
"aws-sigv4",
|
||||
@@ -253,9 +296,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "aws-sigv4"
|
||||
version = "0.54.1"
|
||||
version = "0.55.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cdaf11005b7444e6cd66f600d09861a3aeb6eb89a0f003c7c9820dbab2d15297"
|
||||
checksum = "4ab4eebc8ec484fb9eab04b15a5d1e71f3dc13bee8fdd2d9ed78bcd6ecbd7192"
|
||||
dependencies = [
|
||||
"aws-smithy-http",
|
||||
"form_urlencoded",
|
||||
@@ -272,9 +315,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "aws-smithy-async"
|
||||
version = "0.54.4"
|
||||
version = "0.55.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "63c712a28a4f2f2139759235c08bf98aca99d4fdf1b13c78c5f95613df0a5db9"
|
||||
checksum = "88573bcfbe1dcfd54d4912846df028b42d6255cbf9ce07be216b1bbfd11fc4b9"
|
||||
dependencies = [
|
||||
"futures-util",
|
||||
"pin-project-lite",
|
||||
@@ -284,9 +327,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "aws-smithy-client"
|
||||
version = "0.54.4"
|
||||
version = "0.55.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "104ca17f56cde00a10207169697dfe9c6810db339d52fb352707e64875b30a44"
|
||||
checksum = "b2f52352bae50d3337d5d6151b695d31a8c10ebea113eca5bead531f8301b067"
|
||||
dependencies = [
|
||||
"aws-smithy-async",
|
||||
"aws-smithy-http",
|
||||
@@ -300,6 +343,7 @@ dependencies = [
|
||||
"hyper-rustls",
|
||||
"lazy_static",
|
||||
"pin-project-lite",
|
||||
"rustls",
|
||||
"tokio",
|
||||
"tower",
|
||||
"tracing",
|
||||
@@ -307,9 +351,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "aws-smithy-http"
|
||||
version = "0.54.4"
|
||||
version = "0.55.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "873f316f1833add0d3aa54ed1b0cd252ddd88c792a0cf839886400099971e844"
|
||||
checksum = "03bcc02d7ed9649d855c8ce4a735e9848d7b8f7568aad0504c158e3baa955df8"
|
||||
dependencies = [
|
||||
"aws-smithy-types",
|
||||
"bytes",
|
||||
@@ -329,9 +373,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "aws-smithy-http-tower"
|
||||
version = "0.54.4"
|
||||
version = "0.55.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4f38231d3f5dac9ac7976f44e12803add1385119ffca9e5f050d8e980733d164"
|
||||
checksum = "da88b3a860f65505996c29192d800f1aeb9480440f56d63aad33a3c12045017a"
|
||||
dependencies = [
|
||||
"aws-smithy-http",
|
||||
"aws-smithy-types",
|
||||
@@ -345,18 +389,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "aws-smithy-json"
|
||||
version = "0.54.4"
|
||||
version = "0.55.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4bd83ff2b79e9f729746fcc8ad798676b68fe6ea72986571569a5306a277a182"
|
||||
checksum = "9b0c1e87d75cac889dca2a7f5ba280da2cde8122448e7fec1d614194dfa00c70"
|
||||
dependencies = [
|
||||
"aws-smithy-types",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aws-smithy-query"
|
||||
version = "0.54.4"
|
||||
version = "0.55.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2f0445dafe9d2cd50b44339ae3c3ed46549aad8ac696c52ad660b3e7ae8682b"
|
||||
checksum = "f6b50d15f446c19e088009ecb00e2fb2d13133d6fe1db702e9aa67ad135bf6a6"
|
||||
dependencies = [
|
||||
"aws-smithy-types",
|
||||
"urlencoding",
|
||||
@@ -364,9 +408,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "aws-smithy-types"
|
||||
version = "0.54.4"
|
||||
version = "0.55.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8161232eda10290f5136610a1eb9de56aceaccd70c963a26a260af20ac24794f"
|
||||
checksum = "cd0afc731fd1417d791f9145a1e0c30e23ae0beaab9b4814017708ead2fc20f1"
|
||||
dependencies = [
|
||||
"base64-simd",
|
||||
"itoa",
|
||||
@@ -377,18 +421,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "aws-smithy-xml"
|
||||
version = "0.54.4"
|
||||
version = "0.55.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "343ffe9a9bb3f542675f4df0e0d5933513d6ad038ca3907ad1767ba690a99684"
|
||||
checksum = "8b5398c1c25dfc6f8c282b1552a66aa807c9d6e15e1b3a84b94aa44e7859bec3"
|
||||
dependencies = [
|
||||
"xmlparser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aws-types"
|
||||
version = "0.54.1"
|
||||
version = "0.55.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8f15b34253b68cde08e39b0627cc6101bcca64351229484b4743392c035d057"
|
||||
checksum = "b9b082e329d9a304d39e193ad5c7ab363a0d6507aca6965e0673a746686fb0cc"
|
||||
dependencies = [
|
||||
"aws-credential-types",
|
||||
"aws-smithy-async",
|
||||
@@ -676,40 +720,45 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.1.6"
|
||||
version = "4.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec0b0588d44d4d63a87dbd75c136c166bbfd9a86a31cb89e09906521c7d3f5e3"
|
||||
checksum = "046ae530c528f252094e4a77886ee1374437744b2bff1497aa898bbddbbb29b3"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
"clap_lex",
|
||||
"is-terminal",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "223163f58c9a40c3b0a43e1c4b50a9ce09f007ea2cb1ec258a687945b4b7929f"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
"bitflags",
|
||||
"clap_lex",
|
||||
"strsim",
|
||||
"termcolor",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "4.1.0"
|
||||
version = "4.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8"
|
||||
checksum = "3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 2.0.12",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "0.3.2"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "350b9cf31731f9957399229e9b2adc51eeabdfbe9d71d9a0552275fd12710d09"
|
||||
dependencies = [
|
||||
"os_str_bytes",
|
||||
]
|
||||
checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1"
|
||||
|
||||
[[package]]
|
||||
name = "codespan-reporting"
|
||||
@@ -732,6 +781,21 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "concolor-override"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a855d4a1978dc52fb0536a04d384c2c0c1aa273597f08b77c8c4d3b2eec6037f"
|
||||
|
||||
[[package]]
|
||||
name = "concolor-query"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88d11d52c3d7ca2e6d0040212be9e4dbbcd78b6447f535b6b561f449427944cf"
|
||||
dependencies = [
|
||||
"windows-sys 0.45.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "convert_case"
|
||||
version = "0.4.0"
|
||||
@@ -740,7 +804,7 @@ checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
|
||||
|
||||
[[package]]
|
||||
name = "core"
|
||||
version = "0.2.11"
|
||||
version = "0.3.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async_timing_util",
|
||||
@@ -758,8 +822,9 @@ dependencies = [
|
||||
"hex",
|
||||
"hmac",
|
||||
"jwt",
|
||||
"merge_config_files",
|
||||
"monitor_helpers",
|
||||
"monitor_types 0.2.11",
|
||||
"monitor_types 0.3.0",
|
||||
"mungos",
|
||||
"periphery_client",
|
||||
"serde",
|
||||
@@ -886,7 +951,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"scratch",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -903,7 +968,7 @@ checksum = "086c685979a698443656e5cf7856c95c642295a38599f12fb1ff76fb28d19892"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -946,7 +1011,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"strsim",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -960,7 +1025,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"strsim",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -971,7 +1036,7 @@ checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835"
|
||||
dependencies = [
|
||||
"darling_core 0.13.4",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -982,7 +1047,7 @@ checksum = "b36230598a2d5de7ec1c6f51f72d8a99a9208daff41de2084d06e3fd3ea56685"
|
||||
dependencies = [
|
||||
"darling_core 0.14.3",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -993,10 +1058,10 @@ checksum = "23d8666cb01533c39dde32bcbab8e227b4ed6679b2c925eba05feabea39508fb"
|
||||
|
||||
[[package]]
|
||||
name = "db_client"
|
||||
version = "0.2.11"
|
||||
version = "0.3.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"monitor_types 0.2.11",
|
||||
"monitor_types 0.3.0",
|
||||
"mungos",
|
||||
]
|
||||
|
||||
@@ -1008,7 +1073,7 @@ checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1029,7 +1094,7 @@ dependencies = [
|
||||
"darling 0.14.3",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1039,7 +1104,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ebcda35c7a396850a55ffeac740804b40ffec779b98fffbb1738f4033f0ee79e"
|
||||
dependencies = [
|
||||
"derive_builder_core",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1052,7 +1117,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rustc_version 0.4.0",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1074,7 +1139,7 @@ checksum = "fe165e7ead196bbbf44c7ce11a7a21157b5c002ce46d7098ff9c556784a4912d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1118,7 +1183,7 @@ dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1256,7 +1321,7 @@ checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1443,9 +1508,9 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
|
||||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "0.14.24"
|
||||
version = "0.14.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c"
|
||||
checksum = "cc5e554ff619822309ffd57d8734d77cd5ce6238bc956f037ea06c58238c9899"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
@@ -1768,6 +1833,18 @@ dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "merge_config_files"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "48ed7c516ae04f732a7651e6bbbbdfd7762170fca6b6d263c14a105c41cab9a5"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"toml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mime"
|
||||
version = "0.3.16"
|
||||
@@ -1857,12 +1934,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "monitor_cli"
|
||||
version = "0.2.11"
|
||||
version = "0.3.0"
|
||||
dependencies = [
|
||||
"async_timing_util",
|
||||
"clap",
|
||||
"colored",
|
||||
"monitor_types 0.2.11",
|
||||
"monitor_types 0.3.0",
|
||||
"rand",
|
||||
"run_command",
|
||||
"serde",
|
||||
@@ -1874,12 +1951,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "monitor_client"
|
||||
version = "0.2.11"
|
||||
version = "0.3.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"envy",
|
||||
"futures-util",
|
||||
"monitor_types 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"monitor_types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"reqwest",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
@@ -1891,11 +1968,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "monitor_helpers"
|
||||
version = "0.2.11"
|
||||
version = "0.3.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"axum",
|
||||
"monitor_types 0.2.11",
|
||||
"monitor_types 0.3.0",
|
||||
"rand",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@@ -1904,7 +1981,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "monitor_periphery"
|
||||
version = "0.2.11"
|
||||
version = "0.3.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async_timing_util",
|
||||
@@ -1915,8 +1992,9 @@ dependencies = [
|
||||
"dotenv",
|
||||
"envy",
|
||||
"futures",
|
||||
"merge_config_files",
|
||||
"monitor_helpers",
|
||||
"monitor_types 0.2.11",
|
||||
"monitor_types 0.3.0",
|
||||
"run_command",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
@@ -1930,7 +2008,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "monitor_types"
|
||||
version = "0.2.11"
|
||||
version = "0.3.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bollard",
|
||||
@@ -1947,9 +2025,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "monitor_types"
|
||||
version = "0.2.11"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2b2809cdf9e2c1f1faa0093e6da57e6e4d5833f7dd492df490cc4c66f73a383"
|
||||
checksum = "8bba1f3fb118a665daf75e64267e24630825319903fc6967c3939eeb6a2f2baa"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bollard",
|
||||
@@ -2122,7 +2200,7 @@ checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2144,12 +2222,6 @@ dependencies = [
|
||||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "os_str_bytes"
|
||||
version = "6.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"
|
||||
|
||||
[[package]]
|
||||
name = "outref"
|
||||
version = "0.5.1"
|
||||
@@ -2196,11 +2268,11 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
|
||||
|
||||
[[package]]
|
||||
name = "periphery_client"
|
||||
version = "0.2.11"
|
||||
version = "0.3.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"futures-util",
|
||||
"monitor_types 0.2.11",
|
||||
"monitor_types 0.3.0",
|
||||
"reqwest",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@@ -2225,7 +2297,7 @@ checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2252,35 +2324,11 @@ version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
|
||||
dependencies = [
|
||||
"proc-macro-error-attr",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error-attr"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.51"
|
||||
version = "1.0.54"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6"
|
||||
checksum = "e472a104799c74b514a57226160104aa483546de37e839ec50e3c2e41dd87534"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
@@ -2293,9 +2341,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.23"
|
||||
version = "1.0.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
|
||||
checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
@@ -2637,7 +2685,7 @@ checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2669,7 +2717,7 @@ checksum = "9a5ec9fa74a20ebbe5d9ac23dac1fc96ba0ecfe9f50f2843b52e537b10fbcb4e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2727,7 +2775,7 @@ dependencies = [
|
||||
"darling 0.13.4",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2856,7 +2904,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rustversion",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2885,6 +2933,17 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "79d9531f94112cfc3e4c8f5f02cb2b58f72c97b7efd85f70203cc6d8efda5927"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sync_wrapper"
|
||||
version = "0.1.2"
|
||||
@@ -2966,7 +3025,7 @@ checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3050,7 +3109,7 @@ checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3245,7 +3304,7 @@ checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3336,7 +3395,7 @@ checksum = "89851716b67b937e393b3daa8423e67ddfc4bbbf1654bcf05488e95e0828db0c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3364,7 +3423,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc670d0e358428857cc3b4bf504c691e572fccaec9542ff09212d3f13d74b7a9"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3432,6 +3491,12 @@ version = "0.7.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
|
||||
|
||||
[[package]]
|
||||
name = "utf8parse"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.3.0"
|
||||
@@ -3503,7 +3568,7 @@ dependencies = [
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
@@ -3537,7 +3602,7 @@ checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "monitor_cli"
|
||||
version = "0.2.11"
|
||||
version = "0.3.0"
|
||||
edition = "2021"
|
||||
authors = ["MoghTech"]
|
||||
description = "monitor cli | tools to setup monitor system"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "core"
|
||||
version = "0.2.11"
|
||||
version = "0.3.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
@@ -35,5 +35,6 @@ futures-util = "0.3"
|
||||
diff-struct = "0.5"
|
||||
typeshare = "1.0.0"
|
||||
hex = "0.4"
|
||||
aws-config = "0.54"
|
||||
aws-sdk-ec2 = "0.24"
|
||||
aws-config = "0.55"
|
||||
aws-sdk-ec2 = "0.26"
|
||||
merge_config_files = "0.1.3"
|
||||
@@ -1,6 +1,7 @@
|
||||
use std::time::Duration;
|
||||
|
||||
use anyhow::{anyhow, Context};
|
||||
use aws_sdk_ec2::Client;
|
||||
use diff::Diff;
|
||||
use helpers::{all_logs_success, to_monitor_name};
|
||||
use mungos::{doc, to_bson};
|
||||
@@ -14,7 +15,7 @@ use types::{
|
||||
use crate::{
|
||||
auth::RequestUser,
|
||||
cloud::aws::{
|
||||
self, create_ec2_client, create_instance_with_ami, terminate_ec2_instance, Ec2Instance,
|
||||
create_ec2_client, create_instance_with_ami, terminate_ec2_instance, Ec2Instance,
|
||||
},
|
||||
helpers::empty_or_only_spaces,
|
||||
state::State,
|
||||
@@ -426,7 +427,7 @@ impl State {
|
||||
async fn create_ec2_instance_for_build(
|
||||
&self,
|
||||
build: &Build,
|
||||
) -> anyhow::Result<(Ec2Instance, Option<aws::Client>, Vec<Log>)> {
|
||||
) -> anyhow::Result<(Ec2Instance, Option<Client>, Vec<Log>)> {
|
||||
if build.aws_config.is_none() {
|
||||
return Err(anyhow!("build has no aws_config attached"));
|
||||
}
|
||||
@@ -527,7 +528,7 @@ impl State {
|
||||
|
||||
async fn terminate_ec2_instance(
|
||||
&self,
|
||||
aws_client: aws::Client,
|
||||
aws_client: Client,
|
||||
server: &Ec2Instance,
|
||||
update: &mut Update,
|
||||
) {
|
||||
|
||||
@@ -11,17 +11,17 @@ use crate::{auth::RequestUser, state::State};
|
||||
impl State {
|
||||
pub async fn get_group_check_permissions(
|
||||
&self,
|
||||
deployment_id: &str,
|
||||
group_id: &str,
|
||||
user: &RequestUser,
|
||||
permission_level: PermissionLevel,
|
||||
) -> anyhow::Result<Group> {
|
||||
let group = self.db.get_group(deployment_id).await?;
|
||||
let group = self.db.get_group(group_id).await?;
|
||||
let permissions = group.get_user_permissions(&user.id);
|
||||
if user.is_admin || permissions >= permission_level {
|
||||
Ok(group)
|
||||
} else {
|
||||
Err(anyhow!(
|
||||
"user does not have required permissions on this deployment"
|
||||
"user does not have required permissions on this group"
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ use axum::{routing::post, Extension, Json, Router};
|
||||
use helpers::handle_anyhow_error;
|
||||
use mungos::{doc, Deserialize, Document, Serialize};
|
||||
use types::{
|
||||
monitor_timestamp, Build, Deployment, Log, Operation, PermissionLevel, PermissionsTarget,
|
||||
Procedure, Server, Update, UpdateStatus, UpdateTarget,
|
||||
monitor_timestamp, Build, Deployment, Group, Log, Operation, PermissionLevel,
|
||||
PermissionsTarget, Procedure, Server, Update, UpdateStatus, UpdateTarget,
|
||||
};
|
||||
use typeshare::typeshare;
|
||||
|
||||
@@ -82,10 +82,10 @@ pub fn router() -> Router {
|
||||
|
||||
async fn update_permissions(
|
||||
Extension(state): StateExtension,
|
||||
Extension(user): RequestUserExtension,
|
||||
Extension(req_user): RequestUserExtension,
|
||||
Json(permission_update): Json<PermissionsUpdateBody>,
|
||||
) -> anyhow::Result<Update> {
|
||||
if !user.is_admin {
|
||||
if !req_user.is_admin {
|
||||
return Err(anyhow!(
|
||||
"user not authorized for this action (is not admin)"
|
||||
));
|
||||
@@ -107,7 +107,7 @@ async fn update_permissions(
|
||||
operation: Operation::ModifyUserPermissions,
|
||||
start_ts: monitor_timestamp(),
|
||||
success: true,
|
||||
operator: user.id.clone(),
|
||||
operator: req_user.id.clone(),
|
||||
status: UpdateStatus::Complete,
|
||||
..Default::default()
|
||||
};
|
||||
@@ -199,9 +199,9 @@ async fn update_permissions(
|
||||
.procedures
|
||||
.find_one_by_id(&permission_update.target_id)
|
||||
.await
|
||||
.context("failed at find build query")?
|
||||
.context("failed at find procedure query")?
|
||||
.ok_or(anyhow!(
|
||||
"failed to find a build with id {}",
|
||||
"failed to find a procedure with id {}",
|
||||
permission_update.target_id
|
||||
))?;
|
||||
state
|
||||
@@ -220,6 +220,33 @@ async fn update_permissions(
|
||||
target_user.username, permission_update.permission, procedure.name
|
||||
)
|
||||
}
|
||||
PermissionsTarget::Group => {
|
||||
let group = state
|
||||
.db
|
||||
.groups
|
||||
.find_one_by_id(&permission_update.target_id)
|
||||
.await
|
||||
.context("failed at find group query")?
|
||||
.ok_or(anyhow!(
|
||||
"failed to find a group with id {}",
|
||||
permission_update.target_id
|
||||
))?;
|
||||
state
|
||||
.db
|
||||
.groups
|
||||
.update_one::<Group>(
|
||||
&permission_update.target_id,
|
||||
mungos::Update::Set(doc! {
|
||||
format!("permissions.{}", permission_update.user_id): permission_update.permission.to_string()
|
||||
}),
|
||||
)
|
||||
.await?;
|
||||
update.target = UpdateTarget::Group(group.id);
|
||||
format!(
|
||||
"user {} given {} permissions on group {}",
|
||||
target_user.username, permission_update.permission, group.name
|
||||
)
|
||||
}
|
||||
};
|
||||
update
|
||||
.logs
|
||||
@@ -231,10 +258,10 @@ async fn update_permissions(
|
||||
|
||||
async fn modify_user_enabled(
|
||||
Extension(state): StateExtension,
|
||||
Extension(user): RequestUserExtension,
|
||||
Extension(req_user): RequestUserExtension,
|
||||
Json(ModifyUserEnabledBody { user_id, enabled }): Json<ModifyUserEnabledBody>,
|
||||
) -> anyhow::Result<Update> {
|
||||
if !user.is_admin {
|
||||
if !req_user.is_admin {
|
||||
return Err(anyhow!(
|
||||
"user does not have permissions for this action (not admin)"
|
||||
));
|
||||
@@ -264,7 +291,7 @@ async fn modify_user_enabled(
|
||||
end_ts: Some(ts),
|
||||
status: UpdateStatus::Complete,
|
||||
success: true,
|
||||
operator: user.id.clone(),
|
||||
operator: req_user.id.clone(),
|
||||
..Default::default()
|
||||
};
|
||||
update.id = state.add_update(update.clone()).await?;
|
||||
@@ -273,13 +300,13 @@ async fn modify_user_enabled(
|
||||
|
||||
async fn modify_user_create_server_permissions(
|
||||
Extension(state): StateExtension,
|
||||
Extension(user): RequestUserExtension,
|
||||
Extension(req_user): RequestUserExtension,
|
||||
Json(ModifyUserCreateServerBody {
|
||||
user_id,
|
||||
create_server_permissions,
|
||||
}): Json<ModifyUserCreateServerBody>,
|
||||
) -> anyhow::Result<Update> {
|
||||
if !user.is_admin {
|
||||
if !req_user.is_admin {
|
||||
return Err(anyhow!(
|
||||
"user does not have permissions for this action (not admin)"
|
||||
));
|
||||
@@ -319,7 +346,7 @@ async fn modify_user_create_server_permissions(
|
||||
end_ts: Some(ts),
|
||||
status: UpdateStatus::Complete,
|
||||
success: true,
|
||||
operator: user.id.clone(),
|
||||
operator: req_user.id.clone(),
|
||||
..Default::default()
|
||||
};
|
||||
update.id = state.add_update(update.clone()).await?;
|
||||
@@ -328,13 +355,13 @@ async fn modify_user_create_server_permissions(
|
||||
|
||||
async fn modify_user_create_build_permissions(
|
||||
Extension(state): StateExtension,
|
||||
Extension(user): RequestUserExtension,
|
||||
Extension(req_user): RequestUserExtension,
|
||||
Json(ModifyUserCreateBuildBody {
|
||||
user_id,
|
||||
create_build_permissions,
|
||||
}): Json<ModifyUserCreateBuildBody>,
|
||||
) -> anyhow::Result<Update> {
|
||||
if !user.is_admin {
|
||||
if !req_user.is_admin {
|
||||
return Err(anyhow!(
|
||||
"user does not have permissions for this action (not admin)"
|
||||
));
|
||||
@@ -374,7 +401,7 @@ async fn modify_user_create_build_permissions(
|
||||
end_ts: Some(ts),
|
||||
status: UpdateStatus::Complete,
|
||||
success: true,
|
||||
operator: user.id.clone(),
|
||||
operator: req_user.id.clone(),
|
||||
..Default::default()
|
||||
};
|
||||
update.id = state.add_update(update.clone()).await?;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use anyhow::{anyhow, Context};
|
||||
use async_timing_util::get_timelength_in_ms;
|
||||
use async_timing_util::{get_timelength_in_ms, unix_timestamp_ms};
|
||||
use axum::{
|
||||
extract::{ws::Message as AxumMessage, Path, Query, WebSocketUpgrade},
|
||||
response::IntoResponse,
|
||||
@@ -8,7 +8,7 @@ use axum::{
|
||||
};
|
||||
use futures_util::{future::join_all, SinkExt, StreamExt};
|
||||
use helpers::handle_anyhow_error;
|
||||
use mungos::{doc, Deserialize, Document};
|
||||
use mungos::{doc, Deserialize, Document, FindOptions};
|
||||
use tokio::select;
|
||||
use tokio_tungstenite::tungstenite::Message;
|
||||
use tokio_util::sync::CancellationToken;
|
||||
@@ -19,7 +19,7 @@ use types::{
|
||||
};
|
||||
use typeshare::typeshare;
|
||||
|
||||
const MAX_HISTORICAL_STATS_LIMIT: i64 = 1000;
|
||||
const MAX_HISTORICAL_STATS_LIMIT: i64 = 500;
|
||||
|
||||
use crate::{
|
||||
auth::{RequestUser, RequestUserExtension},
|
||||
@@ -483,14 +483,9 @@ impl State {
|
||||
user: &RequestUser,
|
||||
query: &HistoricalStatsQuery,
|
||||
) -> anyhow::Result<Vec<SystemStatsRecord>> {
|
||||
let limit = if query.limit as i64 > MAX_HISTORICAL_STATS_LIMIT {
|
||||
MAX_HISTORICAL_STATS_LIMIT
|
||||
} else {
|
||||
query.limit as i64
|
||||
};
|
||||
self.get_server_check_permissions(server_id, user, PermissionLevel::Read)
|
||||
.await?;
|
||||
let ts_mod = get_timelength_in_ms(query.interval.to_string().parse().unwrap()) as i64;
|
||||
|
||||
let mut projection = doc! { "processes": 0, "disk.disks": 0 };
|
||||
if !query.networks {
|
||||
projection.insert("networks", 0);
|
||||
@@ -498,14 +493,30 @@ impl State {
|
||||
if !query.components {
|
||||
projection.insert("components", 0);
|
||||
}
|
||||
let limit = if query.limit as i64 > MAX_HISTORICAL_STATS_LIMIT {
|
||||
MAX_HISTORICAL_STATS_LIMIT
|
||||
} else {
|
||||
query.limit as i64
|
||||
};
|
||||
let interval = get_timelength_in_ms(query.interval.to_string().parse().unwrap()) as i64;
|
||||
let mut ts_vec = Vec::<i64>::new();
|
||||
let curr_ts = unix_timestamp_ms() as i64;
|
||||
let mut curr_ts = curr_ts - curr_ts % interval - interval * limit * query.page as i64;
|
||||
for _ in 0..limit {
|
||||
ts_vec.push(curr_ts);
|
||||
curr_ts -= interval;
|
||||
}
|
||||
self.db
|
||||
.stats
|
||||
.get_most_recent(
|
||||
"ts",
|
||||
limit,
|
||||
query.page as u64 * limit as u64,
|
||||
doc! { "server_id": server_id, "ts": { "$mod": [ts_mod, 0] } },
|
||||
projection,
|
||||
.get_some(
|
||||
doc! {
|
||||
"server_id": server_id,
|
||||
"ts": { "$in": ts_vec }
|
||||
},
|
||||
FindOptions::builder()
|
||||
.sort(doc! { "ts": 1 })
|
||||
.projection(projection)
|
||||
.build(),
|
||||
)
|
||||
.await
|
||||
.context("failed at mongo query to get stats")
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
use std::time::Duration;
|
||||
|
||||
use anyhow::{anyhow, Context};
|
||||
use aws_sdk_ec2::model::{
|
||||
BlockDeviceMapping, EbsBlockDevice, InstanceNetworkInterfaceSpecification, InstanceStateChange,
|
||||
InstanceStateName, InstanceStatus, ResourceType, Tag, TagSpecification,
|
||||
};
|
||||
pub use aws_sdk_ec2::{
|
||||
model::InstanceType,
|
||||
output::{DescribeInstanceStatusOutput, TerminateInstancesOutput},
|
||||
Client, Region,
|
||||
use aws_sdk_ec2::{
|
||||
config::Region,
|
||||
types::{
|
||||
BlockDeviceMapping, EbsBlockDevice, InstanceNetworkInterfaceSpecification,
|
||||
InstanceStateChange, InstanceStateName, InstanceStatus, InstanceType, ResourceType, Tag,
|
||||
TagSpecification,
|
||||
},
|
||||
Client,
|
||||
};
|
||||
use types::Server;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use axum_extra::routing::SpaRouter;
|
||||
use dotenv::dotenv;
|
||||
use helpers::parse_config_file;
|
||||
use merge_config_files::parse_config_file;
|
||||
use mungos::Deserialize;
|
||||
use types::CoreConfig;
|
||||
|
||||
@@ -15,7 +15,7 @@ struct Env {
|
||||
pub fn load() -> (CoreConfig, SpaRouter) {
|
||||
dotenv().ok();
|
||||
let env: Env = envy::from_env().expect("failed to parse environment variables");
|
||||
let config = parse_config_file(&env.config_path).expect("failed to parse config");
|
||||
let config = parse_config_file(env.config_path).expect("failed to parse config");
|
||||
let spa_router = SpaRouter::new("/assets", env.frontend_path);
|
||||
(config, spa_router)
|
||||
}
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
# building images
|
||||
|
||||
Monitor builds docker images by cloning the source repository from Github, running ```docker build```, and pushing the resulting image to docker hub. Any repo containing a 'Dockerfile' is buildable using this method.
|
||||
|
||||
Build configuration involves passing file / directory paths, for more details about passing file paths, see the [file paths doc](https://github.com/mbecker20/monitor/blob/main/docs/paths.md).
|
||||
|
||||
## repo configuration
|
||||
To specify the github repo to build, just give it the name of the repo and the branch under *repo config*. The name is given like ```mbecker20/monitor```, it includes the username / organization that owns the repo.
|
||||
|
||||
Many repos are private, in this case a Github access token is required in the periphery.config.toml of the building server. these are specified in the config like ```username = "access_token"```. An account which has access to the repo and is available on the periphery server can be selected to use via the *github account* dropdown menu.
|
||||
|
||||
## docker build configuration
|
||||
|
||||
In order to docker build, monitor just needs to know the build directory and the path of the Dockerfile, you can configure these in the *build config* section.
|
||||
|
||||
If the build directory is the root of the repository, you pass the build path as ```.```. If the build directory is some folder of the repo, just pass the name of the the folder. Do not pass the preceding "/". for example ```build/directory```
|
||||
|
||||
The dockerfile's path is given relative to the build directory. So if your build directory is ```build/directory``` and the dockerfile is in ```build/directory/Dockerfile.example```, you give the dockerfile path simply as ```Dockerfile.example```.
|
||||
|
||||
Just as with private repos, you will need to select a docker account to use with ```docker push```.
|
||||
|
||||
## running a pre build command
|
||||
|
||||
Sometimes a command needs to be run before running ```docker build```, you can configure this in the *pre build* section.
|
||||
|
||||
There are two fields to pass for *pre build*. the first is *path*, which changes the working directory. To run the command in the root of the repo, just pass ```.```. The second field is *command*, this is the shell command to be executed after the repo is cloned.
|
||||
|
||||
For example, say your repo had a folder in it called ```scripts``` with a shell script ```on-clone.sh```. You would give *path* as ```scripts``` and command as ```sh on-clone.sh```. Or you could make *path* just ```.``` and then the command would be ```sh scripts/on-clone.sh```. Either way works fine.
|
||||
|
||||
## adding build args
|
||||
|
||||
The Dockerfile may make use of [build args](https://docs.docker.com/engine/reference/builder/#arg). Build args can be passed using the gui by pressing the ```edit``` button. They are passed in the menu just like in the would in a .env file:
|
||||
|
||||
```
|
||||
BUILD_ARG1=some_value
|
||||
BUILD_ARG2=some_other_value
|
||||
```
|
||||
|
||||
## builder configuration
|
||||
|
||||
A builder is a machine running monitor periphery and docker. Any server connected to monitor can be chosen as the builder for a build.
|
||||
|
||||
Building on a machine running production software is usually not a great idea, as this process can use a lot of the system resources. It is better to start up a temporary cloud machine dedicated for the build, then shut it down when the build is finished. Right now monitor supports AWS ec2 for this task.
|
||||
|
||||
### AWS builder
|
||||
|
||||
You can choose to build on AWS on the "builder" tab on the build's page. From here you can configure the AMI to use as a base to build the image. These must be configured in the monitor core configuration along with other information like defaults to use, AWS credentials, etc. This is explained on the [core setup page](https://github.com/mbecker20/monitor/blob/main/docs/setup.md).
|
||||
|
||||
## versioning
|
||||
|
||||
Monitor uses a major.minor.patch versioning scheme. Every build will auto increment the patch number, and push the image to docker hub with the version tag as well as the "latest" tag.
|
||||
|
||||
|
||||
[next: deploying](https://github.com/mbecker20/monitor/blob/main/docs/deployments.md)
|
||||
|
||||
[back to table of contents](https://github.com/mbecker20/monitor/blob/main/readme.md)
|
||||
@@ -1,5 +0,0 @@
|
||||
# setting up monitor core
|
||||
|
||||
|
||||
|
||||
[back to table of contents](https://github.com/mbecker20/monitor/blob/main/readme.md)
|
||||
20
docsite/.gitignore
vendored
Normal file
20
docsite/.gitignore
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
# Dependencies
|
||||
/node_modules
|
||||
|
||||
# Production
|
||||
/build
|
||||
|
||||
# Generated files
|
||||
.docusaurus
|
||||
.cache-loader
|
||||
|
||||
# Misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
41
docsite/README.md
Normal file
41
docsite/README.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# Website
|
||||
|
||||
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
|
||||
|
||||
### Installation
|
||||
|
||||
```
|
||||
$ yarn
|
||||
```
|
||||
|
||||
### Local Development
|
||||
|
||||
```
|
||||
$ yarn start
|
||||
```
|
||||
|
||||
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
|
||||
|
||||
### Build
|
||||
|
||||
```
|
||||
$ yarn build
|
||||
```
|
||||
|
||||
This command generates static content into the `build` directory and can be served using any static contents hosting service.
|
||||
|
||||
### Deployment
|
||||
|
||||
Using SSH:
|
||||
|
||||
```
|
||||
$ USE_SSH=true yarn deploy
|
||||
```
|
||||
|
||||
Not using SSH:
|
||||
|
||||
```
|
||||
$ GIT_USER=<Your GitHub username> yarn deploy
|
||||
```
|
||||
|
||||
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
|
||||
3
docsite/babel.config.js
Normal file
3
docsite/babel.config.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
|
||||
};
|
||||
42
docsite/docs/api/api-secrets.mdx
Normal file
42
docsite/docs/api/api-secrets.mdx
Normal file
@@ -0,0 +1,42 @@
|
||||
import Divider from '@site/src/components/Divider';
|
||||
|
||||
# api secrets
|
||||
|
||||
these routes are used to manage api secrets.
|
||||
|
||||
| name | route |
|
||||
| ---- | ------ |
|
||||
| [create api secret](/api/api-secrets#create-api-secret) | `POST /api/secret/create` |
|
||||
| [delete api secret](/api/api-secrets#delete-api-secret) | `DELETE /api/secret/delete/<secret-name>` |
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## create api secret
|
||||
`POST /api/secret/create`
|
||||
|
||||
### request body
|
||||
```json
|
||||
{
|
||||
name: string, // name the secret. must be unique among the users secrets
|
||||
expires?: rfc3339_timestamp, // optional expiry time. if none, the secret will not expire.
|
||||
}
|
||||
```
|
||||
|
||||
### response body
|
||||
```json
|
||||
string // the body will be the secret hash used to log in.
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## delete api secret
|
||||
`DELETE /api/secret/delete/<secret-name>`
|
||||
|
||||
### response
|
||||
```json
|
||||
HTTP 200 OK
|
||||
```
|
||||
8
docsite/docs/api/authenticating-requests.md
Normal file
8
docsite/docs/api/authenticating-requests.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# authenticating requests
|
||||
|
||||
monitor uses the `JSON Web Token (JWT)` standard to authenticate all requests to subroutes under `/api`.
|
||||
users can acquire a `JWT` using a [login method](/api/login).
|
||||
|
||||
to authenticate requests, pass the `JWT` under the `Authorization` header:
|
||||
|
||||
`Authorization: Bearer <JWT>`
|
||||
224
docsite/docs/api/build.mdx
Normal file
224
docsite/docs/api/build.mdx
Normal file
@@ -0,0 +1,224 @@
|
||||
import Divider from '@site/src/components/Divider';
|
||||
|
||||
# build
|
||||
|
||||
these routes relate to interacting with monitor `builds`
|
||||
|
||||
| name | route |
|
||||
| ---- | ------ |
|
||||
| [list builds](/api/build#list-builds) | `GET /api/build/list` |
|
||||
| [get build](/api/build#get-build) | `GET /api/build/<build_id>` |
|
||||
| [get build action state](/api/build#get-build-action-state) | `GET /api/build/<build_id>/action_state` |
|
||||
| [get build versions](/api/build#get-build-versions) | `GET /api/build/<build_id>/versions` |
|
||||
| [create build](/api/build#create-build) | `POST /api/build/create` |
|
||||
| [create full build](/api/build#create-full-build) | `POST /api/build/create_full` |
|
||||
| [copy build](/api/build#copy-build) | `POST /api/build/<build_id>/copy` |
|
||||
| [delete build](/api/build#delete-build) | `DELETE /api/build/<build_id>/delete` |
|
||||
| [update build](/api/build#update-build) | `PATCH /api/build/update` |
|
||||
| [build](/api/build#build-action) | `POST /api/build/<build_id>/build` |
|
||||
| [get aws builder defaults](/api/build#get-aws-builder-defaults) | `GET /api/build/aws_builder_defaults` |
|
||||
| [get allowed docker organizations](/api/build#get-allowed-docker-organizations) | `GET /api/build/docker_organizations` |
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## list builds
|
||||
`GET /api/build/list`
|
||||
|
||||
this method will return an array of builds the requesting user has a minimum of `Read` permissions on.
|
||||
|
||||
|
||||
### response body
|
||||
Array<[Build](/api/types#build)>
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## get build
|
||||
`GET /api/build/<build_id>`
|
||||
|
||||
### response body
|
||||
[Build](/api/types#build)
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## get build action state
|
||||
`GET /api/build/<build_id>/action_state`
|
||||
|
||||
this method returns the action state for the build, eg. whether the build is currently `building`.
|
||||
|
||||
|
||||
### response body
|
||||
```json
|
||||
{
|
||||
building: boolean,
|
||||
updating: boolean,
|
||||
}
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## get build versions
|
||||
`GET /api/build/<build_id>/versions`
|
||||
|
||||
paginated route for fetching the most recent available versions of this build.
|
||||
|
||||
### query params
|
||||
```json
|
||||
page=number // optional, default is 0. pagination starting at page 0.
|
||||
major=number // optional. filter by major version number
|
||||
minor=number // optional. filter by minor version number
|
||||
patch=number // optional. filter by patch version number
|
||||
```
|
||||
|
||||
### response body
|
||||
```json
|
||||
[
|
||||
{
|
||||
ts: rfc3339_timestamp,
|
||||
version: {
|
||||
major: number,
|
||||
minor: number,
|
||||
patch: number,
|
||||
}
|
||||
},
|
||||
...
|
||||
]
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## create build
|
||||
`POST /api/build/create`
|
||||
|
||||
|
||||
### request body
|
||||
```json
|
||||
{
|
||||
name: string,
|
||||
}
|
||||
```
|
||||
|
||||
### response body
|
||||
[Build](/api/types#build)
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## create full build
|
||||
`POST /api/build/create_full`
|
||||
|
||||
|
||||
### request body
|
||||
[Build](/api/types#build)
|
||||
|
||||
### response body
|
||||
[Build](/api/types#build)
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## copy build
|
||||
`POST /api/build/<build_id>/copy`
|
||||
|
||||
this method will create a copy of the build with a new _id and name,
|
||||
with all the same configuration as the target build.
|
||||
|
||||
|
||||
### request body
|
||||
```json
|
||||
{
|
||||
name: string, // the new name
|
||||
}
|
||||
```
|
||||
|
||||
### response body
|
||||
[Build](/api/types#build)
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## delete build
|
||||
`DELETE /api/build/<build_id>/delete`
|
||||
|
||||
### response body
|
||||
[Build](/api/types#build)
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## update build
|
||||
`PATCH /api/build/update`
|
||||
|
||||
### request body
|
||||
[Build](/api/types#build)
|
||||
|
||||
### response body
|
||||
[Build](/api/types#build)
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## build (action)
|
||||
`POST /api/build/<build_id>/build`
|
||||
|
||||
### response body
|
||||
[Update](/api/types#update)
|
||||
|
||||
:::note
|
||||
this update will include the `version` field.
|
||||
:::
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## get aws builder defaults
|
||||
`GET /api/build/aws_builder_defaults`
|
||||
|
||||
### response body
|
||||
```json
|
||||
{
|
||||
default_ami_name: string,
|
||||
default_subnet_id: string,
|
||||
default_key_pair_name: string,
|
||||
default_region: string,
|
||||
default_volume_gb: number,
|
||||
default_instance_type: string,
|
||||
default_security_group_ids: string[],
|
||||
default_assign_public_ip: boolean,
|
||||
available_ami_accounts: [
|
||||
{
|
||||
ami_id: string,
|
||||
github: string[],
|
||||
docker: string[],
|
||||
secrets: string[],
|
||||
}
|
||||
],
|
||||
}
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## get allowed docker organizations
|
||||
`GET /api/build/docker_organizations`
|
||||
|
||||
### response body
|
||||
```json
|
||||
string[] // the names of the allowed docker organizations
|
||||
```
|
||||
344
docsite/docs/api/deployment.mdx
Normal file
344
docsite/docs/api/deployment.mdx
Normal file
@@ -0,0 +1,344 @@
|
||||
import Divider from '@site/src/components/Divider';
|
||||
|
||||
# deployment
|
||||
|
||||
these routes relate to interacting with monitor `deployments`
|
||||
|
||||
| name | route |
|
||||
| ---- | ------ |
|
||||
| [list deployments](/api/deployment#list-deployments) | `GET /api/deployment/list` |
|
||||
| [get deployment](/api/deployment#get-deployment) | `GET /api/deployment/<deployment_id>` |
|
||||
| [get deployment action state](/api/deployment#get-deployment-action-state) | `GET /api/deployment/<deployment_id>/action_state` |
|
||||
| [get deployment container log](/api/deployment#get-deployment-container-log) | `GET /api/deployment/<deployment_id>/log` |
|
||||
| [get deployment container stats](/api/deployment#get-deployment-container-stats) | `GET /api/deployment/<deployment_id>/stats` |
|
||||
| [get deployment deployed version](/api/deployment#get-deployment-deployed-version) | `GET /api/deployment/<deployment_id>/deployed_version` |
|
||||
| [create deployment](/api/deployment#create-deployment) | `POST /api/deployment/create` |
|
||||
| [create full deployment](/api/deployment#create-full-deployment) | `POST /api/deployment/create_full` |
|
||||
| [copy deployment](/api/deployment#copy-deployment) | `POST /api/deployment/<deployment_id>/copy` |
|
||||
| [delete deployment](/api/deployment#delete-deployment) | `DELETE /api/deployment/<deployment_id>/delete` |
|
||||
| [update deployment](/api/deployment#update-deployment) | `PATCH /api/deployment/update` |
|
||||
| [rename deployment](/api/deployment#rename-deployment) | `PATCH /api/deployment/<deployment_id>/rename` |
|
||||
| [reclone deployment](/api/deployment#reclone-deployment) | `POST /api/deployment/<deployment_id>/reclone` |
|
||||
| [pull deployment](/api/deployment#pull-deployment) | `POST /api/deployment/<deployment_id>/pull` |
|
||||
| [deploy container](/api/deployment#deploy-container) | `POST /api/deployment/<deployment_id>/deploy` |
|
||||
| [start container](/api/deployment#start-container) | `POST /api/deployment/<deployment_id>/start_container` |
|
||||
| [stop container](/api/deployment#stop-container) | `POST /api/deployment/<deployment_id>/stop_container` |
|
||||
| [remove container](/api/deployment#remove-container) | `POST /api/deployment/<deployment_id>/remove_container` |
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## list deployments
|
||||
`GET /api/deployment/list`
|
||||
|
||||
this method will return an array of deployments with container state that the requesting user has a minimum of `Read` permissions on.
|
||||
|
||||
### response body
|
||||
```json
|
||||
[
|
||||
{
|
||||
deployment: Deployment,
|
||||
state: DockerContainerState,
|
||||
container?: {
|
||||
name: string,
|
||||
id: string,
|
||||
image: string,
|
||||
state: DockerContainerState,
|
||||
status?: string,
|
||||
}
|
||||
},
|
||||
...
|
||||
]
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## get deployment
|
||||
`GET /api/deployment/<deployment_id>`
|
||||
|
||||
this method will return the deployment with container state that
|
||||
the requesting user has a minimum of `Read` permissions on.
|
||||
it will return `500: Internal Server Error` if the user does not have the required permissions.
|
||||
|
||||
### response body
|
||||
```json
|
||||
{
|
||||
deployment: Deployment,
|
||||
state: DockerContainerState,
|
||||
container?: {
|
||||
name: string,
|
||||
id: string,
|
||||
image: string,
|
||||
state: DockerContainerState,
|
||||
status?: string,
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
## get deployment action state
|
||||
`GET /api/deployment/<deployment_id>/action_state`
|
||||
|
||||
this method returns the action state for the deployment, eg. whether the deployment is currently `deploying`.
|
||||
|
||||
### response body
|
||||
```json
|
||||
{
|
||||
deploying: boolean,
|
||||
stopping: boolean,
|
||||
starting: boolean,
|
||||
removing: boolean,
|
||||
pulling: boolean,
|
||||
recloning: boolean,
|
||||
updating: boolean,
|
||||
renaming: boolean,
|
||||
}
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## get deployment container log
|
||||
`GET /api/deployment/<deployment_id>/log`
|
||||
|
||||
this method is used to get the container's log associated with the deployment.
|
||||
|
||||
### query params
|
||||
```json
|
||||
{
|
||||
tail: number // number of log lines to fetch. this is passed to the --tail flag of docker logs command
|
||||
}
|
||||
```
|
||||
|
||||
### response body
|
||||
```json
|
||||
{
|
||||
stdout: string,
|
||||
stderr: string,
|
||||
}
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## get deployment container stats
|
||||
`GET /api/deployment/<deployment_id>/stats`
|
||||
|
||||
this method returns the results of running `docker stats <container_name>`
|
||||
for the container associated with the deployment.
|
||||
|
||||
### response body
|
||||
```json
|
||||
{
|
||||
name: string,
|
||||
cpu_perc: string,
|
||||
mem_perc: string,
|
||||
mem_usage: string,
|
||||
net_io: string,
|
||||
block_io: string,
|
||||
pids: string,
|
||||
}
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## get deployment deployed version
|
||||
`GET /api/deployment/<deployment_id>/deployed_version`
|
||||
|
||||
this method is used to get the image version of the container associated with the deployment, if it exists.
|
||||
otherwise, it will return the version specified in the deployment config.
|
||||
|
||||
### response body
|
||||
```json
|
||||
string // the deployed version like '0.2.4'
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## create deployment
|
||||
`POST /api/deployment/create`
|
||||
|
||||
this method is used to create a new deployment on a particular server.
|
||||
it will return the created deployment.
|
||||
|
||||
:::note
|
||||
users must be **admin** or have `update` permissions on the server specified by the `server_id`
|
||||
in the request body in order for this request to succeed.
|
||||
:::
|
||||
|
||||
### request body
|
||||
```json
|
||||
{
|
||||
name: string,
|
||||
server_id: string,
|
||||
}
|
||||
```
|
||||
|
||||
### response body
|
||||
[Deployment](/api/types#deployment)
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## create full deployment
|
||||
`POST /api/deployment/create_full`
|
||||
|
||||
this method is used to create a new deployment on a particular server, already initialized with config.
|
||||
it will return the created deployment
|
||||
|
||||
### request body
|
||||
[Deployment](/api/types#deployment)
|
||||
|
||||
### response body
|
||||
[Deployment](/api/types#deployment)
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## copy deployment
|
||||
`POST /api/deployment/<deployment_id>/copy`
|
||||
|
||||
this method will create a copy of the deployment with a new _id and name,
|
||||
with all the same configuration as the target deployment.
|
||||
it can be used to move the deployment to another server.
|
||||
|
||||
### request body
|
||||
```json
|
||||
{
|
||||
name: string,
|
||||
server_id: string,
|
||||
}
|
||||
```
|
||||
|
||||
### response body
|
||||
[Deployment](/api/types#deployment)
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## delete deployment
|
||||
`DELETE /api/deployment/<deployment_id>/delete`
|
||||
|
||||
this method will delete the deployment. if a container is associated with the deployment, it will be destroyed.
|
||||
|
||||
### response body
|
||||
[Deployment](/api/types#deployment)
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## update deployment
|
||||
`PATCH /api/deployment/update`
|
||||
|
||||
### request body
|
||||
[Deployment](/api/types#deployment)
|
||||
|
||||
### response body
|
||||
[Deployment](/api/types#deployment)
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## rename deployment
|
||||
`PATCH /api/deployment/<deployment_id>/rename`
|
||||
|
||||
### request body
|
||||
```json
|
||||
{
|
||||
new_name: string,
|
||||
}
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## reclone deployment
|
||||
`POST /api/deployment/<deployment_id>/reclone`
|
||||
|
||||
if the deployment has a repo attached, this will reclone the repo,
|
||||
including the on-clone and on-pull actions.
|
||||
|
||||
### response body
|
||||
[Update](/api/types#update)
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## pull deployment
|
||||
`POST /api/deployment/<deployment_id>/pull`
|
||||
|
||||
if the deployment has a repo attached, this will `git pull` in the repo,
|
||||
including the on-pull action.
|
||||
|
||||
### response body
|
||||
[Update](/api/types#update)
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## deploy container
|
||||
`POST /api/deployment/<deployment_id>/deploy`
|
||||
|
||||
this will deploy the container corresponding to the deployments configuration.
|
||||
if the container already exists, it will destroy it first.
|
||||
|
||||
### response body
|
||||
[Update](/api/types#update)
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## start container
|
||||
`POST /api/deployment/<deployment_id>/start_container`
|
||||
|
||||
this will run `docker start <container_name>` for the container
|
||||
corresponding to the deployment
|
||||
|
||||
### response body
|
||||
[Update](/api/types#update)
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## stop container
|
||||
`POST /api/deployment/<deployment_id>/stop_container`
|
||||
|
||||
this will run `docker stop <container_name>` for the container
|
||||
corresponding to the deployment
|
||||
|
||||
### response body
|
||||
[Update](/api/types#update)
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## remove container
|
||||
`POST /api/deployment/<deployment_id>/remove_container`
|
||||
|
||||
this will run `docker stop <container_name> && docker container rm <container_name>`
|
||||
for the container corresponding to the deployment
|
||||
|
||||
### response body
|
||||
[Update](/api/types#update)
|
||||
11
docsite/docs/api/index.mdx
Normal file
11
docsite/docs/api/index.mdx
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
slug: /api
|
||||
---
|
||||
|
||||
this section documents the rest and websocket api
|
||||
|
||||
```mdx-code-block
|
||||
import DocCardList from '@theme/DocCardList';
|
||||
|
||||
<DocCardList />
|
||||
```
|
||||
103
docsite/docs/api/login.mdx
Normal file
103
docsite/docs/api/login.mdx
Normal file
@@ -0,0 +1,103 @@
|
||||
import Divider from '@site/src/components/Divider';
|
||||
|
||||
# login
|
||||
|
||||
monitor supports local login (username and password), Oauth2 login (github and google),
|
||||
and secret login (username and API secret key).
|
||||
each method must be explicitly enabled in your monitor core config,
|
||||
otherwise the api won't be available.
|
||||
|
||||
:::note
|
||||
in order to login to an Oauth2 user's account programmatically,
|
||||
you must [create an api secret](/api/api-secrets#create-api-secret) and login using [/auth/secret/login](/api/login#login-using-api-secret)
|
||||
:::
|
||||
|
||||
| name | route |
|
||||
| ---- | ------ |
|
||||
| [get login options](/api/login#get-login-options) | `GET /auth/options` |
|
||||
| [create local user account](/api/login#create-local-user-account) | `POST /auth/local/create_user` |
|
||||
| [login local user account](/api/login#login-local-user-account) | `POST /auth/local/login` |
|
||||
| [login using api secret](/api/login#login-using-api-secret) | `POST /auth/secret/login` |
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## get login options
|
||||
`GET /auth/options`
|
||||
|
||||
this method is used to obtain the login options for monitor core
|
||||
|
||||
### response body
|
||||
```json
|
||||
{
|
||||
local: boolean,
|
||||
github: boolean,
|
||||
google: boolean,
|
||||
}
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## create local user account
|
||||
`POST /auth/local/create_user`
|
||||
|
||||
this method will create a new local auth account with the provided **username** and **password**,
|
||||
and return a `JWT` for the user to authenticate with.
|
||||
|
||||
### request body
|
||||
```json
|
||||
{
|
||||
username: string,
|
||||
password: string,
|
||||
}
|
||||
```
|
||||
|
||||
### response body
|
||||
`<JWT token as string>`
|
||||
|
||||
:::caution
|
||||
a user created with this method is, by default, `disabled`. a monitor admin must enable their account before they can access the API.
|
||||
:::
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## login local user account
|
||||
`POST /auth/local/login`
|
||||
|
||||
this method will authenticate a local users credentials and return a JWT if login is successful.
|
||||
|
||||
### request body
|
||||
```json
|
||||
{
|
||||
username: string,
|
||||
password: string,
|
||||
}
|
||||
```
|
||||
|
||||
### response body
|
||||
`<JWT token as string>`
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## login using api secret
|
||||
`POST /auth/secret/login`
|
||||
|
||||
this method will authenticate a users account of any kind using an api secret generated using [/api/secret/create](/api/api-secrets#create-api-secret)
|
||||
|
||||
### request body
|
||||
```json
|
||||
{
|
||||
username: string,
|
||||
secret: string,
|
||||
}
|
||||
```
|
||||
|
||||
### response body
|
||||
`<JWT token as string>`
|
||||
90
docsite/docs/api/permissions.mdx
Normal file
90
docsite/docs/api/permissions.mdx
Normal file
@@ -0,0 +1,90 @@
|
||||
import Divider from '@site/src/components/Divider';
|
||||
|
||||
# permissions
|
||||
|
||||
these routes relate to updating user permissions
|
||||
|
||||
:::note
|
||||
these routes can only be called by **admin** users
|
||||
:::
|
||||
|
||||
| name | route |
|
||||
| ---- | ------ |
|
||||
| [update user permissions on target](/api/permissions#update-user-permissions-on-target) | `POST /api/permissions/update` |
|
||||
| [modify user enabled](/api/permissions#modify-user-enabled) | `POST /api/permissions/modify_enabled` |
|
||||
| [modify user create server permissions](/api/permissions#modify-user-create-server-permissions) | `POST /api/permissions/modify_create_server` |
|
||||
| [modify user create build permissions](/api/permissions#modify-user-create-build-permissions) | `POST /api/permissions/modify_create_build` |
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## update user permissions on target
|
||||
`POST /api/permissions/update`
|
||||
|
||||
### request body
|
||||
```json
|
||||
{
|
||||
user_id: string, // the target users id
|
||||
permission: "none" | "read" | "execute" | "update",
|
||||
target_type: "server" | "deployment" | "build" | "procedure" | "group",
|
||||
target_id: string, // the target resources id
|
||||
}
|
||||
```
|
||||
|
||||
### response body
|
||||
[Update](/api/types#update)
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## modify user enabled
|
||||
`POST /api/permissions/modify_enabled`
|
||||
|
||||
### request body
|
||||
```json
|
||||
{
|
||||
user_id: string, // the target users id
|
||||
enabled: boolean,
|
||||
}
|
||||
```
|
||||
|
||||
### response body
|
||||
[Update](/api/types#update)
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## modify user create server permissions
|
||||
`POST /api/permissions/modify_create_server`
|
||||
|
||||
### request body
|
||||
```json
|
||||
{
|
||||
user_id: string, // the target users id
|
||||
create_server_permissions: boolean,
|
||||
}
|
||||
```
|
||||
|
||||
### response body
|
||||
[Update](/api/types#update)
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## modify user create build permissions
|
||||
`POST /api/permissions/modify_create_build`
|
||||
|
||||
### request body
|
||||
```json
|
||||
{
|
||||
user_id: string, // the target users id
|
||||
create_build_permissions: boolean,
|
||||
}
|
||||
```
|
||||
|
||||
### response body
|
||||
[Update](/api/types#update)
|
||||
10
docsite/docs/api/procedure.mdx
Normal file
10
docsite/docs/api/procedure.mdx
Normal file
@@ -0,0 +1,10 @@
|
||||
import Divider from '@site/src/components/Divider';
|
||||
|
||||
# procedure
|
||||
|
||||
these routes relate to interacting with monitor `procedures`
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
473
docsite/docs/api/server.mdx
Normal file
473
docsite/docs/api/server.mdx
Normal file
@@ -0,0 +1,473 @@
|
||||
import Divider from '@site/src/components/Divider';
|
||||
|
||||
# server
|
||||
|
||||
these routes relate to interacting with monitor `servers`
|
||||
|
||||
| name | route |
|
||||
| ---- | ------ |
|
||||
| [list servers](/api/server#list-servers) | `GET /api/server/list` |
|
||||
| [get server](/api/server#get-server) | `GET /api/server/<server_id>` |
|
||||
| [get server action state](/api/server#get-server-action-state) | `GET /api/server/<server_id>/action_state` |
|
||||
| [get server github accounts](/api/server#get-server-github-accounts) | `GET /api/server/<server_id>/github_accounts` |
|
||||
| [get server docker accounts](/api/server#get-server-docker-accounts) | `GET /api/server/<server_id>/docker_accounts` |
|
||||
| [get server available secrets](/api/server#get-server-available-secrets) | `GET /api/server/<server_id>/secrets` |
|
||||
| [create server](/api/server#create-server) | `POST /api/server/create` |
|
||||
| [create full server](/api/server#create-full-server) | `POST /api/server/create_full` |
|
||||
| [delete server](/api/server#delete-server) | `DELETE /api/server/<server_id>/delete` |
|
||||
| [update server](/api/server#update-server) | `PATCH /api/server/update` |
|
||||
| [get server periphery version](/api/server#get-server-periphery-version) | `GET /api/server/<server_id>/version` |
|
||||
| [get server system information](/api/server#get-server-system-information) | `GET /api/server/<server_id>/system_information` |
|
||||
| [get server stats](/api/server#get-server-stats) | `GET /api/server/<server_id>/stats` |
|
||||
| [get server stats history](/api/server#get-server-stats-history) | `GET /api/server/<server_id>/stats/history` |
|
||||
| [get server stats at time](/api/server#get-server-stats-at-time) | `GET /api/server/<server_id>/stats/at_ts` |
|
||||
| [get docker networks](/api/server#get-docker-networks) | `GET /api/server/<server_id>/networks` |
|
||||
| [prune docker networks](/api/server#prune-docker-networks) | `POST /api/server/<server_id>/networks/prune` |
|
||||
| [get docker images](/api/server#get-docker-images) | `GET /api/server/<server_id>/images` |
|
||||
| [prune docker images](/api/server#prune-docker-images) | `POST /api/server/<server_id>/images/prune` |
|
||||
| [get docker containers](/api/server#get-docker-containers) | `GET /api/server/<server_id>/containers` |
|
||||
| [prune docker containers](/api/server#prune-docker-containers) | `POST /api/server/<server_id>/containers/prune` |
|
||||
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## list servers
|
||||
`GET /api/server/list`
|
||||
|
||||
this method will return an array of servers with their status
|
||||
that the requesting user has a minimum of `Read` permissions on.
|
||||
|
||||
### response body
|
||||
```json
|
||||
[
|
||||
{
|
||||
server: Server,
|
||||
status: ServerStatus
|
||||
},
|
||||
...
|
||||
]
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## get server
|
||||
`GET /api/server/<server_id>`
|
||||
|
||||
this method will return the server with server status that
|
||||
the requesting user has a minimum of `Read` permissions on.
|
||||
it will return `500: Internal Server Error` if the user does not have the required permissions.
|
||||
|
||||
### response body
|
||||
```json
|
||||
{
|
||||
server: Server,
|
||||
status: ServerStatus
|
||||
}
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## get server action state
|
||||
`GET /api/server/<server_id>/action_state`
|
||||
|
||||
this method returns the action state for the server, eg. whether the server is currently `pruning_images`.
|
||||
|
||||
|
||||
### response body
|
||||
```json
|
||||
{
|
||||
pruning_networks: boolean,
|
||||
pruning_containers: boolean,
|
||||
pruning_images: boolean,
|
||||
}
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## get server github accounts
|
||||
`GET /api/server/<server_id>/github_accounts`
|
||||
|
||||
this method returns a list of all the github account usernames that are available on the server,
|
||||
as defined in the server's periphery config under [github_accounts].
|
||||
|
||||
### response body
|
||||
```json
|
||||
["<github_username_1>", "<github_username_2>", ...]
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## get server docker accounts
|
||||
`GET /api/server/<server_id>/docker_accounts`
|
||||
|
||||
this method returns a list of all the docker account usernames that are available on the server,
|
||||
as defined in the server's periphery config under [docker_accounts].
|
||||
|
||||
### response body
|
||||
```json
|
||||
["<docker_username_1>", "<docker_username_2>", ...]
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## get server available secrets
|
||||
`GET /api/server/<server_id>/secrets`
|
||||
|
||||
this method returns a list of all the secret keys that are available on the server,
|
||||
as defined in the server's periphery config under [secrets].
|
||||
|
||||
### response body
|
||||
```json
|
||||
["<secret_key_1>", "<secret_key_2>", ...]
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## create server
|
||||
`POST /api/server/create`
|
||||
|
||||
### request body
|
||||
```json
|
||||
{
|
||||
name: string,
|
||||
address: string, // eg. http://12.34.56.78:8000
|
||||
}
|
||||
```
|
||||
|
||||
### response body
|
||||
[Server](/api/types#server)
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## create full server
|
||||
`POST /api/server/create_full`
|
||||
|
||||
this method is used to create a new server, already initialized with config.
|
||||
it will return the created server.
|
||||
|
||||
### request body
|
||||
[Server](/api/types#server)
|
||||
|
||||
### response body
|
||||
[Server](/api/types#server)
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## delete server
|
||||
`DELETE /api/server/<server_id>/delete`
|
||||
|
||||
this method will delete the server, along with all deployments attached to the server.
|
||||
|
||||
### response body
|
||||
[Server](/api/types#server)
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## update server
|
||||
`PATCH /api/server/update`
|
||||
|
||||
this method is used to update a servers configuration.
|
||||
|
||||
### request body
|
||||
[Server](/api/types#server)
|
||||
|
||||
### response body
|
||||
[Server](/api/types#server)
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## get server periphery version
|
||||
`GET /api/server/<server_id>/version`
|
||||
|
||||
this method is used to get the version of the periphery binary running on the server.
|
||||
|
||||
### response body
|
||||
```json
|
||||
string // the periphery version
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## get server system information
|
||||
`GET /api/server/<server_id>/system_information`
|
||||
|
||||
this method gets some information about the host system running the periphery binary.
|
||||
|
||||
### response body
|
||||
```json
|
||||
{
|
||||
name?: string, // the name of the system
|
||||
os?: string, // the os the system is running
|
||||
kernel?: string, // the version of the kernel
|
||||
core_count?: number, // number of cores in the cpu
|
||||
host_name?: string, // host name of the system
|
||||
cpu_brand: string, // information on the cpu of the system
|
||||
}
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## get server stats
|
||||
`GET /api/server/<server_id>/stats`
|
||||
|
||||
this method retrieves current system stats of the server.
|
||||
|
||||
### query params
|
||||
```json
|
||||
cpus=boolean // optional. if true, response will include information about each core individually
|
||||
disks=boolean // optional. if true, response will include breakdown of disk usage by mount point
|
||||
networks=boolean // optional. if true, response will include info on network usage
|
||||
components=boolean // optional. if true, response will include component tempurature
|
||||
processes=boolean // optional. if true, response will include all system processes running on host and their resource usage
|
||||
```
|
||||
|
||||
### response body
|
||||
```json
|
||||
{
|
||||
system_load: number,
|
||||
cpu_perc: number,
|
||||
cpu_freq_mhz: number,
|
||||
mem_used_gb: number,
|
||||
mem_total_gb: number,
|
||||
disk: {},
|
||||
cpus: [],
|
||||
networks: [],
|
||||
components: [],
|
||||
processes: [],
|
||||
polling_rate: Timelength,
|
||||
refresh_ts: number,
|
||||
refresh_list_ts: number,
|
||||
}
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## get server stats history
|
||||
`GET /api/server/<server_id>/stats/history`
|
||||
|
||||
this method will return historical system stats for the server.
|
||||
the response is paginated, to get older data, specify a higher page number.
|
||||
|
||||
### query params
|
||||
```json
|
||||
interval=Timelength // optional, default interval is 1-hr. controls granularity of historical data
|
||||
limit=number // optional, default is 100, max is 500. specifies the number of data points to fetch
|
||||
page=number // optional, default is 0. specifies the page of data, going backward in time.
|
||||
networks=boolean // optional. if true, response will include historical info on network usage
|
||||
components=boolean // optional. if true, response will include historical component tempuratures
|
||||
```
|
||||
|
||||
### response body
|
||||
```json
|
||||
[
|
||||
{
|
||||
ts: number, // unix timestamp in ms
|
||||
server_id: string // specifies the server
|
||||
system_load: number,
|
||||
cpu_perc: number,
|
||||
cpu_freq_mhz: number,
|
||||
mem_used_gb: number,
|
||||
mem_total_gb: number,
|
||||
disk: {},
|
||||
cpus: [],
|
||||
networks: [],
|
||||
components: [],
|
||||
processes: [],
|
||||
polling_rate: Timelength,
|
||||
},
|
||||
...
|
||||
]
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## get server stats at time
|
||||
`GET /api/server/<server_id>/stats/at_ts`
|
||||
|
||||
this method retrieves the historical stats for a server at a specific timestamp
|
||||
|
||||
### query params
|
||||
```json
|
||||
ts=number // required. the timestamp in ms
|
||||
```
|
||||
|
||||
### response body
|
||||
```json
|
||||
{
|
||||
ts: number, // unix timestamp in ms
|
||||
server_id: string // specifies the server
|
||||
system_load: number,
|
||||
cpu_perc: number,
|
||||
cpu_freq_mhz: number,
|
||||
mem_used_gb: number,
|
||||
mem_total_gb: number,
|
||||
disk: {},
|
||||
cpus: [],
|
||||
networks: [],
|
||||
components: [],
|
||||
processes: [],
|
||||
polling_rate: Timelength,
|
||||
}
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## get docker networks
|
||||
`GET /api/server/<server_id>/networks`
|
||||
|
||||
this method retrieves the docker networks on the server
|
||||
|
||||
### response body
|
||||
```json
|
||||
[
|
||||
{
|
||||
Name?: string,
|
||||
Id?: string,
|
||||
Created?: string,
|
||||
Scope?: string,
|
||||
Driver?: string,
|
||||
EnableIPv6?: boolean,
|
||||
IPAM?: {
|
||||
Driver?: string,
|
||||
Config?: [
|
||||
{
|
||||
Subnet?: string,
|
||||
IPRange?: string,
|
||||
Gateway?: string,
|
||||
AuxiliaryAddresses?: {}
|
||||
},
|
||||
...
|
||||
],
|
||||
Options?: {}
|
||||
},
|
||||
Internal?: boolean,
|
||||
Attachable?: boolean,
|
||||
Ingress?: boolean,
|
||||
Containers?: {},
|
||||
Options?: {},
|
||||
Labels?: {}
|
||||
},
|
||||
...
|
||||
]
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## prune docker networks
|
||||
`POST /api/server/<server_id>/networks/prune`
|
||||
|
||||
this method triggers the `network prune` action on the server, which runs
|
||||
`docker network prune -f` on the target server
|
||||
|
||||
### response body
|
||||
[Update](/api/types#update)
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## get docker images
|
||||
`GET /api/server/<server_id>/images`
|
||||
|
||||
this method will return a list of images available locally on the server
|
||||
|
||||
### response body
|
||||
```json
|
||||
[
|
||||
{
|
||||
Id: string,
|
||||
ParentId: string,
|
||||
RepoTags: [string],
|
||||
RepoDigests: [string],
|
||||
Created: number,
|
||||
Size: number,
|
||||
SharedSize: number,
|
||||
VirtualSize: number,
|
||||
Labels: {},
|
||||
Containers: number,
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## prune docker images
|
||||
`POST /api/server/<server_id>/images/prune`
|
||||
|
||||
this method triggers the `image prune` action, which runs
|
||||
`docker image prune -a -f` on the target server
|
||||
|
||||
### response body
|
||||
[Update](/api/types#update)
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## get docker containers
|
||||
`GET /api/server/<server_id>/containers`
|
||||
|
||||
this method is used to retrieve information about all the containers on the target server
|
||||
|
||||
### response body
|
||||
```json
|
||||
[
|
||||
{
|
||||
name: string,
|
||||
id: string,
|
||||
image: string,
|
||||
state: DockerContainerState,
|
||||
status?: string,
|
||||
},
|
||||
...
|
||||
]
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## prune docker containers
|
||||
`POST /api/server/<server_id>/containers/prune`
|
||||
|
||||
this method triggers the `container prune` action, which runs
|
||||
`docker container prune -f` on the target server
|
||||
|
||||
### response body
|
||||
[Update](/api/types#update)
|
||||
283
docsite/docs/api/types.mdx
Normal file
283
docsite/docs/api/types.mdx
Normal file
@@ -0,0 +1,283 @@
|
||||
import Divider from "@site/src/components/Divider";
|
||||
|
||||
# types
|
||||
|
||||
these types are used across the monitor api, defined using `typescript`. they are referenced throughout the api docs.
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## build
|
||||
|
||||
```typescript
|
||||
interface Build {
|
||||
_id?: {
|
||||
$oid: string;
|
||||
};
|
||||
name: string;
|
||||
description?: string;
|
||||
permissions?: {
|
||||
[user_id: string]: PermissionLevel;
|
||||
};
|
||||
skip_secret_interp?: boolean;
|
||||
server_id?: string;
|
||||
aws_config?: {
|
||||
region?: string;
|
||||
instance_type?: string;
|
||||
ami_name?: string;
|
||||
volume_gb?: number;
|
||||
subnet_id?: string;
|
||||
security_group_ids?: string[];
|
||||
key_pair_name?: string;
|
||||
assign_public_ip?: boolean;
|
||||
};
|
||||
version: {
|
||||
major: number;
|
||||
minor: number;
|
||||
patch: number;
|
||||
};
|
||||
repo?: string;
|
||||
branch?: string;
|
||||
github_account?: string;
|
||||
pre_build?: {
|
||||
path?: string;
|
||||
command?: string;
|
||||
};
|
||||
docker_build_args?: {
|
||||
build_path: string;
|
||||
dockerfile_path?: string;
|
||||
build_args?: Array<{
|
||||
variable: string;
|
||||
value: string;
|
||||
}>;
|
||||
extra_args?: string[];
|
||||
use_buildx?: boolean;
|
||||
};
|
||||
docker_account?: string;
|
||||
docker_organization?: string;
|
||||
last_built_at?: string;
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
}
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## deployment
|
||||
|
||||
```typescript
|
||||
interface Deployment {
|
||||
_id?: {
|
||||
$oid: string;
|
||||
};
|
||||
name: string;
|
||||
description?: string;
|
||||
server_id: string;
|
||||
permissions?: PermissionLevel;
|
||||
skip_secret_interp?: boolean;
|
||||
docker_run_args: {
|
||||
image: string;
|
||||
ports?: Array<{
|
||||
local: string;
|
||||
container: string;
|
||||
}>;
|
||||
volumes?: Array<{
|
||||
local: string;
|
||||
container: string;
|
||||
}>;
|
||||
environment?: Array<{
|
||||
variable: string;
|
||||
value: string;
|
||||
}>;
|
||||
network?: string;
|
||||
restart?: "no" | "on-failure" | "always" | "unless-stopped";
|
||||
post_image?: string;
|
||||
container_user?: string;
|
||||
extra_args?: string[];
|
||||
docker_account?: string;
|
||||
};
|
||||
build_id?: string;
|
||||
build_version?: {
|
||||
major: number;
|
||||
minor: number;
|
||||
patch: number;
|
||||
};
|
||||
repo?: string;
|
||||
branch?: string;
|
||||
github_account?: string;
|
||||
on_clone?: {
|
||||
path?: string;
|
||||
command?: string;
|
||||
};
|
||||
on_pull?: {
|
||||
path?: string;
|
||||
command?: string;
|
||||
};
|
||||
repo_mount?: {
|
||||
local: string;
|
||||
container: string;
|
||||
};
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
}
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## server
|
||||
|
||||
```typescript
|
||||
interface Server {
|
||||
_id?: string;
|
||||
name: string;
|
||||
description?: string;
|
||||
address: string;
|
||||
permissions?: {
|
||||
[user_id: string]: PermissionLevel;
|
||||
};
|
||||
enabled: boolean;
|
||||
to_notify?: string[];
|
||||
auto_prune?: boolean;
|
||||
cpu_alert?: number;
|
||||
mem_alert?: number;
|
||||
disk_alert?: number;
|
||||
stats_interval?: Timelength;
|
||||
region?: string;
|
||||
instance_id?: string;
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
}
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## update
|
||||
|
||||
```typescript
|
||||
interface Update {
|
||||
_id?: string;
|
||||
target: {
|
||||
type: "System" | "Build" | "Deployment" | "Server" | "Procedure" | "Group";
|
||||
id?: string;
|
||||
};
|
||||
operation: Operation;
|
||||
logs: Array<{
|
||||
stage: string;
|
||||
command: string;
|
||||
stdout: string;
|
||||
stderr: string;
|
||||
success: boolean;
|
||||
start_ts: string;
|
||||
end_ts: string;
|
||||
}>;
|
||||
start_ts: string;
|
||||
end_ts?: string;
|
||||
status: "queued" | "in_progress" | "complete";
|
||||
success: boolean;
|
||||
operator: string;
|
||||
version?: {
|
||||
major: number;
|
||||
minor: number;
|
||||
patch: number;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## operation
|
||||
|
||||
```typescript
|
||||
enum Operation {
|
||||
None = "none",
|
||||
CreateServer = "create_server",
|
||||
UpdateServer = "update_server",
|
||||
DeleteServer = "delete_server",
|
||||
PruneImagesServer = "prune_images_server",
|
||||
PruneContainersServer = "prune_containers_server",
|
||||
PruneNetworksServer = "prune_networks_server",
|
||||
RenameServer = "rename_server",
|
||||
CreateBuild = "create_build",
|
||||
UpdateBuild = "update_build",
|
||||
DeleteBuild = "delete_build",
|
||||
BuildBuild = "build_build",
|
||||
CreateDeployment = "create_deployment",
|
||||
UpdateDeployment = "update_deployment",
|
||||
DeleteDeployment = "delete_deployment",
|
||||
DeployContainer = "deploy_container",
|
||||
StopContainer = "stop_container",
|
||||
StartContainer = "start_container",
|
||||
RemoveContainer = "remove_container",
|
||||
PullDeployment = "pull_deployment",
|
||||
RecloneDeployment = "reclone_deployment",
|
||||
RenameDeployment = "rename_deployment",
|
||||
CreateProcedure = "create_procedure",
|
||||
UpdateProcedure = "update_procedure",
|
||||
DeleteProcedure = "delete_procedure",
|
||||
CreateGroup = "create_group",
|
||||
UpdateGroup = "update_group",
|
||||
DeleteGroup = "delete_group",
|
||||
ModifyUserEnabled = "modify_user_enabled",
|
||||
ModifyUserCreateServerPermissions = "modify_user_create_server_permissions",
|
||||
ModifyUserCreateBuildPermissions = "modify_user_create_build_permissions",
|
||||
ModifyUserPermissions = "modify_user_permissions",
|
||||
AutoBuild = "auto_build",
|
||||
AutoPull = "auto_pull",
|
||||
}
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## permission level
|
||||
|
||||
```typescript
|
||||
enum PermissionLevel {
|
||||
None = "none",
|
||||
Read = "read",
|
||||
Execute = "execute",
|
||||
Update = "update",
|
||||
}
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<Divider />
|
||||
```
|
||||
|
||||
## timelength
|
||||
|
||||
```typescript
|
||||
enum Timelength {
|
||||
OneSecond = "1-sec",
|
||||
FiveSeconds = "5-sec",
|
||||
TenSeconds = "10-sec",
|
||||
FifteenSeconds = "15-sec",
|
||||
ThirtySeconds = "30-sec",
|
||||
OneMinute = "1-min",
|
||||
TwoMinutes = "2-min",
|
||||
FiveMinutes = "5-min",
|
||||
TenMinutes = "10-min",
|
||||
FifteenMinutes = "15-min",
|
||||
ThirtyMinutes = "30-min",
|
||||
OneHour = "1-hr",
|
||||
TwoHours = "2-hr",
|
||||
SixHours = "6-hr",
|
||||
EightHours = "8-hr",
|
||||
TwelveHours = "12-hr",
|
||||
OneDay = "1-day",
|
||||
ThreeDay = "3-day",
|
||||
OneWeek = "1-wk",
|
||||
TwoWeeks = "2-wk",
|
||||
ThirtyDays = "30-day",
|
||||
}
|
||||
```
|
||||
0
docsite/docs/api/websocket.mdx
Normal file
0
docsite/docs/api/websocket.mdx
Normal file
9
docsite/docs/build-images/choosing-builder.md
Normal file
9
docsite/docs/build-images/choosing-builder.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# select a builder
|
||||
|
||||
A builder is a machine running monitor periphery and docker. Any server connected to monitor can be chosen as the builder for a build.
|
||||
|
||||
Building on a machine running production software is usually not a great idea, as this process can use a lot of system resources. It is better to start up a temporary cloud machine dedicated for the build, then shut it down when the build is finished. Right now monitor supports AWS ec2 for this task.
|
||||
|
||||
### AWS builder
|
||||
|
||||
You can choose to build on AWS on the "builder" tab on the build's page. From here you can select preconfigured AMIs to use as a base to build the image. These must be configured in the monitor core configuration along with other information like defaults to use, AWS credentials, etc. This is explained on the [core setup page](https://github.com/mbecker20/monitor/blob/main/docs/setup.md).
|
||||
29
docsite/docs/build-images/configuration.md
Normal file
29
docsite/docs/build-images/configuration.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# configuration
|
||||
|
||||
monitor just needs a bit of information in order to build your image.
|
||||
|
||||
### repo configuration
|
||||
To specify the github repo to build, just give it the name of the repo and the branch under *repo config*. The name is given like ```mbecker20/monitor```, it includes the username / organization that owns the repo.
|
||||
|
||||
Many repos are private, in this case a Github access token is required in the periphery.config.toml of the building server. these are specified in the config like ```username = "access_token"```. An account which has access to the repo and is available on the periphery server can be selected to use via the *github account* dropdown menu.
|
||||
|
||||
### docker build configuration
|
||||
|
||||
In order to docker build, monitor just needs to know the build directory and the path of the Dockerfile relative to the repo, you can configure these in the *build config* section.
|
||||
|
||||
If the build directory is the root of the repository, you pass the build path as ```.```. If the build directory is some folder of the repo, just pass the name of the the folder. Do not pass the preceding "/". for example ```build/directory```
|
||||
|
||||
The dockerfile's path is given relative to the build directory. So if your build directory is ```build/directory``` and the dockerfile is in ```build/directory/Dockerfile.example```, you give the dockerfile path simply as ```Dockerfile.example```.
|
||||
|
||||
Just as with private repos, you will need to select a docker account to use with ```docker push```.
|
||||
|
||||
### adding build args
|
||||
|
||||
The Dockerfile may make use of [build args](https://docs.docker.com/engine/reference/builder/#arg). Build args can be passed using the gui by pressing the ```edit``` button. They are passed in the menu just like in the would in a .env file:
|
||||
|
||||
```
|
||||
BUILD_ARG1=some_value
|
||||
BUILD_ARG2=some_other_value
|
||||
```
|
||||
|
||||
Note that these values are visible in the final image using ```docker history```, so shouldn't be used to pass build time secrets. Use [secret mounts](https://docs.docker.com/engine/reference/builder/#run---mounttypesecret) for this instead.
|
||||
15
docsite/docs/build-images/index.mdx
Normal file
15
docsite/docs/build-images/index.mdx
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
slug: /build-images
|
||||
---
|
||||
|
||||
# building images
|
||||
|
||||
Monitor builds docker images by cloning the source repository from Github, running ```docker build```, and pushing the resulting image to docker hub. Any repo containing a ```Dockerfile``` is buildable using this method.
|
||||
|
||||
Build configuration involves passing file / directory paths, for more details about passing file paths, see the [file paths doc](/file-paths).
|
||||
|
||||
```mdx-code-block
|
||||
import DocCardList from '@theme/DocCardList';
|
||||
|
||||
<DocCardList />
|
||||
```
|
||||
7
docsite/docs/build-images/pre-build.md
Normal file
7
docsite/docs/build-images/pre-build.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# pre build command
|
||||
|
||||
Sometimes a command needs to be run before running ```docker build```, you can configure this in the *pre build* section.
|
||||
|
||||
There are two fields to pass for *pre build*. the first is *path*, which changes the working directory. To run the command in the root of the repo, just pass ```.```. The second field is *command*, this is the shell command to be executed after the repo is cloned.
|
||||
|
||||
For example, say your repo had a folder in it called ```scripts``` with a shell script ```on-clone.sh```. You would give *path* as ```scripts``` and command as ```sh on-clone.sh```. Or you could make *path* just ```.``` and then the command would be ```sh scripts/on-clone.sh```. Either way works fine.
|
||||
3
docsite/docs/build-images/versioning.md
Normal file
3
docsite/docs/build-images/versioning.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# versioning
|
||||
|
||||
Monitor uses a major.minor.patch versioning scheme. Every build will auto increment the patch number, and push the image to docker hub with the version tag as well as the ```latest``` tag.
|
||||
7
docsite/docs/connecting-servers/add-server.md
Normal file
7
docsite/docs/connecting-servers/add-server.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# adding the server to monitor
|
||||
|
||||
The easiest way to add the server is with the GUI. On the home page, click the ```+``` button to the right of the server search bar, configure the name and address of the server. The address is the full http/s url to the periphery server, eg ```http://12.34.56.78:8000```.
|
||||
|
||||
Once it is added, you can use access the GUI to modify some config, like the alerting thresholds for cpu, memory and disk usage. A server can also be temporarily disabled, this will prevent alerting if it goes offline.
|
||||
|
||||
Since no state is stored on the periphery servers, you can easily redirect all deployments to be hosted on a different server. Just update the address to point to the new server.
|
||||
16
docsite/docs/connecting-servers/index.mdx
Normal file
16
docsite/docs/connecting-servers/index.mdx
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
slug: /connecting-servers
|
||||
---
|
||||
|
||||
# connecting servers
|
||||
|
||||
Integrating a device into the monitor system has 2 steps:
|
||||
|
||||
1. Setup and start the periphery agent on the server
|
||||
2. Adding the server to monitor via the core API
|
||||
|
||||
```mdx-code-block
|
||||
import DocCardList from '@theme/DocCardList';
|
||||
|
||||
<DocCardList />
|
||||
```
|
||||
@@ -1,11 +1,4 @@
|
||||
# connecting servers
|
||||
|
||||
Integrating a device into the monitor system has 2 steps:
|
||||
|
||||
1. Setup and start the periphery agent on the server
|
||||
2. Adding the server to monitor via the core API
|
||||
|
||||
## setup monitor periphery
|
||||
# setup monitor periphery
|
||||
|
||||
The easiest way to do this is to follow the [monitor guide](https://github.com/mbecker20/monitor-guide). This is a repo containing directions and scripts enabling command line installation via ssh or remotely.
|
||||
|
||||
@@ -13,7 +6,7 @@ The easiest way to do this is to follow the [monitor guide](https://github.com/m
|
||||
|
||||
1. Download the periphery binary from the latest [release](https://github.com/mbecker20/monitor/releases).
|
||||
|
||||
2. Create and edit your config files, following the [config example](https://github.com/mbecker20/monitor/blob/main/config_example/periphery.config.example.toml). The monitor cli can be used to add the boilerplate: ```monitor periphery gen-config --path /path/to/config.toml```. The files can be anywhere, and can be passed to periphery via the ```--config-path``` flag.
|
||||
2. Create and edit your config files, following the [config example](https://github.com/mbecker20/monitor/blob/main/config_example/periphery.config.example.toml). The monitor cli can be used to add the boilerplate: ```monitor periphery gen-config --path /path/to/config.toml```. The files can be anywhere, and can be passed to periphery via the ```--config-path``` argument.
|
||||
|
||||
3. Ensure that inbound connectivity is allowed on the port specified in periphery.config.toml (default 8000).
|
||||
|
||||
@@ -21,36 +14,30 @@ The easiest way to do this is to follow the [monitor guide](https://github.com/m
|
||||
|
||||
5. Start the periphery binary with your preferred process manager, like systemd. The config read from the file is printed on startup, ensure that it is as expected.
|
||||
|
||||
## example periphery start command
|
||||
### example periphery start command
|
||||
|
||||
```
|
||||
periphery \
|
||||
--config-path /path/to/periphery.config.base.toml \
|
||||
--config-path /other_path/to/periphery.config.overide.toml \
|
||||
--config-path /other_path/to/overide-periphery-config-directory \
|
||||
--config-keyword periphery \
|
||||
--config-keyword config \
|
||||
--merge-nested-config \
|
||||
--home_dir /home/username
|
||||
```
|
||||
|
||||
## passing config files
|
||||
### passing config files
|
||||
|
||||
when you pass multiple config files, later --config-path given in the command will always overide previous ones.
|
||||
Either file paths or directory paths can be passed to ```--config-path```.
|
||||
|
||||
there are two ways to merge config files. The default behavior is to completely replace any base fields with whatever fields are present in the overide config. So if you pass ```allowed_ips = []``` in your overide config, the final allowed_ips will be an empty list as well.
|
||||
When using directories, the file entries can be filtered by name with the ```--config-keyword``` argument, which can be passed multiple times to add more keywords. If passed, then only config files with file names that contain all keywords will be merged.
|
||||
|
||||
When passing multiple config files, later --config-path given in the command will always overide previous ones. Directory config files are merged in alphabetical order by name, so ```config_b.toml``` will overide ```config_a.toml```.
|
||||
|
||||
There are two ways to merge config files. The default behavior is to completely replace any base fields with whatever fields are present in the overide config. So if you pass ```allowed_ips = []``` in your overide config, the final allowed_ips will be an empty list as well.
|
||||
|
||||
```--merge-nested-config``` will merge config fields recursively and extend config array fields.
|
||||
|
||||
For example, with ```--merge-nested-config``` you can specify an allowed ip in the base config, and another in the overide config, they will both be present in the final config.
|
||||
|
||||
Similarly, you can specify a base docker / github account pair, and extend them with additional accounts in the overide config.
|
||||
|
||||
## adding the server to monitor
|
||||
|
||||
The easiest way to add the server is with the GUI. On the home page, click the + button to the right of the server search bar, configure the name and address of the server. The address is the full http/s url to the periphery server, eg http://12.34.56.78:8000.
|
||||
|
||||
Once it is added, you can use access the GUI to modify some config, like the alerting thresholds for cpu, memory and disk usage. A server can also be temporarily disabled, this will prevent alerting if it goes offline.
|
||||
|
||||
Since no state is stored on the periphery servers, you can easily redirect all deployments to be hosted on a different server. Just update the address to point to the new server.
|
||||
|
||||
[next: building](https://github.com/mbecker20/monitor/blob/main/docs/builds.md)
|
||||
|
||||
[back to table of contents](https://github.com/mbecker20/monitor/blob/main/readme.md)
|
||||
Similarly, you can specify a base docker / github account pair, and extend them with additional accounts in the overide config.
|
||||
0
docsite/docs/core-setup/authentication.md
Normal file
0
docsite/docs/core-setup/authentication.md
Normal file
0
docsite/docs/core-setup/index.mdx
Normal file
0
docsite/docs/core-setup/index.mdx
Normal file
@@ -1,12 +1,8 @@
|
||||
# deploying applications
|
||||
# configuration
|
||||
|
||||
Monitor can deploy any docker images that it can access with the configured docker accounts. It works by parsing the deployment configuration into a ```docker run``` command. The configuration is stored on MongoDB, and records of all actions (update config, deploy, stop, etc.) are stored as well.
|
||||
## choose the docker image
|
||||
|
||||
Deployment configuration involves passing file / directory paths, for more details about passing file paths, see the [file paths doc](https://github.com/mbecker20/monitor/blob/main/docs/paths.md).
|
||||
|
||||
## configuring the image
|
||||
|
||||
There are two options to configure the deployed image.
|
||||
There are two options to configure the docker image to deploy.
|
||||
|
||||
### attaching a monitor build
|
||||
If the software you want to deploy is built by monitor, you can attach the build directly to the deployment.
|
||||
@@ -84,20 +80,4 @@ Sometimes you need to specify some flags to be passed directly to the applicatio
|
||||
docker run -d --name mongo-db mongo:6.0.3 --quiet
|
||||
```
|
||||
|
||||
In order to achieve this with monitor, just pass ```--quiet``` to 'post image'.
|
||||
|
||||
## container lifetime management
|
||||
|
||||
The lifetime of a docker container is more like a virtual machine. They can be created, started, stopped, and destroyed. The lifetime management actions monitor presents to the user is relative to the containers state. For example, when the container is ```running```, you can either stop it, destroy it, or redeploy it.
|
||||
|
||||
### stopping a container
|
||||
|
||||
Sometimes you want to stop a running application but preserve its logs and configuration, either to be restarted later or to view the logs at a later time. It is more like *pausing* the application with its current config, as no configuration (like environment variable, volume mounts, etc.) will be changed when the container is started again. In order to restart an application with updated configuration, it must be *redeployed*.
|
||||
|
||||
### container redeploy
|
||||
|
||||
redeploying is the action of destroying a container and recreating it. If you update deployment config, these changes will not take effect until the container is redeployed. Just note this will destroy the previous containers logs along with the container itself.
|
||||
|
||||
[next: permissions](https://github.com/mbecker20/monitor/blob/main/docs/permissions.md)
|
||||
|
||||
[back to table of contents](https://github.com/mbecker20/monitor/blob/main/readme.md)
|
||||
In order to achieve this with monitor, just pass ```--quiet``` to 'post image'.
|
||||
11
docsite/docs/deploy-containers/index.mdx
Normal file
11
docsite/docs/deploy-containers/index.mdx
Normal file
@@ -0,0 +1,11 @@
|
||||
# deploy containers
|
||||
|
||||
Monitor can deploy any docker images that it can access with the configured docker accounts. It works by parsing the deployment configuration into a ```docker run``` command, which is then run on the target system. The configuration is stored on MongoDB, and records of all actions (update config, deploy, stop, etc.) are stored as well.
|
||||
|
||||
Deployment configuration involves passing file / directory paths, for more details about passing file paths, see the [file paths doc](/file-paths).
|
||||
|
||||
```mdx-code-block
|
||||
import DocCardList from '@theme/DocCardList';
|
||||
|
||||
<DocCardList />
|
||||
```
|
||||
15
docsite/docs/deploy-containers/lifetime-management.md
Normal file
15
docsite/docs/deploy-containers/lifetime-management.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# container management
|
||||
|
||||
the lifetime of a docker container is more like a virtual machine. They can be created, started, stopped, and destroyed. monitor will display the state of the container and provides an API to manage all your container's lifetimes.
|
||||
|
||||
this is achieved internally by running the appropriate docker command for the requested action (docker stop, docker start, etc).
|
||||
|
||||
### stopping a container
|
||||
|
||||
sometimes you want to stop a running application but preserve its logs and configuration, either to be restarted later or to view the logs at a later time. It is more like *pausing* the application with its current config, as no configuration (like environment variable, volume mounts, etc.) will be changed when the container is started again.
|
||||
|
||||
note that in order to restart an application with updated configuration, it must be *redeployed*. stopping and starting a container again will keep all configuration as it was when the container was initially created.
|
||||
|
||||
### container redeploy
|
||||
|
||||
redeploying is the action of destroying a container and recreating it. If you update deployment config, these changes will not take effect until the container is redeployed. Just note this will destroy the previous containers logs along with the container itself.
|
||||
@@ -1,10 +1,10 @@
|
||||
# File Paths
|
||||
# file paths
|
||||
|
||||
When working with monitor, you might have to configure file or directory paths.
|
||||
when working with monitor, you might have to configure file or directory paths.
|
||||
|
||||
## Relative Paths
|
||||
## relative paths
|
||||
|
||||
Where possible, it is better to use relative file paths. Using relative file paths removes the connection between the process being run and the particular server it runs one, making it easier to move things between servers.
|
||||
Where possible, it is better to use relative file paths. Using relative file paths removes the connection between the process being run and the particular server it runs on, making it easier to move things between servers.
|
||||
|
||||
Where you see relative paths:
|
||||
|
||||
@@ -20,19 +20,12 @@ There are 3 kinds of paths to pass:
|
||||
|
||||
1. to specify the root of the repo, use ```.``` as the path
|
||||
2. to specify a folder in the repo, pass it with **no** preceding ```/```. For example, ```example_folder``` or ```folder1/folder2```
|
||||
3. to specify an absolute path on the servers filesystem, use a preceding slash, eg. ```/home/ubuntu/example```. This way should only be used if absolutely necessary.
|
||||
3. to specify an absolute path on the servers filesystem, use a preceding slash, eg. ```/home/ubuntu/example```. This way should only be used if absolutely necessary, like when passing host paths when configuring docker volumes.
|
||||
|
||||
### Implementation
|
||||
### implementation
|
||||
|
||||
relative file paths are joined with the path of the repo on the system using a Rust [PathBuf](https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.push).
|
||||
|
||||
## Docker Volume Paths
|
||||
|
||||
These are passed directly to the Docker CLI using ```--volume /path/on/system:/path/in/container```. So for these, the same rules apply as when using Docker on the command line. Paths here should be given as absolute, don't use ```~``` or even ```$HOME```.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
---
|
||||
slug: /intro
|
||||
---
|
||||
|
||||
|
||||
# introduction
|
||||
# what is monitor?
|
||||
|
||||
If you have many servers running many applications, it can be a challenge to keep things organized and easily accessible. Without structure, things can become messy quickly, which means operational issues are more likely to arise and they can take longer to resolve. Ultimately these issues hinder productivity and waste valuable time. Monitor is a web app to provide this structure for how applications are built, deployed, and managed across many servers.
|
||||
|
||||
@@ -39,8 +41,4 @@ Monitor exposes powerful functionality over the core's REST API, enabling infras
|
||||
|
||||
Monitor is a system designed to be used by many users, whether they are developers, operations personnel, or administrators. The ability to affect an applications state is very powerful, so monitor has a granular permissioning system to only provide this functionality to the intended users. The permissioning system is explained in detail in the [permissioning](https://github.com/mbecker20/monitor/blob/main/docs/permissions.md) section.
|
||||
|
||||
User sign-on is possible using username / password, or with Oauth (Github and Google). Allowed login methods can be configured from the [core config](https://github.com/mbecker20/monitor/blob/main/config_example/core.config.example.toml).
|
||||
|
||||
[next: connecting servers](https://github.com/mbecker20/monitor/blob/main/docs/servers.md)
|
||||
|
||||
[back to table of contents](https://github.com/mbecker20/monitor/blob/main/readme.md)
|
||||
User sign-on is possible using username / password, or with Oauth (Github and Google). Allowed login methods can be configured from the [core config](https://github.com/mbecker20/monitor/blob/main/config_example/core.config.example.toml).
|
||||
@@ -25,8 +25,4 @@ Users also have some configurable global permissions, these are:
|
||||
- create server permission
|
||||
- create build permission
|
||||
|
||||
Only users with these permissions (as well as admins) can add additional servers to monitor, and can create additional builds, respectively.
|
||||
|
||||
[next: core setup](https://github.com/mbecker20/monitor/blob/main/docs/setup.md)
|
||||
|
||||
[back to table of contents](https://github.com/mbecker20/monitor/blob/main/readme.md)
|
||||
Only users with these permissions (as well as admins) can add additional servers to monitor, and can create additional builds, respectively.
|
||||
99
docsite/docusaurus.config.js
Normal file
99
docsite/docusaurus.config.js
Normal file
@@ -0,0 +1,99 @@
|
||||
// @ts-check
|
||||
// Note: type annotations allow type checking and IDEs autocompletion
|
||||
|
||||
const lightCodeTheme = require('prism-react-renderer/themes/github');
|
||||
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
|
||||
|
||||
/** @type {import('@docusaurus/types').Config} */
|
||||
const config = {
|
||||
title: "monitor",
|
||||
tagline: "distributed build and deployment system",
|
||||
favicon: "img/favicon.ico",
|
||||
|
||||
// Set the production url of your site here
|
||||
url: "https://mbecker20.github.io",
|
||||
// Set the /<baseUrl>/ pathname under which your site is served
|
||||
// For GitHub pages deployment, it is often '/<projectName>/'
|
||||
baseUrl: "/monitor/",
|
||||
// baseUrl: "/",
|
||||
|
||||
// GitHub pages deployment config.
|
||||
// If you aren't using GitHub pages, you don't need these.
|
||||
organizationName: "mbecker20", // Usually your GitHub org/user name.
|
||||
projectName: "monitor", // Usually your repo name.
|
||||
trailingSlash: false,
|
||||
deploymentBranch: "gh-pages-docs",
|
||||
|
||||
onBrokenLinks: "throw",
|
||||
onBrokenMarkdownLinks: "warn",
|
||||
|
||||
// Even if you don't use internalization, you can use this field to set useful
|
||||
// metadata like html lang. For example, if your site is Chinese, you may want
|
||||
// to replace "en" with "zh-Hans".
|
||||
i18n: {
|
||||
defaultLocale: "en",
|
||||
locales: ["en"],
|
||||
},
|
||||
|
||||
presets: [
|
||||
[
|
||||
"classic",
|
||||
/** @type {import('@docusaurus/preset-classic').Options} */
|
||||
({
|
||||
docs: {
|
||||
routeBasePath: "/",
|
||||
sidebarPath: require.resolve("./sidebars.js"),
|
||||
// Please change this to your repo.
|
||||
// Remove this to remove the "edit this page" links.
|
||||
editUrl: "https://github.com/mbecker20/monitor/tree/main/docsite",
|
||||
},
|
||||
theme: {
|
||||
customCss: require.resolve("./src/css/custom.css"),
|
||||
},
|
||||
}),
|
||||
],
|
||||
],
|
||||
|
||||
themeConfig:
|
||||
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
|
||||
({
|
||||
// Replace with your project's social card
|
||||
image: "img/monitor-lizard.png",
|
||||
docs: {
|
||||
sidebar: {
|
||||
autoCollapseCategories: true,
|
||||
}
|
||||
},
|
||||
navbar: {
|
||||
title: "monitor",
|
||||
logo: {
|
||||
alt: "monitor lizard",
|
||||
src: "img/monitor-lizard.png",
|
||||
},
|
||||
items: [
|
||||
{
|
||||
type: "docSidebar",
|
||||
sidebarId: "docs",
|
||||
position: "left",
|
||||
label: "docs",
|
||||
|
||||
},
|
||||
{
|
||||
href: "https://github.com/mbecker20/monitor",
|
||||
label: "GitHub",
|
||||
position: "right",
|
||||
},
|
||||
],
|
||||
},
|
||||
footer: {
|
||||
style: "dark",
|
||||
copyright: `Built with Docusaurus`,
|
||||
},
|
||||
prism: {
|
||||
theme: lightCodeTheme,
|
||||
darkTheme: darkCodeTheme,
|
||||
},
|
||||
}),
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
38
docsite/package.json
Normal file
38
docsite/package.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "docsite",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "docusaurus start",
|
||||
"deploy": "GIT_USER=mbecker20 docusaurus deploy"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.4.0",
|
||||
"@docusaurus/preset-classic": "2.4.0",
|
||||
"@mdx-js/react": "^1.6.22",
|
||||
"clsx": "^1.2.1",
|
||||
"prism-react-renderer": "^1.3.5",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "2.4.0",
|
||||
"@tsconfig/docusaurus": "^1.0.5",
|
||||
"typescript": "^4.7.4"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.5%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.14"
|
||||
}
|
||||
}
|
||||
86
docsite/sidebars.js
Normal file
86
docsite/sidebars.js
Normal file
@@ -0,0 +1,86 @@
|
||||
/**
|
||||
* Creating a sidebar enables you to:
|
||||
- create an ordered group of docs
|
||||
- render a sidebar for each doc of that group
|
||||
- provide next/previous navigation
|
||||
|
||||
The sidebars can be generated from the filesystem, or explicitly defined here.
|
||||
|
||||
Create as many sidebars as you want.
|
||||
*/
|
||||
|
||||
// @ts-check
|
||||
|
||||
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
|
||||
const sidebars = {
|
||||
// By default, Docusaurus generates a sidebar from the docs folder structure
|
||||
// docsSidebar: [{type: 'autogenerated', dirName: '.'}],
|
||||
|
||||
// But you can create a sidebar manually
|
||||
docs: [
|
||||
"intro",
|
||||
{
|
||||
type: "category",
|
||||
label: "connecting servers",
|
||||
link: {
|
||||
type: "doc",
|
||||
id: "connecting-servers/index",
|
||||
},
|
||||
items: [
|
||||
"connecting-servers/setup-periphery",
|
||||
"connecting-servers/add-server",
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "category",
|
||||
label: "build images",
|
||||
link: {
|
||||
type: "doc",
|
||||
id: "build-images/index",
|
||||
},
|
||||
items: [
|
||||
"build-images/configuration",
|
||||
"build-images/pre-build",
|
||||
"build-images/choosing-builder",
|
||||
"build-images/versioning",
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "category",
|
||||
label: "deploy containers",
|
||||
link: {
|
||||
type: "doc",
|
||||
id: "deploy-containers/index",
|
||||
},
|
||||
items: [
|
||||
"deploy-containers/configuration",
|
||||
"deploy-containers/lifetime-management",
|
||||
// "deploy-containers/choosing-builder",
|
||||
// "deploy-containers/versioning",
|
||||
],
|
||||
},
|
||||
"permissioning",
|
||||
"file-paths",
|
||||
{
|
||||
type: "category",
|
||||
label: "API",
|
||||
link: {
|
||||
type: "doc",
|
||||
id: "api/index",
|
||||
},
|
||||
items: [
|
||||
"api/types",
|
||||
"api/authenticating-requests",
|
||||
"api/login",
|
||||
"api/api-secrets",
|
||||
"api/build",
|
||||
"api/deployment",
|
||||
"api/server",
|
||||
"api/permissions",
|
||||
"api/websocket",
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
module.exports = sidebars;
|
||||
15
docsite/src/components/Divider.tsx
Normal file
15
docsite/src/components/Divider.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import React from "react";
|
||||
|
||||
export default function Divider() {
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
opacity: 0.7,
|
||||
backgroundColor: "rgb(175, 175, 175)",
|
||||
height: "3px",
|
||||
width: "100%",
|
||||
margin: "75px 0px"
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
67
docsite/src/components/HomepageFeatures/index.tsx
Normal file
67
docsite/src/components/HomepageFeatures/index.tsx
Normal file
@@ -0,0 +1,67 @@
|
||||
import React from 'react';
|
||||
import clsx from 'clsx';
|
||||
import styles from './styles.module.css';
|
||||
|
||||
type FeatureItem = {
|
||||
title: string;
|
||||
// Svg: React.ComponentType<React.ComponentProps<'svg'>>;
|
||||
description: JSX.Element;
|
||||
};
|
||||
|
||||
const FeatureList: FeatureItem[] = [
|
||||
{
|
||||
title: 'automated builds 🛠️',
|
||||
// Svg: require('@site/static/img/undraw_docusaurus_mountain.svg').default,
|
||||
description: (
|
||||
<>
|
||||
build auto versioned docker images from github repos, trigger builds on git push
|
||||
</>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: 'deploy docker containers 🚀',
|
||||
// Svg: require('@site/static/img/undraw_docusaurus_tree.svg').default,
|
||||
description: (
|
||||
<>
|
||||
deploy your builds (or any docker image), see uptime and logs across all your servers
|
||||
</>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: 'powered by Rust 🦀',
|
||||
// Svg: require('@site/static/img/undraw_docusaurus_react.svg').default,
|
||||
description: (
|
||||
<>
|
||||
The core API and periphery client are written in Rust
|
||||
</>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
function Feature({ title, description }: FeatureItem) {
|
||||
return (
|
||||
<div className={clsx('col col--4')}>
|
||||
{/* <div className="text--center">
|
||||
<Svg className={styles.featureSvg} role="img" />
|
||||
</div> */}
|
||||
<div className="text--center padding-horiz--md">
|
||||
<h3>{title}</h3>
|
||||
<p>{description}</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default function HomepageFeatures(): JSX.Element {
|
||||
return (
|
||||
<section className={styles.features}>
|
||||
<div className="container">
|
||||
<div className="row">
|
||||
{FeatureList.map((props, idx) => (
|
||||
<Feature key={idx} {...props} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
11
docsite/src/components/HomepageFeatures/styles.module.css
Normal file
11
docsite/src/components/HomepageFeatures/styles.module.css
Normal file
@@ -0,0 +1,11 @@
|
||||
.features {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 4rem 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.featureSvg {
|
||||
height: 200px;
|
||||
width: 200px;
|
||||
}
|
||||
11
docsite/src/components/MonitorLogo.tsx
Normal file
11
docsite/src/components/MonitorLogo.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import React from "react";
|
||||
|
||||
export default function MonitorLogo({ width = "4rem" }) {
|
||||
return (
|
||||
<img
|
||||
style={{ width, height: "auto", opacity: 0.7 }}
|
||||
src="img/monitor-lizard.png"
|
||||
alt="monitor-lizard"
|
||||
/>
|
||||
);
|
||||
}
|
||||
13
docsite/src/components/SummaryImg.tsx
Normal file
13
docsite/src/components/SummaryImg.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import React from "react";
|
||||
|
||||
export default function SummaryImg() {
|
||||
return (
|
||||
<div style={{ display: "flex", justifyContent: "center" }}>
|
||||
<img
|
||||
style={{ marginBottom: "4rem", width: "1000px" }}
|
||||
src="img/monitor-summary.png"
|
||||
alt="monitor-summary"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
30
docsite/src/css/custom.css
Normal file
30
docsite/src/css/custom.css
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Any CSS included here will be global. The classic template
|
||||
* bundles Infima by default. Infima is a CSS framework designed to
|
||||
* work well for content-centric websites.
|
||||
*/
|
||||
|
||||
/* You can override the default Infima variables here. */
|
||||
:root {
|
||||
--ifm-color-primary: #2e8555;
|
||||
--ifm-color-primary-dark: #29784c;
|
||||
--ifm-color-primary-darker: #277148;
|
||||
--ifm-color-primary-darkest: #205d3b;
|
||||
--ifm-color-primary-light: #33925d;
|
||||
--ifm-color-primary-lighter: #359962;
|
||||
--ifm-color-primary-lightest: #3cad6e;
|
||||
--ifm-code-font-size: 95%;
|
||||
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* For readability concerns, you should choose a lighter palette in dark mode. */
|
||||
[data-theme='dark'] {
|
||||
--ifm-color-primary: #25c2a0;
|
||||
--ifm-color-primary-dark: #21af90;
|
||||
--ifm-color-primary-darker: #1fa588;
|
||||
--ifm-color-primary-darkest: #1a8870;
|
||||
--ifm-color-primary-light: #29d5b0;
|
||||
--ifm-color-primary-lighter: #32d8b4;
|
||||
--ifm-color-primary-lightest: #4fddbf;
|
||||
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
24
docsite/src/pages/index.module.css
Normal file
24
docsite/src/pages/index.module.css
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* CSS files with the .module.css suffix will be treated as CSS modules
|
||||
* and scoped locally.
|
||||
*/
|
||||
|
||||
.heroBanner {
|
||||
padding: 4rem 0;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 996px) {
|
||||
.heroBanner {
|
||||
padding: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.buttons {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 1rem;
|
||||
}
|
||||
54
docsite/src/pages/index.tsx
Normal file
54
docsite/src/pages/index.tsx
Normal file
@@ -0,0 +1,54 @@
|
||||
import React from 'react';
|
||||
import clsx from 'clsx';
|
||||
import Link from '@docusaurus/Link';
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
import Layout from '@theme/Layout';
|
||||
import HomepageFeatures from '@site/src/components/HomepageFeatures';
|
||||
|
||||
import styles from './index.module.css';
|
||||
import SummaryImg from '../components/SummaryImg';
|
||||
import MonitorLogo from '../components/MonitorLogo';
|
||||
|
||||
function HomepageHeader() {
|
||||
const {siteConfig} = useDocusaurusContext();
|
||||
return (
|
||||
<header className={clsx("hero hero--primary", styles.heroBanner)}>
|
||||
<div className="container">
|
||||
<div style={{ display: "flex", gap: "1rem", justifyContent: "center" }}>
|
||||
<div style={{ position: "relative" }}>
|
||||
<MonitorLogo width="600px" />
|
||||
<h1 className="hero__title" style={{ margin: 0, position: "absolute", top: "40%", left: "50%", transform: "translate(-50%, -50%)" }}>
|
||||
monitor
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
<p className="hero__subtitle">{siteConfig.tagline}</p>
|
||||
<div className={styles.buttons}>
|
||||
<Link className="button button--secondary button--lg" to="/intro">
|
||||
docs
|
||||
</Link>
|
||||
<Link
|
||||
className="button button--secondary button--lg"
|
||||
to="https://github.com/mbecker20/monitor"
|
||||
>
|
||||
github
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
export default function Home(): JSX.Element {
|
||||
const {siteConfig} = useDocusaurusContext();
|
||||
return (
|
||||
<Layout title="monitor docs" description={siteConfig.tagline}>
|
||||
{/* <SummaryImg /> */}
|
||||
<HomepageHeader />
|
||||
<main>
|
||||
<HomepageFeatures />
|
||||
{/* <SummaryImg /> */}
|
||||
</main>
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
0
docsite/static/.nojekyll
Normal file
0
docsite/static/.nojekyll
Normal file
BIN
docsite/static/img/favicon.ico
Normal file
BIN
docsite/static/img/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
1
docsite/static/img/logo.svg
Normal file
1
docsite/static/img/logo.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 6.3 KiB |
BIN
docsite/static/img/monitor-lizard.png
Normal file
BIN
docsite/static/img/monitor-lizard.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 69 KiB |
BIN
docsite/static/img/monitor-summary.png
Normal file
BIN
docsite/static/img/monitor-summary.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 117 KiB |
7
docsite/tsconfig.json
Normal file
7
docsite/tsconfig.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
// This file is not used in compilation. It is here just for a nice editor experience.
|
||||
"extends": "@tsconfig/docusaurus/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "."
|
||||
}
|
||||
}
|
||||
7617
docsite/yarn.lock
Normal file
7617
docsite/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,7 @@ export const NewGroup: Component<{}> = (p) => {
|
||||
<Show
|
||||
when={showNew()}
|
||||
fallback={
|
||||
<button class="green" onClick={toggleShowNew} style={{ width: "100%" }}>
|
||||
<button class="green" onClick={toggleShowNew} style={{ height: "100%" }}>
|
||||
<Icon type="plus" />
|
||||
</button>
|
||||
}
|
||||
@@ -100,12 +100,6 @@ const New: Component<{
|
||||
<button class="green" onClick={create}>
|
||||
create
|
||||
</button>
|
||||
{/* <ConfirmButton
|
||||
class="green"
|
||||
onConfirm={create}
|
||||
>
|
||||
create
|
||||
</ConfirmButton> */}
|
||||
<button class="red" onClick={p.close}>
|
||||
<Icon type="cross" />
|
||||
</button>
|
||||
|
||||
@@ -11,7 +11,11 @@ import { OPERATIONS } from "..";
|
||||
import { useAppDimensions } from "../state/DimensionProvider";
|
||||
import { useAppState } from "../state/StateProvider";
|
||||
import { Operation, Update as UpdateType, UpdateStatus } from "../types";
|
||||
import { readableMonitorTimestamp, readableVersion } from "../util/helpers";
|
||||
import {
|
||||
getId,
|
||||
readableMonitorTimestamp,
|
||||
readableVersion,
|
||||
} from "../util/helpers";
|
||||
import Icon from "./shared/Icon";
|
||||
import Input from "./shared/Input";
|
||||
import Flex from "./shared/layout/Flex";
|
||||
@@ -40,10 +44,17 @@ const Updates: Component<{}> = (p) => {
|
||||
if (username?.includes(search())) return true;
|
||||
});
|
||||
});
|
||||
const [openMenu, setOpenMenu] = createSignal<string | undefined>(undefined);
|
||||
return (
|
||||
<Grid class="full-width card shadow">
|
||||
<Flex alignItems="center" justifyContent="space-between">
|
||||
<h1>updates</h1>
|
||||
<Flex>
|
||||
<h1>updates</h1>
|
||||
<UpdateMenu
|
||||
update={openMenu() ? updates.get(openMenu()!) : undefined}
|
||||
closeMenu={() => setOpenMenu(undefined)}
|
||||
/>
|
||||
</Flex>
|
||||
<Flex alignItems="center">
|
||||
<Input class="lightgrey" placeholder="search" onEdit={setSearch} />
|
||||
<Selector
|
||||
@@ -73,7 +84,12 @@ const Updates: Component<{}> = (p) => {
|
||||
}
|
||||
>
|
||||
<For each={filtered_updates()}>
|
||||
{(update) => <Update update={update} />}
|
||||
{(update) => (
|
||||
<Update
|
||||
update={update}
|
||||
openMenu={() => setOpenMenu(getId(update))}
|
||||
/>
|
||||
)}
|
||||
</For>
|
||||
<Show when={!updates.noMore()}>
|
||||
<button
|
||||
@@ -94,7 +110,7 @@ const Updates: Component<{}> = (p) => {
|
||||
|
||||
export default Updates;
|
||||
|
||||
const Update: Component<{ update: UpdateType }> = (p) => {
|
||||
const Update: Component<{ update: UpdateType; openMenu: () => void }> = (p) => {
|
||||
const { isMobile } = useAppDimensions();
|
||||
const { usernames, name_from_update_target } = useAppState();
|
||||
const name = () => name_from_update_target(p.update.target);
|
||||
@@ -113,9 +129,10 @@ const Update: Component<{ update: UpdateType }> = (p) => {
|
||||
};
|
||||
return (
|
||||
<Flex
|
||||
class="card light shadow wrap"
|
||||
class="card light hover shadow wrap pointer"
|
||||
justifyContent="space-between"
|
||||
alignItems="center"
|
||||
onClick={p.openMenu}
|
||||
>
|
||||
<Flex
|
||||
alignItems="center"
|
||||
@@ -149,7 +166,9 @@ const Update: Component<{ update: UpdateType }> = (p) => {
|
||||
<div style={{ "place-self": "center end" }}>
|
||||
{readableMonitorTimestamp(p.update.start_ts)}
|
||||
</div>
|
||||
<UpdateMenu update={p.update} />
|
||||
{/* <button class="blue" onClick={p.openMenu}>
|
||||
<Icon type="console" />
|
||||
</button> */}
|
||||
</Flex>
|
||||
</Flex>
|
||||
</Flex>
|
||||
|
||||
@@ -5,13 +5,13 @@ import { useAppState } from "../../state/StateProvider";
|
||||
import { useUser } from "../../state/UserProvider";
|
||||
import { PermissionLevel } from "../../types";
|
||||
import { getId } from "../../util/helpers";
|
||||
import Flex from "../shared/layout/Flex";
|
||||
import Grid from "../shared/layout/Grid";
|
||||
import Flex from "../shared/layout/Flex";
|
||||
|
||||
const Resources: Component<{}> = (p) => {
|
||||
const { user, user_id } = useUser();
|
||||
const { user_id } = useUser();
|
||||
const { isMobile } = useAppDimensions();
|
||||
const { builds, deployments, servers } = useAppState();
|
||||
const { builds, deployments, servers, groups } = useAppState();
|
||||
const [search, setSearch] = createSignal("");
|
||||
const _servers = createMemo(() => {
|
||||
return servers.filterArray((s) => {
|
||||
@@ -34,6 +34,13 @@ const Resources: Component<{}> = (p) => {
|
||||
return p ? p !== PermissionLevel.None : false;
|
||||
});
|
||||
});
|
||||
const _groups = createMemo(() => {
|
||||
return groups.filterArray((b) => {
|
||||
if (!b.name.includes(search())) return false;
|
||||
const p = b.permissions?.[user_id()];
|
||||
return p ? p !== PermissionLevel.None : false;
|
||||
});
|
||||
});
|
||||
return (
|
||||
<>
|
||||
<Grid
|
||||
@@ -55,7 +62,9 @@ const Resources: Component<{}> = (p) => {
|
||||
>
|
||||
<Grid gap="0.25rem">
|
||||
<h2>{item.server.name}</h2>
|
||||
<div class="dimmed">{item.server.region || "unknown region"}</div>
|
||||
<div class="dimmed">
|
||||
{item.server.region || "unknown region"}
|
||||
</div>
|
||||
</Grid>
|
||||
<div>{item.server.permissions?.[user_id()] || "none"}</div>
|
||||
</A>
|
||||
@@ -117,6 +126,27 @@ const Resources: Component<{}> = (p) => {
|
||||
</For>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid
|
||||
class="card shadow"
|
||||
style={{ width: "100%", "box-sizing": "border-box" }}
|
||||
>
|
||||
<h1>groups</h1>
|
||||
<Grid gridTemplateColumns={isMobile() ? undefined : "1fr 1fr"}>
|
||||
<For each={_groups()}>
|
||||
{(item) => (
|
||||
<Flex
|
||||
class="card light shadow hover full-width"
|
||||
style={{
|
||||
"justify-content": "space-between",
|
||||
}}
|
||||
>
|
||||
<h2>{item.name}</h2>
|
||||
<div>{item.permissions?.[user_id()] || "none"}</div>
|
||||
</Flex>
|
||||
)}
|
||||
</For>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -38,7 +38,10 @@ const Build: Component<{}> = (p) => {
|
||||
user().admin ||
|
||||
build()?.permissions![user_id()] === PermissionLevel.Update;
|
||||
return (
|
||||
<Show when={build()} fallback={<NotFound type="build" loaded={builds.loaded()} />}>
|
||||
<Show
|
||||
when={build()}
|
||||
fallback={<NotFound type="build" loaded={builds.loaded()} />}
|
||||
>
|
||||
<ActionStateProvider build_id={params.id}>
|
||||
<Grid
|
||||
style={{
|
||||
@@ -46,12 +49,12 @@ const Build: Component<{}> = (p) => {
|
||||
"box-sizing": "border-box",
|
||||
}}
|
||||
>
|
||||
<Header />
|
||||
<Grid
|
||||
style={{ width: "100%" }}
|
||||
gridTemplateColumns={isSemiMobile() ? "1fr" : "1fr 1fr"}
|
||||
>
|
||||
<Grid style={{ "flex-grow": 1, "grid-auto-rows": "auto auto 1fr" }}>
|
||||
<Header />
|
||||
<Grid gridTemplateRows="auto 1fr" style={{ "flex-grow": 1 }}>
|
||||
<Description
|
||||
target={{ type: "Build", id: params.id }}
|
||||
name={build()?.name!}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
Component,
|
||||
createEffect,
|
||||
createSignal,
|
||||
For,
|
||||
onCleanup,
|
||||
Show,
|
||||
@@ -9,14 +10,17 @@ import { useUpdates } from "../../state/hooks";
|
||||
import { useAppState } from "../../state/StateProvider";
|
||||
import Update from "../update/Update";
|
||||
import Grid from "../shared/layout/Grid";
|
||||
import { combineClasses } from "../../util/helpers";
|
||||
import { combineClasses, getId } from "../../util/helpers";
|
||||
import { useParams } from "@solidjs/router";
|
||||
import Flex from "../shared/layout/Flex";
|
||||
import UpdateMenu from "../update/UpdateMenu";
|
||||
import Loading from "../shared/loading/Loading";
|
||||
|
||||
const Updates: Component<{}> = (p) => {
|
||||
const { ws } = useAppState();
|
||||
const params = useParams();
|
||||
const updates = useUpdates({ type: "Build", id: params.id });
|
||||
|
||||
const [openMenu, setOpenMenu] = createSignal<string | undefined>(undefined);
|
||||
let unsub = () => {};
|
||||
createEffect(() => {
|
||||
unsub();
|
||||
@@ -26,27 +30,47 @@ const Updates: Component<{}> = (p) => {
|
||||
}
|
||||
});
|
||||
});
|
||||
onCleanup(() => unsub())
|
||||
onCleanup(() => unsub());
|
||||
return (
|
||||
<Grid
|
||||
class={combineClasses("card shadow")}
|
||||
style={{ "min-width": "350px" }}
|
||||
>
|
||||
<h1>updates</h1>
|
||||
<Grid class="updates-container scroller">
|
||||
<For each={updates.collection()}>
|
||||
{(update) => <Update update={update} />}
|
||||
</For>
|
||||
<Show when={!updates.noMore()}>
|
||||
<button
|
||||
class="grey"
|
||||
style={{ width: "100%" }}
|
||||
onClick={() => updates.loadMore()}
|
||||
>
|
||||
load more
|
||||
</button>
|
||||
</Show>
|
||||
</Grid>
|
||||
<Flex>
|
||||
<h1>updates</h1>
|
||||
<UpdateMenu
|
||||
update={openMenu() ? updates.get(openMenu()!) : undefined}
|
||||
closeMenu={() => setOpenMenu(undefined)}
|
||||
/>
|
||||
</Flex>
|
||||
<Show
|
||||
when={updates.loaded()}
|
||||
fallback={
|
||||
<Flex class="full-size" alignItems="center" justifyContent="center">
|
||||
<Loading type="three-dot" scale={0.7} />
|
||||
</Flex>
|
||||
}
|
||||
>
|
||||
<Grid class="updates-container scroller">
|
||||
<For each={updates.collection()}>
|
||||
{(update) => (
|
||||
<Update
|
||||
update={update}
|
||||
openMenu={() => setOpenMenu(getId(update))}
|
||||
/>
|
||||
)}
|
||||
</For>
|
||||
<Show when={!updates.noMore()}>
|
||||
<button
|
||||
class="grey"
|
||||
style={{ width: "100%" }}
|
||||
onClick={() => updates.loadMore()}
|
||||
>
|
||||
load more
|
||||
</button>
|
||||
</Show>
|
||||
</Grid>
|
||||
</Show>
|
||||
</Grid>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -24,9 +24,11 @@ const BuildConfig: Component<{}> = (p) => {
|
||||
<Repo />
|
||||
<Docker />
|
||||
<CliBuild />
|
||||
<BuildArgs />
|
||||
<ExtraArgs />
|
||||
<UseBuildx />
|
||||
<Show when={build.docker_build_args?.build_path}>
|
||||
<BuildArgs />
|
||||
<ExtraArgs />
|
||||
<UseBuildx />
|
||||
</Show>
|
||||
<Show when={userCanUpdate()}>
|
||||
<WebhookUrl />
|
||||
</Show>
|
||||
|
||||
@@ -9,7 +9,7 @@ const ExtraArgs: Component<{}> = (p) => {
|
||||
const { build, setBuild, userCanUpdate } = useConfig();
|
||||
const onAdd = () => {
|
||||
setBuild("docker_build_args", "extra_args", (extra_args: any) => [
|
||||
...extra_args,
|
||||
...(extra_args || []),
|
||||
"",
|
||||
]);
|
||||
};
|
||||
@@ -28,7 +28,7 @@ const ExtraArgs: Component<{}> = (p) => {
|
||||
</button>
|
||||
</Show>
|
||||
</Flex>
|
||||
<For each={[...build.docker_build_args!.extra_args!.keys()]}>
|
||||
<For each={[...(build.docker_build_args?.extra_args?.keys() || [])]}>
|
||||
{(_, index) => (
|
||||
<Flex
|
||||
justifyContent={userCanUpdate() ? "space-between" : undefined}
|
||||
@@ -37,7 +37,7 @@ const ExtraArgs: Component<{}> = (p) => {
|
||||
>
|
||||
<Input
|
||||
placeholder="--extra-arg=value"
|
||||
value={build.docker_build_args!.extra_args![index()]}
|
||||
value={build.docker_build_args?.extra_args?.[index()] || ""}
|
||||
style={{ width: "80%" }}
|
||||
onEdit={(value) =>
|
||||
setBuild("docker_build_args", "extra_args", index(), value)
|
||||
|
||||
@@ -47,12 +47,12 @@ const Deployment: Component<{}> = (p) => {
|
||||
"box-sizing": "border-box",
|
||||
}}
|
||||
>
|
||||
<Header />
|
||||
<Grid
|
||||
style={{ width: "100%" }}
|
||||
gridTemplateColumns={isSemiMobile() ? "1fr" : "1fr 1fr"}
|
||||
>
|
||||
<Grid style={{ "flex-grow": 1, "grid-auto-rows": "auto auto 1fr" }}>
|
||||
<Header />
|
||||
<Grid style={{ "flex-grow": 1, "grid-auto-rows": "auto 1fr" }}>
|
||||
<Description
|
||||
target={{ type: "Deployment", id: params.id }}
|
||||
name={deployment()?.deployment.name!}
|
||||
|
||||
@@ -116,6 +116,7 @@ const Header: Component<{}> = (p) => {
|
||||
setUpdatingName(false);
|
||||
}}
|
||||
onBlur={() => setEditingName(false)}
|
||||
style={{ "font-size": "1.4rem" }}
|
||||
/>
|
||||
</Show>
|
||||
</Show>
|
||||
@@ -169,7 +170,7 @@ const Header: Component<{}> = (p) => {
|
||||
class="text-hover"
|
||||
style={{ opacity: 0.7, padding: 0 }}
|
||||
>
|
||||
{server()?.server.name}
|
||||
{server()?.server.name || "unknown"}
|
||||
</A>
|
||||
<div class={deploymentHeaderStateClass(deployment().state)}>
|
||||
{deployment().state}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { Component, createEffect, For, onCleanup, Show } from "solid-js";
|
||||
import { Component, createEffect, createSignal, For, onCleanup, Show } from "solid-js";
|
||||
import { useUpdates } from "../../state/hooks";
|
||||
import Grid from "../shared/layout/Grid";
|
||||
import Update from "../update/Update";
|
||||
import { useAppState } from "../../state/StateProvider";
|
||||
import { combineClasses } from "../../util/helpers";
|
||||
import { combineClasses, getId } from "../../util/helpers";
|
||||
import { Operation } from "../../types";
|
||||
import Flex from "../shared/layout/Flex";
|
||||
import Loading from "../shared/loading/Loading";
|
||||
import { useParams } from "@solidjs/router";
|
||||
import UpdateMenu from "../update/UpdateMenu";
|
||||
|
||||
const Updates: Component<{}> = (p) => {
|
||||
const { ws, deployments } = useAppState();
|
||||
@@ -15,6 +16,7 @@ const Updates: Component<{}> = (p) => {
|
||||
const deployment = () => deployments.get(params.id)!
|
||||
const updates = useUpdates({ type: "Deployment", id: params.id }, true);
|
||||
const buildID = () => deployment()?.deployment.build_id;
|
||||
const [openMenu, setOpenMenu] = createSignal<string | undefined>(undefined);
|
||||
let unsub = () => {};
|
||||
createEffect(() => {
|
||||
unsub();
|
||||
@@ -32,18 +34,29 @@ const Updates: Component<{}> = (p) => {
|
||||
onCleanup(() => unsub());
|
||||
return (
|
||||
<Grid class={combineClasses("card shadow")} style={{ "flex-grow": 1 }}>
|
||||
<h1>updates</h1>
|
||||
<Flex>
|
||||
<h1>updates</h1>
|
||||
<UpdateMenu
|
||||
update={openMenu() ? updates.get(openMenu()!) : undefined}
|
||||
closeMenu={() => setOpenMenu(undefined)}
|
||||
/>
|
||||
</Flex>
|
||||
<Show
|
||||
when={updates.loaded()}
|
||||
fallback={
|
||||
<Flex justifyContent="center">
|
||||
<Loading type="three-dot" />
|
||||
<Flex class="full-size" alignItems="center" justifyContent="center">
|
||||
<Loading type="three-dot" scale={0.7} />
|
||||
</Flex>
|
||||
}
|
||||
>
|
||||
<Grid class="updates-container scroller">
|
||||
<For each={updates.collection()}>
|
||||
{(update) => <Update update={update} />}
|
||||
{(update) => (
|
||||
<Update
|
||||
update={update}
|
||||
openMenu={() => setOpenMenu(getId(update))}
|
||||
/>
|
||||
)}
|
||||
</For>
|
||||
<Show when={!updates.noMore()}>
|
||||
<button
|
||||
|
||||
@@ -28,7 +28,7 @@ const ExtraArgs: Component<{}> = (p) => {
|
||||
</button>
|
||||
</Show>
|
||||
</Flex>
|
||||
<For each={[...deployment.docker_run_args.extra_args!.keys()]}>
|
||||
<For each={[...(deployment.docker_run_args.extra_args?.keys() || [])]}>
|
||||
{(_, index) => (
|
||||
<Flex
|
||||
justifyContent={userCanUpdate() ? "space-between" : undefined}
|
||||
@@ -37,7 +37,7 @@ const ExtraArgs: Component<{}> = (p) => {
|
||||
>
|
||||
<Input
|
||||
placeholder="--extra-arg=value"
|
||||
value={deployment.docker_run_args.extra_args![index()]}
|
||||
value={deployment.docker_run_args.extra_args?.[index()] || ""}
|
||||
style={{ width: "80%" }}
|
||||
onEdit={(value) =>
|
||||
setDeployment("docker_run_args", "extra_args", index(), value)
|
||||
|
||||
@@ -41,7 +41,7 @@ const Image: Component<{}> = (p) => {
|
||||
<Selector
|
||||
targetClass="blue"
|
||||
selected={
|
||||
(deployment.build_id && builds.get(deployment.build_id)?.name) ||
|
||||
(deployment.build_id && (builds.get(deployment.build_id)?.name || "unknown")) ||
|
||||
"custom image"
|
||||
}
|
||||
items={[
|
||||
|
||||
@@ -2,19 +2,16 @@ import {
|
||||
Component,
|
||||
} from "solid-js";
|
||||
import { useAppDimensions } from "../../state/DimensionProvider";
|
||||
import { useAppState } from "../../state/StateProvider";
|
||||
import Grid from "../shared/layout/Grid";
|
||||
import SimpleTabs from "../shared/tabs/SimpleTabs";
|
||||
import Summary from "./Summary";
|
||||
import Builds from "./Tree/Builds";
|
||||
import Groups from "./Tree/Groups";
|
||||
import { TreeProvider } from "./Tree/Provider";
|
||||
import Servers from "./Tree/Servers";
|
||||
import Updates from "./Updates/Updates";
|
||||
|
||||
const Home: Component<{}> = (p) => {
|
||||
const { isSemiMobile } = useAppDimensions();
|
||||
const { servers } = useAppState();
|
||||
return (
|
||||
<>
|
||||
<Grid
|
||||
@@ -29,13 +26,9 @@ const Home: Component<{}> = (p) => {
|
||||
containerStyle={{ width: "100%" }}
|
||||
localStorageKey="home-groups-servers-tab-v1"
|
||||
tabs={[
|
||||
{
|
||||
title: "groups",
|
||||
element: () => <Groups />,
|
||||
},
|
||||
{
|
||||
title: "servers",
|
||||
element: () => <Servers serverIDs={servers.ids()!} showAdd />,
|
||||
element: () => <Groups />,
|
||||
},
|
||||
{
|
||||
title: "builds",
|
||||
|
||||
@@ -116,13 +116,9 @@ const Build: Component<{ id: string }> = (p) => {
|
||||
return (
|
||||
<A
|
||||
href={`/build/${p.id}`}
|
||||
class="card light shadow hoverable"
|
||||
class="card light hover shadow full-width"
|
||||
style={{
|
||||
width: "100%",
|
||||
height: "fit-content",
|
||||
"box-sizing": "border-box",
|
||||
"justify-content": "space-between",
|
||||
padding: "0.5rem",
|
||||
}}
|
||||
>
|
||||
<h1 style={{ "font-size": "1.25rem" }}>{build().name}</h1>
|
||||
|
||||
@@ -1,27 +1,36 @@
|
||||
import { Component, createMemo, createSignal, For, Show } from "solid-js";
|
||||
import { useAppState } from "../../../state/StateProvider";
|
||||
import { useLocalStorageToggle } from "../../../util/hooks";
|
||||
import Icon from "../../shared/Icon";
|
||||
import Input from "../../shared/Input";
|
||||
import Flex from "../../shared/layout/Flex";
|
||||
import { Component, For, Show, createMemo, createSignal } from "solid-js";
|
||||
import Grid from "../../shared/layout/Grid";
|
||||
import { useLocalStorage, useToggle } from "../../../util/hooks";
|
||||
import Flex from "../../shared/layout/Flex";
|
||||
import { TREE_SORTS, TreeSortType, useTreeState } from "./Provider";
|
||||
import { useAppState } from "../../../state/StateProvider";
|
||||
import Input from "../../shared/Input";
|
||||
import Selector from "../../shared/menu/Selector";
|
||||
import { NewGroup } from "../../New";
|
||||
import s from "../home.module.scss";
|
||||
import { combineClasses } from "../../../util/helpers";
|
||||
import Icon from "../../shared/Icon";
|
||||
import { useAppDimensions } from "../../../state/DimensionProvider";
|
||||
import ConfirmButton from "../../shared/ConfirmButton";
|
||||
import Server from "./Server";
|
||||
import { useWindowKeyDown } from "../../../util/hooks";
|
||||
import Menu from "../../shared/menu/Menu";
|
||||
import { client } from "../../..";
|
||||
import ConfirmButton from "../../shared/ConfirmButton";
|
||||
import { TreeSortType, TREE_SORTS, useTreeState } from "./Provider";
|
||||
import Selector from "../../shared/menu/Selector";
|
||||
import { useUser } from "../../../state/UserProvider";
|
||||
import { PermissionLevel } from "../../../types";
|
||||
|
||||
const Groups: Component<{}> = (p) => {
|
||||
const { isSemiMobile } = useAppDimensions();
|
||||
const { user, user_id } = useUser();
|
||||
const { groups } = useAppState();
|
||||
const [groupFilter, setGroupFilter] = createSignal("");
|
||||
const [selected, setSelected] = useLocalStorage<string | null>(
|
||||
null,
|
||||
"home-selected-group-v1"
|
||||
);
|
||||
const [searchFilter, setSearchFilter] = createSignal("");
|
||||
const { sort, setSort, group_sorter } = useTreeState();
|
||||
const [editing, toggleEditing, setEditing] = useToggle();
|
||||
const groupIDs = createMemo(() => {
|
||||
if (groups.loaded()) {
|
||||
const filters = groupFilter()
|
||||
const filters = searchFilter()
|
||||
.split(" ")
|
||||
.filter((term) => term.length > 0)
|
||||
.map((term) => term.toLowerCase());
|
||||
@@ -41,177 +50,261 @@ const Groups: Component<{}> = (p) => {
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
const canEdit = (group_id: string) =>
|
||||
user().admin ||
|
||||
groups.get(group_id)?.permissions?.[user_id()] === PermissionLevel.Update;
|
||||
return (
|
||||
<Grid style={{ height: "fit-content" }}>
|
||||
<Grid gridTemplateColumns="1fr auto auto">
|
||||
<Grid class="full-width">
|
||||
<Grid gridTemplateColumns={selected() ? "auto 1fr auto" : "1fr auto"}>
|
||||
<Show when={selected()}>
|
||||
<Flex alignItems="center">
|
||||
<button class="grey" onClick={() => setSelected(null)}>
|
||||
<Icon type="arrow-left" />
|
||||
</button>
|
||||
<h1 style={{ margin: "0 1rem" }}>
|
||||
{selected() === "all" ? "all" : groups.get(selected()!)?.name}
|
||||
</h1>
|
||||
</Flex>
|
||||
</Show>
|
||||
<Input
|
||||
placeholder="filter groups"
|
||||
value={groupFilter()}
|
||||
onEdit={setGroupFilter}
|
||||
placeholder={`filter ${selected() ? "servers" : "groups"}`}
|
||||
value={searchFilter()}
|
||||
onEdit={setSearchFilter}
|
||||
style={{ width: "100%", padding: "0.5rem" }}
|
||||
/>
|
||||
<Selector
|
||||
label={<div class="dimmed">sort by:</div>}
|
||||
selected={sort()}
|
||||
items={TREE_SORTS as any as string[]}
|
||||
onSelect={(mode) => setSort(mode as TreeSortType)}
|
||||
position="bottom right"
|
||||
targetClass="blue"
|
||||
targetStyle={{ height: "100%" }}
|
||||
containerStyle={{ height: "100%" }}
|
||||
/>
|
||||
<NewGroup />
|
||||
<Flex alignItems="center" style={{ width: "fit-content" }}>
|
||||
<Selector
|
||||
label={<div class="dimmed">sort by:</div>}
|
||||
selected={sort()}
|
||||
items={TREE_SORTS as any as string[]}
|
||||
onSelect={(mode) => setSort(mode as TreeSortType)}
|
||||
position="bottom right"
|
||||
targetClass="blue"
|
||||
targetStyle={{ height: "100%" }}
|
||||
containerStyle={{ height: "100%" }}
|
||||
/>
|
||||
<Show when={selected()} fallback={<NewGroup />}>
|
||||
<Show when={selected() !== "all" && canEdit(selected()!)}>
|
||||
<button
|
||||
class="blue"
|
||||
onClick={toggleEditing}
|
||||
style={{ height: "100%" }}
|
||||
>
|
||||
<Icon type="edit" />
|
||||
</button>
|
||||
<AddServerToGroup groupId={selected()!} />
|
||||
</Show>
|
||||
</Show>
|
||||
</Flex>
|
||||
</Grid>
|
||||
<For each={groupIDs()}>{(id) => <Group id={id} />}</For>
|
||||
<Show
|
||||
when={selected()}
|
||||
fallback={
|
||||
<Grid gridTemplateColumns={isSemiMobile() ? "1fr" : "1fr 1fr"}>
|
||||
<GroupButton id="all" setSelected={setSelected} />
|
||||
<For each={groupIDs()}>
|
||||
{(id) => <GroupButton id={id} setSelected={setSelected} />}
|
||||
</For>
|
||||
</Grid>
|
||||
}
|
||||
>
|
||||
<Group
|
||||
id={selected()!}
|
||||
searchFilter={searchFilter()}
|
||||
exit={() => {
|
||||
setSelected(null);
|
||||
setEditing(false);
|
||||
}}
|
||||
editing={editing()}
|
||||
/>
|
||||
</Show>
|
||||
</Grid>
|
||||
);
|
||||
};
|
||||
|
||||
export default Groups;
|
||||
|
||||
const Group: Component<{ id: string }> = (p) => {
|
||||
const { groups, servers, ungroupedServerIds } = useAppState();
|
||||
const { server_sorter } = useTreeState();
|
||||
const group = () => groups.get(p.id);
|
||||
const serverIDs = () => group()?.servers.sort(server_sorter());
|
||||
const [open, toggleOpen] = useLocalStorageToggle(p.id + "-group-homeopen-v1");
|
||||
const [showAdd, setShowAdd] = createSignal(false);
|
||||
const [edit, setEdit] = createSignal(false);
|
||||
const GroupButton: Component<{
|
||||
id: string;
|
||||
setSelected: (s: string) => void;
|
||||
}> = (p) => {
|
||||
const { isSemiMobile } = useAppDimensions();
|
||||
const { user, user_id } = useUser();
|
||||
const { groups, servers } = useAppState();
|
||||
const isAll = () => p.id === "all";
|
||||
const name = () => {
|
||||
if (isAll()) {
|
||||
return "all";
|
||||
}
|
||||
return groups.get(p.id)?.name;
|
||||
};
|
||||
const serverCount = () => {
|
||||
if (isAll()) {
|
||||
return servers.ids()?.length || 0;
|
||||
}
|
||||
return (
|
||||
groups.get(p.id)?.servers.filter((server_id) => servers.get(server_id))
|
||||
.length || 0
|
||||
);
|
||||
};
|
||||
const canEdit = () =>
|
||||
user().admin ||
|
||||
groups.get(p.id)?.permissions?.[user_id()] === PermissionLevel.Update;
|
||||
return (
|
||||
<Show when={group()}>
|
||||
<button
|
||||
class={combineClasses(s.ServerButton, "shadow")}
|
||||
onClick={toggleOpen}
|
||||
>
|
||||
<Flex alignItems="center">
|
||||
<Icon type={open() ? "chevron-up" : "chevron-down"} width="1rem" />
|
||||
<h1 style={{ "font-size": "1.25rem" }}>{group()?.name}</h1>
|
||||
<Flex
|
||||
class="card light hover shadow"
|
||||
style={{
|
||||
"grid-column": isAll() && !isSemiMobile() ? "span 2" : undefined,
|
||||
"justify-content": "space-between",
|
||||
cursor: "pointer",
|
||||
}}
|
||||
onClick={() => p.setSelected(p.id)}
|
||||
>
|
||||
<h1>{name()}</h1>
|
||||
<Flex alignItems="center">
|
||||
<Flex gap="0.4rem">
|
||||
<div>{serverCount()}</div>
|
||||
<div class="dimmed">{`server${serverCount() > 1 ? "s" : ""}`}</div>
|
||||
</Flex>
|
||||
<Flex alignItems="center">
|
||||
<h2>
|
||||
{serverIDs()!.length} server{serverIDs()!.length > 1 ? "s" : ""}
|
||||
</h2>
|
||||
<Show when={open()}>
|
||||
<button
|
||||
class="blue"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
setEdit((edit) => !edit);
|
||||
}}
|
||||
>
|
||||
<Icon type="edit" />
|
||||
</button>
|
||||
<Show when={ungroupedServerIds()?.length || 0 > 0}>
|
||||
<Menu
|
||||
show={showAdd()}
|
||||
close={(e) => {
|
||||
e.stopPropagation();
|
||||
setShowAdd(false);
|
||||
}}
|
||||
position="bottom right"
|
||||
target={
|
||||
<button
|
||||
class="green"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
setShowAdd(true);
|
||||
}}
|
||||
>
|
||||
<Icon type="plus" />
|
||||
</button>
|
||||
}
|
||||
menuStyle={{ gap: "0.5rem" }}
|
||||
content={
|
||||
<>
|
||||
{/* <Input placeholder="search" style={{ width: "10rem" }} /> */}
|
||||
<For each={ungroupedServerIds()!}>
|
||||
{(server_id) => {
|
||||
const server = () => servers.get(server_id)!;
|
||||
return (
|
||||
<ConfirmButton
|
||||
class="lightgrey"
|
||||
style={{ width: "100%" }}
|
||||
onConfirm={() =>
|
||||
client.update_group({
|
||||
...group()!,
|
||||
servers: [...group()!.servers, server_id],
|
||||
})
|
||||
}
|
||||
>
|
||||
{server().server.name}
|
||||
</ConfirmButton>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</Show>
|
||||
</Show>
|
||||
<Show when={canEdit() && !isAll()}>
|
||||
<ConfirmButton
|
||||
class="red"
|
||||
onConfirm={() => client.delete_group(p.id)}
|
||||
>
|
||||
<Icon type="trash" />
|
||||
</ConfirmButton>
|
||||
</Show>
|
||||
</Flex>
|
||||
</Flex>
|
||||
);
|
||||
};
|
||||
|
||||
const Group: Component<{
|
||||
id: string;
|
||||
searchFilter: string;
|
||||
editing: boolean;
|
||||
exit: () => void;
|
||||
}> = (p) => {
|
||||
const { user, user_id } = useUser();
|
||||
const { groups, servers } = useAppState();
|
||||
const { server_sorter } = useTreeState();
|
||||
const group = () => groups.get(p.id);
|
||||
const canEdit = () =>
|
||||
user().admin ||
|
||||
group()?.permissions?.[user_id()] === PermissionLevel.Update;
|
||||
const serverIDs = createMemo(() => {
|
||||
if (servers.loaded()) {
|
||||
const filters = p.searchFilter
|
||||
.split(" ")
|
||||
.filter((term) => term.length > 0)
|
||||
.map((term) => term.toLowerCase());
|
||||
const serverIds = (
|
||||
p.id === "all"
|
||||
? servers.ids()
|
||||
: groups
|
||||
.get(p.id)
|
||||
?.servers.filter((server_id) => servers.get(server_id))
|
||||
)?.sort(server_sorter());
|
||||
return serverIds
|
||||
?.filter((id) => {
|
||||
const name = servers.get(id)!.server.name;
|
||||
for (const term of filters) {
|
||||
if (!name.includes(term)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.sort(server_sorter());
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
useWindowKeyDown((e) => {
|
||||
if (e.key === "ArrowLeft" || e.key === "Escape") {
|
||||
p.exit();
|
||||
}
|
||||
});
|
||||
return (
|
||||
<For each={serverIDs()}>
|
||||
{(id) => (
|
||||
<Flex alignItems="center">
|
||||
<Server id={id} />
|
||||
<Show when={canEdit() && p.editing}>
|
||||
<ConfirmButton
|
||||
class="red"
|
||||
onConfirm={() => {
|
||||
client.update_group({
|
||||
...group()!,
|
||||
servers: group()!.servers.filter((member) => member !== id),
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Icon type="minus" />
|
||||
</ConfirmButton>
|
||||
</Show>
|
||||
</Flex>
|
||||
</button>
|
||||
<Show when={serverIDs() && open()}>
|
||||
<Grid
|
||||
placeItems="center"
|
||||
gridTemplateColumns="1fr auto 1fr"
|
||||
style={{ width: "100%" }}
|
||||
>
|
||||
<div
|
||||
class="lightgrey"
|
||||
style={{ opacity: 0.7, width: "100%", height: "3px" }}
|
||||
/>
|
||||
<div style={{ opacity: 0.7 }}>servers</div>
|
||||
<div
|
||||
class="lightgrey"
|
||||
style={{ opacity: 0.7, width: "100%", height: "3px" }}
|
||||
/>
|
||||
</Grid>
|
||||
<For each={serverIDs()}>
|
||||
{(id) => {
|
||||
return (
|
||||
<Flex alignItems="center">
|
||||
<Server id={id} />
|
||||
<Show when={edit()}>
|
||||
)}
|
||||
</For>
|
||||
);
|
||||
};
|
||||
|
||||
const AddServerToGroup: Component<{ groupId: string }> = (p) => {
|
||||
const { user, user_id } = useUser();
|
||||
const { groups, servers, ungroupedServerIds } = useAppState();
|
||||
const [showAdd, setShowAdd] = createSignal(false);
|
||||
const group = () => groups.get(p.groupId);
|
||||
const canEdit = () =>
|
||||
user().admin ||
|
||||
group()?.permissions?.[user_id()] === PermissionLevel.Update;
|
||||
return (
|
||||
<Show
|
||||
when={canEdit() && ((group() && ungroupedServerIds()?.length) || 0 > 0)}
|
||||
>
|
||||
<Menu
|
||||
show={showAdd()}
|
||||
close={(e) => {
|
||||
e.stopPropagation();
|
||||
setShowAdd(false);
|
||||
}}
|
||||
position="bottom right"
|
||||
target={
|
||||
<button
|
||||
class="green"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
setShowAdd(true);
|
||||
}}
|
||||
>
|
||||
<Icon type="plus" />
|
||||
</button>
|
||||
}
|
||||
menuStyle={{ gap: "0.5rem" }}
|
||||
content={
|
||||
<>
|
||||
{/* <Input placeholder="search" style={{ width: "10rem" }} /> */}
|
||||
<For each={ungroupedServerIds()!}>
|
||||
{(server_id) => {
|
||||
const server = () => servers.get(server_id)!;
|
||||
return (
|
||||
<ConfirmButton
|
||||
class="red"
|
||||
onConfirm={() => {
|
||||
class="lightgrey"
|
||||
style={{ width: "100%" }}
|
||||
onConfirm={() =>
|
||||
client.update_group({
|
||||
...group()!,
|
||||
servers: group()!.servers.filter(
|
||||
(member) => member !== id
|
||||
),
|
||||
});
|
||||
}}
|
||||
servers: [...group()!.servers, server_id],
|
||||
})
|
||||
}
|
||||
>
|
||||
<Icon type="minus" />
|
||||
{server().server.name}
|
||||
</ConfirmButton>
|
||||
</Show>
|
||||
</Flex>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
<Grid
|
||||
placeItems="center"
|
||||
gridTemplateColumns="1fr auto 1fr"
|
||||
style={{ width: "100%" }}
|
||||
>
|
||||
<div
|
||||
class="lightgrey"
|
||||
style={{ opacity: 0.7, width: "100%", height: "3px" }}
|
||||
/>
|
||||
<div style={{ opacity: 0.7 }}>end</div>
|
||||
<div
|
||||
class="lightgrey"
|
||||
style={{ opacity: 0.7, width: "100%", height: "3px" }}
|
||||
/>
|
||||
</Grid>
|
||||
</Show>
|
||||
);
|
||||
}}
|
||||
</For>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</Show>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -18,9 +18,10 @@ const Server: Component<{ id: string }> = (p) => {
|
||||
const server = () => servers.get(p.id);
|
||||
return (
|
||||
<Show when={server()}>
|
||||
<div class={combineClasses(s.Server, "shadow")}>
|
||||
<Grid class="shadow pointer full-width" style={{ height: "fit-content" }} gap="0">
|
||||
<button
|
||||
class={combineClasses(s.ServerButton, "shadow")}
|
||||
class="card light hover shadow full-width"
|
||||
style={{ "justify-content": "space-between" }}
|
||||
onClick={toggleOpen}
|
||||
>
|
||||
<Flex>
|
||||
@@ -54,7 +55,7 @@ const Server: Component<{ id: string }> = (p) => {
|
||||
<Show when={open()}>
|
||||
<ServerChildren id={p.id} />
|
||||
</Show>
|
||||
</div>
|
||||
</Grid>
|
||||
</Show>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
import { Component, createMemo, createSignal, For, Show } from "solid-js";
|
||||
import { useAppState } from "../../../state/StateProvider";
|
||||
import { useUser } from "../../../state/UserProvider";
|
||||
import Input from "../../shared/Input";
|
||||
import Grid from "../../shared/layout/Grid";
|
||||
import Selector from "../../shared/menu/Selector";
|
||||
import AddServer from "./AddServer";
|
||||
import { TreeSortType, TREE_SORTS, useTreeState } from "./Provider";
|
||||
import Server from "./Server";
|
||||
|
||||
const Servers: Component<{ serverIDs: string[]; showAdd?: boolean }> = (p) => {
|
||||
const { user } = useUser();
|
||||
const { servers } = useAppState();
|
||||
const { sort, setSort, server_sorter } = useTreeState();
|
||||
const [serverFilter, setServerFilter] = createSignal("");
|
||||
const serverIDs = createMemo(() => {
|
||||
if (servers.loaded()) {
|
||||
const filters = serverFilter()
|
||||
.split(" ")
|
||||
.filter((term) => term.length > 0)
|
||||
.map((term) => term.toLowerCase());
|
||||
return p.serverIDs.filter((id) => {
|
||||
const name = servers.get(id)!.server.name;
|
||||
for (const term of filters) {
|
||||
if (!name.includes(term)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.sort(server_sorter());
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
return (
|
||||
<Grid style={{ height: "fit-content" }}>
|
||||
<Grid gridTemplateColumns="1fr auto auto">
|
||||
<Input
|
||||
placeholder="filter servers"
|
||||
value={serverFilter()}
|
||||
onEdit={setServerFilter}
|
||||
style={{ width: "100%", padding: "0.5rem" }}
|
||||
/>
|
||||
<Selector
|
||||
label={<div class="dimmed">sort by:</div>}
|
||||
selected={sort()}
|
||||
items={TREE_SORTS as any as string[]}
|
||||
onSelect={(mode) => setSort(mode as TreeSortType)}
|
||||
position="bottom right"
|
||||
targetClass="blue"
|
||||
targetStyle={{ height: "100%" }}
|
||||
containerStyle={{ height: "100%" }}
|
||||
/>
|
||||
<Show
|
||||
when={p.showAdd && (user().admin || user().create_server_permissions)}
|
||||
>
|
||||
<AddServer />
|
||||
</Show>
|
||||
</Grid>
|
||||
<For each={serverIDs()}>{(id) => <Server id={id} />}</For>
|
||||
</Grid>
|
||||
);
|
||||
};
|
||||
|
||||
export default Servers;
|
||||
@@ -13,7 +13,7 @@ import Grid from "../../shared/layout/Grid";
|
||||
import UpdateMenu from "../../update/UpdateMenu";
|
||||
import s from "./update.module.scss";
|
||||
|
||||
const Update: Component<{ update: UpdateType }> = (p) => {
|
||||
const Update: Component<{ update: UpdateType; openMenu: () => void; }> = (p) => {
|
||||
const { usernames, name_from_update_target } =
|
||||
useAppState();
|
||||
const name = () => name_from_update_target(p.update.target);
|
||||
@@ -32,9 +32,10 @@ const Update: Component<{ update: UpdateType }> = (p) => {
|
||||
};
|
||||
return (
|
||||
<Flex
|
||||
class={combineClasses(s.Update, "shadow")}
|
||||
class={combineClasses(s.Update, "card light hover shadow pointer")}
|
||||
justifyContent="space-between"
|
||||
alignItems="center"
|
||||
onClick={p.openMenu}
|
||||
>
|
||||
<Grid gap="0.5rem" placeItems="center start">
|
||||
<A style={{ padding: 0 }} href={link_to()}>
|
||||
@@ -63,7 +64,9 @@ const Update: Component<{ update: UpdateType }> = (p) => {
|
||||
<div>{usernames.get(p.update.operator)}</div>
|
||||
</Flex>
|
||||
</Grid>
|
||||
<UpdateMenu update={p.update} />
|
||||
{/* <button class="blue" style={{ "place-self": "center end" }} onClick={p.openMenu}>
|
||||
<Icon type="console" />
|
||||
</button> */}
|
||||
</Flex>
|
||||
</Flex>
|
||||
);
|
||||
|
||||
@@ -8,6 +8,8 @@ import Grid from "../../shared/layout/Grid";
|
||||
import Loading from "../../shared/loading/Loading";
|
||||
import Selector from "../../shared/menu/Selector";
|
||||
import Update from "./Update";
|
||||
import UpdateMenu from "../../update/UpdateMenu";
|
||||
import { getId } from "../../../util/helpers";
|
||||
|
||||
const Updates: Component<{}> = () => {
|
||||
const { updates } = useAppState();
|
||||
@@ -19,12 +21,19 @@ const Updates: Component<{}> = () => {
|
||||
updates.load();
|
||||
}
|
||||
});
|
||||
const [openMenu, setOpenMenu] = createSignal<string | undefined>(undefined);
|
||||
return (
|
||||
<Grid class="card shadow" style={{ "flex-grow": 1 }}>
|
||||
<Flex alignItems="center" justifyContent="space-between">
|
||||
<A href="/updates" style={{ padding: 0 }}>
|
||||
<h1>updates</h1>
|
||||
</A>
|
||||
<Flex>
|
||||
<A href="/updates" style={{ padding: 0 }}>
|
||||
<h1>updates</h1>
|
||||
</A>
|
||||
<UpdateMenu
|
||||
update={openMenu() ? updates.get(openMenu()!) : undefined}
|
||||
closeMenu={() => setOpenMenu(undefined)}
|
||||
/>
|
||||
</Flex>
|
||||
<Selector
|
||||
label="operation: "
|
||||
selected={operation() ? operation()! : "all"}
|
||||
@@ -46,13 +55,18 @@ const Updates: Component<{}> = () => {
|
||||
when={updates.loaded()}
|
||||
fallback={
|
||||
<Flex justifyContent="center">
|
||||
<Loading type="three-dot" />
|
||||
<Loading type="three-dot" scale={0.7} />
|
||||
</Flex>
|
||||
}
|
||||
>
|
||||
<Grid class="updates-container-small scroller">
|
||||
<For each={updates.collection()}>
|
||||
{(update) => <Update update={update} />}
|
||||
{(update) => (
|
||||
<Update
|
||||
update={update}
|
||||
openMenu={() => setOpenMenu(getId(update))}
|
||||
/>
|
||||
)}
|
||||
</For>
|
||||
<Show when={!updates.noMore()}>
|
||||
<button
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
}
|
||||
|
||||
.Update {
|
||||
background-color: c.$lightgrey;
|
||||
padding: 0.75rem;
|
||||
height: 40px;
|
||||
transform-origin: top;
|
||||
|
||||
@@ -80,7 +80,7 @@ const Header: Component<{}> = (p) => {
|
||||
setUpdatingName(false);
|
||||
}}
|
||||
onBlur={() => setEditingName(false)}
|
||||
|
||||
style={{ "font-size": "1.4rem" }}
|
||||
/>
|
||||
</Show>
|
||||
</Show>
|
||||
|
||||
@@ -24,7 +24,10 @@ const Server: Component<{}> = (p) => {
|
||||
user().admin ||
|
||||
server()?.server.permissions![user_id()] === PermissionLevel.Update;
|
||||
return (
|
||||
<Show when={server()} fallback={<NotFound type="server" loaded={servers.loaded()} />}>
|
||||
<Show
|
||||
when={server()}
|
||||
fallback={<NotFound type="server" loaded={servers.loaded()} />}
|
||||
>
|
||||
<ActionStateProvider>
|
||||
<Grid
|
||||
style={{
|
||||
@@ -32,12 +35,12 @@ const Server: Component<{}> = (p) => {
|
||||
"box-sizing": "border-box",
|
||||
}}
|
||||
>
|
||||
<Header />
|
||||
<Grid
|
||||
style={{ width: "100%" }}
|
||||
gridTemplateColumns={isSemiMobile() ? "1fr" : "1fr 1fr"}
|
||||
>
|
||||
<Grid style={{ "flex-grow": 1, "grid-auto-rows": "auto auto 1fr" }}>
|
||||
<Header />
|
||||
<Grid style={{ "flex-grow": 1, "grid-auto-rows": "auto 1fr" }}>
|
||||
<Description
|
||||
target={{ type: "Server", id: params.id }}
|
||||
name={server().server.name}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
Component,
|
||||
createEffect,
|
||||
createSignal,
|
||||
For,
|
||||
onCleanup,
|
||||
Show,
|
||||
@@ -9,13 +10,17 @@ import { useUpdates } from "../../state/hooks";
|
||||
import { useAppState } from "../../state/StateProvider";
|
||||
import Update from "../update/Update";
|
||||
import Grid from "../shared/layout/Grid";
|
||||
import { combineClasses } from "../../util/helpers";
|
||||
import { combineClasses, getId } from "../../util/helpers";
|
||||
import { useParams } from "@solidjs/router";
|
||||
import Flex from "../shared/layout/Flex";
|
||||
import UpdateMenu from "../update/UpdateMenu";
|
||||
import Loading from "../shared/loading/Loading";
|
||||
|
||||
const Updates: Component<{}> = (p) => {
|
||||
const { ws } = useAppState();
|
||||
const params = useParams();
|
||||
const updates = useUpdates({ type: "Server", id: params.id });
|
||||
const [openMenu, setOpenMenu] = createSignal<string | undefined>(undefined);
|
||||
let unsub = () => {};
|
||||
createEffect(() => {
|
||||
unsub();
|
||||
@@ -27,25 +32,42 @@ const Updates: Component<{}> = (p) => {
|
||||
});
|
||||
onCleanup(() => unsub());
|
||||
return (
|
||||
<Grid
|
||||
class={combineClasses("card shadow")}
|
||||
style={{ "flex-grow": 1 }}
|
||||
>
|
||||
<h1>updates</h1>
|
||||
<Grid class="updates-container scroller">
|
||||
<For each={updates.collection()}>
|
||||
{(update) => <Update update={update} />}
|
||||
</For>
|
||||
<Show when={!updates.noMore()}>
|
||||
<button
|
||||
class="grey"
|
||||
style={{ width: "100%" }}
|
||||
onClick={() => updates.loadMore()}
|
||||
>
|
||||
load more
|
||||
</button>
|
||||
</Show>
|
||||
</Grid>
|
||||
<Grid class={combineClasses("card shadow")} style={{ "flex-grow": 1 }}>
|
||||
<Flex>
|
||||
<h1>updates</h1>
|
||||
<UpdateMenu
|
||||
update={openMenu() ? updates.get(openMenu()!) : undefined}
|
||||
closeMenu={() => setOpenMenu(undefined)}
|
||||
/>
|
||||
</Flex>
|
||||
<Show
|
||||
when={updates.loaded()}
|
||||
fallback={
|
||||
<Flex class="full-size" alignItems="center" justifyContent="center">
|
||||
<Loading type="three-dot" scale={0.7} />
|
||||
</Flex>
|
||||
}
|
||||
>
|
||||
<Grid class="updates-container scroller">
|
||||
<For each={updates.collection()}>
|
||||
{(update) => (
|
||||
<Update
|
||||
update={update}
|
||||
openMenu={() => setOpenMenu(getId(update))}
|
||||
/>
|
||||
)}
|
||||
</For>
|
||||
<Show when={!updates.noMore()}>
|
||||
<button
|
||||
class="grey"
|
||||
style={{ width: "100%" }}
|
||||
onClick={() => updates.loadMore()}
|
||||
>
|
||||
load more
|
||||
</button>
|
||||
</Show>
|
||||
</Grid>
|
||||
</Show>
|
||||
</Grid>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -51,7 +51,7 @@ const Deployment: Component<{ id: string }> = (p) => {
|
||||
<Show when={deployment()}>
|
||||
<A
|
||||
href={`/deployment/${p.id}`}
|
||||
class="card hoverable"
|
||||
class="card clear hover"
|
||||
style={{
|
||||
width: "100%",
|
||||
"justify-content": "space-between",
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { Component, createMemo, For, Show } from "solid-js";
|
||||
import { useAppDimensions } from "../../state/DimensionProvider";
|
||||
import { combineClasses, getId } from "../../util/helpers";
|
||||
import { getId } from "../../util/helpers";
|
||||
import Grid from "../shared/layout/Grid";
|
||||
import SimpleTabs from "../shared/tabs/SimpleTabs";
|
||||
import s from "./serverchildren.module.scss";
|
||||
import { useUser } from "../../state/UserProvider";
|
||||
import { PermissionLevel } from "../../types";
|
||||
import { NewDeployment } from "../New";
|
||||
@@ -23,17 +21,11 @@ const ServerChildren: Component<{ id: string }> = (p) => {
|
||||
(id) => deployments.get(id)?.deployment.server_id === p.id
|
||||
)) as string[];
|
||||
});
|
||||
// const buildIDs = createMemo(() => {
|
||||
// return (builds.loaded() &&
|
||||
// builds
|
||||
// .ids()!
|
||||
// .filter((id) => builds.get(id)?.server_id === p.id)) as string[];
|
||||
// });
|
||||
return (
|
||||
<div class="card shadow">
|
||||
<Grid
|
||||
gap=".5rem"
|
||||
gridTemplateColumns={isSemiMobile() ? "1fr" : "1fr 1fr"}
|
||||
gap="0.5rem"
|
||||
>
|
||||
<For each={deploymentIDs()}>{(id) => <Deployment id={id} />}</For>
|
||||
<Show
|
||||
@@ -47,54 +39,6 @@ const ServerChildren: Component<{ id: string }> = (p) => {
|
||||
</Show>
|
||||
</Grid>
|
||||
</div>
|
||||
// <SimpleTabs
|
||||
// containerClass="card shadow"
|
||||
// localStorageKey={`${p.id}-home-tab`}
|
||||
// tabs={[
|
||||
// {
|
||||
// title: "deployments",
|
||||
// element: () => (
|
||||
// <Grid
|
||||
// gap=".5rem"
|
||||
// class={combineClasses(s.Deployments)}
|
||||
// gridTemplateColumns={isSemiMobile() ? "1fr" : "1fr 1fr"}
|
||||
// >
|
||||
// <For each={deploymentIDs()}>{(id) => <Deployment id={id} />}</For>
|
||||
// <Show
|
||||
// when={
|
||||
// user().admin ||
|
||||
// server()?.server.permissions![getId(user())] ===
|
||||
// PermissionLevel.Update
|
||||
// }
|
||||
// >
|
||||
// <NewDeployment serverID={p.id} />
|
||||
// </Show>
|
||||
// </Grid>
|
||||
// ),
|
||||
// },
|
||||
// // {
|
||||
// // title: "builds",
|
||||
// // element: () => (
|
||||
// // <Grid
|
||||
// // gap=".5rem"
|
||||
// // class={combineClasses(s.Deployments)}
|
||||
// // gridTemplateColumns={isSemiMobile() ? "1fr" : "1fr 1fr"}
|
||||
// // >
|
||||
// // <For each={buildIDs()}>{(id) => <Build id={id} />}</For>
|
||||
// // <Show
|
||||
// // when={
|
||||
// // user().admin ||
|
||||
// // server()?.server.permissions![getId(user())] ===
|
||||
// // PermissionLevel.Update
|
||||
// // }
|
||||
// // >
|
||||
// // <NewBuild serverID={p.id} />
|
||||
// // </Show>
|
||||
// // </Grid>
|
||||
// // ),
|
||||
// // },
|
||||
// ]}
|
||||
// />
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ const CenterMenu: Component<{
|
||||
show: Accessor<boolean>;
|
||||
toggleShow: () => void;
|
||||
content: () => JSXElement;
|
||||
target: JSXElement;
|
||||
target?: JSXElement;
|
||||
targetStyle?: JSX.CSSProperties;
|
||||
targetClass?: string;
|
||||
title?: string;
|
||||
@@ -37,16 +37,18 @@ const CenterMenu: Component<{
|
||||
// });
|
||||
return (
|
||||
<>
|
||||
<button
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
p.toggleShow();
|
||||
}}
|
||||
class={p.targetClass}
|
||||
style={p.targetStyle}
|
||||
>
|
||||
{p.target}
|
||||
</button>
|
||||
<Show when={p.target}>
|
||||
<button
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
p.toggleShow();
|
||||
}}
|
||||
class={p.targetClass}
|
||||
style={p.targetStyle}
|
||||
>
|
||||
{p.target}
|
||||
</button>
|
||||
</Show>
|
||||
<Show when={p.show()}>
|
||||
<Child {...p} show={p.show} toggleShow={p.toggleShow} />
|
||||
</Show>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { Component, JSX, onMount } from "solid-js";
|
||||
import { createStore } from "solid-js/store";
|
||||
import { client, pushNotification } from "../../..";
|
||||
import { CreateServerBody } from "../../../util/client_types";
|
||||
import { useToggle } from "../../../util/hooks";
|
||||
import Icon from "../../shared/Icon";
|
||||
import Input from "../../shared/Input";
|
||||
import Grid from "../../shared/layout/Grid";
|
||||
import CenterMenu from "../../shared/menu/CenterMenu";
|
||||
import { client, pushNotification } from "../..";
|
||||
import { CreateServerBody } from "../../util/client_types";
|
||||
import { useToggle } from "../../util/hooks";
|
||||
import Icon from "../shared/Icon";
|
||||
import Input from "../shared/Input";
|
||||
import Grid from "../shared/layout/Grid";
|
||||
import CenterMenu from "../shared/menu/CenterMenu";
|
||||
|
||||
const AddServer: Component<{}> = () => {
|
||||
const [show, toggleShow] = useToggle();
|
||||
@@ -14,10 +14,11 @@ const AddServer: Component<{}> = () => {
|
||||
<CenterMenu
|
||||
show={show}
|
||||
toggleShow={toggleShow}
|
||||
target={<Icon type="plus" />}
|
||||
target="add server"
|
||||
title="add server"
|
||||
targetClass="green shadow"
|
||||
content={() => <Content close={toggleShow} />}
|
||||
style={{ "box-sizing": "border-box", "max-width": "90vw" }}
|
||||
position="center"
|
||||
/>
|
||||
);
|
||||
@@ -26,7 +27,7 @@ const AddServer: Component<{}> = () => {
|
||||
const INPUT_STYLE: JSX.CSSProperties = {
|
||||
"font-size": "1.25rem",
|
||||
width: "500px",
|
||||
"max-width": "90vw",
|
||||
"max-width": "80vw",
|
||||
};
|
||||
|
||||
const Content: Component<{ close: () => void }> = (p) => {
|
||||
@@ -45,7 +46,12 @@ const Content: Component<{ close: () => void }> = (p) => {
|
||||
}
|
||||
};
|
||||
return (
|
||||
<Grid placeItems="center" style={{ padding: "2rem 1rem 1rem 1rem" }}>
|
||||
<Grid
|
||||
placeItems="center"
|
||||
style={{
|
||||
|
||||
}}
|
||||
>
|
||||
<Input
|
||||
class="darkgrey"
|
||||
ref={nameInput}
|
||||
@@ -17,39 +17,42 @@ const value = () => {
|
||||
const [open, setOpen] = createSignal(false);
|
||||
const close = (inputRef: HTMLInputElement | undefined) => {
|
||||
inputRef?.blur();
|
||||
setSearch("");
|
||||
// setSearch("");
|
||||
setOpen(false);
|
||||
};
|
||||
const [highlighted, setHighlighted] = createSignal(0);
|
||||
|
||||
const filteredDeployments = createMemo(() => {
|
||||
const searchTerms = search()
|
||||
const searchTerms = createMemo(() => {
|
||||
return search()
|
||||
.split(" ")
|
||||
.filter((term) => term.length > 0)
|
||||
.map((term) => term.toLowerCase());
|
||||
return deployments.filterArray((deployment) => {
|
||||
return searchTerms.reduce((prev, search) => {
|
||||
return (
|
||||
prev &&
|
||||
(deployment.deployment.name.toLowerCase().includes(search) ||
|
||||
servers
|
||||
.get(deployment.deployment.server_id)!
|
||||
.server.name.toLowerCase()
|
||||
.includes(search))
|
||||
);
|
||||
}, true);
|
||||
})!;
|
||||
});
|
||||
|
||||
const filteredDeployments = createMemo(
|
||||
() =>
|
||||
deployments.filterArray((deployment) =>
|
||||
searchTerms().reduce((prev, search) => {
|
||||
return (
|
||||
prev && deployment.deployment.name.toLowerCase().includes(search)
|
||||
);
|
||||
}, true)
|
||||
)!
|
||||
);
|
||||
const filteredBuilds = createMemo(
|
||||
() =>
|
||||
builds.filterArray((build) =>
|
||||
build.name.toLowerCase().includes(search().toLowerCase())
|
||||
searchTerms().reduce((prev, search) => {
|
||||
return prev && build.name.toLowerCase().includes(search);
|
||||
}, true)
|
||||
)!
|
||||
);
|
||||
const filteredServers = createMemo(
|
||||
() =>
|
||||
servers.filterArray((server) =>
|
||||
server.server.name.toLowerCase().includes(search().toLowerCase())
|
||||
searchTerms().reduce((prev, search) => {
|
||||
return prev && server.server.name.toLowerCase().includes(search);
|
||||
}, true)
|
||||
)!
|
||||
);
|
||||
|
||||
|
||||
@@ -79,14 +79,14 @@ const SearchMenu: Component<{ close: () => void }> = (p) => {
|
||||
let inputRef: HTMLInputElement | undefined;
|
||||
onMount(() => {
|
||||
if (isSemiMobile()) {
|
||||
inputRef?.focus();
|
||||
setTimeout(() => inputRef?.focus(), 200);
|
||||
}
|
||||
});
|
||||
return (
|
||||
<>
|
||||
<Show when={isSemiMobile()}>
|
||||
<Input
|
||||
ref={() => inputRef}
|
||||
ref={inputRef}
|
||||
class={s.SearchInput}
|
||||
placeholder="search"
|
||||
value={search.value()}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { A, useNavigate } from "@solidjs/router";
|
||||
import { Component, createSignal, JSX, Show } from "solid-js";
|
||||
import { A } from "@solidjs/router";
|
||||
import { Component, createSignal, Show } from "solid-js";
|
||||
import { TOPBAR_HEIGHT } from "../..";
|
||||
import { useAppDimensions } from "../../state/DimensionProvider";
|
||||
import { useAppState } from "../../state/StateProvider";
|
||||
@@ -15,14 +15,7 @@ import Account from "./Account";
|
||||
import { SearchProvider } from "./Search/Provider";
|
||||
import { Search } from "./Search/Search";
|
||||
import s from "./topbar.module.scss";
|
||||
import Updates from "./Updates/Updates";
|
||||
|
||||
const mobileStyle: JSX.CSSProperties = {
|
||||
position: "fixed",
|
||||
top: inPx(44),
|
||||
left: "1rem",
|
||||
width: "calc(100vw - 2rem)",
|
||||
};
|
||||
import AddServer from "./AddServer";
|
||||
|
||||
const Topbar: Component = () => {
|
||||
return (
|
||||
@@ -102,6 +95,7 @@ const RightSide: Component = () => {
|
||||
content={<Updates />}
|
||||
position="bottom right"
|
||||
/> */}
|
||||
<AddServer />
|
||||
<Menu
|
||||
show={menu() === "account"}
|
||||
close={close}
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
import { Component, Show } from "solid-js";
|
||||
import { useAppState } from "../../state/StateProvider";
|
||||
import { Operation, Update as UpdateType, UpdateStatus } from "../../types";
|
||||
import { combineClasses, readableMonitorTimestamp, readableVersion } from "../../util/helpers";
|
||||
import {
|
||||
combineClasses,
|
||||
readableMonitorTimestamp,
|
||||
readableVersion,
|
||||
} from "../../util/helpers";
|
||||
import Icon from "../shared/Icon";
|
||||
import Flex from "../shared/layout/Flex";
|
||||
import Grid from "../shared/layout/Grid";
|
||||
import s from "./update.module.scss";
|
||||
import UpdateMenu from "./UpdateMenu";
|
||||
|
||||
const Update: Component<{ update: UpdateType }> = (p) => {
|
||||
const Update: Component<{ update: UpdateType; openMenu: () => void }> = (p) => {
|
||||
const { usernames } = useAppState();
|
||||
const operation = () => {
|
||||
if (p.update.operation === Operation.BuildBuild) {
|
||||
@@ -19,7 +22,12 @@ const Update: Component<{ update: UpdateType }> = (p) => {
|
||||
}`;
|
||||
};
|
||||
return (
|
||||
<Grid gap="0.25rem" class={combineClasses(s.Update, "shadow")}>
|
||||
<Flex
|
||||
class={combineClasses(s.Update, "card light hover shadow pointer")}
|
||||
onClick={p.openMenu}
|
||||
justifyContent="space-between"
|
||||
alignItems="center"
|
||||
>
|
||||
<Flex gap="0.5rem">
|
||||
<div
|
||||
style={{
|
||||
@@ -32,17 +40,14 @@ const Update: Component<{ update: UpdateType }> = (p) => {
|
||||
<div style={{ opacity: 0.7 }}>(in progress)</div>
|
||||
</Show>
|
||||
</Flex>
|
||||
<div style={{ "place-self": "start end" }}>
|
||||
{readableMonitorTimestamp(p.update.start_ts)}
|
||||
</div>
|
||||
<Flex gap="0.5rem" alignItems="center">
|
||||
<Icon type="user" />
|
||||
<div>{usernames.get(p.update.operator)}</div>
|
||||
</Flex>
|
||||
<Flex style={{ "place-self": "center end" }} alignItems="center">
|
||||
<UpdateMenu update={p.update} />
|
||||
</Flex>
|
||||
</Grid>
|
||||
<Grid gap="0.25rem" placeItems="center end">
|
||||
<div>{readableMonitorTimestamp(p.update.start_ts)}</div>
|
||||
<Flex gap="0.5rem" alignItems="center">
|
||||
<Icon type="user" />
|
||||
<div>{usernames.get(p.update.operator)}</div>
|
||||
</Flex>
|
||||
</Grid>
|
||||
</Flex>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -7,43 +7,41 @@ import {
|
||||
readableMonitorTimestamp,
|
||||
readableVersion,
|
||||
} from "../../util/helpers";
|
||||
import { useToggle } from "../../util/hooks";
|
||||
import Icon from "../shared/Icon";
|
||||
import Flex from "../shared/layout/Flex";
|
||||
import Grid from "../shared/layout/Grid";
|
||||
import CenterMenu from "../shared/menu/CenterMenu";
|
||||
import s from "./update.module.scss";
|
||||
|
||||
const UpdateMenu: Component<{ update: UpdateType }> = (p) => {
|
||||
const UpdateMenu: Component<{ update?: UpdateType; closeMenu: () => void }> = (p) => {
|
||||
const { deployments, servers, builds } = useAppState();
|
||||
const name = () => {
|
||||
if (p.update.target.type === "Deployment" && deployments.loaded()) {
|
||||
if (p.update?.target.type === "Deployment" && deployments.loaded()) {
|
||||
return deployments.get(p.update.target.id!)?.deployment.name || "deleted";
|
||||
} else if (p.update.target.type === "Server" && servers.loaded()) {
|
||||
} else if (p.update?.target.type === "Server" && servers.loaded()) {
|
||||
return servers.get(p.update.target.id)?.server.name || "deleted";
|
||||
} else if (p.update.target.type === "Build" && builds.loaded()) {
|
||||
} else if (p.update?.target.type === "Build" && builds.loaded()) {
|
||||
return builds.get(p.update.target.id)?.name || "deleted";
|
||||
} else {
|
||||
return "monitor";
|
||||
}
|
||||
};
|
||||
const operation = () => {
|
||||
if (p.update.operation === Operation.BuildBuild) {
|
||||
if (p.update?.operation === Operation.BuildBuild) {
|
||||
return "build";
|
||||
}
|
||||
return p.update.operation.replaceAll("_", " ");
|
||||
return p.update?.operation.replaceAll("_", " ");
|
||||
};
|
||||
const [showLog, toggleShowLog] = useToggle();
|
||||
return (
|
||||
<CenterMenu
|
||||
title={`${operation()} | ${name()}`}
|
||||
show={showLog}
|
||||
toggleShow={toggleShowLog}
|
||||
target={<Icon type="console" />}
|
||||
show={() => p.update ? true : false}
|
||||
toggleShow={p.closeMenu}
|
||||
// target={<Icon type="console" />}
|
||||
targetStyle={{ "place-self": "center end" }}
|
||||
targetClass="blue"
|
||||
padding="1rem 2rem"
|
||||
content={() => <UpdateMenuContent update={p.update} />}
|
||||
content={() => <UpdateMenuContent update={p.update!} />}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -12,9 +12,8 @@
|
||||
}
|
||||
|
||||
.Update {
|
||||
background-color: c.$lightgrey;
|
||||
padding: 0.75rem;
|
||||
height: 70px;
|
||||
height: 40px;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-template-rows: 1fr 1fr;
|
||||
transform-origin: top;
|
||||
|
||||
@@ -33,7 +33,7 @@ import Selector from "../shared/menu/Selector";
|
||||
|
||||
const User: Component = () => {
|
||||
const { isMobile } = useAppDimensions();
|
||||
const { builds, deployments, servers, ws } = useAppState();
|
||||
const { builds, deployments, servers, groups, ws } = useAppState();
|
||||
const params = useParams<{ id: string }>();
|
||||
const [user, { refetch }] = createResource(() =>
|
||||
client.get_user_by_id(params.id)
|
||||
@@ -86,6 +86,17 @@ const User: Component = () => {
|
||||
});
|
||||
}
|
||||
});
|
||||
const _groups = createMemo(() => {
|
||||
if (showAll()) {
|
||||
return groups.filterArray((b) => b.name.includes(search()));
|
||||
} else {
|
||||
return groups.filterArray((b) => {
|
||||
if (!b.name.includes(search())) return false;
|
||||
const p = b.permissions?.[params.id];
|
||||
return p ? p !== PermissionLevel.None : false;
|
||||
});
|
||||
}
|
||||
});
|
||||
return (
|
||||
<Grid
|
||||
class="card shadow"
|
||||
@@ -138,7 +149,7 @@ const User: Component = () => {
|
||||
<Flex alignItems="center">
|
||||
<h1>servers</h1>
|
||||
<Show when={_servers()?.length === 0}>
|
||||
<div>empty</div>
|
||||
<div>none</div>
|
||||
</Show>
|
||||
</Flex>
|
||||
<Grid gridTemplateColumns={isMobile() ? undefined : "1fr 1fr"}>
|
||||
@@ -182,7 +193,7 @@ const User: Component = () => {
|
||||
<Flex alignItems="center">
|
||||
<h1>deployments</h1>
|
||||
<Show when={_deployments()?.length === 0}>
|
||||
<div>empty</div>
|
||||
<div>none</div>
|
||||
</Show>
|
||||
</Flex>
|
||||
<Grid gridTemplateColumns={isMobile() ? undefined : "1fr 1fr"}>
|
||||
@@ -229,7 +240,7 @@ const User: Component = () => {
|
||||
<Flex alignItems="center">
|
||||
<h1>builds</h1>
|
||||
<Show when={_builds()?.length === 0}>
|
||||
<div>empty</div>
|
||||
<div>none</div>
|
||||
</Show>
|
||||
</Flex>
|
||||
<Grid gridTemplateColumns={isMobile() ? undefined : "1fr 1fr"}>
|
||||
@@ -263,6 +274,44 @@ const User: Component = () => {
|
||||
</For>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid class="card light shadow">
|
||||
<Flex alignItems="center">
|
||||
<h1>groups</h1>
|
||||
<Show when={_builds()?.length === 0}>
|
||||
<div>none</div>
|
||||
</Show>
|
||||
</Flex>
|
||||
<Grid gridTemplateColumns={isMobile() ? undefined : "1fr 1fr"}>
|
||||
<For each={_groups()}>
|
||||
{(item) => (
|
||||
<Flex
|
||||
class="card shadow"
|
||||
alignItems="center"
|
||||
justifyContent="space-between"
|
||||
>
|
||||
<h2>{item.name}</h2>
|
||||
<Selector
|
||||
targetClass={
|
||||
(item.permissions?.[params.id] || "none") !== "none"
|
||||
? "blue"
|
||||
: "red"
|
||||
}
|
||||
selected={item.permissions?.[params.id] || "none"}
|
||||
items={["none", "read", "execute", "update"]}
|
||||
onSelect={(permission) => {
|
||||
client.update_user_permissions_on_target({
|
||||
user_id: params.id,
|
||||
target_type: PermissionsTarget.Group,
|
||||
target_id: getId(item),
|
||||
permission: permission as PermissionLevel,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</Flex>
|
||||
)}
|
||||
</For>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Show>
|
||||
</Grid>
|
||||
);
|
||||
|
||||
@@ -156,8 +156,10 @@ export const AppStateProvider: ParentComponent = (p) => {
|
||||
return servers.get(target.id)?.server.name || "deleted";
|
||||
} else if (target.type === "Build" && builds) {
|
||||
return builds.get(target.id)?.name || "deleted";
|
||||
} else if (target.type === "Group" && groups) {
|
||||
return groups.get(target.id)?.name || "deleted";
|
||||
} else {
|
||||
return "admin";
|
||||
return "unknown"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -371,12 +371,14 @@ export function useArrayWithId<T, O>(
|
||||
set((curr: T[] | undefined) => (curr ? [...curr, ...items] : items));
|
||||
};
|
||||
const loaded = () => (collection() ? true : false);
|
||||
const get = (id: string) => collection()?.find((item) => getNestedEntry(item, idPath) === id);
|
||||
return {
|
||||
load,
|
||||
collection,
|
||||
addOrUpdate,
|
||||
addManyToEnd,
|
||||
loaded,
|
||||
get,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -35,17 +35,37 @@
|
||||
}
|
||||
|
||||
.card {
|
||||
background-color: c.$grey;
|
||||
background-color: rgba(c.$grey, 0.7);
|
||||
padding: 1rem;
|
||||
transition: all 250ms ease-in-out;
|
||||
}
|
||||
|
||||
.card.hover:hover {
|
||||
background-color: c.$grey;
|
||||
}
|
||||
|
||||
.card.clear {
|
||||
background-color: rgba(c.$lightgrey, 0);
|
||||
}
|
||||
|
||||
.card.clear.hover:hover {
|
||||
background-color: rgba(c.$lightgrey, 0.7);
|
||||
}
|
||||
|
||||
.card.light {
|
||||
background-color: c.$lightgrey;
|
||||
background-color: rgba(c.$lightgrey, 0.7);
|
||||
}
|
||||
|
||||
.card.light.hover:hover {
|
||||
background-color: c.$lightgrey;
|
||||
}
|
||||
|
||||
.card.dark {
|
||||
background-color: c.$darkgrey;
|
||||
background-color: rgba(c.$darkgrey, 0.7);
|
||||
}
|
||||
|
||||
.card.dark.hover:hover {
|
||||
background-color: c.$darkgrey;
|
||||
}
|
||||
|
||||
.card.hoverable:hover {
|
||||
@@ -123,7 +143,7 @@ $anim-time: 500ms;
|
||||
}
|
||||
|
||||
.updates-container {
|
||||
max-height: calc(225px + 5.5rem);
|
||||
max-height: calc(135px + 6.5rem);
|
||||
}
|
||||
|
||||
.updates-container-small {
|
||||
|
||||
@@ -29,7 +29,7 @@ pre {
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.5rem;
|
||||
font-size: 1.6rem;
|
||||
font-weight: 500;
|
||||
user-select: none;
|
||||
margin: 0;
|
||||
@@ -38,7 +38,6 @@ h1 {
|
||||
h2 {
|
||||
font-size: 1.1rem;
|
||||
font-weight: 450;
|
||||
// user-select: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -466,6 +466,7 @@ export enum PermissionsTarget {
|
||||
Deployment = "deployment",
|
||||
Build = "build",
|
||||
Procedure = "procedure",
|
||||
Group = "group",
|
||||
}
|
||||
|
||||
export enum Timelength {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "db_client"
|
||||
version = "0.2.11"
|
||||
version = "0.3.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "monitor_helpers"
|
||||
version = "0.2.11"
|
||||
version = "0.3.0"
|
||||
edition = "2021"
|
||||
authors = ["MoghTech"]
|
||||
description = "helpers used as dependency for mogh tech monitor"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user