Move db item expansion models to db-item-expansion
This commit is contained in:
@@ -87,37 +87,6 @@ export interface LocalDatabase {
|
||||
storagePath: string;
|
||||
}
|
||||
|
||||
export type ExpandedDbItem =
|
||||
| RootLocalExpandedDbItem
|
||||
| LocalUserDefinedListExpandedDbItem
|
||||
| RootRemoteExpandedDbItem
|
||||
| RemoteUserDefinedListExpandedDbItem;
|
||||
|
||||
export enum ExpandedDbItemKind {
|
||||
RootLocal = "rootLocal",
|
||||
LocalUserDefinedList = "localUserDefinedList",
|
||||
RootRemote = "rootRemote",
|
||||
RemoteUserDefinedList = "remoteUserDefinedList",
|
||||
}
|
||||
|
||||
export interface RootLocalExpandedDbItem {
|
||||
kind: ExpandedDbItemKind.RootLocal;
|
||||
}
|
||||
|
||||
export interface LocalUserDefinedListExpandedDbItem {
|
||||
kind: ExpandedDbItemKind.LocalUserDefinedList;
|
||||
listName: string;
|
||||
}
|
||||
|
||||
export interface RootRemoteExpandedDbItem {
|
||||
kind: ExpandedDbItemKind.RootRemote;
|
||||
}
|
||||
|
||||
export interface RemoteUserDefinedListExpandedDbItem {
|
||||
kind: ExpandedDbItemKind.RemoteUserDefinedList;
|
||||
listName: string;
|
||||
}
|
||||
|
||||
export function cloneDbConfig(config: DbConfig): DbConfig {
|
||||
return {
|
||||
databases: {
|
||||
|
||||
@@ -1,6 +1,36 @@
|
||||
import { ExpandedDbItem, ExpandedDbItemKind } from "./config/db-config";
|
||||
import { DbItem, DbItemKind } from "./db-item";
|
||||
|
||||
export type ExpandedDbItem =
|
||||
| RootLocalExpandedDbItem
|
||||
| LocalUserDefinedListExpandedDbItem
|
||||
| RootRemoteExpandedDbItem
|
||||
| RemoteUserDefinedListExpandedDbItem;
|
||||
|
||||
export enum ExpandedDbItemKind {
|
||||
RootLocal = "rootLocal",
|
||||
LocalUserDefinedList = "localUserDefinedList",
|
||||
RootRemote = "rootRemote",
|
||||
RemoteUserDefinedList = "remoteUserDefinedList",
|
||||
}
|
||||
|
||||
export interface RootLocalExpandedDbItem {
|
||||
kind: ExpandedDbItemKind.RootLocal;
|
||||
}
|
||||
|
||||
export interface LocalUserDefinedListExpandedDbItem {
|
||||
kind: ExpandedDbItemKind.LocalUserDefinedList;
|
||||
listName: string;
|
||||
}
|
||||
|
||||
export interface RootRemoteExpandedDbItem {
|
||||
kind: ExpandedDbItemKind.RootRemote;
|
||||
}
|
||||
|
||||
export interface RemoteUserDefinedListExpandedDbItem {
|
||||
kind: ExpandedDbItemKind.RemoteUserDefinedList;
|
||||
listName: string;
|
||||
}
|
||||
|
||||
export function calculateNewExpandedState(
|
||||
currentExpandedItems: ExpandedDbItem[],
|
||||
dbItem: DbItem,
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { App } from "../common/app";
|
||||
import { AppEvent, AppEventEmitter } from "../common/events";
|
||||
import { ValueResult } from "../common/value-result";
|
||||
import { ExpandedDbItem } from "./config/db-config";
|
||||
import { DbConfigStore } from "./config/db-config-store";
|
||||
import { DbItem, DbListKind } from "./db-item";
|
||||
import { calculateNewExpandedState } from "./db-item-expansion";
|
||||
import { calculateNewExpandedState, ExpandedDbItem } from "./db-item-expansion";
|
||||
import {
|
||||
getSelectedDbItem,
|
||||
mapDbItemToSelectedDbItem,
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import {
|
||||
DbConfig,
|
||||
ExpandedDbItem,
|
||||
ExpandedDbItemKind,
|
||||
LocalDatabase,
|
||||
LocalList,
|
||||
RemoteRepositoryList,
|
||||
@@ -18,6 +16,7 @@ import {
|
||||
RootLocalDbItem,
|
||||
RootRemoteDbItem,
|
||||
} from "./db-item";
|
||||
import { ExpandedDbItem, ExpandedDbItemKind } from "./db-item-expansion";
|
||||
|
||||
export function createRemoteTree(
|
||||
dbConfig: DbConfig,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import {
|
||||
ExpandedDbItem,
|
||||
ExpandedDbItemKind,
|
||||
} from "../../../src/databases/config/db-config";
|
||||
import {
|
||||
RemoteUserDefinedListDbItem,
|
||||
RootRemoteDbItem,
|
||||
} from "../../../src/databases/db-item";
|
||||
import { calculateNewExpandedState } from "../../../src/databases/db-item-expansion";
|
||||
import {
|
||||
calculateNewExpandedState,
|
||||
ExpandedDbItem,
|
||||
ExpandedDbItemKind,
|
||||
} from "../../../src/databases/db-item-expansion";
|
||||
import {
|
||||
createRemoteUserDefinedListDbItem,
|
||||
createRootRemoteDbItem,
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import {
|
||||
DbConfig,
|
||||
ExpandedDbItem,
|
||||
ExpandedDbItemKind,
|
||||
SelectedDbItemKind,
|
||||
} from "../../../src/databases/config/db-config";
|
||||
import {
|
||||
@@ -10,6 +8,10 @@ import {
|
||||
isRemoteRepoDbItem,
|
||||
isRemoteUserDefinedListDbItem,
|
||||
} from "../../../src/databases/db-item";
|
||||
import {
|
||||
ExpandedDbItem,
|
||||
ExpandedDbItemKind,
|
||||
} from "../../../src/databases/db-item-expansion";
|
||||
import {
|
||||
createLocalTree,
|
||||
createRemoteTree,
|
||||
|
||||
Reference in New Issue
Block a user