mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-21 19:56:02 +00:00
simplify settings
This commit is contained in:
@@ -43,14 +43,12 @@ export const activeTab = derived([openedTabs], ([$openedTabs]) => $openedTabs.fi
|
||||
export const recentDatabases = writableWithStorage([], 'recentDatabases');
|
||||
export const commandsSettings = derived(useSettings(), (config: any) => (config || {}).commands || {});
|
||||
export const allResultsInOneTabDefault = writableWithStorage(false, 'allResultsInOneTabDefault');
|
||||
export const commandsCustomized = derived(
|
||||
[commands, commandsSettings],
|
||||
([$commands, $commandsSettings]) =>
|
||||
_.mapValues($commands, (v, k) => ({
|
||||
// @ts-ignore
|
||||
...v,
|
||||
...$commandsSettings[k],
|
||||
}))
|
||||
export const commandsCustomized = derived([commands, commandsSettings], ([$commands, $commandsSettings]) =>
|
||||
_.mapValues($commands, (v, k) => ({
|
||||
// @ts-ignore
|
||||
...v,
|
||||
...$commandsSettings[k],
|
||||
}))
|
||||
);
|
||||
|
||||
export const visibleToolbar = writableWithStorage(1, 'visibleToolbar');
|
||||
@@ -137,3 +135,10 @@ currentDatabase.subscribe(value => {
|
||||
invalidateCommands();
|
||||
});
|
||||
export const getCurrentDatabase = () => currentDatabaseValue;
|
||||
|
||||
let currentSettingsValue = null;
|
||||
useSettings().subscribe(value => {
|
||||
currentSettingsValue = value;
|
||||
invalidateCommands();
|
||||
});
|
||||
export const getCurrentSettings = () => currentSettingsValue || {};
|
||||
|
||||
Reference in New Issue
Block a user