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