feat(app/tasks): cancel task button

This commit is contained in:
rhunk
2023-11-25 12:01:55 +01:00
parent 9d93f3086a
commit 656494ea39

View File

@@ -148,7 +148,15 @@ class TasksSection : Section() {
Column {
if (pendingTask != null && !taskStatus.isFinalStage()) {
CircularProgressIndicator(modifier = Modifier.size(30.dp))
FilledIconButton(onClick = {
runCatching {
pendingTask.cancel()
}.onFailure { throwable ->
context.log.error("Failed to cancel task $pendingTask", throwable)
}
}) {
Icon(Icons.Filled.Close, contentDescription = "Cancel")
}
} else {
when (taskStatus) {
TaskStatus.SUCCESS -> Icon(Icons.Filled.Check, contentDescription = "Success", tint = MaterialTheme.colorScheme.primary)