From 9412991dec60136c55ab364878a7251413a0e7c0 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Thu, 2 Feb 2023 14:11:22 +0000 Subject: [PATCH 01/11] Output actual migration error --- thoth-api/src/db.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/thoth-api/src/db.rs b/thoth-api/src/db.rs index ceadf057..8e82f279 100644 --- a/thoth-api/src/db.rs +++ b/thoth-api/src/db.rs @@ -36,8 +36,6 @@ pub fn run_migrations() -> ThothResult<()> { let mut connection = establish_connection().get().unwrap(); match connection.run_pending_migrations(MIGRATIONS) { Ok(_) => Ok(()), - Err(_) => Err(ThothError::DatabaseError( - "Could not run migrations".to_string(), - )), + Err(error) => Err(ThothError::DatabaseError(error.to_string())), } } From 1956004ba0926b96c36ad9ea3fbaf7b7929b9edd Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Thu, 2 Feb 2023 14:13:47 +0000 Subject: [PATCH 02/11] Update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cc17dcf..9f866015 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed + - Replace generic error with actual message when migrations fail + - Upgrade node and rollup in github actions + +### Added + - Github action to check that all migrations run successfully ## [[0.9.7]](https://github.com/thoth-pub/thoth/releases/tag/v0.9.7) - 2023-02-02 ### Fixed From cd79df40c887dc26dac3a5d143522be031b55373 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Thu, 2 Feb 2023 14:15:50 +0000 Subject: [PATCH 03/11] Upgrade github actions build dependencies --- .github/workflows/build_test_and_check.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_test_and_check.yml b/.github/workflows/build_test_and_check.yml index da640d2e..c51563fa 100644 --- a/.github/workflows/build_test_and_check.yml +++ b/.github/workflows/build_test_and_check.yml @@ -35,7 +35,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: '16.16.0' + node-version: '18.13.0' - uses: actions-rs/toolchain@v1 with: toolchain: stable @@ -43,7 +43,7 @@ jobs: with: version: 'v0.10.3' - name: Install rollup - run: sudo npm install -g rollup@2.77.2 + run: sudo npm install -g rollup@3.12.0 - name: Compile WASM run: wasm-pack build thoth-app/ --target web --release - name: Pack APP @@ -59,7 +59,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: '16.16.0' + node-version: '18.13.0' - uses: actions-rs/toolchain@v1 with: toolchain: stable @@ -67,7 +67,7 @@ jobs: with: version: 'v0.10.3' - name: Install rollup - run: sudo npm install -g rollup@2.77.2 + run: sudo npm install -g rollup@3.12.0 - name: Compile WASM run: wasm-pack build thoth-app/ --target web --release - name: Pack APP @@ -88,7 +88,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: '16.16.0' + node-version: '18.13.0' - uses: actions-rs/toolchain@v1 with: toolchain: stable @@ -96,7 +96,7 @@ jobs: with: version: 'v0.10.3' - name: Install rollup - run: sudo npm install -g rollup@2.77.2 + run: sudo npm install -g rollup@3.12.0 - name: Compile WASM run: wasm-pack build thoth-app/ --target web --release - name: Pack APP From c88a09df2fa2d1b12db645085f7f40e909749e9f Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Thu, 2 Feb 2023 14:16:03 +0000 Subject: [PATCH 04/11] Add run_migrations github action --- .github/workflows/run_migrations.yml | 68 +++++++++++++++++++ .../workflows/run_migrations_no_action.yml | 22 ++++++ 2 files changed, 90 insertions(+) create mode 100644 .github/workflows/run_migrations.yml create mode 100644 .github/workflows/run_migrations_no_action.yml diff --git a/.github/workflows/run_migrations.yml b/.github/workflows/run_migrations.yml new file mode 100644 index 00000000..dd44eb4e --- /dev/null +++ b/.github/workflows/run_migrations.yml @@ -0,0 +1,68 @@ +name: run-migrations + +on: + push: + branches: + - master + - develop + paths: + - '**up.sql' + - '**down.sql' + - '**db.rs' + pull_request: + paths: + - '**up.sql' + - '**down.sql' + - '**db.rs' + workflow_dispatch: + +env: + CARGO_TERM_COLOR: always + THOTH_GRAPHQL_API: https://api.thoth.pub + THOTH_EXPORT_API: https://export.thoth.pub + DATABASE_URL: postgres://thoth:thoth@localhost:5432/thoth + +jobs: + run_migrations: + runs-on: ubuntu-latest + services: + postgres: + image: postgres:12 + env: + POSTGRES_PASSWORD: thoth + POSTGRES_DB: thoth + POSTGRES_USER: thoth + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432:5432 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: '18.13.0' + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - uses: jetli/wasm-pack-action@v0.3.0 + with: + version: 'v0.10.3' + - name: Install rollup + run: sudo npm install -g rollup@3.12.0 + - name: Compile WASM + run: wasm-pack build thoth-app/ --target web --release + - name: Pack APP + run: rollup thoth-app/main.js --format iife --file thoth-app/pkg/thoth_app.js + - name: Build binary + uses: actions-rs/cargo@v1 + with: + command: build + args: --verbose + - name: Run migrations + uses: actions-rs/cargo@v1 + with: + command: run + args: migrate diff --git a/.github/workflows/run_migrations_no_action.yml b/.github/workflows/run_migrations_no_action.yml new file mode 100644 index 00000000..830f666e --- /dev/null +++ b/.github/workflows/run_migrations_no_action.yml @@ -0,0 +1,22 @@ +name: run-migrations + +on: + push: + branches: + - master + - develop + paths-ignore: + - '**up.sql' + - '**down.sql' + - '**db.rs' + pull_request: + paths-ignore: + - '**up.sql' + - '**down.sql' + - '**db.rs' + +jobs: + run_migrations: + runs-on: ubuntu-latest + steps: + - run: 'echo "No build required"' From 79ac451df0af160b24aa45e0f813c802c7d7d072 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Tue, 14 Feb 2023 11:57:17 +0000 Subject: [PATCH 05/11] Add about component --- thoth-app/src/component/about.rs | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 thoth-app/src/component/about.rs diff --git a/thoth-app/src/component/about.rs b/thoth-app/src/component/about.rs new file mode 100644 index 00000000..0ffd429e --- /dev/null +++ b/thoth-app/src/component/about.rs @@ -0,0 +1,42 @@ +use yew::html; +use yew::prelude::*; + +pub struct AboutComponent {} + +impl Component for AboutComponent { + type Message = (); + type Properties = (); + + fn create(_ctx: &Context) -> Self { + AboutComponent {} + } + + fn view(&self, _ctx: &Context) -> Html { + html! { +
+

{ "About Us" }

+
+

{ "Thoth is an open metadata management and dissemination platform. As an organisation, we are focused on:" }

+
    +
  • { "creation, curation, and dissemination of high-quality metadata records which are essential for the advancement of public knowledge;" }
  • +
  • { "promote openness in scholarly communications such as open access, open licensing, FLOSS, open data, open metadata, and open standards and protocols;" }
  • +
  • { "embrace infrastructural and platform diversity as an inherent component of a flourishing scholarly communications landscape;" }
  • +
  • { "provide high-quality solutions and services for metadata creation, management, dissemination, archiving and preservation." }
  • +
+

{ "Thoth has been developed by Javier Arias in the context of the Community-led Open Publication Infrastructures for Monographs (COPIM) project funded by UKRI and the Arcadia Fund." }

+

{ "Thoth is incorporated as a Community Interest Company in the UK, no. 14549556." }

+

{ "Address: 40 Devonshire Road, Cambridge, United Kingdom, CB1 2BL" }

+

{ "Organisation" }

+
    +
  • { "Joe Deville (Director)" }
  • +
  • { "Rupert Gatti (Director)" }
  • +
  • { "Vincent W.J. van Gerven Oei (Director)" }
  • +
  • { "Javier Arias (CTO)" }
  • +
  • { "Ross Higman (Software Engineer)" }
  • +
+

{ "Support us through the " }{ "Open Book Collective" }{ "." }

+
+
+ } + } +} From 7b513b59efb21743543ff941b2993bfa7e572345 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Tue, 14 Feb 2023 11:57:34 +0000 Subject: [PATCH 06/11] Add about component --- thoth-app/src/component/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/thoth-app/src/component/mod.rs b/thoth-app/src/component/mod.rs index a145fab1..17171034 100644 --- a/thoth-app/src/component/mod.rs +++ b/thoth-app/src/component/mod.rs @@ -430,6 +430,7 @@ impl ToElementValue for Option { } } +pub mod about; pub mod admin; pub mod affiliations_form; pub mod books; From a38a0b2f0981d5041150fd05d3646df608021862 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Tue, 14 Feb 2023 11:57:56 +0000 Subject: [PATCH 07/11] Add about us route --- thoth-app/src/component/root.rs | 6 ++++++ thoth-app/src/route.rs | 2 ++ 2 files changed, 8 insertions(+) diff --git a/thoth-app/src/component/root.rs b/thoth-app/src/component/root.rs index c5f649d4..551322d4 100644 --- a/thoth-app/src/component/root.rs +++ b/thoth-app/src/component/root.rs @@ -18,6 +18,7 @@ use crate::agent::session_timer::SessionTimerRequest; use crate::agent::version_timer::VersionTimerAgent; use crate::agent::version_timer::VersionTimerDispatcher; use crate::agent::version_timer::VersionTimerRequest; +use crate::component::about::AboutComponent; use crate::component::admin::AdminComponent; use crate::component::catalogue::CatalogueComponent; use crate::component::hero::HeroComponent; @@ -181,6 +182,11 @@ fn switch_app( }, + AppRoute::About => html! { +
+ +
+ }, AppRoute::Login => html! {
diff --git a/thoth-app/src/route.rs b/thoth-app/src/route.rs index f276aedd..9f999b1d 100644 --- a/thoth-app/src/route.rs +++ b/thoth-app/src/route.rs @@ -8,6 +8,8 @@ pub enum AppRoute { #[not_found] #[at("/error")] Error, + #[at("/about")] + About, #[at("/admin/*")] Admin, #[at("/admin")] From da3eb9018be98ba1bb86cac834647e63d94a65aa Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Tue, 14 Feb 2023 11:58:05 +0000 Subject: [PATCH 08/11] Add about us link to navbar --- thoth-app/src/component/navbar.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/thoth-app/src/component/navbar.rs b/thoth-app/src/component/navbar.rs index 0450bf03..5d0d7a92 100644 --- a/thoth-app/src/component/navbar.rs +++ b/thoth-app/src/component/navbar.rs @@ -66,6 +66,13 @@ impl Component for NavbarComponent { {"Catalogue"} > + + classes="navbar-item" + to={ AppRoute::About } + > + {"About Us"} + > +