mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-21 00:06:01 +00:00
collapsed left column - moved from settings to storage
This commit is contained in:
@@ -67,6 +67,7 @@
|
|||||||
import registerCommand from '../commands/registerCommand';
|
import registerCommand from '../commands/registerCommand';
|
||||||
import { registerMenu } from '../utility/contextMenu';
|
import { registerMenu } from '../utility/contextMenu';
|
||||||
import { getBoolSettingsValue } from '../settings/settingsTools';
|
import { getBoolSettingsValue } from '../settings/settingsTools';
|
||||||
|
import { getLocalStorage } from '../utility/storageCache';
|
||||||
|
|
||||||
export let config;
|
export let config;
|
||||||
export let setConfig;
|
export let setConfig;
|
||||||
@@ -100,7 +101,7 @@
|
|||||||
|
|
||||||
let managerSize;
|
let managerSize;
|
||||||
const collapsedLeftColumnStore =
|
const collapsedLeftColumnStore =
|
||||||
getContext('collapsedLeftColumnStore') || writable(!getBoolSettingsValue('dataGrid.showLeftColumn', false));
|
getContext('collapsedLeftColumnStore') || writable(getLocalStorage('dataGrid_collapsedLeftColumn', false));
|
||||||
|
|
||||||
$: isFormView = !!(formDisplay && formDisplay.config && formDisplay.config.isFormView);
|
$: isFormView = !!(formDisplay && formDisplay.config && formDisplay.config.isFormView);
|
||||||
$: isJsonView = !!config?.isJsonView;
|
$: isJsonView = !!config?.isJsonView;
|
||||||
|
|||||||
@@ -53,7 +53,6 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="heading">Data grid</div>
|
<div class="heading">Data grid</div>
|
||||||
<FormCheckboxField name="dataGrid.showLeftColumn" label="Show left column by default" />
|
|
||||||
<FormTextField
|
<FormTextField
|
||||||
name="dataGrid.pageSize"
|
name="dataGrid.pageSize"
|
||||||
label="Page size (number of rows for incremental loading, must be between 5 and 1000)"
|
label="Page size (number of rows for incremental loading, must be between 5 and 1000)"
|
||||||
|
|||||||
@@ -49,7 +49,8 @@
|
|||||||
import ChangeSetGrider from '../datagrid/ChangeSetGrider';
|
import ChangeSetGrider from '../datagrid/ChangeSetGrider';
|
||||||
import { setContext } from 'svelte';
|
import { setContext } from 'svelte';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { apiCall } from '../utility/api';
|
import { apiCall } from '../utility/api';
|
||||||
|
import { getLocalStorage, setLocalStorage } from '../utility/storageCache';
|
||||||
|
|
||||||
export let tabid;
|
export let tabid;
|
||||||
export let conid;
|
export let conid;
|
||||||
@@ -133,8 +134,9 @@ import { apiCall } from '../utility/api';
|
|||||||
|
|
||||||
registerMenu({ command: 'collectionTable.save', tag: 'save' });
|
registerMenu({ command: 'collectionTable.save', tag: 'save' });
|
||||||
|
|
||||||
const collapsedLeftColumnStore = writable(false);
|
const collapsedLeftColumnStore = writable(getLocalStorage('collection_collapsedLeftColumn', false));
|
||||||
setContext('collapsedLeftColumnStore', collapsedLeftColumnStore);
|
setContext('collapsedLeftColumnStore', collapsedLeftColumnStore);
|
||||||
|
$: setLocalStorage('collection_collapsedLeftColumn', $collapsedLeftColumnStore);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<DataGrid
|
<DataGrid
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
import { registerMenu } from '../utility/contextMenu';
|
import { registerMenu } from '../utility/contextMenu';
|
||||||
import createActivator, { getActiveComponent } from '../utility/createActivator';
|
import createActivator, { getActiveComponent } from '../utility/createActivator';
|
||||||
import createUndoReducer from '../utility/createUndoReducer';
|
import createUndoReducer from '../utility/createUndoReducer';
|
||||||
|
import { getLocalStorage, setLocalStorage } from '../utility/storageCache';
|
||||||
import useGridConfig from '../utility/useGridConfig';
|
import useGridConfig from '../utility/useGridConfig';
|
||||||
|
|
||||||
export let tabid;
|
export let tabid;
|
||||||
@@ -99,8 +100,9 @@
|
|||||||
dispatchModel({ type: 'set', value: newModel });
|
dispatchModel({ type: 'set', value: newModel });
|
||||||
}
|
}
|
||||||
|
|
||||||
const collapsedLeftColumnStore = writable(false);
|
const collapsedLeftColumnStore = writable(getLocalStorage('freeTable_collapsedLeftColumn', false));
|
||||||
setContext('collapsedLeftColumnStore', collapsedLeftColumnStore);
|
setContext('collapsedLeftColumnStore', collapsedLeftColumnStore);
|
||||||
|
$: setLocalStorage('freeTable_collapsedLeftColumn', $collapsedLeftColumnStore);
|
||||||
|
|
||||||
export function toggleDynamicStructure() {
|
export function toggleDynamicStructure() {
|
||||||
let structure = $modelState.value.structure;
|
let structure = $modelState.value.structure;
|
||||||
|
|||||||
@@ -53,6 +53,7 @@
|
|||||||
import { getBoolSettingsValue } from '../settings/settingsTools';
|
import { getBoolSettingsValue } from '../settings/settingsTools';
|
||||||
import { setContext } from 'svelte';
|
import { setContext } from 'svelte';
|
||||||
import { apiCall } from '../utility/api';
|
import { apiCall } from '../utility/api';
|
||||||
|
import { getLocalStorage, setLocalStorage, setLocalStorage } from '../utility/storageCache';
|
||||||
|
|
||||||
export let tabid;
|
export let tabid;
|
||||||
export let conid;
|
export let conid;
|
||||||
@@ -110,8 +111,9 @@
|
|||||||
|
|
||||||
registerMenu({ command: 'tableData.save', tag: 'save' });
|
registerMenu({ command: 'tableData.save', tag: 'save' });
|
||||||
|
|
||||||
const collapsedLeftColumnStore = writable(!getBoolSettingsValue('dataGrid.showLeftColumn', false));
|
const collapsedLeftColumnStore = writable(getLocalStorage('dataGrid_collapsedLeftColumn', false));
|
||||||
setContext('collapsedLeftColumnStore', collapsedLeftColumnStore);
|
setContext('collapsedLeftColumnStore', collapsedLeftColumnStore);
|
||||||
|
$: setLocalStorage('dataGrid_collapsedLeftColumn', $collapsedLeftColumnStore);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<TableDataGrid
|
<TableDataGrid
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
import { getBoolSettingsValue } from '../settings/settingsTools';
|
import { getBoolSettingsValue } from '../settings/settingsTools';
|
||||||
import { extensions } from '../stores';
|
import { extensions } from '../stores';
|
||||||
import { useConnectionInfo, useDatabaseServerVersion, useViewInfo } from '../utility/metadataLoaders';
|
import { useConnectionInfo, useDatabaseServerVersion, useViewInfo } from '../utility/metadataLoaders';
|
||||||
|
import { getLocalStorage, setLocalStorage } from '../utility/storageCache';
|
||||||
import useGridConfig from '../utility/useGridConfig';
|
import useGridConfig from '../utility/useGridConfig';
|
||||||
import StatusBarTabItem from '../widgets/StatusBarTabItem.svelte';
|
import StatusBarTabItem from '../widgets/StatusBarTabItem.svelte';
|
||||||
|
|
||||||
@@ -44,8 +45,9 @@
|
|||||||
)
|
)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
const collapsedLeftColumnStore = writable(!getBoolSettingsValue('dataGrid.showLeftColumn', false));
|
const collapsedLeftColumnStore = writable(getLocalStorage('dataGrid_collapsedLeftColumn', false));
|
||||||
setContext('collapsedLeftColumnStore', collapsedLeftColumnStore);
|
setContext('collapsedLeftColumnStore', collapsedLeftColumnStore);
|
||||||
|
$: setLocalStorage('dataGrid_collapsedLeftColumn', $collapsedLeftColumnStore);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if display}
|
{#if display}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
const cache = {};
|
const cache = {};
|
||||||
|
|
||||||
export function getLocalStorage(key) {
|
export function getLocalStorage(key, defaultValue = undefined) {
|
||||||
if (key in cache) return cache[key];
|
if (key in cache) return cache[key];
|
||||||
const item = localStorage.getItem(key);
|
const item = localStorage.getItem(key);
|
||||||
if (item) {
|
if (item) {
|
||||||
@@ -8,7 +8,7 @@ export function getLocalStorage(key) {
|
|||||||
cache[key] = res;
|
cache[key] = res;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
return undefined;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setLocalStorage(key, value) {
|
export function setLocalStorage(key, value) {
|
||||||
|
|||||||
Reference in New Issue
Block a user