mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
change recent database
This commit is contained in:
parent
638b04877d
commit
e2dcfe9940
@ -1,5 +1,5 @@
|
||||
<script lang="ts" context="module">
|
||||
import { commands } from '../stores';
|
||||
import { commands, visibleCommandPalette } from '../stores';
|
||||
import { get } from 'svelte/store';
|
||||
import { runGroupCommand } from './runCommand';
|
||||
|
||||
@ -38,6 +38,7 @@
|
||||
if (notGroup.length == 1) {
|
||||
const command = notGroup[0];
|
||||
if (command.onClick) command.onClick();
|
||||
else if (command.getSubCommands) visibleCommandPalette.set(command);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -25,11 +25,11 @@
|
||||
import registerCommand from './registerCommand';
|
||||
|
||||
let domInput;
|
||||
let parentCommand;
|
||||
let filter = '';
|
||||
const domItems = {};
|
||||
|
||||
$: selectedIndex = true ? 0 : filter;
|
||||
$: parentCommand = _.isPlainObject($visibleCommandPalette) ? $visibleCommandPalette : null;
|
||||
|
||||
onMount(() => {
|
||||
const oldFocus = document.activeElement;
|
||||
@ -50,7 +50,7 @@
|
||||
|
||||
function handleCommand(command) {
|
||||
if (command.getSubCommands) {
|
||||
parentCommand = command;
|
||||
$visibleCommandPalette = command;
|
||||
domInput.focus();
|
||||
filter = '';
|
||||
selectedIndex = 0;
|
||||
|
@ -8,7 +8,7 @@ currentDatabase.subscribe(value => {
|
||||
recentDatabases.update(list => {
|
||||
const res = [
|
||||
value,
|
||||
..._.compact(list).filter(x => x.name != value.name || x.connection?._id != value.connection?.id),
|
||||
..._.compact(list).filter(x => x.name != value.name || x.connection?._id != value.connection?._id),
|
||||
].slice(0, 10);
|
||||
return res;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user