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

Merge branch 'dev'

parents 789daecb f795f9fc
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ author: Martin Weise
#### Changes
* Added a visual filter for displaying starred/unstarred/all subsets in the UI.
* Specified image platform as `linux/amd64` in `docker-compose.yaml` deployment to enable host platform (e.g. ARM) to
emulate it.
* Specified resource limits in the `docker-compose.yaml` deployment
......
No preview for this file type
......@@ -162,9 +162,6 @@ export default {
return this.roles.includes('create-table')
},
canViewSubsets () {
if (!this.cacheUser) {
return false
}
return this.hasReadAccess
},
isOwner () {
......
......@@ -590,7 +590,7 @@ export default {
return
}
const tid = this.$route.query.tid
const selection = this.tables.filter(t => t.id === tid)
const selection = this.datasources.filter(t => t.id === tid)
if (selection.length === 0) {
console.warn('Failed to find table with id', tid)
return
......
<template>
<div>
<v-toolbar
class="pr-2"
color="secondary"
flat>
<v-spacer />
<v-btn
:variant="buttonVariant"
:prepend-icon="filterIcon"
@click="switchFilter">
{{ filterText }}
</v-btn>
</v-toolbar>
<v-card
v-if="!loadingSubsets && subsets.length === 0"
variant="flat"
......@@ -14,6 +26,7 @@
<Loading />
</v-list-item>
<div
v-if="!loadingSubsets"
v-for="(subset, i) in subsets"
:key="`q-${i}`">
<v-divider v-if="i !== 0" class="mx-4" />
......@@ -45,6 +58,7 @@ export default {
loadingSubsets: false,
loadingIdentifiers: false,
subsets: [],
filter: null,
cacheStore: useCacheStore()
}
},
......@@ -58,8 +72,35 @@ export default {
isDarkTheme () {
return this.$vuetify.theme.global.name.toLowerCase().startsWith('dark')
},
buttonVariant () {
const runtimeConfig = useRuntimeConfig()
return this.$vuetify.theme.global.name.toLowerCase().endsWith('contrast') ? runtimeConfig.public.variant.button.contrast : runtimeConfig.public.variant.button.normal
},
colorVariant () {
return this.isContrastTheme ? '' : (this.isDarkTheme ? 'tertiary' : 'secondary')
},
filterIcon () {
if (this.filter === true) {
return 'mdi-star'
}
if (this.filter === false) {
return 'mdi-star-off'
}
return 'mdi-star-outline'
},
filterText () {
if (this.filter === true) {
return 'Starred'
}
if (this.filter === false) {
return 'Not Starred'
}
return 'All'
}
},
watch: {
filter () {
this.loadQueries()
}
},
mounted () {
......@@ -69,7 +110,7 @@ export default {
loadQueries () {
this.loadingSubsets = true
const queryService = useQueryService()
queryService.findAll(this.$route.params.database_id, true)
queryService.findAll(this.$route.params.database_id, this.filter)
.then((subsets) => {
this.loadingSubsets = false
this.subsets = subsets.map(subset => {
......@@ -87,6 +128,17 @@ export default {
toast.error(this.$t(code))
})
},
switchFilter () {
if (this.filter === true) {
this.filter = false
return
}
if (this.filter === false) {
this.filter = null
return
}
this.filter = true
},
title (subset) {
if (subset.identifiers.length === 0) {
return subset.query
......
......@@ -169,6 +169,7 @@
</v-col>
</v-row>
<v-row
v-if="columns.length !== 0"
dense>
<v-col>
<v-btn
......@@ -181,7 +182,8 @@
@click="addColumn()" />
</v-col>
</v-row>
<v-row>
<v-row
v-if="columns.length !== 0">
<v-col>
<v-btn
color="secondary"
......@@ -250,6 +252,9 @@ export default {
return this.$vuetify.theme.global.name.toLowerCase().endsWith('contrast') ? runtimeConfig.public.variant.button.contrast : runtimeConfig.public.variant.button.normal
},
showPrimaryKeyWarning () {
if (this.columns.length === 0) {
return false
}
return this.columns.filter(c => c.primary_key).length === 0
}
},
......
......@@ -117,11 +117,14 @@ export default {
return this.roles.includes('update-table') && this.table.owner.id === this.cacheUser.uid
},
isOwner () {
if (!this.cacheUser || !this.database) {
return false
}
const databaseService = useDatabaseService()
return databaseService.isOwner(this.database, this.cacheUser)
},
canCreateView () {
if (!this.roles || !this.cacheUser || !this.isOwner) {
if (!this.roles || !this.isOwner) {
return false
}
return this.roles.includes('create-database-view')
......
......@@ -214,7 +214,7 @@ export const useDatabaseService = (): any => {
if (!database || !user) {
return false
}
return database.owner.id === user.id
return database.owner.id === user.uid
}
return {
......
<template>
<div
v-if="canInsertTableData">
<v-toolbar flat>
<div>
<v-toolbar
v-if="hasReadAccess"
flat>
<v-btn
class="mr-2"
variant="plain"
......@@ -12,6 +13,7 @@
:text="title" />
</v-toolbar>
<v-card
v-if="canInsertTableData"
variant="flat"
rounded="0">
<v-card-text>
......@@ -84,6 +86,9 @@ export default {
access () {
return this.cacheStore.getAccess
},
hasReadAccess () {
return this.access
},
title () {
if (!this.table) {
return this.$t('pages.table.import.title')
......@@ -91,7 +96,7 @@ export default {
return this.$t('pages.table.import.title') + ' ' + this.table.name
},
canInsertTableData () {
if (!this.table || !this.access || !this.cacheUser || !this.roles || !this.roles.includes('insert-table-data')) {
if (!this.table || !this.cacheUser || !this.roles || !this.roles.includes('insert-table-data') || !this.hasReadAccess) {
return false
}
const userService = useUserService()
......
......@@ -155,8 +155,7 @@
</v-stepper-header>
<v-stepper-window
direction="vertical">
<v-container
v-if="step >= 4">
<v-container>
<TableSchema
ref="schema"
:back="false"
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment