Skip to content
Snippets Groups Projects
Unverified Commit 99ca05a9 authored by Martin Weise's avatar Martin Weise
Browse files

Merge branch 'dev' into 286-use-keycloak-for-roles-and-user-management-insecure

parents 67b8849f 31fd9d5c
Branches
Tags
2 merge requests!163Relase 1.3.0,!155Added readme to authentication service and added eureka service
......@@ -117,7 +117,7 @@ class QueryService {
exportSubset (id, databaseId, queryId) {
return new Promise((resolve, reject) => {
api.put(`/api/container/${id}/database/${databaseId}/query/${queryId}/export`, {}, { headers: { Accept: 'text/csv' } })
api.get(`/api/container/${id}/database/${databaseId}/query/${queryId}/export`, { headers: { Accept: 'text/csv' } })
.then((response) => {
resolve(response.data)
})
......
......@@ -31,6 +31,12 @@
<v-btn v-if="canImportCsv" class="mr-2 mb-1" :to="`/container/${$route.params.container_id}/database/${$route.params.database_id}/table/import`">
<v-icon left>mdi-cloud-upload</v-icon> Import .csv
</v-btn>
<DownloadButton
v-if="database?.identifier"
:pid="database.identifier.id"
class="mr-2 mb-1">
<v-icon left>mdi-code-tags</v-icon> Identifier .xml
</DownloadButton>
<v-btn v-if="canCreateSubset" color="secondary" class="mb-1 white--text" :to="`/container/${$route.params.container_id}/database/${$route.params.database_id}/query/create`">
<v-icon left>mdi-wrench</v-icon> Create Subset
</v-btn>
......@@ -65,7 +71,10 @@
</template>
<script>
import DownloadButton from '@/components/identifier/DownloadButton'
export default {
components: { DownloadButton },
data () {
return {
tab: null,
......@@ -117,20 +126,6 @@ export default {
return false
}
return this.database.owner.username === this.user.username
},
config () {
if (this.token === null) {
return {}
}
return {
headers: { Authorization: `Bearer ${this.token}` }
}
},
silentConfig () {
return {
headers: this.config.headers,
progress: false
}
}
}
}
......
<template>
<v-btn
:loading="loading"
v-bind="$attrs"
@click.stop="download">
<slot />
</v-btn>
</template>
<script>
export default {
props: {
pid: {
type: Number,
default () {
return null
}
},
contentType: {
type: String,
default () {
return 'text/xml'
}
},
filename: {
type: String,
default () {
return 'identifier.xml'
}
}
},
data () {
return {
loading: false
}
},
computed: {
token () {
return this.$store.state.token
},
config () {
if (this.token === null) {
return {
headers: { Accept: 'application/json' }
}
}
return {
headers: { Authorization: `Bearer ${this.token}`, Accept: 'application/json' }
}
}
},
methods: {
async download () {
this.loading = true
try {
const config = this.config
config.headers.Accept = this.contentType
const res = await this.$axios.get(`/api/pid/${this.pid}`, config)
console.debug('export identifier', res)
const url = window.URL.createObjectURL(new Blob([res.data]))
const link = document.createElement('a')
link.href = url
link.setAttribute('download', this.filename)
document.body.appendChild(link)
link.click()
} catch (err) {
console.error('Could not export identifier', err)
this.$toast.error('Could not export identifier')
this.error = true
}
this.loading = false
}
}
}
</script>
<style scoped>
</style>
......@@ -85,7 +85,7 @@
</template>
<v-list>
<v-list-item
v-for="locale in availableLocales"
v-for="locale in []"
:key="locale.code"
:to="switchLocalePath(locale.code)">
<v-list-item-title>{{ locale.name }}</v-list-item-title>
......
......@@ -8,7 +8,7 @@
"signup": "Registrieren"
},
"databases": {
"recent": "Kürzliche Datenbanken",
"recent": "Neue Datenbanken",
"tooltip": {
"private": "Privat",
"public": "Öffentlich"
......
......@@ -245,7 +245,6 @@ export default {
loading: false,
loadingDelete: false,
editDbDialog: false,
metadataLoading: false,
items: [
{ text: 'Databases', to: '/container', activeClass: '' },
{
......@@ -386,26 +385,6 @@ export default {
this.editDbDialog = false
this.editVisibilityDialog = false
},
async download () {
this.metadataLoading = true
try {
const config = this.config
config.headers.Accept = 'text/xml'
const res = await this.$axios.get(`/api/pid/${this.database.identifier.id}`, config)
console.debug('export identifier', res)
const url = window.URL.createObjectURL(new Blob([res.data]))
const link = document.createElement('a')
link.href = url
link.setAttribute('download', 'identifier.xml')
document.body.appendChild(link)
link.click()
} catch (err) {
console.error('Could not export identifier', err)
this.$toast.error('Could not export identifier')
this.error = true
}
this.metadataLoading = false
},
async deleteIdentifier () {
if (!this.database.identifier.id) {
return
......
......@@ -11,71 +11,25 @@
</v-toolbar-title>
<v-spacer />
<v-toolbar-title>
<v-btn v-if="!query.is_persisted && canWrite" :loading="loadingSave" class="mb-1 mr-2" @click.stop="save">
<v-btn v-if="!loadingQuery && !query.is_persisted && canWrite" :loading="loadingSave" class="mb-1" @click.stop="save">
<v-icon left>mdi-content-save-outline</v-icon> Save
</v-btn>
<v-btn v-if="query.is_persisted && !query.identifier && canWrite" class="mb-1 mr-2" color="primary" :disabled="!executionUTC" @click.stop="openDialog()">
<v-btn v-if="query.is_persisted && !query.identifier && canWrite" class="mb-1 ml-2" color="primary" :disabled="!executionUTC" @click.stop="openDialog()">
<v-icon left>mdi-content-save-outline</v-icon> Get PID
</v-btn>
<v-btn v-if="result_visibility && !query.identifier && query.result_number" class="mb-1" :loading="downloadLoading" @click.stop="downloadSubset">
<v-btn v-if="result_visibility && query.result_number" class="mb-1 ml-2" :loading="downloadLoading" @click.stop="downloadSubset">
<v-icon left>mdi-download</v-icon> Data .csv
</v-btn>
<v-btn v-if="result_visibility && query.identifier && query.result_number" class="mb-1" :loading="downloadLoading" @click.stop="downloadMetadata('text/csv')">
<v-icon left>mdi-download</v-icon> Data .csv
</v-btn>
<v-btn
v-if="query.identifier"
color="secondary"
class="ml-2"
:loading="metadataLoading"
@click.stop="downloadMetadata('text/xml')">
<v-icon left>mdi-code-tags</v-icon> Metadata .xml
</v-btn>
<DownloadButton v-if="query.identifier" :pid="query.identifier.id" class="mb-1 ml-2">
<v-icon left>mdi-code-tags</v-icon> Identifier .xml
</DownloadButton>
</v-toolbar-title>
</v-toolbar>
<v-card flat tile>
<v-card-title>
Subset Information
</v-card-title>
<v-card v-if="query && query.identifier" flat tile>
<v-card-title>Identifier</v-card-title>
<v-card-text>
<v-alert
v-if="!loadingQuery && !query.is_persisted && canWrite"
border="left"
color="info">
Query is not yet saved in the query store, <a @click="save">save</a> it to view it later.
</v-alert>
<v-list dense>
<v-list-item>
<v-list-item-icon>
<v-icon v-if="!database">mdi-database-outline</v-icon>
<v-icon v-if="database" :color="database.is_public ? 'success' : 'error'">mdi-database-outline</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>
Database Visibility
</v-list-item-title>
<v-list-item-content>
<v-skeleton-loader v-if="!database" type="text" class="skeleton-small" />
<span v-if="database">{{ database.is_public ? 'Public' : 'Private' }}</span>
</v-list-item-content>
<v-list-item-title class="mt-2">
Database Name
</v-list-item-title>
<v-list-item-content>
<v-skeleton-loader v-if="!database" type="text" class="skeleton-small" />
<span v-if="database">{{ database.name }}</span>
</v-list-item-content>
<div v-if="database && database.identifier">
<v-list-item-title class="mt-2">
Database License
</v-list-item-title>
<v-list-item-content>
<a :href="database.identifier.license.uri">{{ database.identifier.license.identifier }}</a>
</v-list-item-content>
</div>
</v-list-item-content>
</v-list-item>
<v-list-item v-if="query && query.identifier">
<v-list-item-icon>
<v-icon>mdi-lock-clock</v-icon>
</v-list-item-icon>
......@@ -140,6 +94,52 @@
<Citation :pid="pid" />
</v-list-item-content>
</v-list-item>
</v-list>
</v-card-text>
</v-card>
<v-divider v-if="query && query.identifier" />
<v-card flat tile>
<v-card-title>
Subset Information
</v-card-title>
<v-card-text>
<v-alert
v-if="!loadingQuery && !query.is_persisted && canWrite"
border="left"
color="info">
Query is not yet saved in the query store, <a @click="save">save</a> it to view it later.
</v-alert>
<v-list dense>
<v-list-item>
<v-list-item-icon>
<v-icon v-if="!database">mdi-database-outline</v-icon>
<v-icon v-if="database" :color="database.is_public ? 'success' : 'error'">mdi-database-outline</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>
Database Visibility
</v-list-item-title>
<v-list-item-content>
<v-skeleton-loader v-if="!database" type="text" class="skeleton-small" />
<span v-if="database">{{ database.is_public ? 'Public' : 'Private' }}</span>
</v-list-item-content>
<v-list-item-title class="mt-2">
Database Name
</v-list-item-title>
<v-list-item-content>
<v-skeleton-loader v-if="!database" type="text" class="skeleton-small" />
<span v-if="database">{{ database.name }}</span>
</v-list-item-content>
<div v-if="database && database.identifier">
<v-list-item-title class="mt-2">
Database License
</v-list-item-title>
<v-list-item-content>
<a :href="database.identifier.license.uri">{{ database.identifier.license.identifier }}</a>
</v-list-item-content>
</div>
</v-list-item-content>
</v-list-item>
<v-list-item>
<v-list-item-icon>
<v-icon>mdi-text-short</v-icon>
......@@ -202,6 +202,7 @@
</v-list>
</v-card-text>
</v-card>
<v-divider />
<QueryResults
id="query-results"
ref="queryResults"
......@@ -221,6 +222,7 @@
import Persist from '@/components/dialogs/Persist'
import Citation from '@/components/identifier/Citation'
import Banner from '@/components/identifier/Banner'
import DownloadButton from '@/components/identifier/DownloadButton'
import { formatTimestampUTCLabel, formatDateUTC } from '@/utils'
import QueryService from '@/api/query.service'
......@@ -229,7 +231,8 @@ export default {
components: {
Persist,
Citation,
Banner
Banner,
DownloadButton
},
data () {
return {
......@@ -262,7 +265,6 @@ export default {
loadingDatabase: false,
loadingIdentifier: false,
loadingQuery: true,
metadataLoading: false,
downloadLoading: false,
error: false,
promises: []
......@@ -375,30 +377,6 @@ export default {
this.$refs.queryResults.reExecute(this.query.id)
this.$refs.queryResults.reExecuteCount(this.query.id)
},
downloadMetadata (mime) {
if (mime === 'text/csv') {
this.downloadLoading = true
} else if (mime === 'text/xml') {
this.metadataLoading = true
}
QueryService.exportMetadata(this.query.identifier.id, mime)
.then((metadata) => {
const url = window.URL.createObjectURL(new Blob([metadata]))
const link = document.createElement('a')
link.href = url
if (mime === 'text/csv') {
link.setAttribute('download', 'subset.csv')
} else if (mime === 'text/xml') {
link.setAttribute('download', 'identifier.xml')
}
document.body.appendChild(link)
link.click()
})
.finally(() => {
this.downloadLoading = false
this.metadataLoading = false
})
},
downloadSubset () {
this.downloadLoading = true
QueryService.exportSubset(this.$route.params.container_id, this.$route.params.database_id, this.$route.params.query_id)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment