diff --git a/.docs/changelog.md b/.docs/changelog.md index 5078f2159c18592f6454366f6938e02dda094e01..e3f7a573e4c1ff84c500f1215b548710a6040c83 100644 --- a/.docs/changelog.md +++ b/.docs/changelog.md @@ -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 diff --git a/dbrepo-auth-service/listeners/target/create-event-listener.jar b/dbrepo-auth-service/listeners/target/create-event-listener.jar index e6ee56c50203b9ba4e75d7964141c3c353ff933d..7e717c5aada04fa7e157ec8dd9f04333955cf816 100644 Binary files a/dbrepo-auth-service/listeners/target/create-event-listener.jar and b/dbrepo-auth-service/listeners/target/create-event-listener.jar differ diff --git a/dbrepo-ui/components/database/DatabaseToolbar.vue b/dbrepo-ui/components/database/DatabaseToolbar.vue index 5416d1b5ec1e692eebe8f85c3b22b8c82b8615a3..642f75a529194b2524cb1e5bd9cf08a68013782f 100644 --- a/dbrepo-ui/components/database/DatabaseToolbar.vue +++ b/dbrepo-ui/components/database/DatabaseToolbar.vue @@ -162,9 +162,6 @@ export default { return this.roles.includes('create-table') }, canViewSubsets () { - if (!this.cacheUser) { - return false - } return this.hasReadAccess }, isOwner () { diff --git a/dbrepo-ui/components/subset/Builder.vue b/dbrepo-ui/components/subset/Builder.vue index 4e4fe21eecb64311937e737fd2a0f7aeaf2f56f3..24e91eec87ae82b75a35aca9f8a9adef4df63c5c 100644 --- a/dbrepo-ui/components/subset/Builder.vue +++ b/dbrepo-ui/components/subset/Builder.vue @@ -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 diff --git a/dbrepo-ui/components/subset/SubsetList.vue b/dbrepo-ui/components/subset/SubsetList.vue index df0948372eed1dbf60260b6f3bd835e51dd93d2a..8c5efe1022189ee56340e419ac6e3e0a080db70b 100644 --- a/dbrepo-ui/components/subset/SubsetList.vue +++ b/dbrepo-ui/components/subset/SubsetList.vue @@ -1,5 +1,17 @@ <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 diff --git a/dbrepo-ui/components/table/TableSchema.vue b/dbrepo-ui/components/table/TableSchema.vue index 62d88647e4c1ee39a51be16ef2e6f50a6c739e86..d6b9c138853e9638ad5291bfd30ccf6b6da09e07 100644 --- a/dbrepo-ui/components/table/TableSchema.vue +++ b/dbrepo-ui/components/table/TableSchema.vue @@ -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 } }, diff --git a/dbrepo-ui/components/table/TableToolbar.vue b/dbrepo-ui/components/table/TableToolbar.vue index 72d20ebdc259ab52a2d790594b3c2776dcc790d4..70c2165b3078294bacd5a47a9e6caa6a6d3072f2 100644 --- a/dbrepo-ui/components/table/TableToolbar.vue +++ b/dbrepo-ui/components/table/TableToolbar.vue @@ -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') diff --git a/dbrepo-ui/composables/database-service.ts b/dbrepo-ui/composables/database-service.ts index 204f99dd351d1b80df3033e8fda0fd4b21eb235e..77c958fc9266ec0fe94dd7bdc7db7255c03c4990 100644 --- a/dbrepo-ui/composables/database-service.ts +++ b/dbrepo-ui/composables/database-service.ts @@ -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 { diff --git a/dbrepo-ui/pages/database/[database_id]/table/[table_id]/import.vue b/dbrepo-ui/pages/database/[database_id]/table/[table_id]/import.vue index efbcd6accf7d3d896769241a7de0d1325a30b3a4..260f2113d1828eb284477f48c021138f4c75ffc0 100644 --- a/dbrepo-ui/pages/database/[database_id]/table/[table_id]/import.vue +++ b/dbrepo-ui/pages/database/[database_id]/table/[table_id]/import.vue @@ -1,7 +1,8 @@ <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() diff --git a/dbrepo-ui/pages/database/[database_id]/table/create/dataset.vue b/dbrepo-ui/pages/database/[database_id]/table/create/dataset.vue index 56db5fdc374cdfd683eb00328f86534cd9fd81bf..088190ac5a2fe8a8c9deb5d943c2069b216d2725 100644 --- a/dbrepo-ui/pages/database/[database_id]/table/create/dataset.vue +++ b/dbrepo-ui/pages/database/[database_id]/table/create/dataset.vue @@ -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" diff --git a/helm/dbrepo/files/create-event-listener.jar b/helm/dbrepo/files/create-event-listener.jar index e6ee56c50203b9ba4e75d7964141c3c353ff933d..7e717c5aada04fa7e157ec8dd9f04333955cf816 100644 Binary files a/helm/dbrepo/files/create-event-listener.jar and b/helm/dbrepo/files/create-event-listener.jar differ