Skip to content

Commit b7e717d

Browse files
authored
Merge pull request dbgate#1451 from dbgate/feature/display-schema
Added schema name for tables
2 parents 1be4fc8 + 5dcf6cc commit b7e717d

1 file changed

Lines changed: 20 additions & 8 deletions

File tree

packages/web/src/commands/CommandPalette.svelte

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,17 @@
2525
});
2626
2727
function extractDbItems(db, dbConnectionInfo, connectionList, $extensions, currentThemeType) {
28+
const allObjects = _.flatten(
29+
['tables', 'collections', 'views', 'matviews', 'procedures', 'functions'].map(objectTypeField =>
30+
((db || {})[objectTypeField] || []).map(obj => ({ objectTypeField, obj }))
31+
)
32+
);
33+
const pureNameCounts = _.countBy(allObjects, ({ obj }) => obj.pureName);
2834
const objectList = _.flatten(
2935
['tables', 'collections', 'views', 'matviews', 'procedures', 'functions'].map(objectTypeField =>
3036
_.sortBy(
3137
((db || {})[objectTypeField] || []).map(obj => ({
32-
text: obj.pureName,
38+
text: pureNameCounts[obj.pureName] > 1 ? fullNameToLabel(obj) : obj.pureName,
3339
onClick: () => handleDatabaseObjectClick({ objectTypeField, ...dbConnectionInfo, ...obj }),
3440
icon: databaseObjectIcons[objectTypeField],
3541
})),
@@ -43,11 +49,11 @@
4349
if (connection.singleDatabase) continue;
4450
if (getCurrentConfig()?.singleDbConnection) continue;
4551
const databases = getLocalStorage(`database_list_${conid}`) || [];
46-
52+
4753
const driver = findEngineDriver(connection, $extensions);
4854
const driverIcon = getDriverIcon(driver, currentThemeType);
4955
const connectionIcon = driverIcon || 'img database';
50-
56+
5157
for (const db of databases) {
5258
databaseList.push({
5359
text: `${db.name} on ${getConnectionLabel(connection)}`,
@@ -66,7 +72,7 @@
6672
</script>
6773
6874
<script>
69-
import { filterName, getConnectionLabel, findEngineDriver } from 'dbgate-tools';
75+
import { filterName, getConnectionLabel, findEngineDriver, fullNameToLabel } from 'dbgate-tools';
7076
7177
import _ from 'lodash';
7278
import { onMount } from 'svelte';
@@ -190,7 +196,8 @@
190196
domInput.focus();
191197
}}
192198
>
193-
<FontIcon icon="icon menu" /> {_t('commandPalette.commands', { defaultMessage: 'Commands' })}
199+
<FontIcon icon="icon menu" />
200+
{_t('commandPalette.commands', { defaultMessage: 'Commands' })}
194201
</div>
195202
<div
196203
class="page"
@@ -200,7 +207,8 @@
200207
domInput.focus();
201208
}}
202209
>
203-
<FontIcon icon="icon database" /> {_t('common.database', { defaultMessage: 'Database' })}
210+
<FontIcon icon="icon database" />
211+
{_t('common.database', { defaultMessage: 'Database' })}
204212
</div>
205213
</div>
206214
<div class="mainInner">
@@ -211,7 +219,9 @@
211219
bind:value={filter}
212220
on:keydown={handleKeyDown}
213221
placeholder={_tval(parentCommand?.text) ||
214-
($visibleCommandPalette == 'database' ? _t('commandPalette.searchInDatabase', { defaultMessage: 'Search in database' }) : _t('commandPalette.searchInCommands', { defaultMessage: 'Search in commands' }))}
222+
($visibleCommandPalette == 'database'
223+
? _t('commandPalette.searchInDatabase', { defaultMessage: 'Search in database' })
224+
: _t('commandPalette.searchInCommands', { defaultMessage: 'Search in commands' }))}
215225
/>
216226
</div>
217227
<div class="content">
@@ -360,7 +370,9 @@
360370
display: flex;
361371
align-items: center;
362372
gap: 6px;
363-
transition: color 150ms ease-in-out, border-color 150ms ease-in-out;
373+
transition:
374+
color 150ms ease-in-out,
375+
border-color 150ms ease-in-out;
364376
}
365377
366378
.page:hover {

0 commit comments

Comments
 (0)