Browse Source

feat(nc-gui): Added i18n to ERD and added option to show MM tables

pull/3612/head
Muhammed Mustafa 2 years ago
parent
commit
e755edd98b
  1. 4
      packages/nc-gui/components/erd/SimpleView.vue
  2. 16
      packages/nc-gui/components/erd/View.vue
  3. 11
      packages/nc-gui/lang/en.json

4
packages/nc-gui/components/erd/SimpleView.vue

@ -193,11 +193,11 @@ onBeforeMount(() => {
>
<div class="flex flex-row items-center space-x-1 border-b-1 pb-1 border-gray-100">
<MdiTableLarge class="text-primary" />
<div>Table</div>
<div>{{ $t('objects.table') }}</div>
</div>
<div class="flex flex-row items-center space-x-1 pt-1">
<MdiView class="text-primary" />
<div>SQL View</div>
<div>{{ $t('objects.sqlVIew') }}</div>
</div>
</div>
</VueFlow>

16
packages/nc-gui/components/erd/View.vue

@ -10,12 +10,14 @@ const { metas, getMeta } = useMetas()
let isLoading = $ref(true)
const erdKey = ref(0)
const showMMOption = ref(false)
const config = ref({
showPkAndFk: true,
showViews: false,
showAllColumns: true,
singleTableMode: !!table,
showMMTables: false,
})
const tables = computed(() => {
@ -51,7 +53,7 @@ onMounted(async () => {
const tablesFilteredWithConfig = computed(() =>
tables.value
.filter((table) => !table.mm)
.filter((table) => config.value.showMMTables || (!config.value.showMMTables && !table.mm))
.filter((table) => (!config.value.showViews && table.type !== 'view') || config.value.showViews),
)
@ -88,15 +90,21 @@ watch(
<div class="absolute top-2 right-10 flex-col bg-white py-2 px-4 border-1 border-gray-100 rounded-md z-50 space-y-1">
<div class="flex flex-row items-center">
<a-checkbox v-model:checked="config.showAllColumns" v-e="['c:erd:showAllColumns']" />
<span class="ml-2" style="font-size: 0.65rem">Show columns</span>
<span class="ml-2 select-none" style="font-size: 0.65rem" @dblclick="showMMOption = true">{{
$t('activity.erd.showColumns')
}}</span>
</div>
<div class="flex flex-row items-center">
<a-checkbox v-model:checked="config.showPkAndFk" v-e="['c:erd:showPkAndFk']" />
<span class="ml-2" style="font-size: 0.65rem">Show PK and FK</span>
<span class="ml-2 select-none" style="font-size: 0.65rem">{{ $t('activity.erd.showPkAndFk') }}</span>
</div>
<div v-if="!table" class="flex flex-row items-center">
<a-checkbox v-model:checked="config.showViews" v-e="['c:erd:showViews']" />
<span class="ml-2" style="font-size: 0.65rem">Show SQL views</span>
<span class="ml-2 select-none" style="font-size: 0.65rem">{{ $t('activity.erd.showSqlViews') }}</span>
</div>
<div v-if="!table && showMMOption" class="flex flex-row items-center">
<a-checkbox v-model:checked="config.showMMTables" v-e="['c:erd:showMMTables']" />
<span class="ml-2 select-none" style="font-size: 0.65rem">{{ $t('activity.erd.showMMTables') }}</span>
</div>
</div>
</div>

11
packages/nc-gui/lang/en.json

@ -103,7 +103,8 @@
"editor": "Editor",
"commenter": "Commenter",
"viewer": "Viewer"
}
},
"sqlVIew": "SQL View"
},
"datatype": {
"ID": "ID",
@ -407,7 +408,13 @@
"linkRecord": "Link record",
"addNewRecord": "Add new record",
"useConnectionUrl": "Use Connection URL",
"toggleCommentsDraw": "Toggle comments draw"
"toggleCommentsDraw": "Toggle comments draw",
"erd": {
"showColumns": "Show Columns",
"showPkAndFk": "Show Primary and Foreign Keys",
"showSqlViews": "Show SQL Views",
"showMMTables": "Show MM tables"
}
},
"tooltip": {
"saveChanges": "Save changes",

Loading…
Cancel
Save