Move /admin/repo/update to /admin/refs/update
This commit is contained in:
parent
2bf939186d
commit
b587a87d50
7 changed files with 23 additions and 39 deletions
|
|
@ -17,8 +17,7 @@ use self::{
|
||||||
post_admin_queue_add, post_admin_queue_add_batch, post_admin_queue_decrease,
|
post_admin_queue_add, post_admin_queue_add_batch, post_admin_queue_decrease,
|
||||||
post_admin_queue_delete, post_admin_queue_increase,
|
post_admin_queue_delete, post_admin_queue_increase,
|
||||||
},
|
},
|
||||||
refs::{post_admin_refs_track, post_admin_refs_untrack},
|
refs::{post_admin_refs_track, post_admin_refs_untrack, post_admin_repo_update},
|
||||||
repo::post_admin_repo_update,
|
|
||||||
},
|
},
|
||||||
api::worker::{
|
api::worker::{
|
||||||
get_api_worker_bench_repo_by_hash_tree_tar_gz, get_api_worker_repo_by_hash_tree_tar_gz,
|
get_api_worker_bench_repo_by_hash_tree_tar_gz, get_api_worker_repo_by_hash_tree_tar_gz,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,2 @@
|
||||||
pub mod queue;
|
pub mod queue;
|
||||||
pub mod refs;
|
pub mod refs;
|
||||||
pub mod repo;
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
use axum::{
|
use axum::{
|
||||||
extract::State,
|
extract::State,
|
||||||
response::{IntoResponse, Redirect},
|
response::{IntoResponse, Redirect},
|
||||||
|
|
@ -6,12 +8,13 @@ use axum::{
|
||||||
use log::info;
|
use log::info;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use sqlx::SqlitePool;
|
use sqlx::SqlitePool;
|
||||||
|
use tokio::sync::mpsc;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
config::ServerConfig,
|
config::ServerConfig,
|
||||||
server::web::{
|
server::web::{
|
||||||
base::Base,
|
base::Base,
|
||||||
paths::{PathAdminRefsTrack, PathAdminRefsUntrack, PathIndex},
|
paths::{PathAdminRefsTrack, PathAdminRefsUntrack, PathAdminRefsUpdate, PathIndex},
|
||||||
},
|
},
|
||||||
somehow,
|
somehow,
|
||||||
};
|
};
|
||||||
|
|
@ -56,3 +59,15 @@ pub async fn post_admin_refs_untrack(
|
||||||
let link = Base::link_with_config(config, PathIndex {});
|
let link = Base::link_with_config(config, PathIndex {});
|
||||||
Ok(Redirect::to(&link.to_string()))
|
Ok(Redirect::to(&link.to_string()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn post_admin_repo_update(
|
||||||
|
_path: PathAdminRefsUpdate,
|
||||||
|
State(config): State<&'static ServerConfig>,
|
||||||
|
State(recurring_tx): State<Arc<mpsc::UnboundedSender<()>>>,
|
||||||
|
) -> somehow::Result<impl IntoResponse> {
|
||||||
|
let _ = recurring_tx.send(());
|
||||||
|
info!("Admin updated repo");
|
||||||
|
|
||||||
|
let link = Base::link_with_config(config, PathIndex {});
|
||||||
|
Ok(Redirect::to(&link.to_string()))
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
use axum::{
|
|
||||||
extract::State,
|
|
||||||
response::{IntoResponse, Redirect},
|
|
||||||
};
|
|
||||||
use log::info;
|
|
||||||
use tokio::sync::mpsc;
|
|
||||||
|
|
||||||
use crate::{
|
|
||||||
config::ServerConfig,
|
|
||||||
server::web::{
|
|
||||||
base::Base,
|
|
||||||
paths::{PathAdminRepoUpdate, PathIndex},
|
|
||||||
},
|
|
||||||
somehow,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub async fn post_admin_repo_update(
|
|
||||||
_path: PathAdminRepoUpdate,
|
|
||||||
State(config): State<&'static ServerConfig>,
|
|
||||||
State(recurring_tx): State<Arc<mpsc::UnboundedSender<()>>>,
|
|
||||||
) -> somehow::Result<impl IntoResponse> {
|
|
||||||
let _ = recurring_tx.send(());
|
|
||||||
info!("Admin updated repo");
|
|
||||||
|
|
||||||
let link = Base::link_with_config(config, PathIndex {});
|
|
||||||
Ok(Redirect::to(&link.to_string()))
|
|
||||||
}
|
|
||||||
|
|
@ -8,7 +8,7 @@ use crate::{
|
||||||
server::web::{
|
server::web::{
|
||||||
base::{Base, Link, Tab},
|
base::{Base, Link, Tab},
|
||||||
link::LinkCommit,
|
link::LinkCommit,
|
||||||
paths::{PathAdminRefsTrack, PathAdminRefsUntrack, PathAdminRepoUpdate, PathIndex},
|
paths::{PathAdminRefsTrack, PathAdminRefsUntrack, PathAdminRefsUpdate, PathIndex},
|
||||||
},
|
},
|
||||||
somehow,
|
somehow,
|
||||||
};
|
};
|
||||||
|
|
@ -24,7 +24,7 @@ struct Ref {
|
||||||
struct IndexTemplate {
|
struct IndexTemplate {
|
||||||
link_admin_refs_track: Link,
|
link_admin_refs_track: Link,
|
||||||
link_admin_refs_untrack: Link,
|
link_admin_refs_untrack: Link,
|
||||||
link_admin_repo_update: Link,
|
link_admin_refs_update: Link,
|
||||||
base: Base,
|
base: Base,
|
||||||
|
|
||||||
tracked_refs: Vec<Ref>,
|
tracked_refs: Vec<Ref>,
|
||||||
|
|
@ -68,7 +68,7 @@ pub async fn get_index(
|
||||||
Ok(IndexTemplate {
|
Ok(IndexTemplate {
|
||||||
link_admin_refs_track: base.link(PathAdminRefsTrack {}),
|
link_admin_refs_track: base.link(PathAdminRefsTrack {}),
|
||||||
link_admin_refs_untrack: base.link(PathAdminRefsUntrack {}),
|
link_admin_refs_untrack: base.link(PathAdminRefsUntrack {}),
|
||||||
link_admin_repo_update: base.link(PathAdminRepoUpdate {}),
|
link_admin_refs_update: base.link(PathAdminRefsUpdate {}),
|
||||||
base: Base::new(config, Tab::Index),
|
base: Base::new(config, Tab::Index),
|
||||||
|
|
||||||
tracked_refs,
|
tracked_refs,
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,8 @@ pub struct PathAdminRefsTrack {}
|
||||||
pub struct PathAdminRefsUntrack {}
|
pub struct PathAdminRefsUntrack {}
|
||||||
|
|
||||||
#[derive(Deserialize, TypedPath)]
|
#[derive(Deserialize, TypedPath)]
|
||||||
#[typed_path("/admin/repo/update")]
|
#[typed_path("/admin/refs/update")]
|
||||||
pub struct PathAdminRepoUpdate {}
|
pub struct PathAdminRefsUpdate {}
|
||||||
|
|
||||||
#[derive(Deserialize, TypedPath)]
|
#[derive(Deserialize, TypedPath)]
|
||||||
#[typed_path("/admin/queue/add")]
|
#[typed_path("/admin/queue/add")]
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@
|
||||||
</form>
|
</form>
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<form method="post" action="{{ link_admin_repo_update }}">
|
<form method="post" action="{{ link_admin_refs_update }}">
|
||||||
<button>Update</button>
|
<button>Update</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue