From 666200469a69727ad529b4e99c490ff014c17272 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Mon, 6 May 2024 11:48:45 +0100 Subject: [PATCH 1/8] Apply linting --- thoth-app/src/component/work.rs | 12 ++++++--- thoth-app/src/models/mod.rs | 4 --- thoth-export-server/src/record.rs | 44 +++++++++++++++---------------- 3 files changed, 31 insertions(+), 29 deletions(-) diff --git a/thoth-app/src/component/work.rs b/thoth-app/src/component/work.rs index 94390c97f..214d988db 100644 --- a/thoth-app/src/component/work.rs +++ b/thoth-app/src/component/work.rs @@ -207,9 +207,15 @@ impl Component for WorkComponent { self.doi = self.work.doi.clone().unwrap_or_default().to_string(); self.imprint_id = self.work.imprint.imprint_id; self.work_type = self.work.work_type.clone(); - self.data.imprints = body.data.imprints.to_owned(); - self.data.work_types = body.data.work_types.enum_values.to_owned(); - self.data.work_statuses = body.data.work_statuses.enum_values.to_owned(); + body.data.imprints.clone_into(&mut self.data.imprints); + body.data + .work_types + .enum_values + .clone_into(&mut self.data.work_types); + body.data + .work_statuses + .enum_values + .clone_into(&mut self.data.work_statuses); // If user doesn't have permission to edit this object, redirect to dashboard if let Some(publishers) = diff --git a/thoth-app/src/models/mod.rs b/thoth-app/src/models/mod.rs index 8b0a2d44c..f1dfebbcc 100644 --- a/thoth-app/src/models/mod.rs +++ b/thoth-app/src/models/mod.rs @@ -121,10 +121,6 @@ pub trait ListString { const BULLET_SEPARATOR: &'static str = " • "; const COMMA_SEPARATOR: &'static str = ", "; - fn separated_list_item_bullet_small(&self) -> Html { - self.separated_list_item(true, Self::BULLET_SEPARATOR) - } - fn separated_list_item_comma(&self) -> Html { self.separated_list_item(false, Self::COMMA_SEPARATOR) } diff --git a/thoth-export-server/src/record.rs b/thoth-export-server/src/record.rs index 9b7d8c37a..85d0e4892 100644 --- a/thoth-export-server/src/record.rs +++ b/thoth-export-server/src/record.rs @@ -4,6 +4,7 @@ use paperclip::actix::web::HttpResponse; use paperclip::actix::OperationModifier; use paperclip::v2::models::{DefaultOperationRaw, Either, Response}; use paperclip::v2::schema::Apiv2Schema; +use std::fmt::Display; use std::str::FromStr; use thoth_client::Work; use thoth_errors::{ThothError, ThothResult}; @@ -285,28 +286,27 @@ impl FromStr for MetadataSpecification { } } -impl ToString for MetadataSpecification { - fn to_string(&self) -> String { - match self { - MetadataSpecification::Onix3Thoth(_) => "onix_3.0::thoth".to_string(), - MetadataSpecification::Onix3ProjectMuse(_) => "onix_3.0::project_muse".to_string(), - MetadataSpecification::Onix3Oapen(_) => "onix_3.0::oapen".to_string(), - MetadataSpecification::Onix3Jstor(_) => "onix_3.0::jstor".to_string(), - MetadataSpecification::Onix3GoogleBooks(_) => "onix_3.0::google_books".to_string(), - MetadataSpecification::Onix3Overdrive(_) => "onix_3.0::overdrive".to_string(), - MetadataSpecification::Onix21EbscoHost(_) => "onix_2.1::ebsco_host".to_string(), - MetadataSpecification::Onix21ProquestEbrary(_) => { - "onix_2.1::proquest_ebrary".to_string() - } - MetadataSpecification::CsvThoth(_) => "csv::thoth".to_string(), - MetadataSpecification::JsonThoth(_) => "json::thoth".to_string(), - MetadataSpecification::KbartOclc(_) => "kbart::oclc".to_string(), - MetadataSpecification::BibtexThoth(_) => "bibtex::thoth".to_string(), - MetadataSpecification::DoiDepositCrossref(_) => "doideposit::crossref".to_string(), - MetadataSpecification::Marc21RecordThoth(_) => "marc21record::thoth".to_string(), - MetadataSpecification::Marc21MarkupThoth(_) => "marc21markup::thoth".to_string(), - MetadataSpecification::Marc21XmlThoth(_) => "marc21xml::thoth".to_string(), - } +impl Display for MetadataSpecification { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let str = match self { + MetadataSpecification::Onix3Thoth(_) => "onix_3.0::thoth", + MetadataSpecification::Onix3ProjectMuse(_) => "onix_3.0::project_muse", + MetadataSpecification::Onix3Oapen(_) => "onix_3.0::oapen", + MetadataSpecification::Onix3Jstor(_) => "onix_3.0::jstor", + MetadataSpecification::Onix3GoogleBooks(_) => "onix_3.0::google_books", + MetadataSpecification::Onix3Overdrive(_) => "onix_3.0::overdrive", + MetadataSpecification::Onix21EbscoHost(_) => "onix_2.1::ebsco_host", + MetadataSpecification::Onix21ProquestEbrary(_) => "onix_2.1::proquest_ebrary", + MetadataSpecification::CsvThoth(_) => "csv::thoth", + MetadataSpecification::JsonThoth(_) => "json::thoth", + MetadataSpecification::KbartOclc(_) => "kbart::oclc", + MetadataSpecification::BibtexThoth(_) => "bibtex::thoth", + MetadataSpecification::DoiDepositCrossref(_) => "doideposit::crossref", + MetadataSpecification::Marc21RecordThoth(_) => "marc21record::thoth", + MetadataSpecification::Marc21MarkupThoth(_) => "marc21markup::thoth", + MetadataSpecification::Marc21XmlThoth(_) => "marc21xml::thoth", + }; + write!(f, "{}", str) } } From bb262c460902d8612ddc52948b1a616208e817f3 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Mon, 6 May 2024 11:49:29 +0100 Subject: [PATCH 2/8] Upgrade rust 1.78.0 --- Dockerfile | 2 +- Dockerfile.dev | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5fabc028b..911d1e904 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG MUSL_IMAGE=clux/muslrust:1.77.2-stable +ARG MUSL_IMAGE=clux/muslrust:1.78.0-stable FROM ${MUSL_IMAGE} as build diff --git a/Dockerfile.dev b/Dockerfile.dev index 9f2ac2d13..881163402 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,4 +1,4 @@ -ARG RUST_VERSION=1.77.2 +ARG RUST_VERSION=1.78.0 FROM rust:${RUST_VERSION} From a5700ea223e9d652c5bf07af280ea7dd5be468fe Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Mon, 6 May 2024 12:05:26 +0100 Subject: [PATCH 3/8] Display output of build scripts --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 984519939..22e24d6f9 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ docker-dev-db: docker-compose -f docker-compose.dev.yml up db build: - cargo build + cargo build -vv build-graphql-api: build From bc87620897b6e2027b27f85633820d568112da4f Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Mon, 6 May 2024 12:23:26 +0100 Subject: [PATCH 4/8] Upgrade trunk --- Dockerfile.dev | 2 +- thoth-app-server/build.rs | 2 +- thoth-app/Trunk.toml | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile.dev b/Dockerfile.dev index 881163402..5fbfd2598 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -2,7 +2,7 @@ ARG RUST_VERSION=1.78.0 FROM rust:${RUST_VERSION} -ENV TRUNK_VERSION=0.18.8 +ENV TRUNK_VERSION=0.20.0 ARG THOTH_GRAPHQL_API=http://localhost:8000 ARG THOTH_EXPORT_API=http://localhost:8181 diff --git a/thoth-app-server/build.rs b/thoth-app-server/build.rs index 84d963acf..fb021bf91 100644 --- a/thoth-app-server/build.rs +++ b/thoth-app-server/build.rs @@ -2,7 +2,7 @@ use dotenv::dotenv; use std::env; use std::process::{exit, Command}; -const TRUNK_VERSION: &str = "0.19.2"; +const TRUNK_VERSION: &str = "0.20.0"; fn is_wasm_target_installed() -> bool { let output = Command::new("rustup") diff --git a/thoth-app/Trunk.toml b/thoth-app/Trunk.toml index f5c75869e..e9b1a5a8f 100644 --- a/thoth-app/Trunk.toml +++ b/thoth-app/Trunk.toml @@ -5,6 +5,8 @@ dist = "pkg" public_url = "/admin/" # Whether to include hash values in the output file names. filehash = false +# Control minification +minify = "on_release" # can be one of: never, on_release, always [clean] # The output dir for all final assets. From 4ae04891f7a642f6bf2bbe6d36aa4498074d6f2a Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Mon, 6 May 2024 12:28:30 +0100 Subject: [PATCH 5/8] Update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a875d6d9..6828ec273 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ 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 + - Upgrade rust to `1.78.0` in production and development `Dockerfile` + - Upgrade `trunk` to v0.20.0 + - Added `-vv` option to build command in Makefile ## [[0.12.4]](https://github.com/thoth-pub/thoth/releases/tag/v0.12.4) - 2024-04-30 ### Changed From f70a777c743708ce058a2f1197eff165ce3b1c6a Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Mon, 6 May 2024 12:30:56 +0100 Subject: [PATCH 6/8] Update changelog --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6828ec273..6aa60490a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,9 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Changed - - Upgrade rust to `1.78.0` in production and development `Dockerfile` - - Upgrade `trunk` to v0.20.0 - - Added `-vv` option to build command in Makefile + - [601](https://github.com/thoth-pub/thoth/pull/601) - Upgrade rust to `1.78.0` in production and development `Dockerfile` + - [601](https://github.com/thoth-pub/thoth/pull/601) - Upgrade `trunk` to v0.20.0 + - [601](https://github.com/thoth-pub/thoth/pull/601) - Added `-vv` option to build command in Makefile ## [[0.12.4]](https://github.com/thoth-pub/thoth/releases/tag/v0.12.4) - 2024-04-30 ### Changed From 9c9f912acde68a8c7af4758a005a4fb1bee2549c Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Mon, 6 May 2024 12:38:51 +0100 Subject: [PATCH 7/8] Display output of build scripts in github actions --- .github/workflows/build_test_and_check.yml | 4 ++-- .github/workflows/run_migrations.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_test_and_check.yml b/.github/workflows/build_test_and_check.yml index 1fc0fff63..385d4dd47 100644 --- a/.github/workflows/build_test_and_check.yml +++ b/.github/workflows/build_test_and_check.yml @@ -34,13 +34,13 @@ jobs: steps: - uses: actions/checkout@v4 - name: Build binary - run: cargo build --verbose + run: cargo build -vv test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Run tests - run: cargo test --workspace --verbose + run: cargo test --workspace -vv lint: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/run_migrations.yml b/.github/workflows/run_migrations.yml index 8bb9f52bf..07dceb3b0 100644 --- a/.github/workflows/run_migrations.yml +++ b/.github/workflows/run_migrations.yml @@ -42,7 +42,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Build binary - run: cargo build --verbose + run: cargo build -vv - name: Run migrations run: cargo run migrate - name: Revert migrations From 0f485fb918bf2a4d37e0c8448287f1c6d1bd061a Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Mon, 6 May 2024 12:39:09 +0100 Subject: [PATCH 8/8] Update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6aa60490a..0d3e088d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - [601](https://github.com/thoth-pub/thoth/pull/601) - Upgrade rust to `1.78.0` in production and development `Dockerfile` - [601](https://github.com/thoth-pub/thoth/pull/601) - Upgrade `trunk` to v0.20.0 - - [601](https://github.com/thoth-pub/thoth/pull/601) - Added `-vv` option to build command in Makefile + - [601](https://github.com/thoth-pub/thoth/pull/601) - Added `-vv` option to build command in Makefile and GitHub actions ## [[0.12.4]](https://github.com/thoth-pub/thoth/releases/tag/v0.12.4) - 2024-04-30 ### Changed