Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
847ad5f
LEA (Test-`Row`): Added functionality to click on a row with the abil…
Dr-Eckig Feb 3, 2026
03ab5c2
LEA (`OverviewTable`): Created a new reusable component for overview …
Dr-Eckig Feb 4, 2026
8baaab7
LEA (Test-Overview-`Row`): Refactored blocking navigation when select…
Dr-Eckig Feb 10, 2026
9eeee24
LEA (Test-Overview-`Row`): Moved the signal for blocking row clicks w…
Dr-Eckig Feb 11, 2026
40afad1
LEA-components (`OverviewTable`): Extended the generic component for …
Dr-Eckig Feb 11, 2026
b0173ad
LEA (`app.rs`): Moved the event listener for detecting text selection…
Dr-Eckig Feb 11, 2026
052ccdd
LEA (`LeaOverviewTableRow`): Added a new component `LeaOverviewTableR…
Dr-Eckig Feb 11, 2026
c325c3a
LEA (`SourcesOverview`): Used the new `OverviewTable` component in th…
Dr-Eckig Feb 11, 2026
ec056bf
LEA (`SourcesOverview`): Fixed warnings "using signals outside a reac…
Dr-Eckig Feb 11, 2026
873d12b
LEA (`OverviewTable`): Fixed reactivity of the `OverviewTable` compon…
Dr-Eckig Feb 11, 2026
e972494
LEA (`OverviewTable`): Disabled `navigate_to` when clicking on a butt…
Dr-Eckig Feb 11, 2026
0f8415b
LEA (`OverviewTable`): Added a new component `OverviewTableCell` whic…
Dr-Eckig Feb 11, 2026
9862969
LEA (`TestsOverview`): Refactored the `TestsOverview` page by using t…
Dr-Eckig Feb 11, 2026
27767ee
LEA (`TestsOverview`): Refactored the `PeersOverview` page by using t…
Dr-Eckig Feb 11, 2026
d81de9b
LEA (`TestsOverview`): Refactored the `ClustersOverview` page by usin…
Dr-Eckig Feb 11, 2026
4fdca37
LEA: Removed unused `dropdown_active` signals of all Overview-`Row` c…
Dr-Eckig Feb 19, 2026
40b4d4e
LEA: Changed displaying the `source_name` in the `TestsOverview` by `…
Dr-Eckig Feb 19, 2026
d45ca71
LEA: Changed syntax of dynamic HTML class names to be consistent thro…
Dr-Eckig Feb 19, 2026
4ffa856
LEA: Renamed directory `tests` -> `viper_tests`.
Dr-Eckig Feb 19, 2026
b6d7b1e
LEA: Renamed `test` -> `viper_test`, `source` -> `viper_source` and `…
Dr-Eckig Feb 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ uuid = "1.13.1"
walkdir = "2.5.0"
wasm-bindgen-futures = "0.4.50"
wasm-bindgen-test = "0.3.50"
web-sys = "0.3.85"

# v36.x is an LTS release: https://docs.wasmtime.dev/stability-release.html
# Will stick to v36.x for now, because v39+ contains `im-rc` as dependency which is under MPL-2.0.
Expand Down
1 change: 1 addition & 0 deletions opendut-lea/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ tracing-web = { workspace = true }
url = { workspace = true }
uuid = { workspace = true, features = ["js"] }
wasm-bindgen-futures = { workspace = true }
web-sys = { workspace = true }

[build-dependencies]
shadow-rs = { workspace = true, default-features = true }
Expand Down
1 change: 1 addition & 0 deletions opendut-lea/opendut-lea-components/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ leptos = { workspace = true, features = ["csr"] }
leptos-use = { workspace = true }
slotmap = { workspace = true }
tracing = { workspace = true }
web-sys = { workspace = true, features = ["Selection"] }

[lints]
workspace = true
1 change: 0 additions & 1 deletion opendut-lea/opendut-lea-components/src/inputs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ pub mod user_input;
pub mod user_textarea;
pub mod vector_user_input;
pub mod user_select;
pub mod selection_table;

pub type UserInputError = String;
pub type UserInputValue = Ior<UserInputError, String>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub fn UserSelect(
<div class="field">
<label class="label">{ label }</label>
<div class="control">
<div class="select" class:is-danger=has_error>
<div class="select" class=("is-danger", has_error)>
<select
aria-label=move || label.get()
prop:value=selected_value
Expand Down
5 changes: 4 additions & 1 deletion opendut-lea/opendut-lea-components/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ pub use buttons::icon_button::IconButton;
pub use buttons::collapse_button::CollapseButton;
pub use inputs::{UserInputError, UserInputValue};
pub use inputs::readonly_input::ReadOnlyInput;
pub use inputs::selection_table::{SelectionTable, SelectionTableRow};
pub use inputs::user_input::UserInput;
pub use inputs::user_select::{UserSelect, SelectionOption};
pub use inputs::user_textarea::UserTextarea;
Expand All @@ -30,9 +29,12 @@ pub use warning_message::WarningMessage;
pub use util::ior::Ior;
pub use util::net::UserNetworkInterfaceConfiguration;
pub use util::signal::{ButtonStateSignalProvider, ToggleSignal, Toggled};
pub use util::table_row_selection::has_text_selection;
pub use doorhanger::{Doorhanger, DoorhangerAlignment};
pub use icon_text::IconText;
pub use toggle::Toggle;
pub use tables::selection_table::{SelectionTable, SelectionTableRow};
pub use tables::overview_table::{TableHeading, OverviewTable, OverviewTableRow, OverviewTableCell};

pub mod health;
pub mod tooltip;
Expand All @@ -49,6 +51,7 @@ mod warning_message;
mod util;
mod icon_text;
mod toggle;
mod tables;

pub const NON_BREAKING_SPACE: &str = "\u{a0}";

Expand Down
2 changes: 2 additions & 0 deletions opendut-lea/opendut-lea-components/src/tables/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod selection_table;
pub mod overview_table;
89 changes: 89 additions & 0 deletions opendut-lea/opendut-lea-components/src/tables/overview_table.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
use leptos::prelude::*;
use web_sys::MouseEvent;
use crate::LoadingSpinner;

#[derive(Clone)]
pub struct TableHeading {
pub title: String,
pub is_narrow: bool,
}

impl TableHeading {
pub fn new(title: String) -> Self {
Self {
title,
is_narrow: false,
}
}
pub fn set_narrow(self) -> Self {
Self {
title: self.title,
is_narrow: true,
}
}
}

#[component]
pub fn OverviewTable(
headings: Vec<TableHeading>,
children: Children,
) -> impl IntoView {

view! {
<table class="table is-hoverable is-fullwidth">
<thead>
<tr>
<For
each=move || Clone::clone(&headings)
key=|heading| Clone::clone(&heading.title)
children=move |heading| {
let title = heading.title;
let is_narrow = heading.is_narrow;

view! {
<th class=(["is-narrow", "has-text-centered"], is_narrow)>
{ title }
</th>
}
}
/>
</tr>
</thead>
<tbody>
<Suspense fallback=LoadingSpinner>
{ children() }
</Suspense>
</tbody>
</table>
}
}

#[component]
pub fn OverviewTableRow<F>(
block_row_click: RwSignal<bool>,
navigation_on_click: F,
children: Children
) -> impl IntoView
where F: Fn(MouseEvent) + 'static {

let on_row_click = move |event: MouseEvent| {
if block_row_click.get_untracked() {
block_row_click.set(false);
return;
}
navigation_on_click(event);
};

view! {
<tr class="is-clickable" on:click=on_row_click>
{ children() }
</tr>
}
}

#[component]
pub fn OverviewTableCell(children: Children) -> impl IntoView {
view! {
<td class="is-vcentered"> { children() } </td>
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ where

view! {
<tr
class:has-background-link-light=move || is_selected.get()
class=("has-background-link-light", move || is_selected.get())
style=move || if is_disabled.get() {"cursor: not-allowed; opacity: 0.8;"} else {"cursor: pointer;"}
on:click=move |_| {
if is_disabled.get() { return }
Expand Down
2 changes: 1 addition & 1 deletion opendut-lea/opendut-lea-components/src/tabs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub fn Tabs(
<li class=("is-active", is_active) class=move || ("is-hidden", is_hidden().unwrap_or_default())>
<a href=tab.href>
<div class="icon-text">
<span class="icon has-text-danger" class:is-hidden=move || !is_error().unwrap_or_default()>
<span class="icon has-text-danger" class=("is-hidden", move || !is_error().unwrap_or_default())>
<i class=FontAwesomeIcon::CircleExclamation.as_class()></i>
</span>
<span>{ tab.title }</span>
Expand Down
7 changes: 5 additions & 2 deletions opendut-lea/opendut-lea-components/src/toggle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ pub fn Toggle<F>(
where F: Fn() + 'static {

view! {
<div class="is-flex is-align-items-center is-justify-content-center">
<div
class="is-flex is-align-items-center is-justify-content-center"
on:click=move |event| event.stop_propagation()
>
<label class="dut-toggle"
class:active = move || is_active.get()
class=("active", move || is_active.get())
on:click=move |_| on_action()
/>
{
Expand Down
2 changes: 1 addition & 1 deletion opendut-lea/opendut-lea-components/src/tooltip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub fn Tooltip(
<div class="tooltip-trigger">
{ children() }
</div>
<div class="tooltip-container" class:is-hidden=move || is_hidden.get()>
<div class="tooltip-container" class=("is-hidden", move || is_hidden.get())>
<div class="tooltip-content p-0">
<div class="tooltip-item p-3">
{ text }
Expand Down
1 change: 1 addition & 0 deletions opendut-lea/opendut-lea-components/src/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ pub use tick::Tick;

pub mod signal;
pub mod ior;
pub mod table_row_selection;
10 changes: 10 additions & 0 deletions opendut-lea/opendut-lea-components/src/util/table_row_selection.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use leptos::web_sys;

pub fn has_text_selection() -> bool {
let window = web_sys::window().unwrap();
if let Ok(Some(selection)) = window.get_selection() {
!selection.is_collapsed()
} else {
false
}
}
21 changes: 21 additions & 0 deletions opendut-lea/src/app.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
use std::sync::Arc;
use gloo_net::http;
use leptos::ev;
use leptos::prelude::*;
use leptos_oidc::{Auth, AuthParameters, AuthSignal};
use leptos_use::{use_document, use_event_listener};
use serde::{Deserialize, Deserializer};
use tracing::info;
use url::Url;
use opendut_auth::public::Authentication;
use opendut_carl_api::carl::wasm::CarlClient;
use opendut_lea_components::has_text_selection;
use opendut_model::lea::LeaConfig;
use crate::components::Toaster;
use crate::components::AppGlobalsResource;
Expand Down Expand Up @@ -70,6 +73,12 @@ pub struct AppGlobalsError {
pub message: String
}

#[derive(Clone)]
pub struct SelectionContext {
pub has_selection: RwSignal<bool>,
}


#[component]
pub fn LoadingApp() -> impl IntoView {
let _ = provide_authentication_signals_in_context();
Expand Down Expand Up @@ -122,6 +131,18 @@ pub fn LoadingApp() -> impl IntoView {
let user = use_context::<UserAuthenticationSignal>().expect("UserAuthenticationSignal should be provided in the context.");
let hide_buttons = Signal::derive(move || !user.read().is_authenticated().unwrap_or(false));

let has_selection = RwSignal::new(false);
provide_context(SelectionContext { has_selection });

let context = use_context::<SelectionContext>()
.expect("SelectionContext should be provided in the context.");
let _ = use_event_listener(use_document(), ev::selectionchange, move |_| {
let new_value = has_text_selection();
if context.has_selection.get_untracked() != new_value {
context.has_selection.set(new_value);
}
});

view! {
<Navbar menu_visible hide_buttons />
<div class="columns is-mobile m-0">
Expand Down
33 changes: 13 additions & 20 deletions opendut-lea/src/clusters/overview/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ use leptos::prelude::*;
use tracing::{debug, error};
use opendut_carl_api::carl::ClientError;
use opendut_carl_api::carl::cluster::StoreClusterDeploymentError;
use opendut_lea_components::{ButtonColor, ButtonSize, ButtonState, FontAwesomeIcon, IconButton};
use opendut_lea_components::{ButtonColor, ButtonSize, ButtonState, FontAwesomeIcon, IconButton, OverviewTable, TableHeading};
use opendut_model::cluster::{ClusterDeployment, ClusterDescriptor, ClusterId};

use crate::app::use_app_globals;
use crate::clusters::components::CreateClusterButton;
use crate::clusters::IsDeployed;
use crate::clusters::overview::row::Row;
use crate::components::{use_toaster, BasePageContainer, Breadcrumb, LoadingSpinner, Toast};
use crate::components::{use_toaster, BasePageContainer, Breadcrumb, Toast};

#[component]
pub fn ClustersOverview() -> impl IntoView {
Expand Down Expand Up @@ -148,10 +148,17 @@ pub fn ClustersOverview() -> impl IntoView {
Breadcrumb::new("Clusters", "/clusters")
];

let table_headings = vec![
TableHeading::new(String::from("Deploy")).set_narrow(),
TableHeading::new(String::from("Health")).set_narrow(),
TableHeading::new(String::from("Name")),
TableHeading::new(String::from("Action")).set_narrow(),
];

view! {
<BasePageContainer
title="Clusters"
breadcrumbs=breadcrumbs
breadcrumbs
controls=view! {
<div class="buttons">
<CreateClusterButton />
Expand All @@ -168,20 +175,8 @@ pub fn ClustersOverview() -> impl IntoView {
</div>
}
>
<table class="table is-hoverable is-fullwidth">
<thead>
<tr>
<th class="is-narrow">"Deploy"</th>
<th class="is-narrow">"Health"</th>
<th>"Name"</th>
<th class="is-narrow has-text-centered">"Action"</th>
</tr>
</thead>
<tbody>
<Suspense
fallback=LoadingSpinner
>
{ move || {
<OverviewTable headings=table_headings>
{ move || {
let on_deploy = on_deploy.clone();
let on_undeploy = on_undeploy.clone();

Expand Down Expand Up @@ -212,9 +207,7 @@ pub fn ClustersOverview() -> impl IntoView {
}
})
}}
</Suspense>
</tbody>
</table>
</OverviewTable>
</BasePageContainer>
}
}
Loading