task: Add "remove" button next to oneshot tasks (#10083)

Release Notes:

- Added a "remove" button next to oneshot tasks in tasks modal.
This commit is contained in:
Piotr Osiewicz
2024-04-02 17:59:22 +02:00
committed by GitHub
parent a1cb6772bf
commit 8df888e5b1
2 changed files with 58 additions and 1 deletions
+7
View File
@@ -75,6 +75,13 @@ impl OneshotSource {
new_oneshot
}
}
/// Removes a task with a given ID from this source.
pub fn remove(&mut self, id: &TaskId) {
let position = self.tasks.iter().position(|task| task.id() == id);
if let Some(position) = position {
self.tasks.remove(position);
}
}
}
impl TaskSource for OneshotSource {