From 4b761c54004fa97f30f5c13459690d22a1416102 Mon Sep 17 00:00:00 2001
From: Martin Weise <martin.weise@tuwien.ac.at>
Date: Tue, 7 Jan 2025 10:59:53 +0100
Subject: [PATCH] Simplified interface

---
 .../components/database/DatabaseCreate.vue    | 51 ++++++++++---------
 dbrepo-ui/locales/en-US.json                  | 18 ++++---
 2 files changed, 37 insertions(+), 32 deletions(-)

diff --git a/dbrepo-ui/components/database/DatabaseCreate.vue b/dbrepo-ui/components/database/DatabaseCreate.vue
index cd85489790..d0f386b088 100644
--- a/dbrepo-ui/components/database/DatabaseCreate.vue
+++ b/dbrepo-ui/components/database/DatabaseCreate.vue
@@ -54,30 +54,12 @@
             </v-col>
           </v-row>
           <v-row>
-            <v-col
-              md="6">
-              <v-select
-                v-model="payload.is_public"
-                name="public"
-                :label="$t('pages.database.subpages.create.data.label')"
-                :hint="$t('pages.database.subpages.create.data.hint')"
-                persistent-hint
-                :variant="inputVariant"
-                :items="visibilityOptions"
-                item-title="name"
-                item-value="value"
-                :rules="[v => !!v || $t('validation.required')]"
-                return-object
-                required>
-              </v-select>
-            </v-col>
-            <v-col
-              md="6">
+            <v-col>
               <v-select
-                v-model="payload.is_schema_public"
-                name="schema-public"
-                :label="$t('pages.database.subpages.create.schema.label')"
-                :hint="$t('pages.database.subpages.create.schema.hint')"
+                v-model="mode"
+                name="mode"
+                :label="$t('pages.database.subpages.create.visibility.label')"
+                :hint="$t('pages.database.subpages.create.visibility.hint')"
                 persistent-hint
                 :variant="inputVariant"
                 :items="visibilityOptions"
@@ -86,6 +68,19 @@
                 :rules="[v => !!v || $t('validation.required')]"
                 return-object
                 required>
+                <template
+                  v-slot:append-inner>
+                  <v-tooltip
+                    location="bottom">
+                    <template
+                      v-slot:activator="{ props }">
+                      <v-icon
+                        v-bind="props"
+                        icon="mdi-help-circle-outline" />
+                    </template>
+                    {{ mode.hint }}
+                  </v-tooltip>
+                </template>
               </v-select>
             </v-col>
           </v-row>
@@ -125,14 +120,17 @@ export default {
       engines: [],
       visibilityOptions: [
         {
-          name: this.$t('toolbars.database.public'),
+          name: this.$t('pages.database.subpages.create.visibility.public.label'),
+          hint: this.$t('pages.database.subpages.create.visibility.public.hint'),
           value: true
         },
         {
-          name: this.$t('toolbars.database.private'),
+          name: this.$t('pages.database.subpages.create.visibility.private.label'),
+          hint: this.$t('pages.database.subpages.create.visibility.private.hint'),
           value: false
         }
       ],
+      mode: true,
       payload: {
         name: null,
         is_public: true,
@@ -151,6 +149,7 @@ export default {
     }
   },
   mounted () {
+    this.mode = this.visibilityOptions[0]
     this.fetchContainers()
   },
   methods: {
@@ -186,6 +185,8 @@ export default {
     create () {
       this.loading = true
       this.payload.container_id = this.engine.id
+      this.payload.is_public = this.mode.value
+      this.payload.is_schema_public = this.mode.value
       const databaseService = useDatabaseService()
       databaseService.create(this.payload)
         .then(async (database) => {
diff --git a/dbrepo-ui/locales/en-US.json b/dbrepo-ui/locales/en-US.json
index 162f4c09d2..655ec2a345 100644
--- a/dbrepo-ui/locales/en-US.json
+++ b/dbrepo-ui/locales/en-US.json
@@ -653,13 +653,17 @@
             "label": "Engine",
             "hint": "Required"
           },
-          "data": {
-            "label": "Data Visibility",
-            "hint": "Required"
-          },
-          "schema": {
-            "label": "Schema Visibility",
-            "hint": "Required"
+          "visibility": {
+            "label": "Visibility",
+            "hint": "Required",
+            "public": {
+              "label": "Public",
+              "hint": "Everything is visible to the public, e.g. to publish data used in a open-access paper. You can later update the visibility of data."
+            },
+            "private": {
+              "label": "Private",
+              "hint": "Nothing is visible to anyone without dedicated read-access, e.g. to work on a dataset. You can later update the visibility of data."
+            }
           },
           "submit": {
             "text": "Create"
-- 
GitLab