Dashboard
Patchwork.Dashboard — TypeDashboard(title::String, tabs::Vector{Tab}; custom_css::String = "", sidebar_open::Bool = true)Main dashboard type containing all content to be rendered.
A dashboard generates a self-contained HTML file with Vue.js reactivity, Tailwind CSS styling, and a responsive tabbed interface. It automatically collects and includes all necessary dependencies from the plugins used.
Fields
- title::String: Dashboard title displayed in the header and browser tab
- tabs::Vector{Tab}: Vector of tabs to display in the sidebar
- custom_css::String: Optional custom CSS styles to apply globally
- sidebar_open::Bool: Whether the sidebar should be initially expanded (default: true)
Example
dashboard = Patchwork.Dashboard(
    "Analytics Dashboard",
    [
        Patchwork.Tab("Overview", [...]),
        Patchwork.Tab("Details", [...]),
    ],
    custom_css = """
    .custom-header {
        background: linear-gradient(to right, #667eea, #764ba2);
    }
    """,
    sidebar_open = false  # Start with collapsed sidebar
)See also: Tab, save, generate_html
Patchwork.generate_html — Methodgenerate_html(dashboard::Dashboard) -> StringGenerate complete HTML string for dashboard.
This function generates a self-contained HTML document from the dashboard. It collects all unique plugin types, gathers their dependencies, and creates a Vue.js-powered single-page application with reactive tab switching and search functionality.
The generation process:
- Collects unique plugin types from all tabs
- Gathers CSS dependencies (CDN URLs) from plugin types
- Gathers JavaScript dependencies (CDN URLs) from plugin types
- Gathers initialization scripts from plugin types
- Gathers custom CSS from plugin types
- Generates unique IDs for each plugin instance
- Converts plugins to HTML using to_html
- Embeds all data as JSON in Vue.js application
- Creates responsive UI with sidebar, search, and mobile support
Arguments
- dashboard::Dashboard: Dashboard to generate HTML for
Returns
- String: Complete HTML document as a string
Example
dashboard = Patchwork.Dashboard("Title", tabs)
html = generate_html(dashboard)
write("output.html", html)Patchwork.save — Methodsave(dashboard::Dashboard, path::String) -> StringGenerate complete HTML and save to file.
This function generates a self-contained HTML file from the dashboard and writes it to the specified path. The generated file includes all necessary CSS and JavaScript dependencies, plugin content, and initialization code.
Arguments
- dashboard::Dashboard: Dashboard to save
- path::String: Output file path (absolute or relative)
Returns
- String: Path to the saved file
Example
dashboard = Patchwork.Dashboard("Title", tabs)
save(dashboard, "output.html")
save(dashboard, "/path/to/dashboard.html")See also: Dashboard, generate_html