Skip to content

Commit 0be0bb2

Browse files
committed
add knob for hiding chains in the ui
1 parent 713d873 commit 0be0bb2

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

fe/src/account.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub mod handlers {
4343
.await?
4444
.into_iter()
4545
.sorted_by_key(|c| c.name.to_string())
46-
.filter(|c| c.enabled)
46+
.filter(|c| c.enabled && !c.hidden)
4747
.collect::<Vec<_>>();
4848
let resp = Html(state.templates.render(
4949
"index.html",

fe/src/api_docs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub async fn index(State(state): State<web::State>) -> Result<Html<String>, shar
99
let chains = chains::list(&pg)
1010
.await?
1111
.into_iter()
12-
.filter(|c| c.enabled)
12+
.filter(|c| c.enabled && !c.hidden)
1313
.map(|mut c| {
1414
c.start_block = Some(c.start_block.unwrap_or(1));
1515
c

fe/src/chains.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ pub struct Config {
88
pub enabled: bool,
99
#[serde(default)]
1010
pub popular: bool,
11+
#[serde(default)]
12+
pub hidden: bool,
1113
pub chain: i64,
1214
pub start_block: Option<i64>,
1315
#[serde(skip_serializing)]
@@ -116,7 +118,7 @@ pub mod handlers {
116118
pub async fn list(pg: &tokio_postgres::Client) -> Result<Vec<Config>> {
117119
Ok(pg
118120
.query(
119-
"select enabled, chain, name, url, start_block, popular from config order by chain",
121+
"select enabled, chain, name, url, start_block, popular, hidden from config order by chain",
120122
&[],
121123
)
122124
.await?
@@ -125,6 +127,7 @@ pub async fn list(pg: &tokio_postgres::Client) -> Result<Vec<Config>> {
125127
name: row.get("name"),
126128
enabled: row.get("enabled"),
127129
popular: row.get("popular"),
130+
hidden: row.get("hidden"),
128131
chain: row.get("chain"),
129132
url: row.get("url"),
130133
start_block: row.get("start_block"),

fe/src/schema.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ create table if not exists config (
158158
batch_size int2 not null default 2000,
159159
concurrency int2 not null default 10,
160160
popular bool default false,
161+
hidden bool default false,
161162
provision_key text
162163
);
163164

0 commit comments

Comments
 (0)