From 7122f87d787e4a4d5cee589a4b9512fd376ae478 Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Mon, 30 May 2022 15:55:10 +0100 Subject: [PATCH 01/53] Update cargo to latest yew version (0.19.3) [broken] --- Cargo.lock | 141 ++++++++++++++++++++++++++++++++++++++++--- thoth-app/Cargo.toml | 2 +- 2 files changed, 134 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 125dca88..927079e6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1463,10 +1463,38 @@ checksum = "68ce6f2dfa9f57f15b848efa2aade5e1850dc72986b87a2b0752d44ca08f4967" dependencies = [ "gloo-console-timer", "gloo-events", - "gloo-file", + "gloo-file 0.1.0", "gloo-timers", ] +[[package]] +name = "gloo" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23947965eee55e3e97a5cd142dd4c10631cc349b48cecca0ed230fd296f568cd" +dependencies = [ + "gloo-console", + "gloo-dialogs", + "gloo-events", + "gloo-file 0.2.1", + "gloo-render", + "gloo-storage", + "gloo-timers", + "gloo-utils", +] + +[[package]] +name = "gloo-console" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3907f786f65bbb4f419e918b0c5674175ef1c231ecda93b2dbd65fd1e8882637" +dependencies = [ + "js-sys", + "serde", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "gloo-console-timer" version = "0.1.0" @@ -1476,6 +1504,16 @@ dependencies = [ "web-sys", ] +[[package]] +name = "gloo-dialogs" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67062364ac72d27f08445a46cab428188e2e224ec9e37efdba48ae8c289002e6" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + [[package]] name = "gloo-events" version = "0.1.1" @@ -1498,6 +1536,43 @@ dependencies = [ "web-sys", ] +[[package]] +name = "gloo-file" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa5d6084efa4a2b182ef3a8649cb6506cb4843f22cf907c6e0a799944248ae90" +dependencies = [ + "gloo-events", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-render" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd9306aef67cfd4449823aadcd14e3958e0800aa2183955a309112a84ec7764" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-storage" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1caa4ba51c99de680dee3ad99c32ca45e9f13311be72079154d222c3f9a6b6f5" +dependencies = [ + "gloo-utils", + "js-sys", + "serde", + "serde_json", + "thiserror", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "gloo-timers" version = "0.2.1" @@ -1509,6 +1584,17 @@ dependencies = [ "web-sys", ] +[[package]] +name = "gloo-utils" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c0bbef55e98d946adbd89f3c65a497cf9adb995a73b99573f30180e8813ab21" +dependencies = [ + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "graphql-introspection-query" version = "0.1.0" @@ -2419,7 +2505,7 @@ dependencies = [ "serde_json", "serde_yaml", "thiserror", - "url 1.7.2", + "url 2.2.2", ] [[package]] @@ -3297,6 +3383,12 @@ dependencies = [ "parking_lot 0.10.0", ] +[[package]] +name = "scoped-tls-hkt" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2e9d7eaddb227e8fbaaa71136ae0e1e913ca159b86c7da82f3e8f0044ad3a63" + [[package]] name = "scoped_threadpool" version = "0.1.9" @@ -3863,7 +3955,7 @@ dependencies = [ "wasm-bindgen", "wasm-logger", "wasm-pack", - "yew", + "yew 0.19.3", "yew-router", "yewtil", ] @@ -4712,7 +4804,7 @@ dependencies = [ "cfg-if 1.0.0", "cfg-match", "console_error_panic_hook", - "gloo", + "gloo 0.2.1", "http 0.2.6", "indexmap", "js-sys", @@ -4725,7 +4817,26 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "yew-macro", + "yew-macro 0.18.0", +] + +[[package]] +name = "yew" +version = "0.19.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a1ccb53e57d3f7d847338cf5758befa811cabe207df07f543c06f502f9998cd" +dependencies = [ + "console_error_panic_hook", + "gloo 0.4.2", + "gloo-utils", + "indexmap", + "js-sys", + "scoped-tls-hkt", + "slab", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "yew-macro 0.19.3", ] [[package]] @@ -4741,6 +4852,20 @@ dependencies = [ "syn 1.0.72", ] +[[package]] +name = "yew-macro" +version = "0.19.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fab79082b556d768d6e21811869c761893f0450e1d550a67892b9bce303b7bb" +dependencies = [ + "boolinator", + "lazy_static 1.4.0", + "proc-macro-error", + "proc-macro2 1.0.36", + "quote 1.0.15", + "syn 1.0.72", +] + [[package]] name = "yew-router" version = "0.15.0" @@ -4749,7 +4874,7 @@ checksum = "27666236d9597eac9be560e841e415e20ba67020bc8cd081076be178e159c8bc" dependencies = [ "cfg-if 1.0.0", "cfg-match", - "gloo", + "gloo 0.2.1", "js-sys", "log", "nom", @@ -4757,7 +4882,7 @@ dependencies = [ "serde_json", "wasm-bindgen", "web-sys", - "yew", + "yew 0.18.0", "yew-router-macro", "yew-router-route-parser", ] @@ -4795,7 +4920,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "yew", + "yew 0.18.0", "yewtil-macro", ] diff --git a/thoth-app/Cargo.toml b/thoth-app/Cargo.toml index 7cb4b8c6..120c51a3 100644 --- a/thoth-app/Cargo.toml +++ b/thoth-app/Cargo.toml @@ -23,7 +23,7 @@ anyhow = "1.0.32" chrono = { version = "0.4", features = ["serde"] } log = "0.4.11" thiserror = "1.0.20" -yew = "0.18.0" +yew = "0.19.3" yew-router = "0.15.0" yewtil = { version = "0.4.0", features = ["fetch", "pure"] } wasm-bindgen = "0.2.74" From 855e2464630fefe25385abbc8616439577b49875 Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Mon, 30 May 2022 16:00:09 +0100 Subject: [PATCH 02/53] Basic syntax updates: ShouldRender removed, non-literal props require braces, fn change becomes fn changed [broken] --- thoth-app/src/component/admin.rs | 54 ++--- thoth-app/src/component/affiliations_form.rs | 44 ++-- thoth-app/src/component/catalogue.rs | 25 +-- thoth-app/src/component/contributions_form.rs | 72 +++--- thoth-app/src/component/contributor.rs | 36 +-- thoth-app/src/component/dashboard.rs | 24 +- thoth-app/src/component/delete_dialogue.rs | 16 +- thoth-app/src/component/fundings_form.rs | 46 ++-- thoth-app/src/component/imprint.rs | 28 +-- thoth-app/src/component/institution.rs | 42 ++-- thoth-app/src/component/issues_form.rs | 32 +-- thoth-app/src/component/languages_form.rs | 42 ++-- thoth-app/src/component/locations_form.rs | 44 ++-- thoth-app/src/component/login.rs | 18 +- thoth-app/src/component/menu.rs | 24 +- thoth-app/src/component/mod.rs | 28 ++- thoth-app/src/component/navbar.rs | 12 +- thoth-app/src/component/new_contributor.rs | 40 ++-- thoth-app/src/component/new_imprint.rs | 24 +- thoth-app/src/component/new_institution.rs | 36 +-- thoth-app/src/component/new_publisher.rs | 20 +- thoth-app/src/component/new_series.rs | 52 ++--- thoth-app/src/component/new_work.rs | 152 ++++++------- thoth-app/src/component/notification.rs | 7 +- thoth-app/src/component/prices_form.rs | 36 +-- thoth-app/src/component/publication.rs | 37 ++-- thoth-app/src/component/publication_modal.rs | 84 +++---- thoth-app/src/component/publications_form.rs | 26 +-- thoth-app/src/component/publisher.rs | 24 +- thoth-app/src/component/related_works_form.rs | 42 ++-- thoth-app/src/component/root.rs | 10 +- thoth-app/src/component/series.rs | 56 ++--- thoth-app/src/component/subjects_form.rs | 38 ++-- thoth-app/src/component/utils.rs | 142 ++++++------ thoth-app/src/component/work.rs | 208 +++++++++--------- thoth-app/src/models/contributor/mod.rs | 2 +- thoth-app/src/models/imprint/mod.rs | 2 +- thoth-app/src/models/institution/mod.rs | 2 +- thoth-app/src/models/mod.rs | 2 +- thoth-app/src/models/publication/mod.rs | 2 +- thoth-app/src/models/publisher/mod.rs | 2 +- thoth-app/src/models/series/mod.rs | 2 +- thoth-app/src/models/work/mod.rs | 2 +- 43 files changed, 817 insertions(+), 820 deletions(-) diff --git a/thoth-app/src/component/admin.rs b/thoth-app/src/component/admin.rs index 2314f82a..237f96da 100644 --- a/thoth-app/src/component/admin.rs +++ b/thoth-app/src/component/admin.rs @@ -96,7 +96,7 @@ impl Component for AdminComponent { } } - fn update(&mut self, msg: Self::Message) -> ShouldRender { + fn update(&mut self, msg: Self::Message) -> bool { match msg { Msg::RedirectToLogin => { self.router @@ -106,7 +106,7 @@ impl Component for AdminComponent { } } - fn change(&mut self, props: Self::Properties) -> ShouldRender { + fn changed(&mut self, props: Self::Properties) -> bool { if self.props != props { self.previous_route.neq_assign(self.props.route.clone()); self.props = props; @@ -134,44 +134,44 @@ impl Component for AdminComponent {
- +
{ match &self.props.route { - AdminRoute::Admin => html!{}, - AdminRoute::Dashboard => html!{}, - AdminRoute::Works => html!{}, - AdminRoute::Books => html!{}, - AdminRoute::Chapters => html!{}, + AdminRoute::Admin => html!{}, + AdminRoute::Dashboard => html!{}, + AdminRoute::Works => html!{}, + AdminRoute::Books => html!{}, + AdminRoute::Chapters => html!{}, AdminRoute::Work(id) => html!{ }, AdminRoute::NewWork => html!{ }, - AdminRoute::Publishers => html!{}, - AdminRoute::Publisher(id) => html!{}, + AdminRoute::Publishers => html!{}, + AdminRoute::Publisher(id) => html!{}, AdminRoute::NewPublisher => html!{}, - AdminRoute::Imprints => html!{}, - AdminRoute::Imprint(id) => html!{}, - AdminRoute::NewImprint => html!{}, - AdminRoute::Institutions => html!{}, - AdminRoute::Institution(id) => html!{}, + AdminRoute::Imprints => html!{}, + AdminRoute::Imprint(id) => html!{}, + AdminRoute::NewImprint => html!{}, + AdminRoute::Institutions => html!{}, + AdminRoute::Institution(id) => html!{}, AdminRoute::NewInstitution => html!{}, - AdminRoute::Publications => html!{}, + AdminRoute::Publications => html!{}, AdminRoute::Publication(id) => html!{ }, AdminRoute::NewPublication => { @@ -183,12 +183,12 @@ impl Component for AdminComponent { } } - AdminRoute::Contributors => html!{}, - AdminRoute::Contributor(id) => html!{}, + AdminRoute::Contributors => html!{}, + AdminRoute::Contributor(id) => html!{}, AdminRoute::NewContributor => html!{}, - AdminRoute::Serieses => html!{}, - AdminRoute::NewSeries => html!{}, - AdminRoute::Series(id) => html!{}, + AdminRoute::Serieses => html!{}, + AdminRoute::NewSeries => html!{}, + AdminRoute::Series(id) => html!{}, } }
diff --git a/thoth-app/src/component/affiliations_form.rs b/thoth-app/src/component/affiliations_form.rs index 0e11df07..cd70b71c 100644 --- a/thoth-app/src/component/affiliations_form.rs +++ b/thoth-app/src/component/affiliations_form.rs @@ -133,7 +133,7 @@ impl Component for AffiliationsFormComponent { } } - fn update(&mut self, msg: Self::Message) -> ShouldRender { + fn update(&mut self, msg: Self::Message) -> bool { match msg { Msg::ToggleModalFormDisplay(show_form, a) => { self.show_modal_form = show_form; @@ -435,7 +435,7 @@ impl Component for AffiliationsFormComponent { } } - fn change(&mut self, props: Self::Properties) -> ShouldRender { + fn changed(&mut self, props: Self::Properties) -> bool { if self.props.neq_assign(props) { self.link.send_message(Msg::GetAffiliations); true @@ -455,43 +455,43 @@ impl Component for AffiliationsFormComponent { }); html! {
-
- +
+