From 85b33aab88251d0cd43c2357cd1ea7829c974bf2 Mon Sep 17 00:00:00 2001
From: Martin Weise <martin.weise@tuwien.ac.at>
Date: Thu, 11 Aug 2022 14:42:59 +0200
Subject: [PATCH] Updated table schema error message

---
 fda-ui/components/TableSchema.vue                         | 2 +-
 .../_container_id/database/_database_id/table/create.vue  | 8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/fda-ui/components/TableSchema.vue b/fda-ui/components/TableSchema.vue
index 5d4577bc1c..93a96e92cb 100644
--- a/fda-ui/components/TableSchema.vue
+++ b/fda-ui/components/TableSchema.vue
@@ -14,7 +14,7 @@
               v-model="c.name"
               required
               :rules="[v => !!v || $t('Required')]"
-              :error-messages="needsSequence && c.name === 'id' ? ['Column with this name already present'] : []"
+              :error-messages="needsSequence && c.name === 'id' ? ['Column needs to be declared as primary key'] : []"
               label="Name *" />
           </v-col>
           <v-col cols="2">
diff --git a/fda-ui/pages/container/_container_id/database/_database_id/table/create.vue b/fda-ui/pages/container/_container_id/database/_database_id/table/create.vue
index 2345caf0ab..248ba2e426 100644
--- a/fda-ui/pages/container/_container_id/database/_database_id/table/create.vue
+++ b/fda-ui/pages/container/_container_id/database/_database_id/table/create.vue
@@ -20,8 +20,8 @@
                 name="name"
                 label="Table Name *"
                 autocomplete="off"
-                :rules="[v => !!v || $t('Required')]"
-                :error-messages="!validTableName ? ['Table with this name exists!'] : []"
+                :rules="[v => notEmpty(v) || $t('Required')]"
+                :error-messages="!validTableName ? ['Table with this name exists'] : []"
                 required />
             </v-col>
           </v-row>
@@ -32,7 +32,7 @@
                 name="description"
                 label="Description *"
                 autocomplete="off"
-                :rules="[v => !!v || $t('Required')]"
+                :rules="[v => notEmpty(v) || $t('Required')]"
                 required />
             </v-col>
           </v-row>
@@ -59,6 +59,7 @@
 
 <script>
 import TableSchema from '@/components/TableSchema'
+const { notEmpty } = require('@/utils')
 export default {
   components: {
     TableSchema
@@ -113,6 +114,7 @@ export default {
     this.listTables()
   },
   methods: {
+    notEmpty,
     submit () {
       this.$refs.form.validate()
     },
-- 
GitLab