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]" > - +