change recent database

This commit is contained in:
Jan Prochazka 2021-03-25 13:31:24 +01:00
parent 638b04877d
commit e2dcfe9940
3 changed files with 5 additions and 4 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
});