repl: Create action to refresh kernelspecs (#14786)
Adds a command to refresh kernelspecs. Also added the kernelspecs to the runtime panel when none are running. That's just for now until we move out of the panel completely. Release Notes: - N/A
This commit is contained in:
@@ -23,7 +23,10 @@ use workspace::{
|
|||||||
Workspace,
|
Workspace,
|
||||||
};
|
};
|
||||||
|
|
||||||
actions!(repl, [Run, ClearOutputs, Interrupt, Shutdown]);
|
actions!(
|
||||||
|
repl,
|
||||||
|
[Run, ClearOutputs, Interrupt, Shutdown, RefreshKernelspecs]
|
||||||
|
);
|
||||||
actions!(repl_panel, [ToggleFocus]);
|
actions!(repl_panel, [ToggleFocus]);
|
||||||
|
|
||||||
pub fn init(cx: &mut AppContext) {
|
pub fn init(cx: &mut AppContext) {
|
||||||
@@ -32,6 +35,14 @@ pub fn init(cx: &mut AppContext) {
|
|||||||
workspace.register_action(|workspace, _: &ToggleFocus, cx| {
|
workspace.register_action(|workspace, _: &ToggleFocus, cx| {
|
||||||
workspace.toggle_panel_focus::<RuntimePanel>(cx);
|
workspace.toggle_panel_focus::<RuntimePanel>(cx);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
workspace.register_action(|workspace, _: &RefreshKernelspecs, cx| {
|
||||||
|
if let Some(panel) = workspace.panel::<RuntimePanel>(cx) {
|
||||||
|
panel.update(cx, |panel, cx| {
|
||||||
|
panel.refresh_kernelspecs(cx).detach();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.detach();
|
.detach();
|
||||||
@@ -543,6 +554,13 @@ impl Render for RuntimePanel {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
.child(Label::new("Kernels available").size(LabelSize::Large))
|
||||||
|
.children(
|
||||||
|
self.kernel_specifications.iter().map(|spec| {
|
||||||
|
h_flex().gap_2().child(Label::new(spec.name.clone()))
|
||||||
|
.child(Label::new(spec.kernelspec.language.clone()).color(Color::Muted))
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
.into_any_element();
|
.into_any_element();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user