mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-17 22:36:01 +00:00
filter only tables with rows
This commit is contained in:
@@ -4,7 +4,17 @@
|
||||
export const extractKey = ({ schemaName, pureName }) => (schemaName ? `${schemaName}.${pureName}` : pureName);
|
||||
export const createMatcher =
|
||||
(filter, cfg = DEFAULT_OBJECT_SEARCH_SETTINGS) =>
|
||||
({ schemaName, pureName, objectComment, tableEngine, columns, objectTypeField, tableName, createSql }) => {
|
||||
({
|
||||
schemaName,
|
||||
pureName,
|
||||
objectComment,
|
||||
tableEngine,
|
||||
columns,
|
||||
objectTypeField,
|
||||
tableName,
|
||||
createSql,
|
||||
tableRowCount,
|
||||
}) => {
|
||||
const mainArgs = [];
|
||||
const childArgs = [];
|
||||
if (cfg.schemaName) mainArgs.push(schemaName);
|
||||
@@ -12,6 +22,7 @@
|
||||
if (objectTypeField == 'tables') {
|
||||
if (cfg.tableComment) mainArgs.push(objectComment);
|
||||
if (cfg.tableEngine) mainArgs.push(tableEngine);
|
||||
if (cfg.tablesWithRows && !tableRowCount) return 'none';
|
||||
|
||||
for (const column of columns || []) {
|
||||
if (cfg.columnName) childArgs.push(column.columnName);
|
||||
|
||||
@@ -195,6 +195,7 @@ export const DEFAULT_OBJECT_SEARCH_SETTINGS = {
|
||||
columnComment: false,
|
||||
sqlObjectText: false,
|
||||
tableEngine: false,
|
||||
tablesWithRows: false,
|
||||
};
|
||||
|
||||
export const DEFAULT_CONNECTION_SEARCH_SETTINGS = {
|
||||
|
||||
@@ -143,6 +143,7 @@
|
||||
res.push({ label: 'Column comment', switchValue: 'columnComment' });
|
||||
res.push({ label: 'View/procedure/trigger text', switchValue: 'sqlObjectText' });
|
||||
res.push({ label: 'Table engine', switchValue: 'tableEngine' });
|
||||
res.push({ label: 'Only tables with rows', switchValue: 'tablesWithRows' });
|
||||
}
|
||||
return res.map(item => ({
|
||||
...item,
|
||||
|
||||
Reference in New Issue
Block a user