mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 23:35:59 +00:00
SYNC: show diagram table counts WIP
This commit is contained in:
committed by
Diflow
parent
f2570c97f3
commit
6467db4a21
@@ -1,6 +1,7 @@
|
||||
import { DatabaseInfo, TableInfo } from 'dbgate-types';
|
||||
import { extendDatabaseInfo } from './structureTools';
|
||||
import _sortBy from 'lodash/sortBy';
|
||||
import { filterName } from './filterName';
|
||||
|
||||
function tableWeight(table: TableInfo, maxRowcount?: number) {
|
||||
let weight = 0;
|
||||
@@ -18,9 +19,23 @@ function tableWeight(table: TableInfo, maxRowcount?: number) {
|
||||
if (maxRowcount) return weight;
|
||||
}
|
||||
|
||||
export function chooseTopTables(tables: TableInfo[], count: number) {
|
||||
export function chooseTopTables(tables: TableInfo[], count: number, tableFilter: string, omitTablesFilter: string) {
|
||||
const filteredTables = tables.filter(table => {
|
||||
if (tableFilter) {
|
||||
if (!filterName(tableFilter, table?.pureName)) return false;
|
||||
}
|
||||
if (omitTablesFilter) {
|
||||
if (filterName(omitTablesFilter, table?.pureName)) return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
if (!(count > 0)) {
|
||||
return filteredTables;
|
||||
}
|
||||
|
||||
const dbinfo: DatabaseInfo = {
|
||||
tables,
|
||||
tables: filteredTables,
|
||||
} as DatabaseInfo;
|
||||
|
||||
const extended = extendDatabaseInfo(dbinfo);
|
||||
|
||||
Reference in New Issue
Block a user