diff --git a/migrations/20220215214154_favicon.sql b/migrations/20220215214154_favicon.sql new file mode 100644 index 0000000..239d77f --- /dev/null +++ b/migrations/20220215214154_favicon.sql @@ -0,0 +1,3 @@ + +ALTER TABLE application ADD COLUMN favicon Boolean DEFAULT false; +ALTER TABLE bookmark ADD COLUMN favicon Boolean DEFAULT false; diff --git a/src/api/applications.rs b/src/api/applications.rs index 2031171..0da08f9 100644 --- a/src/api/applications.rs +++ b/src/api/applications.rs @@ -15,6 +15,7 @@ struct ApiApplication { pub application_category_id: Option, pub enable_healthcheck: bool, pub healthcheck_status: Option, + pub favicon: bool, } impl From for ApiApplication { @@ -29,6 +30,7 @@ impl From for ApiApplication { application_category_id: model.application_category_id, enable_healthcheck: model.enable_healthcheck, healthcheck_status: None, + favicon: model.favicon, } } } @@ -65,6 +67,7 @@ pub async fn new_application( glyph: Set(data.0.glyph), application_category_id: Set(data.0.application_category_id), enable_healthcheck: Set(data.0.enable_healthcheck), + favicon: Set(data.0.favicon), }; let app = model.insert(&state.db).await?; Ok(HttpResponse::Ok().json(app)) @@ -106,6 +109,7 @@ pub async fn update_applications( application_category_id: Set(data.application_category_id), glyph: Set(data.glyph), enable_healthcheck: Set(data.enable_healthcheck), + favicon: Set(data.favicon), }; let model = ret.update(&state.db).await?; Ok(HttpResponse::Ok().json(model)) @@ -210,6 +214,7 @@ mod tests { active: true, application_category_id: None, enable_healthcheck: false, + ..Default::default() }; let state = setup_state().await?; diff --git a/src/api/authorization.rs b/src/api/authorization.rs index dfd659a..879d0f1 100644 --- a/src/api/authorization.rs +++ b/src/api/authorization.rs @@ -49,7 +49,7 @@ pub struct UpdatePasswordRequest { } #[instrument] -#[post("password")] +#[put("password")] pub async fn update_password( state: web::Data, req: web::Json, diff --git a/src/entity/application.rs b/src/entity/application.rs index 84ac8f8..870eb93 100644 --- a/src/entity/application.rs +++ b/src/entity/application.rs @@ -15,6 +15,7 @@ pub struct Model { pub glyph: Option, pub application_category_id: Option, pub enable_healthcheck: bool, + pub favicon: bool, } #[derive(Copy, Clone, Debug, EnumIter)] @@ -52,6 +53,7 @@ impl Default for Model { glyph: Default::default(), application_category_id: Default::default(), enable_healthcheck: false, + favicon: false, } } } diff --git a/src/main.rs b/src/main.rs index 1b0904a..e1085cb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -126,7 +126,7 @@ async fn main() { .await; } Ok(res) => { - if st + if *st .healthcheck_status .lock() .await diff --git a/src/ui/components/ApplicationModal.vue b/src/ui/components/ApplicationModal.vue index 0e062f3..105f2df 100644 --- a/src/ui/components/ApplicationModal.vue +++ b/src/ui/components/ApplicationModal.vue @@ -12,7 +12,8 @@ - + + @@ -84,6 +85,7 @@ export default { let resp = await axios.post("/api/applications", { active: true, enableHealthcheck: !!this.app.enableHealthcheck, + favicon: !!this.app.favicon, ...this.app, }); if (resp.status == 200) { diff --git a/src/ui/components/ApplicationTile.vue b/src/ui/components/ApplicationTile.vue index daf42a7..9e40740 100644 --- a/src/ui/components/ApplicationTile.vue +++ b/src/ui/components/ApplicationTile.vue @@ -1,7 +1,7 @@