wip: ingest
This commit is contained in:
+47
-1
@@ -27,14 +27,15 @@ mod export;
|
||||
mod gradient;
|
||||
mod histogram;
|
||||
mod import;
|
||||
mod import_ui;
|
||||
mod labels;
|
||||
mod library;
|
||||
mod library_ui;
|
||||
#[cfg(live_style)]
|
||||
mod live_style;
|
||||
mod masks_ui;
|
||||
mod net_runtime;
|
||||
mod presets;
|
||||
mod masks_ui;
|
||||
mod segmentation;
|
||||
mod settings_store;
|
||||
mod settings_ui;
|
||||
@@ -895,6 +896,51 @@ pub fn run(paths: Vec<PathBuf>) -> Result<()> {
|
||||
// the settings page edits, and a controller scoped to the wiring block
|
||||
// would be gone by the time that callback is built.
|
||||
let settings = settings_ui::SettingsController::new();
|
||||
|
||||
// TRACES: FR-CAT-10 | FR-CAT-11 | FR-NC-7a | FR-NC-7b
|
||||
// Import: a card into the library, and on to the server.
|
||||
//
|
||||
// Wired after the settings controller exists because it shares it — an
|
||||
// import's options are stored in the same file as everything else, and two
|
||||
// controllers each holding their own copy would each save over the other.
|
||||
//
|
||||
// The account is fetched afresh inside the closure rather than captured:
|
||||
// this runs once at startup, where a library can be opened, closed and
|
||||
// re-opened for the whole life of the window.
|
||||
{
|
||||
let import = import_ui::ImportController::new(settings.clone(), activity.clone());
|
||||
let library_for_context = library.clone();
|
||||
let weak = window.as_weak();
|
||||
import_ui::wire(
|
||||
&window,
|
||||
import,
|
||||
move || {
|
||||
let (creds, session) = library_for_context.session()?;
|
||||
Some(import_ui::Context {
|
||||
catalog: library::catalog_path(&session.server, &session.user_id),
|
||||
library_label: session.root.clone(),
|
||||
// The same formats the scan looks for. An import that took
|
||||
// types the library then ignores would copy files off the
|
||||
// card that never appear in the grid.
|
||||
filter: session.format_filter(),
|
||||
upload: Some(import::Upload {
|
||||
credentials: creds,
|
||||
user_id: session.user_id.clone(),
|
||||
library: session.root.clone(),
|
||||
}),
|
||||
})
|
||||
},
|
||||
move || {
|
||||
// The import wrote files into a folder on this machine and, if
|
||||
// the account allowed it, into the library on the server. Only
|
||||
// the second is what the grid shows, so this asks for the scan
|
||||
// that finds them rather than inserting rows itself.
|
||||
if let Some(w) = weak.upgrade() {
|
||||
w.invoke_library_rescan();
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
{
|
||||
// What the cache actually holds, so the ceiling above it is a figure
|
||||
// the user can judge rather than an abstract one.
|
||||
|
||||
Reference in New Issue
Block a user