repl: Iterate on design of REPL sessions view (#14987)
This PR iterates on the design of the REPL sessions view. We now use the same component for both available kernels and running ones to provide some consistency between the two modes: <img width="1208" alt="Screenshot 2024-07-22 at 6 49 08 PM" src="https://github.com/user-attachments/assets/8b5c3600-e438-49fa-8484-cefabf4b44f1"> <img width="1208" alt="Screenshot 2024-07-22 at 6 49 14 PM" src="https://github.com/user-attachments/assets/5125e9b3-6465-4d1e-9036-e6ca270dedcb"> Release Notes: - N/A
This commit is contained in:
parent
01392c1329
commit
fe1f55cbfd
6 changed files with 192 additions and 121 deletions
|
@ -18,7 +18,6 @@ use std::{
|
|||
path::PathBuf,
|
||||
sync::Arc,
|
||||
};
|
||||
use ui::{Color, Indicator};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct KernelSpecification {
|
||||
|
@ -72,15 +71,6 @@ async fn peek_ports(ip: IpAddr) -> Result<[u16; 5]> {
|
|||
Ok(ports)
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Kernel {
|
||||
RunningKernel(RunningKernel),
|
||||
StartingKernel(Shared<Task<()>>),
|
||||
ErroredLaunch(String),
|
||||
ShuttingDown,
|
||||
Shutdown,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum KernelStatus {
|
||||
Idle,
|
||||
|
@ -90,6 +80,7 @@ pub enum KernelStatus {
|
|||
ShuttingDown,
|
||||
Shutdown,
|
||||
}
|
||||
|
||||
impl KernelStatus {
|
||||
pub fn is_connected(&self) -> bool {
|
||||
match self {
|
||||
|
@ -127,20 +118,16 @@ impl From<&Kernel> for KernelStatus {
|
|||
}
|
||||
}
|
||||
|
||||
impl Kernel {
|
||||
pub fn dot(&self) -> Indicator {
|
||||
match self {
|
||||
Kernel::RunningKernel(kernel) => match kernel.execution_state {
|
||||
ExecutionState::Idle => Indicator::dot().color(Color::Success),
|
||||
ExecutionState::Busy => Indicator::dot().color(Color::Modified),
|
||||
},
|
||||
Kernel::StartingKernel(_) => Indicator::dot().color(Color::Modified),
|
||||
Kernel::ErroredLaunch(_) => Indicator::dot().color(Color::Error),
|
||||
Kernel::ShuttingDown => Indicator::dot().color(Color::Modified),
|
||||
Kernel::Shutdown => Indicator::dot().color(Color::Disabled),
|
||||
}
|
||||
}
|
||||
#[derive(Debug)]
|
||||
pub enum Kernel {
|
||||
RunningKernel(RunningKernel),
|
||||
StartingKernel(Shared<Task<()>>),
|
||||
ErroredLaunch(String),
|
||||
ShuttingDown,
|
||||
Shutdown,
|
||||
}
|
||||
|
||||
impl Kernel {
|
||||
pub fn status(&self) -> KernelStatus {
|
||||
self.into()
|
||||
}
|
||||
|
@ -162,6 +149,16 @@ impl Kernel {
|
|||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_shutting_down(&self) -> bool {
|
||||
match self {
|
||||
Kernel::ShuttingDown => true,
|
||||
Kernel::RunningKernel(_)
|
||||
| Kernel::StartingKernel(_)
|
||||
| Kernel::ErroredLaunch(_)
|
||||
| Kernel::Shutdown => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct RunningKernel {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue