Skip to content
Snippets Groups Projects
Verified Commit a09e4baf authored by Martin Weise's avatar Martin Weise
Browse files

Hotfix the UUID validation and move the subset download

parent d8ba9d8c
Branches
Tags
3 merge requests!363Resolve "Hotfix query execution",!360Resolve "Hotfix: No validator could be found for constraint 'org.hibernate.validator.constraints.UUID'",!359Hotfix the UUID validation and move the subset download
......@@ -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).
......
......@@ -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:
......
......@@ -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);
......
......@@ -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
})
}
}
}
......
......@@ -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
})
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment