Skip to content
Merged
Changes from all commits
Commits
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
33 changes: 23 additions & 10 deletions opendut-lea/src/clusters/overview/row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use leptos::html::Div;
use leptos::prelude::*;
use opendut_lea_components::{health, ButtonColor, Toggle};
use opendut_lea_components::health::Health;
use opendut_lea_components::tooltip::{Tooltip};
use opendut_model::cluster::ClusterDescriptor;
use crate::clusters::components::DeleteClusterButton;
use crate::clusters::IsDeployed;
Expand All @@ -15,8 +16,8 @@ pub fn Row<OnDeployFn, OnUndeployFn, OnDeleteFn>(
on_delete: OnDeleteFn,
) -> impl IntoView
where
OnDeployFn: Fn() + 'static,
OnUndeployFn: Fn() + 'static,
OnDeployFn: Fn() + Send + 'static,
OnUndeployFn: Fn() + Send + 'static,
OnDeleteFn: Fn() + Copy + Send + 'static,
{

Expand Down Expand Up @@ -46,17 +47,29 @@ where
}
});

let tooltip_text = Signal::derive(move || {
if is_deployed.get().0 {
"Deployment requested".to_string()
} else {
"Undeployed".to_string()
}
});

view! {
<tr>
<td class="is-vcentered has-text-centered">
<Toggle
is_active = Signal::derive(move || {
is_deployed.get().0
})
on_action = move || {
if is_deployed.get().0 { on_undeploy() } else { on_deploy() }
}
/>
<Tooltip
text=tooltip_text
>
<Toggle
is_active = Signal::derive(move || {
is_deployed.get().0
})
on_action = move || {
if is_deployed.get().0 { on_undeploy() } else { on_deploy() }
}
/>
</Tooltip>
</td>
<td class="is-vcentered has-text-centered">
<Health state=health_state />
Expand Down
Loading