agent: Improve MCP status indicator tooltip and loading state (#32414)
Mostly a small tweak making sure that the indicator tooltip hit area is bigger and the loading state is clearer (not using an indicator anymore). Way more little improvement opportunities in this component to do, though. Release Notes: - N/A
This commit is contained in:
parent
f0ce62ead8
commit
ab70e524c8
1 changed files with 15 additions and 15 deletions
|
@ -12,7 +12,7 @@ use context_server::ContextServerId;
|
||||||
use fs::Fs;
|
use fs::Fs;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
Action, Animation, AnimationExt as _, AnyView, App, Entity, EventEmitter, FocusHandle,
|
Action, Animation, AnimationExt as _, AnyView, App, Entity, EventEmitter, FocusHandle,
|
||||||
Focusable, ScrollHandle, Subscription, pulsating_between,
|
Focusable, ScrollHandle, Subscription, Transformation, percentage,
|
||||||
};
|
};
|
||||||
use language_model::{LanguageModelProvider, LanguageModelProviderId, LanguageModelRegistry};
|
use language_model::{LanguageModelProvider, LanguageModelProviderId, LanguageModelRegistry};
|
||||||
use project::context_server_store::{ContextServerStatus, ContextServerStore};
|
use project::context_server_store::{ContextServerStatus, ContextServerStore};
|
||||||
|
@ -475,7 +475,6 @@ impl AgentConfiguration {
|
||||||
.get(&context_server_id)
|
.get(&context_server_id)
|
||||||
.copied()
|
.copied()
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
let tools = tools_by_source
|
let tools = tools_by_source
|
||||||
.get(&ToolSource::ContextServer {
|
.get(&ToolSource::ContextServer {
|
||||||
id: context_server_id.0.clone().into(),
|
id: context_server_id.0.clone().into(),
|
||||||
|
@ -484,25 +483,23 @@ impl AgentConfiguration {
|
||||||
let tool_count = tools.len();
|
let tool_count = tools.len();
|
||||||
|
|
||||||
let border_color = cx.theme().colors().border.opacity(0.6);
|
let border_color = cx.theme().colors().border.opacity(0.6);
|
||||||
let success_color = Color::Success.color(cx);
|
|
||||||
|
|
||||||
let (status_indicator, tooltip_text) = match server_status {
|
let (status_indicator, tooltip_text) = match server_status {
|
||||||
ContextServerStatus::Starting => (
|
ContextServerStatus::Starting => (
|
||||||
Indicator::dot()
|
Icon::new(IconName::LoadCircle)
|
||||||
.color(Color::Success)
|
.size(IconSize::XSmall)
|
||||||
|
.color(Color::Accent)
|
||||||
.with_animation(
|
.with_animation(
|
||||||
SharedString::from(format!("{}-starting", context_server_id.0.clone(),)),
|
SharedString::from(format!("{}-starting", context_server_id.0.clone(),)),
|
||||||
Animation::new(Duration::from_secs(2))
|
Animation::new(Duration::from_secs(3)).repeat(),
|
||||||
.repeat()
|
|icon, delta| icon.transform(Transformation::rotate(percentage(delta))),
|
||||||
.with_easing(pulsating_between(0.4, 1.)),
|
|
||||||
move |this, delta| this.color(success_color.alpha(delta).into()),
|
|
||||||
)
|
)
|
||||||
.into_any_element(),
|
.into_any_element(),
|
||||||
"Server is starting.",
|
"Server is starting.",
|
||||||
),
|
),
|
||||||
ContextServerStatus::Running => (
|
ContextServerStatus::Running => (
|
||||||
Indicator::dot().color(Color::Success).into_any_element(),
|
Indicator::dot().color(Color::Success).into_any_element(),
|
||||||
"Server is running.",
|
"Server is active.",
|
||||||
),
|
),
|
||||||
ContextServerStatus::Error(_) => (
|
ContextServerStatus::Error(_) => (
|
||||||
Indicator::dot().color(Color::Error).into_any_element(),
|
Indicator::dot().color(Color::Error).into_any_element(),
|
||||||
|
@ -526,12 +523,11 @@ impl AgentConfiguration {
|
||||||
.p_1()
|
.p_1()
|
||||||
.justify_between()
|
.justify_between()
|
||||||
.when(
|
.when(
|
||||||
error.is_some() || are_tools_expanded && tool_count > 1,
|
error.is_some() || are_tools_expanded && tool_count >= 1,
|
||||||
|element| element.border_b_1().border_color(border_color),
|
|element| element.border_b_1().border_color(border_color),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
h_flex()
|
h_flex()
|
||||||
.gap_1p5()
|
|
||||||
.child(
|
.child(
|
||||||
Disclosure::new(
|
Disclosure::new(
|
||||||
"tool-list-disclosure",
|
"tool-list-disclosure",
|
||||||
|
@ -551,12 +547,16 @@ impl AgentConfiguration {
|
||||||
})),
|
})),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
div()
|
h_flex()
|
||||||
.id(item_id.clone())
|
.id(SharedString::from(format!("tooltip-{}", item_id)))
|
||||||
|
.h_full()
|
||||||
|
.w_3()
|
||||||
|
.mx_1()
|
||||||
|
.justify_center()
|
||||||
.tooltip(Tooltip::text(tooltip_text))
|
.tooltip(Tooltip::text(tooltip_text))
|
||||||
.child(status_indicator),
|
.child(status_indicator),
|
||||||
)
|
)
|
||||||
.child(Label::new(context_server_id.0.clone()).ml_0p5())
|
.child(Label::new(item_id).ml_0p5().mr_1p5())
|
||||||
.when(is_running, |this| {
|
.when(is_running, |this| {
|
||||||
this.child(
|
this.child(
|
||||||
Label::new(if tool_count == 1 {
|
Label::new(if tool_count == 1 {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue