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