diff --git a/.docs/changelog.md b/.docs/changelog.md index 0f6f11f524d89b3b7fa9a8a0d037d9565ae7de1c..98a65bf4cebdc205490b2cdfd7e1e0ee72f13984 100644 --- a/.docs/changelog.md +++ b/.docs/changelog.md @@ -18,6 +18,8 @@ author: Martin Weise #### Fixes +* Fixed a validation problem failing to validate UUIDs + in [#471](https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/issues/471). * Fixed the `dist.tar.gz` file not being found in the CI/CD pipeline on `release-` branches in [#465](https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/issues/465). diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3a5d8368d1740da27d76202c59f79a8519e92803..ac86d248266d9429e499623a2dba28691420e4dd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -234,6 +234,7 @@ test-upload-service: image: maven:3-openjdk-17 stage: test script: + - "mvn -f ./dbrepo-metadata-service/pom.xml clean install $MAVEN_OPTS -DskipTests" - "mvn -f ./dbrepo-upload-service/pom.xml clean test $MAVEN_OPTS" test-analyse-service: diff --git a/dbrepo-data-service/rest-service/src/main/java/at/tuwien/endpoints/AccessEndpoint.java b/dbrepo-data-service/rest-service/src/main/java/at/tuwien/endpoints/AccessEndpoint.java index e5a25f174e8a41a942c9ded92cbfcf06e59e1713..3152958f230a545e79ef79c46b3e843aded64e09 100644 --- a/dbrepo-data-service/rest-service/src/main/java/at/tuwien/endpoints/AccessEndpoint.java +++ b/dbrepo-data-service/rest-service/src/main/java/at/tuwien/endpoints/AccessEndpoint.java @@ -15,7 +15,6 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import jakarta.validation.Valid; -import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import lombok.extern.log4j.Log4j2; import org.springframework.beans.factory.annotation.Autowired; @@ -77,7 +76,7 @@ public class AccessEndpoint { schema = @Schema(implementation = ApiErrorDto.class))}), }) public ResponseEntity<Void> create(@NotNull @PathVariable("databaseId") Long databaseId, - @org.hibernate.validator.constraints.UUID @PathVariable("userId") UUID userId, + @PathVariable("userId") UUID userId, @Valid @RequestBody UpdateDatabaseAccessDto data) throws NotAllowedException, DatabaseUnavailableException, DatabaseNotFoundException, RemoteUnavailableException, UserNotFoundException, DatabaseMalformedException, MetadataServiceException { @@ -133,7 +132,7 @@ public class AccessEndpoint { schema = @Schema(implementation = ApiErrorDto.class))}), }) public ResponseEntity<Void> update(@NotNull @PathVariable("databaseId") Long databaseId, - @org.hibernate.validator.constraints.UUID @PathVariable("userId") UUID userId, + @PathVariable("userId") UUID userId, @Valid @RequestBody UpdateDatabaseAccessDto access) throws NotAllowedException, DatabaseUnavailableException, DatabaseNotFoundException, RemoteUnavailableException, UserNotFoundException, DatabaseMalformedException, MetadataServiceException { @@ -190,7 +189,7 @@ public class AccessEndpoint { schema = @Schema(implementation = ApiErrorDto.class))}), }) public ResponseEntity<Void> revoke(@NotNull @PathVariable("databaseId") Long databaseId, - @org.hibernate.validator.constraints.UUID @PathVariable("userId") UUID userId) throws NotAllowedException, + @PathVariable("userId") UUID userId) throws NotAllowedException, DatabaseUnavailableException, DatabaseNotFoundException, RemoteUnavailableException, UserNotFoundException, DatabaseMalformedException, MetadataServiceException { log.debug("endpoint revoke access to database, databaseId={}, userId={}", databaseId, userId); diff --git a/dbrepo-ui/components/subset/SubsetToolbar.vue b/dbrepo-ui/components/subset/SubsetToolbar.vue index db9452feaac3c78e879e3ca157034ea8c87da6dc..0fc5be7c88e0db232ba76bf91cec1f3c351ab5be 100644 --- a/dbrepo-ui/components/subset/SubsetToolbar.vue +++ b/dbrepo-ui/components/subset/SubsetToolbar.vue @@ -12,16 +12,6 @@ v-if="identifier" :text="title" /> <v-spacer /> - <v-btn - v-if="result_visibility && subset && subset.result_number" - class="mb-1 ml-2" - color="tertiary" - :variant="buttonVariant" - :prepend-icon="$vuetify.display.lgAndUp ? 'mdi-download' : null" - :loading="downloadLoading" - @click.stop="downloadSubset"> - {{ ($vuetify.display.lgAndUp ? $t('toolbars.subset.export.data.xl') + ' ' : '') + $t('toolbars.subset.export.data.permanent') }} - </v-btn> <v-btn v-if="canPersistQuery" :loading="loadingSave" @@ -157,15 +147,6 @@ export default { } return formatTimestampUTCLabel(this.subset.created) }, - result_visibility () { - if (!this.database || !this.subset) { - return false - } - if (this.database.is_public) { - return true - } - return this.subset.creator.username === this.username - }, hasReadAccess () { if (!this.access) { return false @@ -239,25 +220,6 @@ export default { .finally(() => { this.loading = false }) - }, - downloadSubset () { - this.downloadLoading = true - const queryService = useQueryService() - queryService.exportCsv(this.$route.params.database_id, this.$route.params.subset_id) - .then((data) => { - const url = URL.createObjectURL(data) - const link = document.createElement('a') - link.href = url - link.download = 'subset.csv' - document.body.appendChild(link) - link.click() - }) - .catch(() => { - this.downloadLoading = false - }) - .finally(() => { - this.downloadLoading = false - }) } } } diff --git a/dbrepo-ui/pages/database/[database_id]/subset/[subset_id]/data.vue b/dbrepo-ui/pages/database/[database_id]/subset/[subset_id]/data.vue index b063317e074d69d97c99812a74cdd22a5d3feceb..d4d707fab871efd1773884d8eb5b23f720fba410 100644 --- a/dbrepo-ui/pages/database/[database_id]/subset/[subset_id]/data.vue +++ b/dbrepo-ui/pages/database/[database_id]/subset/[subset_id]/data.vue @@ -16,6 +16,14 @@ </span> </v-toolbar-title> <v-spacer /> + <v-btn + v-if="canDownload" + :prepend-icon="$vuetify.display.lgAndUp ? 'mdi-download' : null" + variant="flat" + :loading="downloadLoading" + :text="$t('toolbars.table.data.download')" + class="mr-2" + @click.stop="download" /> <v-btn :prepend-icon="$vuetify.display.lgAndUp ? 'mdi-refresh' : null" variant="flat" @@ -52,6 +60,7 @@ export default { data () { return { loadingSubset: false, + downloadLoading: false, items: [ { title: this.$t('navigation.databases'), @@ -90,7 +99,22 @@ export default { return null } return formatTimestampUTCLabel(this.subset.created) - } + }, + canDownload () { + if (!this.result_visibility || !this.subset.id) { + return false + } + return this.subset.id + }, + result_visibility () { + if (!this.database || !this.subset) { + return false + } + if (this.database.is_public) { + return true + } + return this.subset.creator.username === this.username + }, }, mounted () { this.loadSubset() @@ -114,6 +138,28 @@ export default { loadResult () { this.$refs.queryResults.reExecute(this.subset.id) this.$refs.queryResults.reExecuteCount(this.subset.id) + }, + download () { + this.downloadLoading = true + const queryService = useQueryService() + queryService.exportCsv(this.$route.params.database_id, this.subset.id) + .then((data) => { + this.downloadLoading = false + const url = URL.createObjectURL(data) + const link = document.createElement('a') + link.href = url + link.download = 'table.csv' + document.body.appendChild(link) + link.click() + }) + .catch(({code}) => { + this.downloadLoading = false + const toast = useToastInstance() + toast.error(this.$t(code)) + }) + .finally(() => { + this.downloadLoading = false + }) } } }