search settings improvement

This commit is contained in:
SPRINX0\prochazka
2024-12-20 08:42:30 +01:00
parent c65bf51dcd
commit edf64db69a
5 changed files with 25 additions and 21 deletions

View File

@@ -8,8 +8,8 @@
const mainArgs = []; const mainArgs = [];
const childArgs = []; const childArgs = [];
if (cfg.schemaName) mainArgs.push(schemaName); if (cfg.schemaName) mainArgs.push(schemaName);
if (cfg.pureName) mainArgs.push(pureName);
if (objectTypeField == 'tables') { if (objectTypeField == 'tables') {
if (cfg.tableName) mainArgs.push(pureName);
if (cfg.tableComment) mainArgs.push(objectComment); if (cfg.tableComment) mainArgs.push(objectComment);
if (cfg.tableEngine) mainArgs.push(tableEngine); if (cfg.tableEngine) mainArgs.push(tableEngine);
@@ -18,10 +18,7 @@
if (cfg.columnComment) childArgs.push(column.columnComment); if (cfg.columnComment) childArgs.push(column.columnComment);
if (cfg.columnDataType) childArgs.push(column.dataType); if (cfg.columnDataType) childArgs.push(column.dataType);
} }
} else if (objectTypeField == 'collections') {
if (cfg.collectionName) mainArgs.push(pureName);
} else { } else {
if (cfg.sqlObjectName) mainArgs.push(pureName);
if (cfg.sqlObjectText) childArgs.push(createSql); if (cfg.sqlObjectText) childArgs.push(createSql);
} }

View File

@@ -289,6 +289,8 @@
'img export': 'mdi mdi-database-export color-icon-green', 'img export': 'mdi mdi-database-export color-icon-green',
'img transform': 'mdi mdi-rotate-orbit color-icon-blue', 'img transform': 'mdi mdi-rotate-orbit color-icon-blue',
'img tip': 'mdi mdi-lightbulb-on color-icon-yellow', 'img tip': 'mdi mdi-lightbulb-on color-icon-yellow',
'img filter-active': 'mdi mdi-filter-cog color-icon-blue',
}; };
</script> </script>

View File

@@ -162,16 +162,13 @@ export const selectedDatabaseObjectAppObject = writable(null);
export const focusedConnectionOrDatabase = writable<{ conid: string; database?: string; connection: any }>(null); export const focusedConnectionOrDatabase = writable<{ conid: string; database?: string; connection: any }>(null);
export const DEFAULT_OBJECT_SEARCH_SETTINGS = { export const DEFAULT_OBJECT_SEARCH_SETTINGS = {
collectionName: true, pureName: true,
schemaName: false, schemaName: false,
tableName: true, columnName: false,
viewName: true,
columnName: true,
columnDataType: false, columnDataType: false,
tableComment: true, tableComment: true,
columnComment: true, columnComment: false,
sqlObjectName: true, sqlObjectText: false,
sqlObjectText: true,
tableEngine: false, tableEngine: false,
}; };
@@ -185,12 +182,12 @@ export const DEFAULT_CONNECTION_SEARCH_SETTINGS = {
export const databaseObjectAppObjectSearchSettings = writableWithStorage( export const databaseObjectAppObjectSearchSettings = writableWithStorage(
DEFAULT_OBJECT_SEARCH_SETTINGS, DEFAULT_OBJECT_SEARCH_SETTINGS,
'databaseObjectAppObjectSearchSettings' 'databaseObjectAppObjectSearchSettings2'
); );
export const connectionAppObjectSearchSettings = writableWithStorage( export const connectionAppObjectSearchSettings = writableWithStorage(
DEFAULT_CONNECTION_SEARCH_SETTINGS, DEFAULT_CONNECTION_SEARCH_SETTINGS,
'connectionAppObjectSearchSettings' 'connectionAppObjectSearchSettings2'
); );
export const currentThemeDefinition = derived([currentTheme, extensions], ([$currentTheme, $extensions]) => export const currentThemeDefinition = derived([currentTheme, extensions], ([$currentTheme, $extensions]) =>

View File

@@ -217,7 +217,12 @@
}} }}
/> />
<CloseSearchButton bind:filter /> <CloseSearchButton bind:filter />
<DropDownButton icon="icon filter" menu={createSearchMenu} square={!!filter} narrow={false} /> <DropDownButton
icon={filter ? 'img filter-active' : 'icon filter'}
menu={createSearchMenu}
square={!!filter}
narrow={false}
/>
{#if $commandsCustomized['new.connection']?.enabled} {#if $commandsCustomized['new.connection']?.enabled}
<InlineButton <InlineButton
on:click={() => runCommand('new.connection')} on:click={() => runCommand('new.connection')}

View File

@@ -131,18 +131,16 @@
const res = []; const res = [];
res.push({ label: 'Search by:', isBold: true, disabled: true }); res.push({ label: 'Search by:', isBold: true, disabled: true });
if (driver?.databaseEngineTypes?.includes('document')) { if (driver?.databaseEngineTypes?.includes('document')) {
res.push({ label: 'Collection names', switchValue: 'collectionName' }); res.push({ label: 'Collection name', switchValue: 'pureName' });
} }
if (driver?.databaseEngineTypes?.includes('sql')) { if (driver?.databaseEngineTypes?.includes('sql')) {
res.push({ label: 'Schema name', switchValue: 'schemaName' }); res.push({ label: 'Table/view/procedure name', switchValue: 'pureName' });
res.push({ label: 'Table name', switchValue: 'tableName' }); res.push({ label: 'Schema', switchValue: 'schemaName' });
res.push({ label: 'View name', switchValue: 'viewName' });
res.push({ label: 'Column name', switchValue: 'columnName' }); res.push({ label: 'Column name', switchValue: 'columnName' });
res.push({ label: 'Column data type', switchValue: 'columnType' }); res.push({ label: 'Column data type', switchValue: 'columnType' });
res.push({ label: 'Table comment', switchValue: 'tableComment' }); res.push({ label: 'Table comment', switchValue: 'tableComment' });
res.push({ label: 'Column comment', switchValue: 'columnComment' }); res.push({ label: 'Column comment', switchValue: 'columnComment' });
res.push({ label: 'Procedure/function/trigger name', switchValue: 'sqlObjectName' }); res.push({ label: 'View/procedure/trigger text', switchValue: 'sqlObjectText' });
res.push({ label: 'Procedure/function/trigger text', switchValue: 'sqlObjectText' });
res.push({ label: 'Table engine', switchValue: 'tableEngine' }); res.push({ label: 'Table engine', switchValue: 'tableEngine' });
} }
return res.map(item => ({ return res.map(item => ({
@@ -217,7 +215,12 @@
}} }}
/> />
<CloseSearchButton bind:filter /> <CloseSearchButton bind:filter />
<DropDownButton icon="icon filter" menu={createSearchMenu} square={!!filter} narrow={false} /> <DropDownButton
icon={filter ? 'img filter-active' : 'icon filter'}
menu={createSearchMenu}
square={!!filter}
narrow={false}
/>
{#if !filter} {#if !filter}
<DropDownButton icon="icon plus-thick" menu={createAddMenu} /> <DropDownButton icon="icon plus-thick" menu={createAddMenu} />
{/if} {/if}