Cancel takes effect at once in the UI: the timer stops, Cancel/Retry hide and the build reads Stopping until the VM has shut down, then Cancelled (it read Build failed before)
Browse files at this commitd0f70252f53e6259d47db62342dec7c086987552Parent: 117c2aa- fix
- Cancel takes effect at once in the UI: the timer stops, Cancel/Retry hide and the build reads Stopping until the VM has shut down, then Cancelled (it read Build failed before)
3 changed files +21 -9
- crates/client/lang/en/builder_release.txt +1 -0
- crates/client/lang/tr/builder_release.txt +1 -0
- crates/client/src/gui/builder/releases.rs +19 -9
crates/client/lang/en/builder_release.txtmodified+1 -0
| @@ -31,3 +31,4 @@ ready = Ready to publish | ||
| 31 | 31 | discard = Discard |
| 32 | 32 | server = Server |
| 33 | 33 | retry = Retry |
| 34 | +stopping = Stopping |
crates/client/lang/tr/builder_release.txtmodified+1 -0
| @@ -31,3 +31,4 @@ ready = Yayına hazır | ||
| 31 | 31 | discard = Vazgeç |
| 32 | 32 | server = Sunucu |
| 33 | 33 | retry = Tekrar dene |
| 34 | +stopping = Durduruluyor |
crates/client/src/gui/builder/releases.rsmodified+19 -9
| @@ -59,6 +59,7 @@ struct Row { | ||
| 59 | 59 | #[derive(Clone, Copy, PartialEq, Eq)] |
| 60 | 60 | enum Status { |
| 61 | 61 | Running, |
| 62 | + Stopping, | |
| 62 | 63 | Done, |
| 63 | 64 | Failed, |
| 64 | 65 | Cancelled, |
| @@ -145,6 +146,10 @@ impl Desk { | ||
| 145 | 146 | !self.dismissed && (self.build.is_some() || self.failed() || self.cancelled) |
| 146 | 147 | } |
| 147 | 148 | |
| 149 | + fn active(&self) -> bool { | |
| 150 | + self.build.is_some() && !self.cancelled | |
| 151 | + } | |
| 152 | + | |
| 148 | 153 | fn failed(&self) -> bool { |
| 149 | 154 | self.jobs |
| 150 | 155 | .iter() |
| @@ -163,12 +168,14 @@ impl Desk { | ||
| 163 | 168 | if self.jobs.is_empty() || self.dismissed { |
| 164 | 169 | return None; |
| 165 | 170 | } |
| 166 | - Some(if self.build.is_some() { | |
| 171 | + Some(if self.active() { | |
| 167 | 172 | Status::Running |
| 168 | - } else if self.failed() { | |
| 169 | - Status::Failed | |
| 173 | + } else if self.build.is_some() { | |
| 174 | + Status::Stopping | |
| 170 | 175 | } else if self.cancelled { |
| 171 | 176 | Status::Cancelled |
| 177 | + } else if self.failed() { | |
| 178 | + Status::Failed | |
| 172 | 179 | } else { |
| 173 | 180 | Status::Done |
| 174 | 181 | }) |
| @@ -527,7 +534,7 @@ impl Yumush { | ||
| 527 | 534 | |
| 528 | 535 | fn progress_card(&self, entity: &Entity<Self>, palette: Palette) -> Div { |
| 529 | 536 | let w = &w().builder_release; |
| 530 | - let running = self.desk.build.is_some(); | |
| 537 | + let running = self.desk.active(); | |
| 531 | 538 | let close = if running { |
| 532 | 539 | parts::button( |
| 533 | 540 | "cancel_release_build", |
| @@ -568,7 +575,7 @@ impl Yumush { | ||
| 568 | 575 | entity: &Entity<Self>, |
| 569 | 576 | palette: Palette, |
| 570 | 577 | ) -> Option<AnyElement> { |
| 571 | - if self.desk.build.is_none() || !matches!(row.phase, Phase::Failed(_)) { | |
| 578 | + if !self.desk.active() || !matches!(row.phase, Phase::Failed(_)) { | |
| 572 | 579 | return None; |
| 573 | 580 | } |
| 574 | 581 | let job = row.job; |
| @@ -602,6 +609,7 @@ impl Yumush { | ||
| 602 | 609 | let w = &w().builder_release; |
| 603 | 610 | let label = match self.desk.status() { |
| 604 | 611 | Some(Status::Running) => w.building, |
| 612 | + Some(Status::Stopping) => w.stopping, | |
| 605 | 613 | Some(Status::Failed) => w.build_failed, |
| 606 | 614 | Some(Status::Cancelled) => w.cancelled, |
| 607 | 615 | Some(Status::Done) if self.desk.can_publish() => w.ready, |
| @@ -614,7 +622,7 @@ impl Yumush { | ||
| 614 | 622 | self.settings.clock_seconds, |
| 615 | 623 | ) |
| 616 | 624 | .unwrap_or_default(); |
| 617 | - let aside = if self.desk.build.is_some() { | |
| 625 | + let aside = if self.desk.active() { | |
| 618 | 626 | format!("{finished} / {} · {time}", self.desk.jobs.len()) |
| 619 | 627 | } else { |
| 620 | 628 | time |
| @@ -626,7 +634,7 @@ impl Yumush { | ||
| 626 | 634 | .text_size(text(text::LABEL)) |
| 627 | 635 | .child( |
| 628 | 636 | div() |
| 629 | - .text_color(if self.desk.failed() { | |
| 637 | + .text_color(if self.desk.status() == Some(Status::Failed) { | |
| 630 | 638 | palette.danger |
| 631 | 639 | } else { |
| 632 | 640 | palette.text |
| @@ -674,6 +682,7 @@ impl Yumush { | ||
| 674 | 682 | let seconds = self.settings.clock_seconds; |
| 675 | 683 | let label = match status { |
| 676 | 684 | Status::Running => w.building, |
| 685 | + Status::Stopping => w.stopping, | |
| 677 | 686 | Status::Done if self.desk.can_publish() => w.ready, |
| 678 | 687 | Status::Done => w.done, |
| 679 | 688 | Status::Failed => w.build_failed, |
| @@ -734,7 +743,7 @@ impl Yumush { | ||
| 734 | 743 | palette: Palette, |
| 735 | 744 | ) -> Div { |
| 736 | 745 | let w = &w().builder_release; |
| 737 | - let running = self.desk.build.is_some(); | |
| 746 | + let running = self.desk.active(); | |
| 738 | 747 | let open = parts::button( |
| 739 | 748 | "build_open_releases", |
| 740 | 749 | w.open_releases, |
| @@ -991,6 +1000,7 @@ impl Yumush { | ||
| 991 | 1000 | build.cancel(); |
| 992 | 1001 | } |
| 993 | 1002 | self.desk.cancelled = true; |
| 1003 | + self.desk.ended = Some(Instant::now()); | |
| 994 | 1004 | cx.notify(); |
| 995 | 1005 | } |
| 996 | 1006 | |
| @@ -1020,7 +1030,7 @@ impl Yumush { | ||
| 1020 | 1030 | } |
| 1021 | 1031 | Event::Done => { |
| 1022 | 1032 | self.desk.build = None; |
| 1023 | - self.desk.ended = Some(Instant::now()); | |
| 1033 | + self.desk.ended.get_or_insert_with(Instant::now); | |
| 1024 | 1034 | } |
| 1025 | 1035 | } |
| 1026 | 1036 | window.refresh(); |