mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-22 12:16:01 +00:00
save perspective to file
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { DatabaseInfo, ForeignKeyInfo } from 'dbgate-types';
|
||||
import { DatabaseInfo, ForeignKeyInfo, NamedObjectInfo } from 'dbgate-types';
|
||||
|
||||
export interface PerspectiveConfigColumns {
|
||||
expandedColumns: string[];
|
||||
@@ -28,6 +28,7 @@ export interface PerspectiveFilterColumnInfo {
|
||||
foreignKey: ForeignKeyInfo;
|
||||
}
|
||||
export interface PerspectiveConfig extends PerspectiveConfigColumns {
|
||||
rootObject: { schemaName?: string; pureName: string };
|
||||
filters: { [uniqueName: string]: string };
|
||||
filterInfos: { [uniqueName: string]: PerspectiveFilterColumnInfo };
|
||||
sort: {
|
||||
@@ -39,7 +40,7 @@ export interface PerspectiveConfig extends PerspectiveConfigColumns {
|
||||
customJoins: PerspectiveCustomJoinConfig[];
|
||||
}
|
||||
|
||||
export function createPerspectiveConfig(): PerspectiveConfig {
|
||||
export function createPerspectiveConfig(rootObject: { schemaName?: string; pureName: string }): PerspectiveConfig {
|
||||
return {
|
||||
expandedColumns: [],
|
||||
checkedColumns: [],
|
||||
@@ -48,6 +49,7 @@ export function createPerspectiveConfig(): PerspectiveConfig {
|
||||
filters: {},
|
||||
filterInfos: {},
|
||||
sort: {},
|
||||
rootObject,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ test('test flat view', () => {
|
||||
const root = new PerspectiveTableNode(
|
||||
artistTable,
|
||||
{ conid: { db: chinookDbInfo } },
|
||||
createPerspectiveConfig(),
|
||||
createPerspectiveConfig({ pureName: 'Artist' }),
|
||||
null,
|
||||
null,
|
||||
{ conid: 'conid', database: 'db' },
|
||||
@@ -38,7 +38,7 @@ test('test one level nesting', () => {
|
||||
const root = new PerspectiveTableNode(
|
||||
artistTable,
|
||||
{ conid: { db: chinookDbInfo } },
|
||||
{ ...createPerspectiveConfig(), checkedColumns: ['Artist.Album'] },
|
||||
{ ...createPerspectiveConfig({ pureName: 'Artist' }), checkedColumns: ['Artist.Album'] },
|
||||
null,
|
||||
null,
|
||||
{ conid: 'conid', database: 'db' },
|
||||
@@ -88,7 +88,7 @@ test('test two level nesting', () => {
|
||||
const root = new PerspectiveTableNode(
|
||||
artistTable,
|
||||
{ conid: { db: chinookDbInfo } },
|
||||
{ ...createPerspectiveConfig(), checkedColumns: ['Artist.Album', 'Artist.Album.Track'] },
|
||||
{ ...createPerspectiveConfig({ pureName: 'Artist' }), checkedColumns: ['Artist.Album', 'Artist.Album.Track'] },
|
||||
null,
|
||||
null,
|
||||
{ conid: 'conid', database: 'db' },
|
||||
|
||||
Reference in New Issue
Block a user