Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ scc = "3.3.2"
scraper = "0.25.0"
serde_json = "1.0.140"
serde_qs = "0.15.0"
serde_urlencoded = "0.7.1"
serde = { version = "1.0.194" }
sha3 = "0.10.8"
sqlx = { version = "0.8.6", default-features = false }
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions nts-pool-management/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ rustls = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
serde_qs = { workspace = true }
serde_urlencoded = { workspace = true }
sha3.workspace = true
sqlx = { workspace = true, default-features = false, features = [
"runtime-tokio",
Expand Down
86 changes: 68 additions & 18 deletions nts-pool-management/assets/components.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ button,
[type="button"],
[type="submit"],
[type="reset"],
.pagination button,
a.btn {
display: inline-block;
background-color: var(--primary);
Expand Down Expand Up @@ -37,7 +38,7 @@ a.btn {
}

.btn-alt:hover {
color: color-mix(in lab, var(--primary), var(--black) 30%);
color: color-mix(in lab, var(--primary), var(--black) 30%) !important;
}

.btn-link,
Expand All @@ -52,7 +53,7 @@ a.btn {

.btn-sm {
max-width: fit-content;
padding: var(--space-xs) var(--space-sm);
padding: 0 var(--space-sm);
}

highlight-actions {
Expand Down Expand Up @@ -99,10 +100,11 @@ input[type="password"].error {
}

h1 {
font-size: 2.25rem;
font-size: 2.25rem;
}

h2 {
margin-top: var(--space-md);
margin-bottom: var(--space-sm);
}

Expand All @@ -111,6 +113,7 @@ h3 {
}

section > p {
font-size: 18px;
margin-bottom: var(--space-sm);
}

Expand All @@ -134,7 +137,7 @@ code-block {
display: block;
width: 100%;
margin: var(--space-sm) 0;
padding: var(--space-xs) var(--space-xs);
padding: var(--space-sm) var(--space-md);
}

.key {
Expand Down Expand Up @@ -214,12 +217,12 @@ details.confirmation-btn > div {

@keyframes animateDown {
0% {
opacity: 0;
transform: translatey(-15px);
opacity: 0;
transform: translatey(-15px);
}
100% {
opacity: 1;
transform: translatey(0);
opacity: 1;
transform: translatey(0);
}
}

Expand Down Expand Up @@ -262,6 +265,7 @@ dialog .dialog-actions {

details.toast > summary,
aside {
font-weight: bold;
padding: var(--space-sm) var(--space-md);
border-width: var(--border-width);
border-style: solid;
Expand All @@ -278,23 +282,28 @@ table {
width: 100%;
th {
text-align: left;

a,
a:visited {
color: inherit;
}
}

th,
td {
width: 100%;
white-space: nowrap;
padding: var(--space-sm);
}

tbody {
tr:nth-child(odd) {
background-color: var(--white);
tr {
border-bottom: 1px solid var(--grey);
}
}

.actions {
text-align: right;

td.actions {
float: right;
display: flex;
gap: var(--space-xs);
white-space: nowrap;
Expand All @@ -303,16 +312,20 @@ table {

table.birowed {
tbody {
tr:nth-child(4n + 1),
tr:nth-child(4n + 2),
tr:nth-child(4n + 4) {
background-color: var(--white);
border: none;
}

tr:nth-child(4n + 2),
tr:nth-child(4n + 1),
tr:nth-child(4n + 3) {
background-color: transparent;
}
}

details {
cursor: pointer;
user-select: none;
}
}

table.autowidth {
Expand All @@ -324,6 +337,43 @@ table.autowidth {
}
}

.table-controls {
display: flex;
gap: var(--space-md);
margin-top: var(--space-sm);
justify-content: space-between;
padding: 0 var(--space-sm);

.pagination {
a.btn, button {
color: var(--secondary);
background-color: inherit;
padding: 0 var(--space-sm);
border: inherit;
}
}

[aria-disabled] {
color: var(--grey);
}

[aria-disabled]:hover {
color: var(--grey);
cursor: inherit;
}

[aria-current="page"] {
text-decoration: underline;
}
}

.table-filter {
margin: var(--space-sm) 0;
display: flex;
gap: var(--space-sm);
align-items: baseline;
}

.multivalue-box {
display: flex;
width: fit-content;
Expand Down
2 changes: 1 addition & 1 deletion nts-pool-management/assets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ main section {
margin-bottom: var(--space-lg);
}

nav {
nav:not(.pagination) {
background-color: var(--secondary);
color: var(--white);
display: flex;
Expand Down
3 changes: 3 additions & 0 deletions nts-pool-management/assets/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
--success: #74ce42;
--info: #99b6d5;
--link: #0a57f0;
--text-color-body: #333;

--muted: var(--grey);

/* spacing */
--space-xxs: 0.25rem;
--space-xs: 0.5rem;
Expand Down
1 change: 1 addition & 0 deletions nts-pool-management/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub use common::*;

mod common;
pub mod models;
mod pagination;
pub mod routes;
mod scoring;
pub mod templates;
Expand Down
21 changes: 21 additions & 0 deletions nts-pool-management/src/models/time_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,27 @@ pub async fn logs(
.await
}

pub async fn log_count(
conn: impl DbConnLike<'_>,
time_source_id: TimeSourceId,
monitor_id: MonitorId,
protocol: IpVersion,
) -> Result<i64, sqlx::Error> {
Ok(sqlx::query!(
r#"
SELECT COUNT(*) as "count!"
FROM monitor_samples
WHERE time_source_id = $1 AND protocol = $2 AND monitor_id = $3
"#,
time_source_id as _,
protocol as _,
monitor_id as _,
)
.fetch_one(conn)
.await?
.count)
}

pub async fn source_name(
conn: impl DbConnLike<'_>,
owner: UserId,
Expand Down
Loading
Loading