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_delete, post_admin_queue_increase,
|
||||
},
|
||||
refs::{post_admin_refs_track, post_admin_refs_untrack},
|
||||
repo::post_admin_repo_update,
|
||||
refs::{post_admin_refs_track, post_admin_refs_untrack, post_admin_repo_update},
|
||||
},
|
||||
api::worker::{
|
||||
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 refs;
|
||||
pub mod repo;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use axum::{
|
||||
extract::State,
|
||||
response::{IntoResponse, Redirect},
|
||||
|
|
@ -6,12 +8,13 @@ use axum::{
|
|||
use log::info;
|
||||
use serde::Deserialize;
|
||||
use sqlx::SqlitePool;
|
||||
use tokio::sync::mpsc;
|
||||
|
||||
use crate::{
|
||||
config::ServerConfig,
|
||||
server::web::{
|
||||
base::Base,
|
||||
paths::{PathAdminRefsTrack, PathAdminRefsUntrack, PathIndex},
|
||||
paths::{PathAdminRefsTrack, PathAdminRefsUntrack, PathAdminRefsUpdate, PathIndex},
|
||||
},
|
||||
somehow,
|
||||
};
|
||||
|
|
@ -56,3 +59,15 @@ pub async fn post_admin_refs_untrack(
|
|||
let link = Base::link_with_config(config, PathIndex {});
|
||||
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::{
|
||||
base::{Base, Link, Tab},
|
||||
link::LinkCommit,
|
||||
paths::{PathAdminRefsTrack, PathAdminRefsUntrack, PathAdminRepoUpdate, PathIndex},
|
||||
paths::{PathAdminRefsTrack, PathAdminRefsUntrack, PathAdminRefsUpdate, PathIndex},
|
||||
},
|
||||
somehow,
|
||||
};
|
||||
|
|
@ -24,7 +24,7 @@ struct Ref {
|
|||
struct IndexTemplate {
|
||||
link_admin_refs_track: Link,
|
||||
link_admin_refs_untrack: Link,
|
||||
link_admin_repo_update: Link,
|
||||
link_admin_refs_update: Link,
|
||||
base: Base,
|
||||
|
||||
tracked_refs: Vec<Ref>,
|
||||
|
|
@ -68,7 +68,7 @@ pub async fn get_index(
|
|||
Ok(IndexTemplate {
|
||||
link_admin_refs_track: base.link(PathAdminRefsTrack {}),
|
||||
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),
|
||||
|
||||
tracked_refs,
|
||||
|
|
|
|||
|
|
@ -62,8 +62,8 @@ pub struct PathAdminRefsTrack {}
|
|||
pub struct PathAdminRefsUntrack {}
|
||||
|
||||
#[derive(Deserialize, TypedPath)]
|
||||
#[typed_path("/admin/repo/update")]
|
||||
pub struct PathAdminRepoUpdate {}
|
||||
#[typed_path("/admin/refs/update")]
|
||||
pub struct PathAdminRefsUpdate {}
|
||||
|
||||
#[derive(Deserialize, TypedPath)]
|
||||
#[typed_path("/admin/queue/add")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue