mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-25 13:16:00 +00:00
change recent database
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts" context="module">
|
<script lang="ts" context="module">
|
||||||
import { commands } from '../stores';
|
import { commands, visibleCommandPalette } from '../stores';
|
||||||
import { get } from 'svelte/store';
|
import { get } from 'svelte/store';
|
||||||
import { runGroupCommand } from './runCommand';
|
import { runGroupCommand } from './runCommand';
|
||||||
|
|
||||||
@@ -38,6 +38,7 @@
|
|||||||
if (notGroup.length == 1) {
|
if (notGroup.length == 1) {
|
||||||
const command = notGroup[0];
|
const command = notGroup[0];
|
||||||
if (command.onClick) command.onClick();
|
if (command.onClick) command.onClick();
|
||||||
|
else if (command.getSubCommands) visibleCommandPalette.set(command);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,11 +25,11 @@
|
|||||||
import registerCommand from './registerCommand';
|
import registerCommand from './registerCommand';
|
||||||
|
|
||||||
let domInput;
|
let domInput;
|
||||||
let parentCommand;
|
|
||||||
let filter = '';
|
let filter = '';
|
||||||
const domItems = {};
|
const domItems = {};
|
||||||
|
|
||||||
$: selectedIndex = true ? 0 : filter;
|
$: selectedIndex = true ? 0 : filter;
|
||||||
|
$: parentCommand = _.isPlainObject($visibleCommandPalette) ? $visibleCommandPalette : null;
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
const oldFocus = document.activeElement;
|
const oldFocus = document.activeElement;
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
|
|
||||||
function handleCommand(command) {
|
function handleCommand(command) {
|
||||||
if (command.getSubCommands) {
|
if (command.getSubCommands) {
|
||||||
parentCommand = command;
|
$visibleCommandPalette = command;
|
||||||
domInput.focus();
|
domInput.focus();
|
||||||
filter = '';
|
filter = '';
|
||||||
selectedIndex = 0;
|
selectedIndex = 0;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ currentDatabase.subscribe(value => {
|
|||||||
recentDatabases.update(list => {
|
recentDatabases.update(list => {
|
||||||
const res = [
|
const res = [
|
||||||
value,
|
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);
|
].slice(0, 10);
|
||||||
return res;
|
return res;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user