Build and Publish are separate steps. Build only builds
Browse files at this commitcd8e27cfff5732d0a47e51111609e37a940551a0Parent: 4d140ba- feat
- Build and Publish are separate steps. Build only builds
- the result waits in a '#N · Ready to publish' card with Required, Discard and Publish (also Publish from the sidebar popover). Job lanes show only while a build runs or failed. Published list is one line per release in a virtualized list
3 changed files +211 -136
- crates/client/lang/en/builder_release.txt +3 -2
- crates/client/lang/tr/builder_release.txt +3 -2
- crates/client/src/gui/builder/releases.rs +205 -132
crates/client/lang/en/builder_release.txtmodified+3 -2
| @@ -1,5 +1,4 @@ | |||
| 1 | add_files = Add files | 1 | add_files = Add files |
| 2 | -draft = Upload | ||
| 3 | published = Published | 2 | published = Published |
| 4 | compressing = Compressing | 3 | compressing = Compressing |
| 5 | duplicate = Duplicate target | 4 | duplicate = Duplicate target |
| @@ -7,7 +6,7 @@ required = Required | |||
| 7 | publish = Publish | 6 | publish = Publish |
| 8 | confirm = Confirm | 7 | confirm = Confirm |
| 9 | no_releases = No releases | 8 | no_releases = No releases |
| 10 | -build = Build & publish | 9 | +build = Build |
| 11 | choose_source = Choose source | 10 | choose_source = Choose source |
| 12 | no_source = No source folder | 11 | no_source = No source folder |
| 13 | not_source = Not a release source | 12 | not_source = Not a release source |
| @@ -28,3 +27,5 @@ build_failed = Build failed | |||
| 28 | cancelled = Cancelled | 27 | cancelled = Cancelled |
| 29 | open_releases = Open Releases | 28 | open_releases = Open Releases |
| 30 | dismiss = Dismiss | 29 | dismiss = Dismiss |
| 30 | +ready = Ready to publish | ||
| 31 | +discard = Discard | ||
crates/client/lang/tr/builder_release.txtmodified+3 -2
| @@ -1,5 +1,4 @@ | |||
| 1 | add_files = Dosya ekle | 1 | add_files = Dosya ekle |
| 2 | -draft = Yükle | ||
| 3 | published = Yayınlananlar | 2 | published = Yayınlananlar |
| 4 | compressing = Sıkıştırılıyor | 3 | compressing = Sıkıştırılıyor |
| 5 | duplicate = Aynı hedef tekrarlı | 4 | duplicate = Aynı hedef tekrarlı |
| @@ -7,7 +6,7 @@ required = Zorunlu | |||
| 7 | publish = Yayınla | 6 | publish = Yayınla |
| 8 | confirm = Onayla | 7 | confirm = Onayla |
| 9 | no_releases = Sürüm yok | 8 | no_releases = Sürüm yok |
| 10 | -build = Derle ve yayınla | 9 | +build = Derle |
| 11 | choose_source = Kaynak seç | 10 | choose_source = Kaynak seç |
| 12 | no_source = Kaynak klasörü yok | 11 | no_source = Kaynak klasörü yok |
| 13 | not_source = Geçerli bir sürüm kaynağı değil | 12 | not_source = Geçerli bir sürüm kaynağı değil |
| @@ -28,3 +27,5 @@ build_failed = Derleme başarısız | |||
| 28 | cancelled = İptal edildi | 27 | cancelled = İptal edildi |
| 29 | open_releases = Sürümleri aç | 28 | open_releases = Sürümleri aç |
| 30 | dismiss = Kapat | 29 | dismiss = Kapat |
| 30 | +ready = Yayına hazır | ||
| 31 | +discard = Vazgeç | ||
crates/client/src/gui/builder/releases.rsmodified+205 -132
| @@ -4,7 +4,7 @@ use common::{ | |||
| 4 | }; | 4 | }; |
| 5 | use gpui_kit::{ | 5 | use gpui_kit::{ |
| 6 | Anchor, AnyElement, Context, Div, Entity, Hsla, IntoElement, ParentElement, PathPromptOptions, | 6 | Anchor, AnyElement, Context, Div, Entity, Hsla, IntoElement, ParentElement, PathPromptOptions, |
| 7 | - Styled, Window, component::popover::Popover, div, px, | 7 | + Styled, Window, component::popover::Popover, div, px, uniform_list, |
| 8 | }; | 8 | }; |
| 9 | use std::path::PathBuf; | 9 | use std::path::PathBuf; |
| 10 | use std::time::{Duration, Instant}; | 10 | use std::time::{Duration, Instant}; |
| @@ -38,7 +38,6 @@ pub(crate) struct Desk { | |||
| 38 | jobs: Vec<Row>, | 38 | jobs: Vec<Row>, |
| 39 | failed: bool, | 39 | failed: bool, |
| 40 | cancelled: bool, | 40 | cancelled: bool, |
| 41 | - auto_publish: bool, | ||
| 42 | began: Option<Instant>, | 41 | began: Option<Instant>, |
| 43 | ended: Option<Instant>, | 42 | ended: Option<Instant>, |
| 44 | dismissed: bool, | 43 | dismissed: bool, |
| @@ -128,6 +127,19 @@ impl Desk { | |||
| 128 | }) | 127 | }) |
| 129 | } | 128 | } |
| 130 | 129 | ||
| 130 | + fn next_seq(&self) -> u64 { | ||
| 131 | + self.releases | ||
| 132 | + .iter() | ||
| 133 | + .map(|release| release.seq) | ||
| 134 | + .max() | ||
| 135 | + .unwrap_or(0) | ||
| 136 | + + 1 | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + fn building(&self) -> bool { | ||
| 140 | + !self.dismissed && (self.build.is_some() || self.failed || self.cancelled) | ||
| 141 | + } | ||
| 142 | + | ||
| 131 | fn draft(&mut self, id: u64) -> Option<&mut Draft> { | 143 | fn draft(&mut self, id: u64) -> Option<&mut Draft> { |
| 132 | self.drafts.iter_mut().find(|draft| draft.id == id) | 144 | self.drafts.iter_mut().find(|draft| draft.id == id) |
| 133 | } | 145 | } |
| @@ -333,30 +345,24 @@ fn release_row( | |||
| 333 | }; | 345 | }; |
| 334 | 346 | ||
| 335 | list_row() | 347 | list_row() |
| 348 | + .h(px(size::ROW)) | ||
| 336 | .child( | 349 | .child( |
| 337 | div() | 350 | div() |
| 338 | - .flex_1() | 351 | + .w(px(size::CONTROL * 1.5)) |
| 339 | - .min_w_0() | 352 | + .text_size(text(text::LABEL)) |
| 340 | - .flex() | 353 | + .text_color(palette.text) |
| 341 | - .flex_col() | 354 | + .child(format!("#{seq}")), |
| 342 | - .child( | ||
| 343 | - div() | ||
| 344 | - .text_size(text(text::LABEL)) | ||
| 345 | - .text_color(palette.text) | ||
| 346 | - .child(format!("#{seq}")), | ||
| 347 | - ) | ||
| 348 | - .child( | ||
| 349 | - div() | ||
| 350 | - .truncate() | ||
| 351 | - .text_size(text(text::CAPTION)) | ||
| 352 | - .text_color(palette.muted) | ||
| 353 | - .child(targets), | ||
| 354 | - ), | ||
| 355 | ) | 355 | ) |
| 356 | .child(caption_text( | 356 | .child(caption_text( |
| 357 | millis_time(release.created_ms, w().common.date), | 357 | millis_time(release.created_ms, w().common.date), |
| 358 | palette.muted, | 358 | palette.muted, |
| 359 | )) | 359 | )) |
| 360 | + .child( | ||
| 361 | + caption_text(targets, palette.muted) | ||
| 362 | + .flex_1() | ||
| 363 | + .min_w_0() | ||
| 364 | + .truncate(), | ||
| 365 | + ) | ||
| 360 | .child(control) | 366 | .child(control) |
| 361 | } | 367 | } |
| 362 | 368 | ||
| @@ -385,51 +391,22 @@ impl Yumush { | |||
| 385 | yumush.pick_release_source(window, cx) | 391 | yumush.pick_release_source(window, cx) |
| 386 | }), | 392 | }), |
| 387 | ); | 393 | ); |
| 394 | + let build = parts::button( | ||
| 395 | + "build_release", | ||
| 396 | + w().builder_release.build, | ||
| 397 | + Press::Primary, | ||
| 398 | + palette.tokens, | ||
| 399 | + entity_action(entity, |yumush, window, cx| yumush.start_build(window, cx)), | ||
| 400 | + ); | ||
| 388 | let build = if self.settings.release_source.is_some() && !running { | 401 | let build = if self.settings.release_source.is_some() && !running { |
| 389 | - parts::button( | 402 | + build |
| 390 | - "build_release", | ||
| 391 | - w().builder_release.build, | ||
| 392 | - Press::Primary, | ||
| 393 | - palette.tokens, | ||
| 394 | - entity_action(entity, |yumush, window, cx| yumush.start_build(window, cx)), | ||
| 395 | - ) | ||
| 396 | - .into_any_element() | ||
| 397 | } else { | 403 | } else { |
| 398 | - parts::button( | 404 | + build.opacity(0.4) |
| 399 | - "build_release", | ||
| 400 | - w().builder_release.build, | ||
| 401 | - Press::Primary, | ||
| 402 | - palette.tokens, | ||
| 403 | - |_, _| {}, | ||
| 404 | - ) | ||
| 405 | - .opacity(0.4) | ||
| 406 | - .into_any_element() | ||
| 407 | }; | 405 | }; |
| 408 | - let cancel = running.then(|| { | ||
| 409 | - parts::button( | ||
| 410 | - "cancel_release_build", | ||
| 411 | - w().builder_release.cancel, | ||
| 412 | - Press::Danger, | ||
| 413 | - palette.tokens, | ||
| 414 | - entity_action(entity, |yumush, _, cx| yumush.cancel_build(cx)), | ||
| 415 | - ) | ||
| 416 | - }); | ||
| 417 | - let required = parts::labeled_toggle( | ||
| 418 | - "release_required", | ||
| 419 | - w().builder_release.required, | ||
| 420 | - self.desk.required, | ||
| 421 | - palette.tokens, | ||
| 422 | - entity_action(entity, |yumush, _, cx| { | ||
| 423 | - yumush.desk.required = !yumush.desk.required; | ||
| 424 | - cx.notify(); | ||
| 425 | - }), | ||
| 426 | - ); | ||
| 427 | - let lanes = self.lanes(|row| row, palette); | ||
| 428 | 406 | ||
| 429 | card(palette) | 407 | card(palette) |
| 430 | .child( | 408 | .child( |
| 431 | list_row() | 409 | list_row() |
| 432 | - .justify_between() | ||
| 433 | .child( | 410 | .child( |
| 434 | div() | 411 | div() |
| 435 | .flex_1() | 412 | .flex_1() |
| @@ -439,19 +416,89 @@ impl Yumush { | |||
| 439 | .text_color(palette.muted) | 416 | .text_color(palette.muted) |
| 440 | .child(source), | 417 | .child(source), |
| 441 | ) | 418 | ) |
| 442 | - .child(choose), | 419 | + .child(choose) |
| 420 | + .child(build), | ||
| 421 | + ) | ||
| 422 | + .children( | ||
| 423 | + self.desk | ||
| 424 | + .building() | ||
| 425 | + .then(|| self.progress_card(entity, palette)), | ||
| 426 | + ) | ||
| 427 | + } | ||
| 428 | + | ||
| 429 | + fn progress_card(&self, entity: &Entity<Self>, palette: Palette) -> Div { | ||
| 430 | + let w = &w().builder_release; | ||
| 431 | + let running = self.desk.build.is_some(); | ||
| 432 | + let close = if running { | ||
| 433 | + parts::button( | ||
| 434 | + "cancel_release_build", | ||
| 435 | + w.cancel, | ||
| 436 | + Press::Danger, | ||
| 437 | + palette.tokens, | ||
| 438 | + entity_action(entity, |yumush, _, cx| yumush.cancel_build(cx)), | ||
| 439 | + ) | ||
| 440 | + } else { | ||
| 441 | + parts::button( | ||
| 442 | + "dismiss_release_build", | ||
| 443 | + w.dismiss, | ||
| 444 | + Press::Plain, | ||
| 445 | + palette.tokens, | ||
| 446 | + entity_action(entity, |yumush, _, cx| { | ||
| 447 | + yumush.desk.dismissed = true; | ||
| 448 | + cx.notify(); | ||
| 449 | + }), | ||
| 443 | ) | 450 | ) |
| 444 | - .child(div().flex().flex_col().children(lanes)) | 451 | + }; |
| 452 | + div() | ||
| 453 | + .flex() | ||
| 454 | + .flex_col() | ||
| 455 | + .pt(px(space::MD)) | ||
| 456 | + .child(self.build_head(palette)) | ||
| 457 | + .child(parts::track( | ||
| 458 | + Fill::Part(self.desk.share()), | ||
| 459 | + self.desk.failed, | ||
| 460 | + palette.tokens, | ||
| 461 | + )) | ||
| 462 | + .children(self.lanes(|row| row, palette)) | ||
| 463 | + .child(list_row().justify_end().child(close)) | ||
| 464 | + } | ||
| 465 | + | ||
| 466 | + fn build_head(&self, palette: Palette) -> Div { | ||
| 467 | + let w = &w().builder_release; | ||
| 468 | + let label = match self.desk.status() { | ||
| 469 | + Some(Status::Running) => w.building, | ||
| 470 | + Some(Status::Failed) => w.build_failed, | ||
| 471 | + Some(Status::Cancelled) => w.cancelled, | ||
| 472 | + Some(Status::Done) if self.desk.can_publish() => w.ready, | ||
| 473 | + _ => w.done, | ||
| 474 | + }; | ||
| 475 | + let finished = self.desk.jobs.iter().filter(|row| row.finished()).count(); | ||
| 476 | + let time = span( | ||
| 477 | + self.desk.began, | ||
| 478 | + self.desk.ended, | ||
| 479 | + self.settings.clock_seconds, | ||
| 480 | + ) | ||
| 481 | + .unwrap_or_default(); | ||
| 482 | + let aside = if self.desk.build.is_some() { | ||
| 483 | + format!("{finished} / {} · {time}", self.desk.jobs.len()) | ||
| 484 | + } else { | ||
| 485 | + time | ||
| 486 | + }; | ||
| 487 | + div() | ||
| 488 | + .flex() | ||
| 489 | + .justify_between() | ||
| 490 | + .pb(px(space::XS)) | ||
| 491 | + .text_size(text(text::LABEL)) | ||
| 445 | .child( | 492 | .child( |
| 446 | - list_row().justify_between().child(required).child( | 493 | + div() |
| 447 | - div() | 494 | + .text_color(if self.desk.failed { |
| 448 | - .flex() | 495 | + palette.danger |
| 449 | - .items_center() | 496 | + } else { |
| 450 | - .gap(px(space::SM)) | 497 | + palette.text |
| 451 | - .children(cancel) | 498 | + }) |
| 452 | - .child(build), | 499 | + .child(label), |
| 453 | - ), | ||
| 454 | ) | 500 | ) |
| 501 | + .child(div().text_color(palette.muted).child(aside)) | ||
| 455 | } | 502 | } |
| 456 | 503 | ||
| 457 | fn lanes(&self, fit: impl Fn(Div) -> Div, palette: Palette) -> Vec<Div> { | 504 | fn lanes(&self, fit: impl Fn(Div) -> Div, palette: Palette) -> Vec<Div> { |
| @@ -489,6 +536,7 @@ impl Yumush { | |||
| 489 | let seconds = self.settings.clock_seconds; | 536 | let seconds = self.settings.clock_seconds; |
| 490 | let label = match status { | 537 | let label = match status { |
| 491 | Status::Running => w.building, | 538 | Status::Running => w.building, |
| 539 | + Status::Done if self.desk.can_publish() => w.ready, | ||
| 492 | Status::Done => w.done, | 540 | Status::Done => w.done, |
| 493 | Status::Failed => w.build_failed, | 541 | Status::Failed => w.build_failed, |
| 494 | Status::Cancelled => w.cancelled, | 542 | Status::Cancelled => w.cancelled, |
| @@ -549,11 +597,6 @@ impl Yumush { | |||
| 549 | ) -> Div { | 597 | ) -> Div { |
| 550 | let w = &w().builder_release; | 598 | let w = &w().builder_release; |
| 551 | let running = self.desk.build.is_some(); | 599 | let running = self.desk.build.is_some(); |
| 552 | - let total = span( | ||
| 553 | - self.desk.began, | ||
| 554 | - self.desk.ended, | ||
| 555 | - self.settings.clock_seconds, | ||
| 556 | - ); | ||
| 557 | let open = parts::button( | 600 | let open = parts::button( |
| 558 | "build_open_releases", | 601 | "build_open_releases", |
| 559 | w.open_releases, | 602 | w.open_releases, |
| @@ -572,6 +615,16 @@ impl Yumush { | |||
| 572 | palette.tokens, | 615 | palette.tokens, |
| 573 | yumush_action(entity, popover, |yumush, _, cx| yumush.cancel_build(cx)), | 616 | yumush_action(entity, popover, |yumush, _, cx| yumush.cancel_build(cx)), |
| 574 | ) | 617 | ) |
| 618 | + } else if self.desk.can_publish() { | ||
| 619 | + parts::button( | ||
| 620 | + "build_sheet_publish", | ||
| 621 | + w.publish, | ||
| 622 | + Press::Primary, | ||
| 623 | + palette.tokens, | ||
| 624 | + yumush_action(entity, popover, |yumush, window, cx| { | ||
| 625 | + yumush.publish_release(window, cx) | ||
| 626 | + }), | ||
| 627 | + ) | ||
| 575 | } else { | 628 | } else { |
| 576 | parts::button( | 629 | parts::button( |
| 577 | "build_sheet_dismiss", | 630 | "build_sheet_dismiss", |
| @@ -587,19 +640,16 @@ impl Yumush { | |||
| 587 | parts::popover(palette.tokens) | 640 | parts::popover(palette.tokens) |
| 588 | .w(px(size::SHEET)) | 641 | .w(px(size::SHEET)) |
| 589 | .p(px(space::MD)) | 642 | .p(px(space::MD)) |
| 590 | - .child( | 643 | + .child(self.build_head(palette)) |
| 591 | - div() | ||
| 592 | - .flex() | ||
| 593 | - .justify_between() | ||
| 594 | - .pb(px(space::XS)) | ||
| 595 | - .text_size(text(text::LABEL)) | ||
| 596 | - .child(div().text_color(palette.text).child(w.build)) | ||
| 597 | - .children(total.map(|time| div().text_color(palette.muted).child(time))), | ||
| 598 | - ) | ||
| 599 | .children(self.lanes( | 644 | .children(self.lanes( |
| 600 | |row| row.min_h(px(size::CONTROL)).py(px(space::XXS)), | 645 | |row| row.min_h(px(size::CONTROL)).py(px(space::XXS)), |
| 601 | palette, | 646 | palette, |
| 602 | )) | 647 | )) |
| 648 | + .children((!running && self.desk.can_publish()).then(|| { | ||
| 649 | + div() | ||
| 650 | + .pt(px(space::SM)) | ||
| 651 | + .child(self.required_toggle(entity, palette)) | ||
| 652 | + })) | ||
| 603 | .child( | 653 | .child( |
| 604 | div() | 654 | div() |
| 605 | .pt(px(space::SM)) | 655 | .pt(px(space::SM)) |
| @@ -610,57 +660,95 @@ impl Yumush { | |||
| 610 | ) | 660 | ) |
| 611 | } | 661 | } |
| 612 | 662 | ||
| 663 | + fn required_toggle(&self, entity: &Entity<Self>, palette: Palette) -> impl IntoElement { | ||
| 664 | + parts::labeled_toggle( | ||
| 665 | + "release_required", | ||
| 666 | + w().builder_release.required, | ||
| 667 | + self.desk.required, | ||
| 668 | + palette.tokens, | ||
| 669 | + entity_action(entity, |yumush, window, cx| { | ||
| 670 | + yumush.desk.required = !yumush.desk.required; | ||
| 671 | + window.refresh(); | ||
| 672 | + cx.notify(); | ||
| 673 | + }), | ||
| 674 | + ) | ||
| 675 | + } | ||
| 676 | + | ||
| 613 | fn draft_card(&self, entity: &Entity<Self>, palette: Palette) -> Div { | 677 | fn draft_card(&self, entity: &Entity<Self>, palette: Palette) -> Div { |
| 678 | + let w = &w().builder_release; | ||
| 614 | let drafts = &self.desk.drafts; | 679 | let drafts = &self.desk.drafts; |
| 615 | let rows: Vec<Div> = drafts | 680 | let rows: Vec<Div> = drafts |
| 616 | .iter() | 681 | .iter() |
| 617 | .enumerate() | 682 | .enumerate() |
| 618 | .map(|(index, draft)| draft_row(draft, is_duplicate(drafts, index), entity, palette)) | 683 | .map(|(index, draft)| draft_row(draft, is_duplicate(drafts, index), entity, palette)) |
| 619 | .collect(); | 684 | .collect(); |
| 685 | + let publish = parts::button( | ||
| 686 | + "publish_release", | ||
| 687 | + w.publish, | ||
| 688 | + Press::Primary, | ||
| 689 | + palette.tokens, | ||
| 690 | + entity_action(entity, |yumush, window, cx| { | ||
| 691 | + yumush.publish_release(window, cx) | ||
| 692 | + }), | ||
| 693 | + ); | ||
| 620 | let publish = if self.desk.can_publish() { | 694 | let publish = if self.desk.can_publish() { |
| 621 | - parts::button( | 695 | + publish |
| 622 | - "publish_release", | ||
| 623 | - w().builder_release.publish, | ||
| 624 | - Press::Primary, | ||
| 625 | - palette.tokens, | ||
| 626 | - entity_action(entity, |yumush, window, cx| { | ||
| 627 | - yumush.publish_release(window, cx) | ||
| 628 | - }), | ||
| 629 | - ) | ||
| 630 | - .into_any_element() | ||
| 631 | } else { | 696 | } else { |
| 632 | - parts::button( | 697 | + publish.opacity(0.4) |
| 633 | - "publish_release", | ||
| 634 | - w().builder_release.publish, | ||
| 635 | - Press::Primary, | ||
| 636 | - palette.tokens, | ||
| 637 | - |_, _| {}, | ||
| 638 | - ) | ||
| 639 | - .opacity(0.4) | ||
| 640 | - .into_any_element() | ||
| 641 | }; | 698 | }; |
| 699 | + let discard = parts::button( | ||
| 700 | + "discard_release", | ||
| 701 | + w.discard, | ||
| 702 | + Press::Plain, | ||
| 703 | + palette.tokens, | ||
| 704 | + entity_action(entity, |yumush, _, cx| { | ||
| 705 | + yumush.desk.drafts.clear(); | ||
| 706 | + yumush.desk.required = false; | ||
| 707 | + cx.notify(); | ||
| 708 | + }), | ||
| 709 | + ); | ||
| 642 | card(palette) | 710 | card(palette) |
| 643 | - .child(card_header(w().builder_release.draft, Vec::new(), palette)) | 711 | + .child(card_header( |
| 712 | + &format!("#{} · {}", self.desk.next_seq(), w.ready), | ||
| 713 | + Vec::new(), | ||
| 714 | + palette, | ||
| 715 | + )) | ||
| 644 | .child(div().flex().flex_col().children(rows)) | 716 | .child(div().flex().flex_col().children(rows)) |
| 645 | - .child(list_row().justify_end().child(publish)) | 717 | + .child( |
| 718 | + list_row() | ||
| 719 | + .child(self.required_toggle(entity, palette)) | ||
| 720 | + .child(div().flex_1()) | ||
| 721 | + .child(discard) | ||
| 722 | + .child(publish), | ||
| 723 | + ) | ||
| 646 | } | 724 | } |
| 647 | 725 | ||
| 648 | fn releases_card(&self, entity: &Entity<Self>, palette: Palette) -> Div { | 726 | fn releases_card(&self, entity: &Entity<Self>, palette: Palette) -> Div { |
| 649 | - let pending = self.desk.pending_required; | 727 | + let count = self.desk.releases.len(); |
| 650 | - let rows: Vec<Div> = self | 728 | + let header = card_header(w().builder_release.published, Vec::new(), palette); |
| 651 | - .desk | 729 | + if count == 0 { |
| 652 | - .releases | 730 | + return card(palette).child(header).child(rows_body( |
| 653 | - .iter() | ||
| 654 | - .map(|release| release_row(release, pending == Some(release.seq), entity, palette)) | ||
| 655 | - .collect(); | ||
| 656 | - | ||
| 657 | - card(palette) | ||
| 658 | - .child(card_header( | ||
| 659 | - w().builder_release.published, | ||
| 660 | Vec::new(), | 731 | Vec::new(), |
| 732 | + w().builder_release.no_releases, | ||
| 661 | palette, | 733 | palette, |
| 662 | - )) | 734 | + )); |
| 663 | - .child(rows_body(rows, w().builder_release.no_releases, palette)) | 735 | + } |
| 736 | + let list = { | ||
| 737 | + let entity = entity.clone(); | ||
| 738 | + uniform_list("published_releases", count, move |range, _, cx| { | ||
| 739 | + let yumush = entity.read(cx); | ||
| 740 | + let pending = yumush.desk.pending_required; | ||
| 741 | + let palette = crate::gui::palette(cx); | ||
| 742 | + yumush.desk.releases[range] | ||
| 743 | + .iter() | ||
| 744 | + .map(|release| { | ||
| 745 | + release_row(release, pending == Some(release.seq), &entity, palette) | ||
| 746 | + }) | ||
| 747 | + .collect() | ||
| 748 | + }) | ||
| 749 | + .h(px((count as f32 * size::ROW).min(size::PAGE))) | ||
| 750 | + }; | ||
| 751 | + card(palette).child(header).child(list) | ||
| 664 | } | 752 | } |
| 665 | 753 | ||
| 666 | pub(super) fn load_releases(&mut self, window: &mut Window, cx: &mut Context<Self>) { | 754 | pub(super) fn load_releases(&mut self, window: &mut Window, cx: &mut Context<Self>) { |
| @@ -728,7 +816,6 @@ impl Yumush { | |||
| 728 | self.desk.dismissed = false; | 816 | self.desk.dismissed = false; |
| 729 | self.desk.failed = false; | 817 | self.desk.failed = false; |
| 730 | self.desk.cancelled = false; | 818 | self.desk.cancelled = false; |
| 731 | - self.desk.auto_publish = false; | ||
| 732 | 819 | ||
| 733 | cx.spawn_in(window, async move |this, cx| { | 820 | cx.spawn_in(window, async move |this, cx| { |
| 734 | while let Some(event) = events.recv().await { | 821 | while let Some(event) = events.recv().await { |
| @@ -765,7 +852,6 @@ impl Yumush { | |||
| 765 | build.cancel(); | 852 | build.cancel(); |
| 766 | } | 853 | } |
| 767 | self.desk.cancelled = true; | 854 | self.desk.cancelled = true; |
| 768 | - self.desk.auto_publish = false; | ||
| 769 | cx.notify(); | 855 | cx.notify(); |
| 770 | } | 856 | } |
| 771 | 857 | ||
| @@ -790,9 +876,6 @@ impl Yumush { | |||
| 790 | Event::Done => { | 876 | Event::Done => { |
| 791 | self.desk.build = None; | 877 | self.desk.build = None; |
| 792 | self.desk.ended = Some(Instant::now()); | 878 | self.desk.ended = Some(Instant::now()); |
| 793 | - self.desk.auto_publish = | ||
| 794 | - !self.desk.failed && !self.desk.cancelled && !self.desk.drafts.is_empty(); | ||
| 795 | - self.try_auto_publish(window, cx); | ||
| 796 | } | 879 | } |
| 797 | } | 880 | } |
| 798 | window.refresh(); | 881 | window.refresh(); |
| @@ -812,13 +895,6 @@ impl Yumush { | |||
| 812 | row.phase = phase; | 895 | row.phase = phase; |
| 813 | } | 896 | } |
| 814 | 897 | ||
| 815 | - fn try_auto_publish(&mut self, window: &mut Window, cx: &mut Context<Self>) { | ||
| 816 | - if self.desk.auto_publish && self.desk.can_publish() { | ||
| 817 | - self.desk.auto_publish = false; | ||
| 818 | - self.publish_release(window, cx); | ||
| 819 | - } | ||
| 820 | - } | ||
| 821 | - | ||
| 822 | pub(super) fn pick_release_files(&self, window: &mut Window, cx: &mut Context<Self>) { | 898 | pub(super) fn pick_release_files(&self, window: &mut Window, cx: &mut Context<Self>) { |
| 823 | let picked = cx.prompt_for_paths(PathPromptOptions { | 899 | let picked = cx.prompt_for_paths(PathPromptOptions { |
| 824 | files: true, | 900 | files: true, |
| @@ -880,13 +956,10 @@ impl Yumush { | |||
| 880 | Err(error) => Stage::Failed(error.to_string()), | 956 | Err(error) => Stage::Failed(error.to_string()), |
| 881 | }; | 957 | }; |
| 882 | let _ = this.update_in(cx, |yumush, window, cx| { | 958 | let _ = this.update_in(cx, |yumush, window, cx| { |
| 883 | - if matches!(stage, Stage::Failed(_)) { | ||
| 884 | - yumush.desk.auto_publish = false; | ||
| 885 | - } | ||
| 886 | if let Some(draft) = yumush.desk.draft(id) { | 959 | if let Some(draft) = yumush.desk.draft(id) { |
| 887 | draft.stage = stage; | 960 | draft.stage = stage; |
| 888 | } | 961 | } |
| 889 | - yumush.try_auto_publish(window, cx); | 962 | + window.refresh(); |
| 890 | cx.notify(); | 963 | cx.notify(); |
| 891 | }); | 964 | }); |
| 892 | }) | 965 | }) |
| @@ -896,7 +969,6 @@ impl Yumush { | |||
| 896 | 969 | ||
| 897 | fn remove_draft(&mut self, id: u64, cx: &mut Context<Self>) { | 970 | fn remove_draft(&mut self, id: u64, cx: &mut Context<Self>) { |
| 898 | self.desk.drafts.retain(|draft| draft.id != id); | 971 | self.desk.drafts.retain(|draft| draft.id != id); |
| 899 | - self.desk.auto_publish = false; | ||
| 900 | cx.notify(); | 972 | cx.notify(); |
| 901 | } | 973 | } |
| 902 | 974 | ||
| @@ -925,6 +997,7 @@ impl Yumush { | |||
| 925 | yumush.desk.drafts.clear(); | 997 | yumush.desk.drafts.clear(); |
| 926 | yumush.desk.required = false; | 998 | yumush.desk.required = false; |
| 927 | yumush.desk.publishing = false; | 999 | yumush.desk.publishing = false; |
| 1000 | + yumush.desk.dismissed = true; | ||
| 928 | yumush.load_releases(window, cx); | 1001 | yumush.load_releases(window, cx); |
| 929 | }); | 1002 | }); |
| 930 | } | 1003 | } |