remoting: Register remote modal action when flag is present (#11426)
Fixes #11391 Release Notes: - N/A
This commit is contained in:
parent
283d424485
commit
cf6c2daaa2
1 changed files with 13 additions and 4 deletions
|
@ -2,6 +2,7 @@ use std::time::Duration;
|
||||||
|
|
||||||
use dev_server_projects::{DevServer, DevServerId, DevServerProject, DevServerProjectId};
|
use dev_server_projects::{DevServer, DevServerId, DevServerProject, DevServerProjectId};
|
||||||
use editor::Editor;
|
use editor::Editor;
|
||||||
|
use feature_flags::FeatureFlagAppExt;
|
||||||
use feature_flags::FeatureFlagViewExt;
|
use feature_flags::FeatureFlagViewExt;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
percentage, Action, Animation, AnimationExt, AnyElement, AppContext, ClipboardItem,
|
percentage, Action, Animation, AnimationExt, AnyElement, AppContext, ClipboardItem,
|
||||||
|
@ -49,15 +50,23 @@ enum Mode {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DevServerProjects {
|
impl DevServerProjects {
|
||||||
pub fn register(_: &mut Workspace, cx: &mut ViewContext<Workspace>) {
|
pub fn register(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) {
|
||||||
cx.observe_flag::<feature_flags::Remoting, _>(|enabled, workspace, _| {
|
cx.observe_flag::<feature_flags::Remoting, _>(|enabled, workspace, _| {
|
||||||
if enabled {
|
if enabled {
|
||||||
workspace.register_action(|workspace, _: &OpenRemote, cx| {
|
Self::register_open_remote_action(workspace);
|
||||||
workspace.toggle_modal(cx, |cx| Self::new(cx))
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
|
|
||||||
|
if cx.has_flag::<feature_flags::Remoting>() {
|
||||||
|
Self::register_open_remote_action(workspace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn register_open_remote_action(workspace: &mut Workspace) {
|
||||||
|
workspace.register_action(|workspace, _: &OpenRemote, cx| {
|
||||||
|
workspace.toggle_modal(cx, |cx| Self::new(cx))
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn open(workspace: View<Workspace>, cx: &mut WindowContext) {
|
pub fn open(workspace: View<Workspace>, cx: &mut WindowContext) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue