mirror of
https://github.com/openai/codex.git
synced 2026-09-17 12:23:33 +00:00
update
This commit is contained in:
@@ -1604,15 +1604,16 @@ impl App {
|
||||
is_installed,
|
||||
is_enabled,
|
||||
} => {
|
||||
self.chat_widget.open_app_link_view(
|
||||
app_id,
|
||||
title,
|
||||
description,
|
||||
instructions,
|
||||
url,
|
||||
is_installed,
|
||||
is_enabled,
|
||||
);
|
||||
self.chat_widget
|
||||
.open_app_link_view(crate::bottom_pane::AppLinkViewParams {
|
||||
app_id,
|
||||
title,
|
||||
description,
|
||||
instructions,
|
||||
url,
|
||||
is_installed,
|
||||
is_enabled,
|
||||
});
|
||||
}
|
||||
AppEvent::OpenUrlInBrowser { url } => {
|
||||
self.open_url_in_browser(url);
|
||||
|
||||
@@ -32,6 +32,16 @@ enum AppLinkScreen {
|
||||
InstallConfirmation,
|
||||
}
|
||||
|
||||
pub(crate) struct AppLinkViewParams {
|
||||
pub(crate) app_id: String,
|
||||
pub(crate) title: String,
|
||||
pub(crate) description: Option<String>,
|
||||
pub(crate) instructions: String,
|
||||
pub(crate) url: String,
|
||||
pub(crate) is_installed: bool,
|
||||
pub(crate) is_enabled: bool,
|
||||
}
|
||||
|
||||
pub(crate) struct AppLinkView {
|
||||
app_id: String,
|
||||
title: String,
|
||||
@@ -47,16 +57,16 @@ pub(crate) struct AppLinkView {
|
||||
}
|
||||
|
||||
impl AppLinkView {
|
||||
pub(crate) fn new(
|
||||
app_id: String,
|
||||
title: String,
|
||||
description: Option<String>,
|
||||
instructions: String,
|
||||
url: String,
|
||||
is_installed: bool,
|
||||
is_enabled: bool,
|
||||
app_event_tx: AppEventSender,
|
||||
) -> Self {
|
||||
pub(crate) fn new(params: AppLinkViewParams, app_event_tx: AppEventSender) -> Self {
|
||||
let AppLinkViewParams {
|
||||
app_id,
|
||||
title,
|
||||
description,
|
||||
instructions,
|
||||
url,
|
||||
is_installed,
|
||||
is_enabled,
|
||||
} = params;
|
||||
Self {
|
||||
app_id,
|
||||
title,
|
||||
@@ -432,13 +442,15 @@ mod tests {
|
||||
let (tx_raw, _rx) = unbounded_channel::<AppEvent>();
|
||||
let tx = AppEventSender::new(tx_raw);
|
||||
let view = AppLinkView::new(
|
||||
"connector_1".to_string(),
|
||||
"Notion".to_string(),
|
||||
None,
|
||||
"Manage app".to_string(),
|
||||
"https://example.test/notion".to_string(),
|
||||
true,
|
||||
true,
|
||||
AppLinkViewParams {
|
||||
app_id: "connector_1".to_string(),
|
||||
title: "Notion".to_string(),
|
||||
description: None,
|
||||
instructions: "Manage app".to_string(),
|
||||
url: "https://example.test/notion".to_string(),
|
||||
is_installed: true,
|
||||
is_enabled: true,
|
||||
},
|
||||
tx,
|
||||
);
|
||||
|
||||
@@ -453,13 +465,15 @@ mod tests {
|
||||
let (tx_raw, mut rx) = unbounded_channel::<AppEvent>();
|
||||
let tx = AppEventSender::new(tx_raw);
|
||||
let mut view = AppLinkView::new(
|
||||
"connector_1".to_string(),
|
||||
"Notion".to_string(),
|
||||
None,
|
||||
"Manage app".to_string(),
|
||||
"https://example.test/notion".to_string(),
|
||||
true,
|
||||
true,
|
||||
AppLinkViewParams {
|
||||
app_id: "connector_1".to_string(),
|
||||
title: "Notion".to_string(),
|
||||
description: None,
|
||||
instructions: "Manage app".to_string(),
|
||||
url: "https://example.test/notion".to_string(),
|
||||
is_installed: true,
|
||||
is_enabled: true,
|
||||
},
|
||||
tx,
|
||||
);
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ mod multi_select_picker;
|
||||
mod request_user_input;
|
||||
mod status_line_setup;
|
||||
pub(crate) use app_link_view::AppLinkView;
|
||||
pub(crate) use app_link_view::AppLinkViewParams;
|
||||
pub(crate) use approval_overlay::ApprovalOverlay;
|
||||
pub(crate) use approval_overlay::ApprovalRequest;
|
||||
pub(crate) use request_user_input::RequestUserInputOverlay;
|
||||
|
||||
@@ -1147,26 +1147,8 @@ impl ChatWidget {
|
||||
self.request_redraw();
|
||||
}
|
||||
|
||||
pub(crate) fn open_app_link_view(
|
||||
&mut self,
|
||||
app_id: String,
|
||||
title: String,
|
||||
description: Option<String>,
|
||||
instructions: String,
|
||||
url: String,
|
||||
is_installed: bool,
|
||||
is_enabled: bool,
|
||||
) {
|
||||
let view = crate::bottom_pane::AppLinkView::new(
|
||||
app_id,
|
||||
title,
|
||||
description,
|
||||
instructions,
|
||||
url,
|
||||
is_installed,
|
||||
is_enabled,
|
||||
self.app_event_tx.clone(),
|
||||
);
|
||||
pub(crate) fn open_app_link_view(&mut self, params: crate::bottom_pane::AppLinkViewParams) {
|
||||
let view = crate::bottom_pane::AppLinkView::new(params, self.app_event_tx.clone());
|
||||
self.bottom_pane.show_view(Box::new(view));
|
||||
self.request_redraw();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user