diff options
Diffstat (limited to 'ui/src/old/admin/import.rs')
| -rw-r--r-- | ui/src/old/admin/import.rs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/ui/src/old/admin/import.rs b/ui/src/old/admin/import.rs new file mode 100644 index 0000000..805d787 --- /dev/null +++ b/ui/src/old/admin/import.rs @@ -0,0 +1,46 @@ +/* + This file is part of jellything (https://codeberg.org/metamuffin/jellything) + which is licensed under the GNU Affero General Public License (version 3); see /COPYING. + Copyright (C) 2026 metamuffin <metamuffin.org> +*/ + +use crate::{FlashM, Page, locale::tr, scaffold::{FlashDisplay, RenderInfo}}; +use jellycommon::routes::u_admin_import_post; + +impl Page for AdminImportPage<'_> { + fn title(&self) -> String { + "Import".to_string() + } + fn to_render(&self) -> markup::DynRender<'_> { + markup::new!(@self) + } +} + +markup::define!( + AdminImportPage<'a>(ri: &'a RenderInfo<'a>, busy: bool, last_import_err: &'a [String], flash: &'a FlashM) { + @FlashDisplay { flash } + @if *busy { + h1 { @tr(ri.lang, "admin.import.running") } + noscript { "Live import progress needs javascript." } + div[id="admin_import"] {} + } else { + h1 { @tr(ri.lang, "admin.import.title") } + @if !last_import_err.is_empty() { + section.message.error { + details { + summary { p.error { @tr(ri.lang, "admin.import_errors").replace("{n}", &last_import_err.len().to_string()) } } + ol { @for e in *last_import_err { + li.error { pre.error { @e } } + }} + } + } + } + form[method="POST", action=u_admin_import_post(true)] { + input[type="submit", value=tr(ri.lang, "admin.dashboard.import.inc").to_string()]; + } + form[method="POST", action=u_admin_import_post(false)] { + input[type="submit", value=tr(ri.lang, "admin.dashboard.import.full").to_string()]; + } + } + } +); |