From 25a113b69ba5d2fc3307ec2eeec05732cf979b4c Mon Sep 17 00:00:00 2001 From: dataeaseShu <106045316+dataeaseShu@users.noreply.github.com> Date: Mon, 26 Sep 2022 16:36:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0sql=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E6=95=B0=E6=8D=AE=E5=8F=82=E8=80=83=E4=B8=AD=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E8=A1=A8=E5=92=8C=E5=AD=97=E6=AE=B5=E4=B8=BA0=20?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=E8=BF=9B=E5=85=A5=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=90=8E=E5=9B=9E=E9=80=80=E5=AE=9A=E4=BD=8D?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/dataset/add/AddSQL.vue | 19 +++++++++---------- frontend/src/views/dataset/group/Group.vue | 18 +++++++++++++++--- frontend/src/views/dataset/index.vue | 2 +- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/frontend/src/views/dataset/add/AddSQL.vue b/frontend/src/views/dataset/add/AddSQL.vue index 7837dc9077..e1269f9168 100644 --- a/frontend/src/views/dataset/add/AddSQL.vue +++ b/frontend/src/views/dataset/add/AddSQL.vue @@ -122,7 +122,7 @@ {{ $t('deDataset.to_start_using') }} -
+
{ this.calHeight() } this.calHeight() - this.initDataSource() + await this.initDataSource() this.$refs.myCm.codemirror.on('keypress', () => { this.$refs.myCm.codemirror.showHint() }) - this.initTableInfo() }, created() { @@ -562,8 +557,11 @@ export default { } } } + this.tableLoading = true post('/datasource/getTables/' + this.dataSource, {}).then((response) => { this.tableData = response.data + }).finally(() => { + this.tableLoading = false }) }, calHeight: _.debounce(function() { @@ -572,7 +570,7 @@ export default { this.height = currentHeight - sqlHeight - 56 - 54 - 36 - 64 }, 200), initDataSource() { - listDatasource().then((response) => { + return listDatasource().then((response) => { this.options = response.data.filter((item) => item.type !== 'api') }) }, @@ -582,6 +580,7 @@ export default { getTable(this.param.tableId).then((response) => { const table = response.data this.dataSource = table.dataSourceId + this.changeDatasource() this.mode = table.mode + '' if (JSON.parse(table.info).isBase64Encryption) { diff --git a/frontend/src/views/dataset/group/Group.vue b/frontend/src/views/dataset/group/Group.vue index 9261a9e947..73e0212b3f 100644 --- a/frontend/src/views/dataset/group/Group.vue +++ b/frontend/src/views/dataset/group/Group.vue @@ -419,7 +419,11 @@ export default { type: Object, required: false, default: null - } + }, + currentNodeId: { + type: String, + default: '' + }, }, data() { return { @@ -542,11 +546,16 @@ export default { queryAuthModel({ modelType: 'dataset' }, true) .then((res) => { localStorage.setItem('dataset-tree', JSON.stringify(res.data)) - this.tData = res.data + this.tData = res.data || [] this.$nextTick(() => { this.$refs.datasetTreeRef?.filter(this.filterText) if (id && name.includes(this.filterText)) { this.dfsTableData(this.tData, id) + } else { + const currentNodeId = sessionStorage.getItem('dataset-current-node') + if (currentNodeId) { + this.dfsTableData(this.tData, currentNodeId) + } } }) }) @@ -555,6 +564,9 @@ export default { }) this.refresh() }, + beforeDestroy() { + sessionStorage.setItem('dataset-current-node', this.currentNodeId) + }, methods: { dfsTableData(arr, id) { arr.some((ele) => { @@ -776,7 +788,7 @@ export default { .then((res) => { localStorage.setItem('dataset-tree', JSON.stringify(res.data)) if (!userCache) { - this.tData = res.data + this.tData = res.data || [] } this.$nextTick(() => { this.$refs.datasetTreeRef?.filter(this.filterText) diff --git a/frontend/src/views/dataset/index.vue b/frontend/src/views/dataset/index.vue index 2aa38bba0c..6eb63a6f56 100644 --- a/frontend/src/views/dataset/index.vue +++ b/frontend/src/views/dataset/index.vue @@ -3,7 +3,7 @@ v-loading="$store.getters.loadingMap[$store.getters.currentPath]" > - +