open new tab - corrent multiTabIndex

This commit is contained in:
Jan Prochazka
2023-03-05 12:14:43 +01:00
parent 15d005be13
commit d283429f40
3 changed files with 11 additions and 9 deletions

View File

@@ -1,6 +1,5 @@
import _ from 'lodash';
import { get } from 'svelte/store';
import { currentDatabase } from '../stores';
import { getCurrentDatabase } from '../stores';
import getConnectionLabel from '../utility/getConnectionLabel';
import openNewTab from '../utility/openNewTab';
@@ -9,11 +8,12 @@ export default function newQuery({
icon = 'img sql-file',
title = undefined,
initialData = undefined,
multiTabIndex = undefined,
...props
} = {}) {
const $currentDatabase = get(currentDatabase);
const connection = _.get($currentDatabase, 'connection') || {};
const database = _.get($currentDatabase, 'name');
const currentDb = getCurrentDatabase();
const connection = currentDb?.connection || {};
const database = currentDb?.name;
const tooltip = `${getConnectionLabel(connection)}\n${database}`;
@@ -23,6 +23,7 @@ export default function newQuery({
icon,
tooltip,
tabComponent,
multiTabIndex,
props: {
...props,
conid: connection._id,