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

View File

@@ -289,6 +289,8 @@
'img export': 'mdi mdi-database-export color-icon-green',
'img transform': 'mdi mdi-rotate-orbit color-icon-blue',
'img tip': 'mdi mdi-lightbulb-on color-icon-yellow',
'img filter-active': 'mdi mdi-filter-cog color-icon-blue',
};
</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 DEFAULT_OBJECT_SEARCH_SETTINGS = {
collectionName: true,
pureName: true,
schemaName: false,
tableName: true,
viewName: true,
columnName: true,
columnName: false,
columnDataType: false,
tableComment: true,
columnComment: true,
sqlObjectName: true,
sqlObjectText: true,
columnComment: false,
sqlObjectText: false,
tableEngine: false,
};
@@ -185,12 +182,12 @@ export const DEFAULT_CONNECTION_SEARCH_SETTINGS = {
export const databaseObjectAppObjectSearchSettings = writableWithStorage(
DEFAULT_OBJECT_SEARCH_SETTINGS,
'databaseObjectAppObjectSearchSettings'
'databaseObjectAppObjectSearchSettings2'
);
export const connectionAppObjectSearchSettings = writableWithStorage(
DEFAULT_CONNECTION_SEARCH_SETTINGS,
'connectionAppObjectSearchSettings'
'connectionAppObjectSearchSettings2'
);
export const currentThemeDefinition = derived([currentTheme, extensions], ([$currentTheme, $extensions]) =>

View File

@@ -217,7 +217,12 @@
}}
/>
<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}
<InlineButton
on:click={() => runCommand('new.connection')}

View File

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