forge
Explore
Log in

Don't you dare go Hollow

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 commit

d0f70252f53e6259d47db62342dec7c086987552Ahmet Kaan GümüşParent: 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)
Show full message
🐛 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)
crates/client/lang/en/builder_release.txtmodified+1 -0
@@ -31,3 +31,4 @@ ready = Ready to publish
3131 discard = Discard
3232 server = Server
3333 retry = Retry
34+stopping = Stopping
crates/client/lang/tr/builder_release.txtmodified+1 -0
@@ -31,3 +31,4 @@ ready = Yayına hazır
3131 discard = Vazgeç
3232 server = Sunucu
3333 retry = Tekrar dene
34+stopping = Durduruluyor
crates/client/src/gui/builder/releases.rsmodified+19 -9
@@ -59,6 +59,7 @@ struct Row {
5959 #[derive(Clone, Copy, PartialEq, Eq)]
6060 enum Status {
6161 Running,
62+ Stopping,
6263 Done,
6364 Failed,
6465 Cancelled,
@@ -145,6 +146,10 @@ impl Desk {
145146 !self.dismissed && (self.build.is_some() || self.failed() || self.cancelled)
146147 }
147148
149+ fn active(&self) -> bool {
150+ self.build.is_some() && !self.cancelled
151+ }
152+
148153 fn failed(&self) -> bool {
149154 self.jobs
150155 .iter()
@@ -163,12 +168,14 @@ impl Desk {
163168 if self.jobs.is_empty() || self.dismissed {
164169 return None;
165170 }
166- Some(if self.build.is_some() {
171+ Some(if self.active() {
167172 Status::Running
168- } else if self.failed() {
169- Status::Failed
173+ } else if self.build.is_some() {
174+ Status::Stopping
170175 } else if self.cancelled {
171176 Status::Cancelled
177+ } else if self.failed() {
178+ Status::Failed
172179 } else {
173180 Status::Done
174181 })
@@ -527,7 +534,7 @@ impl Yumush {
527534
528535 fn progress_card(&self, entity: &Entity<Self>, palette: Palette) -> Div {
529536 let w = &w().builder_release;
530- let running = self.desk.build.is_some();
537+ let running = self.desk.active();
531538 let close = if running {
532539 parts::button(
533540 "cancel_release_build",
@@ -568,7 +575,7 @@ impl Yumush {
568575 entity: &Entity<Self>,
569576 palette: Palette,
570577 ) -> Option<AnyElement> {
571- if self.desk.build.is_none() || !matches!(row.phase, Phase::Failed(_)) {
578+ if !self.desk.active() || !matches!(row.phase, Phase::Failed(_)) {
572579 return None;
573580 }
574581 let job = row.job;
@@ -602,6 +609,7 @@ impl Yumush {
602609 let w = &w().builder_release;
603610 let label = match self.desk.status() {
604611 Some(Status::Running) => w.building,
612+ Some(Status::Stopping) => w.stopping,
605613 Some(Status::Failed) => w.build_failed,
606614 Some(Status::Cancelled) => w.cancelled,
607615 Some(Status::Done) if self.desk.can_publish() => w.ready,
@@ -614,7 +622,7 @@ impl Yumush {
614622 self.settings.clock_seconds,
615623 )
616624 .unwrap_or_default();
617- let aside = if self.desk.build.is_some() {
625+ let aside = if self.desk.active() {
618626 format!("{finished} / {} · {time}", self.desk.jobs.len())
619627 } else {
620628 time
@@ -626,7 +634,7 @@ impl Yumush {
626634 .text_size(text(text::LABEL))
627635 .child(
628636 div()
629- .text_color(if self.desk.failed() {
637+ .text_color(if self.desk.status() == Some(Status::Failed) {
630638 palette.danger
631639 } else {
632640 palette.text
@@ -674,6 +682,7 @@ impl Yumush {
674682 let seconds = self.settings.clock_seconds;
675683 let label = match status {
676684 Status::Running => w.building,
685+ Status::Stopping => w.stopping,
677686 Status::Done if self.desk.can_publish() => w.ready,
678687 Status::Done => w.done,
679688 Status::Failed => w.build_failed,
@@ -734,7 +743,7 @@ impl Yumush {
734743 palette: Palette,
735744 ) -> Div {
736745 let w = &w().builder_release;
737- let running = self.desk.build.is_some();
746+ let running = self.desk.active();
738747 let open = parts::button(
739748 "build_open_releases",
740749 w.open_releases,
@@ -991,6 +1000,7 @@ impl Yumush {
9911000 build.cancel();
9921001 }
9931002 self.desk.cancelled = true;
1003+ self.desk.ended = Some(Instant::now());
9941004 cx.notify();
9951005 }
9961006
@@ -1020,7 +1030,7 @@ impl Yumush {
10201030 }
10211031 Event::Done => {
10221032 self.desk.build = None;
1023- self.desk.ended = Some(Instant::now());
1033+ self.desk.ended.get_or_insert_with(Instant::now);
10241034 }
10251035 }
10261036 window.refresh();