Allow rerunning tasks with unknown termination status (#16374)
This commit is contained in:
parent
e36e605c96
commit
ae9e6a9daa
1 changed files with 20 additions and 15 deletions
|
@ -943,14 +943,8 @@ impl Item for TerminalView {
|
||||||
fn tab_content(&self, params: TabContentParams, cx: &WindowContext) -> AnyElement {
|
fn tab_content(&self, params: TabContentParams, cx: &WindowContext) -> AnyElement {
|
||||||
let terminal = self.terminal().read(cx);
|
let terminal = self.terminal().read(cx);
|
||||||
let title = terminal.title(true);
|
let title = terminal.title(true);
|
||||||
|
let rerun_button = |task_id: task::TaskId| {
|
||||||
let (icon, icon_color, rerun_button) = match terminal.task() {
|
IconButton::new("rerun-icon", IconName::Rerun)
|
||||||
Some(terminal_task) => match &terminal_task.status {
|
|
||||||
TaskStatus::Unknown => (IconName::ExclamationTriangle, Color::Warning, None),
|
|
||||||
TaskStatus::Running => (IconName::Play, Color::Disabled, None),
|
|
||||||
TaskStatus::Completed { success } => {
|
|
||||||
let task_id = terminal_task.id.clone();
|
|
||||||
let rerun_button = IconButton::new("rerun-icon", IconName::Rerun)
|
|
||||||
.icon_size(IconSize::Small)
|
.icon_size(IconSize::Small)
|
||||||
.size(ButtonSize::Compact)
|
.size(ButtonSize::Compact)
|
||||||
.icon_color(Color::Default)
|
.icon_color(Color::Default)
|
||||||
|
@ -959,10 +953,21 @@ impl Item for TerminalView {
|
||||||
.on_click(move |_, cx| {
|
.on_click(move |_, cx| {
|
||||||
cx.dispatch_action(Box::new(tasks_ui::Rerun {
|
cx.dispatch_action(Box::new(tasks_ui::Rerun {
|
||||||
task_id: Some(task_id.clone()),
|
task_id: Some(task_id.clone()),
|
||||||
..Default::default()
|
..tasks_ui::Rerun::default()
|
||||||
}));
|
}));
|
||||||
});
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
let (icon, icon_color, rerun_button) = match terminal.task() {
|
||||||
|
Some(terminal_task) => match &terminal_task.status {
|
||||||
|
TaskStatus::Running => (IconName::Play, Color::Disabled, None),
|
||||||
|
TaskStatus::Unknown => (
|
||||||
|
IconName::ExclamationTriangle,
|
||||||
|
Color::Warning,
|
||||||
|
Some(rerun_button(terminal_task.id.clone())),
|
||||||
|
),
|
||||||
|
TaskStatus::Completed { success } => {
|
||||||
|
let rerun_button = rerun_button(terminal_task.id.clone());
|
||||||
if *success {
|
if *success {
|
||||||
(IconName::Check, Color::Success, Some(rerun_button))
|
(IconName::Check, Color::Success, Some(rerun_button))
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue