Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/facett

facett-lineage/examples/lineage_panel.rs

//! **lineage_panel** — the [`facett_lineage`] data-lineage DAG mounted on the
//! reusable [`facett_wasm_demo`] host: the [`LineageView::demo`] fixture (a Spark
//! ingest fanning through skade `main.raw → clean/metrics → gold`, with an atomic
//! release) rendered over the [`facett_graphnav`] GRAPH NAVIGATOR — pan/zoom,
//! labelled dataset nodes, directed run edges — as a **native window** and a **wasm
//! / WebGL canvas** from the same source, ready for a Codeberg-Pages site (the
//! harness recipe in `facett-demo/README.md`).
//!
//! - native: `cargo run -p facett-lineage --example lineage_panel`
//! - wasm:   `cargo build -p facett-lineage --example lineage_panel --target wasm32-unknown-unknown`
//!   then `wasm-bindgen … --target web` it and serve with the generated
//!   `index.html` ([`facett_wasm_demo::IndexHtml`]).

use facett_lineage::LineageView;
use facett_wasm_demo::FacetApp;

/// The panel's fixture: the built-in demo lineage graph (datasets → runs).
fn panel() -> LineageView {
    LineageView::demo()
}

// ── native host ──────────────────────────────────────────────────────────────
#[cfg(not(target_arch = "wasm32"))]
fn main() -> eframe::Result<()> {
    facett_wasm_demo::NativeDemo::new("facett-lineage — data-lineage DAG demo")
        .run(move |_cc| FacetApp::boxed(Box::new(panel())))
}

// On wasm the entry point is `start` (below); `main` still has to exist to link.
#[cfg(target_arch = "wasm32")]
fn main() {}

// ── web host ─────────────────────────────────────────────────────────────────
#[cfg(target_arch = "wasm32")]
#[wasm_bindgen::prelude::wasm_bindgen(start)]
pub fn start() {
    facett_wasm_demo::WebDemo::new("demo_canvas").mount(move |_cc, _hash| FacetApp::boxed(Box::new(panel())));
}

/// The browser-readable state hook: `window.__lineage_state()` returns the view's
/// live `state_json` (the lineage summary + graphnav canvas), so a headless drive
/// verifies the shipped bundle without a human.
#[cfg(target_arch = "wasm32")]
#[wasm_bindgen::prelude::wasm_bindgen(js_name = __lineage_state)]
pub fn lineage_state() -> String {
    facett_wasm_demo::latest_state()
}