Browse Source

refactor(nc-gui): remove keys from erd views

pull/3612/head
braks 2 years ago committed by Muhammed Mustafa
parent
commit
48e3043532
  1. 9
      packages/nc-gui/components/erd/SimpleView.vue
  2. 3
      packages/nc-gui/components/erd/View.vue

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

@ -6,8 +6,6 @@ import { UITypes } from 'nocodb-sdk'
import dagre from 'dagre' import dagre from 'dagre'
import TableNode from './TableNode.vue' import TableNode from './TableNode.vue'
import RelationEdge from './RelationEdge.vue' import RelationEdge from './RelationEdge.vue'
import MdiView from '~icons/mdi/eye-circle-outline'
import MdiTableLarge from '~icons/mdi/table-large'
interface Props { interface Props {
tables: any[] tables: any[]
@ -26,12 +24,14 @@ const { metasWithIdAsKey } = useMetas()
const { $destroy, fitView } = useVueFlow() const { $destroy, fitView } = useVueFlow()
const isTransitioning = ref(true) const { $destroy, fitView } = useVueFlow()
const isTransitioning = ref(true)
const nodes = ref<Node[]>([]) const nodes = ref<Node[]>([])
const edges = ref<Edge[]>([]) const edges = ref<Edge[]>([])
let dagreGraph: dagre.graphlib.Graph let dagreGraph: dagre.graphlib.Graph
const initDagre = () => { const initDagre = () => {
dagreGraph = new dagre.graphlib.Graph() dagreGraph = new dagre.graphlib.Graph()
dagreGraph.setDefaultEdgeLabel(() => ({})) dagreGraph.setDefaultEdgeLabel(() => ({}))
@ -137,6 +137,7 @@ const populateEdges = () => {
const connectNonConnectedNodes = () => { const connectNonConnectedNodes = () => {
const connectedNodes = new Set<string>() const connectedNodes = new Set<string>()
edges.value.forEach((edge) => { edges.value.forEach((edge) => {
connectedNodes.add(edge.source) connectedNodes.add(edge.source)
connectedNodes.add(edge.target) connectedNodes.add(edge.target)
@ -229,7 +230,7 @@ useEventListener('transitionend', () => {
<div>{{ $t('objects.table') }}</div> <div>{{ $t('objects.table') }}</div>
</div> </div>
<div class="flex flex-row items-center space-x-1 pt-1"> <div class="flex flex-row items-center space-x-1 pt-1">
<MdiView class="text-primary" /> <MdiEyeCircleOutline class="text-primary" />
<div>{{ $t('objects.sqlVIew') }}</div> <div>{{ $t('objects.sqlVIew') }}</div>
</div> </div>
</div> </div>

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

@ -11,7 +11,6 @@ const tables = ref<TableType>([])
const { metas, getMeta } = useMetas() const { metas, getMeta } = useMetas()
let isLoading = $ref(true) let isLoading = $ref(true)
const erdKey = ref(0)
const showAdvancedOptions = ref(false) const showAdvancedOptions = ref(false)
const config = ref({ const config = ref({
@ -104,7 +103,7 @@ watch(
</div> </div>
</div> </div>
<div v-else class="relative h-full"> <div v-else class="relative h-full">
<ErdSimpleView :key="erdKey" :tables="tables" :config="config" /> <ErdSimpleView :tables="tables" :config="config" />
<div <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 nc-erd-context-menu z-50" 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 nc-erd-context-menu z-50"

Loading…
Cancel
Save