diff --git a/backend/services/connection_service.go b/backend/services/connection_service.go index 86d6ad5..41c332c 100644 --- a/backend/services/connection_service.go +++ b/backend/services/connection_service.go @@ -179,7 +179,7 @@ func (c *connectionService) OpenConnection(name string) (resp types.JSResp) { return } - // get total database + // get total databases config, err := rdb.ConfigGet(ctx, "databases").Result() if err != nil { resp.Msg = err.Error() @@ -347,12 +347,12 @@ func (c *connectionService) ServerInfo(name string) (resp types.JSResp) { // OpenDatabase open select database, and list all keys // @param path contain connection name and db name -func (c *connectionService) OpenDatabase(connName string, db int) (resp types.JSResp) { - return c.ScanKeys(connName, db, "*") +func (c *connectionService) OpenDatabase(connName string, db int, match string) (resp types.JSResp) { + return c.ScanKeys(connName, db, match) } -// ScanKeys scan all keys below prefix -func (c *connectionService) ScanKeys(connName string, db int, prefix string) (resp types.JSResp) { +// ScanKeys scan all keys +func (c *connectionService) ScanKeys(connName string, db int, match string) (resp types.JSResp) { rdb, ctx, err := c.getRedisClient(connName, db) if err != nil { resp.Msg = err.Error() @@ -364,7 +364,7 @@ func (c *connectionService) ScanKeys(connName string, db int, prefix string) (re var cursor uint64 for { var loadedKey []string - loadedKey, cursor, err = rdb.Scan(ctx, cursor, prefix, 10000).Result() + loadedKey, cursor, err = rdb.Scan(ctx, cursor, match, 10000).Result() if err != nil { resp.Msg = err.Error() return diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 22643e7..5832723 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -17,6 +17,7 @@ import usePreferencesStore from './stores/preferences.js' import useConnectionStore from './stores/connections.js' import { useI18n } from 'vue-i18n' import { darkTheme, lightTheme, useOsTheme } from 'naive-ui' +import KeyFilterDialog from './components/dialogs/KeyFilterDialog.vue' hljs.registerLanguage('json', json) hljs.registerLanguage('plaintext', plaintext) @@ -95,6 +96,7 @@ const theme = computed(() => { + diff --git a/frontend/src/components/dialogs/KeyFilterDialog.vue b/frontend/src/components/dialogs/KeyFilterDialog.vue new file mode 100644 index 0000000..d6a84b5 --- /dev/null +++ b/frontend/src/components/dialogs/KeyFilterDialog.vue @@ -0,0 +1,91 @@ + + + + + + + {{ filterForm.server }} + + + {{ filterForm.db }} + + + + + + + + {{ $t('filter_pattern_tip') }} + + + {{ $t('restore_defaults') }} + + + + + + + + diff --git a/frontend/src/components/sidebar/BrowserTree.vue b/frontend/src/components/sidebar/BrowserTree.vue index 44699bd..013c716 100644 --- a/frontend/src/components/sidebar/BrowserTree.vue +++ b/frontend/src/components/sidebar/BrowserTree.vue @@ -1,10 +1,10 @@