Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { ValueResult } from "../../common/value-result";
import {
LocalDatabaseDbItem,
LocalListDbItem,
VariantAnalysisUserDefinedListDbItem,
RemoteUserDefinedListDbItem,
DbItem,
DbItemKind,
} from "../db-item";
Expand Down Expand Up @@ -113,7 +113,7 @@ export class DbConfigStore extends DisposableObject {
case DbItemKind.LocalList:
config = removeLocalList(this.config, dbItem.listName);
break;
case DbItemKind.VariantAnalysisUserDefinedList:
case DbItemKind.RemoteUserDefinedList:
config = removeRemoteList(this.config, dbItem.listName);
break;
case DbItemKind.LocalDatabase:
Expand Down Expand Up @@ -246,7 +246,7 @@ export class DbConfigStore extends DisposableObject {
}

public async renameRemoteList(
currentDbItem: VariantAnalysisUserDefinedListDbItem,
currentDbItem: RemoteUserDefinedListDbItem,
newName: string,
) {
if (!this.config) {
Expand Down
8 changes: 4 additions & 4 deletions extensions/ql-vscode/src/databases/db-item-expansion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export type ExpandedDbItem =
| RootLocalExpandedDbItem
| LocalUserDefinedListExpandedDbItem
| RootRemoteExpandedDbItem
| VariantAnalysisUserDefinedListExpandedDbItem;
| RemoteUserDefinedListExpandedDbItem;

export enum ExpandedDbItemKind {
RootLocal = "rootLocal",
Expand All @@ -26,7 +26,7 @@ export interface RootRemoteExpandedDbItem {
kind: ExpandedDbItemKind.RootRemote;
}

export interface VariantAnalysisUserDefinedListExpandedDbItem {
export interface RemoteUserDefinedListExpandedDbItem {
kind: ExpandedDbItemKind.RemoteUserDefinedList;
listName: string;
}
Expand Down Expand Up @@ -89,7 +89,7 @@ function mapDbItemToExpandedDbItem(dbItem: DbItem): ExpandedDbItem {
};
case DbItemKind.RootRemote:
return { kind: ExpandedDbItemKind.RootRemote };
case DbItemKind.VariantAnalysisUserDefinedList:
case DbItemKind.RemoteUserDefinedList:
return {
kind: ExpandedDbItemKind.RemoteUserDefinedList,
listName: dbItem.listName,
Expand All @@ -113,7 +113,7 @@ function isDbItemEqualToExpandedDbItem(
);
case DbItemKind.RootRemote:
return expandedDbItem.kind === ExpandedDbItemKind.RootRemote;
case DbItemKind.VariantAnalysisUserDefinedList:
case DbItemKind.RemoteUserDefinedList:
return (
expandedDbItem.kind === ExpandedDbItemKind.RemoteUserDefinedList &&
expandedDbItem.listName === dbItem.listName
Expand Down
2 changes: 1 addition & 1 deletion extensions/ql-vscode/src/databases/db-item-naming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function getDbItemName(dbItem: DbItem): string | undefined {
case DbItemKind.RootRemote:
return undefined;
case DbItemKind.LocalList:
case DbItemKind.VariantAnalysisUserDefinedList:
case DbItemKind.RemoteUserDefinedList:
case DbItemKind.RemoteSystemDefinedList:
return dbItem.listName;
case DbItemKind.RemoteOwner:
Expand Down
4 changes: 2 additions & 2 deletions extensions/ql-vscode/src/databases/db-item-selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function extractSelected(
}
}
break;
case DbItemKind.VariantAnalysisUserDefinedList:
case DbItemKind.RemoteUserDefinedList:
for (const repo of dbItem.repos) {
if (repo.selected) {
return repo;
Expand All @@ -59,7 +59,7 @@ export function mapDbItemToSelectedDbItem(
listName: dbItem.listName,
};

case DbItemKind.VariantAnalysisUserDefinedList:
case DbItemKind.RemoteUserDefinedList:
return {
kind: SelectedDbItemKind.VariantAnalysisUserDefinedList,
listName: dbItem.listName,
Expand Down
20 changes: 10 additions & 10 deletions extensions/ql-vscode/src/databases/db-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ export enum DbItemKind {
LocalDatabase = "LocalDatabase",
RootRemote = "RootRemote",
RemoteSystemDefinedList = "RemoteSystemDefinedList",
VariantAnalysisUserDefinedList = "VariantAnalysisUserDefinedList",
RemoteUserDefinedList = "RemoteUserDefinedList",
RemoteOwner = "RemoteOwner",
RemoteRepo = "RemoteRepo",
}

export const remoteDbKinds = [
DbItemKind.RootRemote,
DbItemKind.RemoteSystemDefinedList,
DbItemKind.VariantAnalysisUserDefinedList,
DbItemKind.RemoteUserDefinedList,
DbItemKind.RemoteOwner,
DbItemKind.RemoteRepo,
];
Expand Down Expand Up @@ -70,7 +70,7 @@ export type DbItem =

export type RemoteDbItem =
| RemoteSystemDefinedListDbItem
| VariantAnalysisUserDefinedListDbItem
| RemoteUserDefinedListDbItem
| RemoteOwnerDbItem
| RemoteRepoDbItem;

Expand All @@ -82,8 +82,8 @@ export interface RemoteSystemDefinedListDbItem {
listDescription: string;
}

export interface VariantAnalysisUserDefinedListDbItem {
kind: DbItemKind.VariantAnalysisUserDefinedList;
export interface RemoteUserDefinedListDbItem {
kind: DbItemKind.RemoteUserDefinedList;
expanded: boolean;
selected: boolean;
listName: string;
Expand All @@ -109,10 +109,10 @@ export function isRemoteSystemDefinedListDbItem(
return dbItem.kind === DbItemKind.RemoteSystemDefinedList;
}

export function isVariantAnalysisUserDefinedListDbItem(
export function isRemoteUserDefinedListDbItem(
dbItem: DbItem,
): dbItem is VariantAnalysisUserDefinedListDbItem {
return dbItem.kind === DbItemKind.VariantAnalysisUserDefinedList;
): dbItem is RemoteUserDefinedListDbItem {
return dbItem.kind === DbItemKind.RemoteUserDefinedList;
}

export function isRemoteOwnerDbItem(
Expand Down Expand Up @@ -145,7 +145,7 @@ const SelectableDbItemKinds = [
DbItemKind.LocalList,
DbItemKind.LocalDatabase,
DbItemKind.RemoteSystemDefinedList,
DbItemKind.VariantAnalysisUserDefinedList,
DbItemKind.RemoteUserDefinedList,
DbItemKind.RemoteOwner,
DbItemKind.RemoteRepo,
];
Expand All @@ -165,7 +165,7 @@ export function flattenDbItems(dbItems: DbItem[]): DbItem[] {
case DbItemKind.RootRemote:
allItems.push(...flattenDbItems(dbItem.children));
break;
case DbItemKind.VariantAnalysisUserDefinedList:
case DbItemKind.RemoteUserDefinedList:
allItems.push(...dbItem.repos);
break;
case DbItemKind.LocalDatabase:
Expand Down
8 changes: 3 additions & 5 deletions extensions/ql-vscode/src/databases/db-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
DbListKind,
LocalDatabaseDbItem,
LocalListDbItem,
VariantAnalysisUserDefinedListDbItem,
RemoteUserDefinedListDbItem,
} from "./db-item";
import {
updateExpandedItem,
Expand Down Expand Up @@ -123,14 +123,12 @@ export class DbManager {
}

public async renameList(
currentDbItem: LocalListDbItem | VariantAnalysisUserDefinedListDbItem,
currentDbItem: LocalListDbItem | RemoteUserDefinedListDbItem,
newName: string,
): Promise<void> {
if (currentDbItem.kind === DbItemKind.LocalList) {
await this.dbConfigStore.renameLocalList(currentDbItem, newName);
} else if (
currentDbItem.kind === DbItemKind.VariantAnalysisUserDefinedList
) {
} else if (currentDbItem.kind === DbItemKind.RemoteUserDefinedList) {
await this.dbConfigStore.renameRemoteList(currentDbItem, newName);
}

Expand Down
6 changes: 3 additions & 3 deletions extensions/ql-vscode/src/databases/db-tree-creator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
RemoteOwnerDbItem,
RemoteRepoDbItem,
RemoteSystemDefinedListDbItem,
VariantAnalysisUserDefinedListDbItem,
RemoteUserDefinedListDbItem,
RootLocalDbItem,
RootRemoteDbItem,
} from "./db-item";
Expand Down Expand Up @@ -102,7 +102,7 @@ function createVariantAnalysisUserDefinedList(
list: RemoteRepositoryList,
dbConfig: DbConfig,
expandedItems: ExpandedDbItem[],
): VariantAnalysisUserDefinedListDbItem {
): RemoteUserDefinedListDbItem {
const selected =
dbConfig.selected &&
dbConfig.selected.kind ===
Expand All @@ -116,7 +116,7 @@ function createVariantAnalysisUserDefinedList(
);

return {
kind: DbItemKind.VariantAnalysisUserDefinedList,
kind: DbItemKind.RemoteUserDefinedList,
listName: list.name,
repos: list.repositories.map((r) => createRepoItem(r, dbConfig, list.name)),
selected: !!selected,
Expand Down
2 changes: 1 addition & 1 deletion extensions/ql-vscode/src/databases/ui/db-item-mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function mapDbItemToTreeViewItem(dbItem: DbItem): DbTreeViewItem {
dbItem.listDescription,
);

case DbItemKind.VariantAnalysisUserDefinedList:
case DbItemKind.RemoteUserDefinedList:
return createDbTreeViewItemUserDefinedList(
dbItem,
dbItem.listName,
Expand Down
8 changes: 4 additions & 4 deletions extensions/ql-vscode/src/databases/ui/db-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
LocalDatabaseDbItem,
LocalListDbItem,
remoteDbKinds,
VariantAnalysisUserDefinedListDbItem,
RemoteUserDefinedListDbItem,
} from "../db-item";
import { getDbItemName } from "../db-item-naming";
import { DbManager } from "../db-manager";
Expand Down Expand Up @@ -124,7 +124,7 @@ export class DbPanel extends DisposableObject {
private async addNewRemoteDatabase(): Promise<void> {
const highlightedItem = await this.getHighlightedDbItem();

if (highlightedItem?.kind === DbItemKind.VariantAnalysisUserDefinedList) {
if (highlightedItem?.kind === DbItemKind.RemoteUserDefinedList) {
await this.addNewRemoteRepo(highlightedItem.listName);
} else if (
highlightedItem?.kind === DbItemKind.RemoteRepo &&
Expand Down Expand Up @@ -313,7 +313,7 @@ export class DbPanel extends DisposableObject {
case DbItemKind.LocalDatabase:
await this.renameLocalDatabaseItem(dbItem, newName);
break;
case DbItemKind.VariantAnalysisUserDefinedList:
case DbItemKind.RemoteUserDefinedList:
await this.renameVariantAnalysisUserDefinedListItem(dbItem, newName);
break;
default:
Expand Down Expand Up @@ -354,7 +354,7 @@ export class DbPanel extends DisposableObject {
}

private async renameVariantAnalysisUserDefinedListItem(
dbItem: VariantAnalysisUserDefinedListDbItem,
dbItem: RemoteUserDefinedListDbItem,
newName: string,
): Promise<void> {
if (dbItem.listName === newName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ export function getDbItemActions(dbItem: DbItem): DbTreeViewItemAction[] {

const dbItemKindsThatCanBeRemoved = [
DbItemKind.LocalList,
DbItemKind.VariantAnalysisUserDefinedList,
DbItemKind.RemoteUserDefinedList,
DbItemKind.LocalDatabase,
DbItemKind.RemoteRepo,
DbItemKind.RemoteOwner,
];

const dbItemKindsThatCanBeRenamed = [
DbItemKind.LocalList,
DbItemKind.VariantAnalysisUserDefinedList,
DbItemKind.RemoteUserDefinedList,
DbItemKind.LocalDatabase,
];

Expand Down
4 changes: 2 additions & 2 deletions extensions/ql-vscode/src/databases/ui/db-tree-view-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
RemoteOwnerDbItem,
RemoteRepoDbItem,
RemoteSystemDefinedListDbItem,
VariantAnalysisUserDefinedListDbItem,
RemoteUserDefinedListDbItem,
RootLocalDbItem,
RootRemoteDbItem,
} from "../db-item";
Expand Down Expand Up @@ -97,7 +97,7 @@ export function createDbTreeViewItemSystemDefinedList(
}

export function createDbTreeViewItemUserDefinedList(
dbItem: LocalListDbItem | VariantAnalysisUserDefinedListDbItem,
dbItem: LocalListDbItem | RemoteUserDefinedListDbItem,
listName: string,
children: DbTreeViewItem[],
): DbTreeViewItem {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export async function getRepositorySelection(
);
case DbItemKind.RemoteSystemDefinedList:
return { repositoryLists: [selectedDbItem.listName] };
case DbItemKind.VariantAnalysisUserDefinedList:
case DbItemKind.RemoteUserDefinedList:
if (selectedDbItem.repos.length === 0) {
throw new UserCancellationException(
"The selected repository list is empty. Please add repositories to it before running a variant analysis.",
Expand Down
8 changes: 4 additions & 4 deletions extensions/ql-vscode/test/factories/db-item-factories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
RemoteOwnerDbItem,
RemoteRepoDbItem,
RemoteSystemDefinedListDbItem,
VariantAnalysisUserDefinedListDbItem,
RemoteUserDefinedListDbItem,
RootLocalDbItem,
RootRemoteDbItem,
} from "../../src/databases/db-item";
Expand Down Expand Up @@ -79,7 +79,7 @@ export function createRemoteSystemDefinedListDbItem({
};
}

export function createVariantAnalysisUserDefinedListDbItem({
export function createRemoteUserDefinedListDbItem({
expanded = false,
selected = false,
listName = `list${faker.datatype.number()}`,
Expand All @@ -93,9 +93,9 @@ export function createVariantAnalysisUserDefinedListDbItem({
expanded?: boolean;
selected?: boolean;
repos?: RemoteRepoDbItem[];
} = {}): VariantAnalysisUserDefinedListDbItem {
} = {}): RemoteUserDefinedListDbItem {
return {
kind: DbItemKind.VariantAnalysisUserDefinedList,
kind: DbItemKind.RemoteUserDefinedList,
expanded,
selected,
listName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
createLocalListDbItem,
createRemoteOwnerDbItem,
createRemoteRepoDbItem,
createVariantAnalysisUserDefinedListDbItem,
createRemoteUserDefinedListDbItem,
} from "../../../factories/db-item-factories";
import { createMockApp } from "../../../__mocks__/appMock";

Expand Down Expand Up @@ -348,7 +348,7 @@ describe("db config store", () => {
const configStore = await initializeConfig(dbConfig, configPath, app);

// Rename
const currentDbItem = createVariantAnalysisUserDefinedListDbItem({
const currentDbItem = createRemoteUserDefinedListDbItem({
listName: "list1",
});
await configStore.renameRemoteList(currentDbItem, "listRenamed");
Expand Down Expand Up @@ -477,7 +477,7 @@ describe("db config store", () => {
const configStore = await initializeConfig(dbConfig, configPath, app);

// Rename
const currentDbItem = createVariantAnalysisUserDefinedListDbItem({
const currentDbItem = createRemoteUserDefinedListDbItem({
listName: "list1",
});
await expect(
Expand Down Expand Up @@ -555,7 +555,7 @@ describe("db config store", () => {
const configStore = await initializeConfig(dbConfig, configPath, app);

// Remove
const currentDbItem = createVariantAnalysisUserDefinedListDbItem({
const currentDbItem = createRemoteUserDefinedListDbItem({
listName: "list1",
});
await configStore.removeDbItem(currentDbItem);
Expand Down
Loading