Rename remote to variant analysis

This commit is contained in:
Nora
2023-01-17 13:43:08 +00:00
parent 611f6e39e0
commit fe17f61b5e
5 changed files with 33 additions and 25 deletions

View File

@@ -146,7 +146,7 @@ export class DbConfigStore extends DisposableObject {
parentList?: string, parentList?: string,
): Promise<void> { ): Promise<void> {
if (!this.config) { if (!this.config) {
throw Error("Cannot add remote repo if config is not loaded"); throw Error("Cannot add variant analysis repo if config is not loaded");
} }
if (repoNwo === "") { if (repoNwo === "") {
@@ -155,7 +155,7 @@ export class DbConfigStore extends DisposableObject {
if (this.doesRemoteDbExist(repoNwo)) { if (this.doesRemoteDbExist(repoNwo)) {
throw Error( throw Error(
`A remote repository with the name '${repoNwo}' already exists`, `A variant analysis repository with the name '${repoNwo}' already exists`,
); );
} }
@@ -177,7 +177,7 @@ export class DbConfigStore extends DisposableObject {
public async addRemoteOwner(owner: string): Promise<void> { public async addRemoteOwner(owner: string): Promise<void> {
if (!this.config) { if (!this.config) {
throw Error("Cannot add remote owner if config is not loaded"); throw Error("Cannot add owner if config is not loaded");
} }
if (owner === "") { if (owner === "") {
@@ -185,7 +185,7 @@ export class DbConfigStore extends DisposableObject {
} }
if (this.doesRemoteOwnerExist(owner)) { if (this.doesRemoteOwnerExist(owner)) {
throw Error(`A remote owner with the name '${owner}' already exists`); throw Error(`An owner with the name '${owner}' already exists`);
} }
const config = cloneDbConfig(this.config); const config = cloneDbConfig(this.config);
@@ -212,7 +212,7 @@ export class DbConfigStore extends DisposableObject {
public async addRemoteList(listName: string): Promise<void> { public async addRemoteList(listName: string): Promise<void> {
if (!this.config) { if (!this.config) {
throw Error("Cannot add remote list if config is not loaded"); throw Error("Cannot add variant analysis list if config is not loaded");
} }
this.validateRemoteListName(listName); this.validateRemoteListName(listName);
@@ -250,7 +250,9 @@ export class DbConfigStore extends DisposableObject {
newName: string, newName: string,
) { ) {
if (!this.config) { if (!this.config) {
throw Error("Cannot rename remote list if config is not loaded"); throw Error(
"Cannot rename variant analysis list if config is not loaded",
);
} }
this.validateRemoteListName(newName); this.validateRemoteListName(newName);
@@ -287,7 +289,9 @@ export class DbConfigStore extends DisposableObject {
public doesRemoteListExist(listName: string): boolean { public doesRemoteListExist(listName: string): boolean {
if (!this.config) { if (!this.config) {
throw Error("Cannot check remote list existence if config is not loaded"); throw Error(
"Cannot check variant analysis list existence if config is not loaded",
);
} }
return this.config.databases.variantAnalysis.repositoryLists.some( return this.config.databases.variantAnalysis.repositoryLists.some(
@@ -306,7 +310,7 @@ export class DbConfigStore extends DisposableObject {
public doesLocalDbExist(dbName: string, listName?: string): boolean { public doesLocalDbExist(dbName: string, listName?: string): boolean {
if (!this.config) { if (!this.config) {
throw Error( throw Error(
"Cannot check remote database existence if config is not loaded", "Cannot check variant analysis repository existence if config is not loaded",
); );
} }
@@ -323,7 +327,7 @@ export class DbConfigStore extends DisposableObject {
public doesRemoteDbExist(dbName: string, listName?: string): boolean { public doesRemoteDbExist(dbName: string, listName?: string): boolean {
if (!this.config) { if (!this.config) {
throw Error( throw Error(
"Cannot check remote database existence if config is not loaded", "Cannot check variant analysis repository existence if config is not loaded",
); );
} }
@@ -338,9 +342,7 @@ export class DbConfigStore extends DisposableObject {
public doesRemoteOwnerExist(owner: string): boolean { public doesRemoteOwnerExist(owner: string): boolean {
if (!this.config) { if (!this.config) {
throw Error( throw Error("Cannot check owner existence if config is not loaded");
"Cannot check remote owner existence if config is not loaded",
);
} }
return this.config.databases.variantAnalysis.owners.includes(owner); return this.config.databases.variantAnalysis.owners.includes(owner);
@@ -482,7 +484,9 @@ export class DbConfigStore extends DisposableObject {
} }
if (this.doesRemoteListExist(listName)) { if (this.doesRemoteListExist(listName)) {
throw Error(`A remote list with the name '${listName}' already exists`); throw Error(
`A variant analysis list with the name '${listName}' already exists`,
);
} }
} }

View File

@@ -381,7 +381,7 @@ function getRemoteList(
); );
if (!list) { if (!list) {
throw Error(`Cannot find remote list '${listName}'`); throw Error(`Cannot find variant analysis list '${listName}'`);
} }
return list; return list;

View File

@@ -135,14 +135,14 @@ export class DbPanel extends DisposableObject {
const quickPickItems = [ const quickPickItems = [
{ {
label: "$(repo) From a GitHub repository", label: "$(repo) From a GitHub repository",
detail: "Add a remote repository from GitHub", detail: "Add a variant analysis repository from GitHub",
alwaysShow: true, alwaysShow: true,
kind: "repo", kind: "repo",
}, },
{ {
label: "$(organization) All repositories of a GitHub org or owner", label: "$(organization) All repositories of a GitHub org or owner",
detail: detail:
"Add a remote list of repositories from a GitHub organization/owner", "Add a variant analysis list of repositories from a GitHub organization/owner",
alwaysShow: true, alwaysShow: true,
kind: "owner", kind: "owner",
}, },
@@ -151,7 +151,7 @@ export class DbPanel extends DisposableObject {
await window.showQuickPick<RemoteDatabaseQuickPickItem>( await window.showQuickPick<RemoteDatabaseQuickPickItem>(
quickPickItems, quickPickItems,
{ {
title: "Add a remote repository", title: "Add a variant analysis repository",
placeHolder: "Select an option", placeHolder: "Select an option",
ignoreFocusOut: true, ignoreFocusOut: true,
}, },
@@ -171,7 +171,7 @@ export class DbPanel extends DisposableObject {
private async addNewRemoteRepo(parentList?: string): Promise<void> { private async addNewRemoteRepo(parentList?: string): Promise<void> {
const repoName = await window.showInputBox({ const repoName = await window.showInputBox({
title: "Add a remote repository", title: "Add a repository",
prompt: "Insert a GitHub repository URL or name with owner", prompt: "Insert a GitHub repository URL or name with owner",
placeHolder: "github.com/<owner>/<repo> or <owner>/<repo>", placeHolder: "github.com/<owner>/<repo> or <owner>/<repo>",
}); });
@@ -246,8 +246,8 @@ export class DbPanel extends DisposableObject {
} else { } else {
const quickPickItems = [ const quickPickItems = [
{ {
label: "$(cloud) Remote", label: "$(cloud) Variant Analysis",
detail: "Add a remote database from GitHub", detail: "Add a repository from GitHub",
alwaysShow: true, alwaysShow: true,
kind: DbListKind.Remote, kind: DbListKind.Remote,
}, },
@@ -419,7 +419,7 @@ export class DbPanel extends DisposableObject {
const githubUrl = getGitHubUrl(treeViewItem.dbItem); const githubUrl = getGitHubUrl(treeViewItem.dbItem);
if (!githubUrl) { if (!githubUrl) {
throw new Error( throw new Error(
"Unable to open on GitHub. Please select a remote repository or owner.", "Unable to open on GitHub. Please select a variant analysis repository or owner.",
); );
} }

View File

@@ -482,7 +482,9 @@ describe("db config store", () => {
}); });
await expect( await expect(
configStore.renameRemoteList(currentDbItem, "list2"), configStore.renameRemoteList(currentDbItem, "list2"),
).rejects.toThrow(`A remote list with the name 'list2' already exists`); ).rejects.toThrow(
`A variant analysis list with the name 'list2' already exists`,
);
configStore.dispose(); configStore.dispose();
}); });

View File

@@ -715,7 +715,9 @@ describe("db panel", () => {
await expect( await expect(
dbManager.addNewList(DbListKind.Remote, "my-list-1"), dbManager.addNewList(DbListKind.Remote, "my-list-1"),
).rejects.toThrow( ).rejects.toThrow(
new Error("A remote list with the name 'my-list-1' already exists"), new Error(
"A variant analysis list with the name 'my-list-1' already exists",
),
); );
}); });
@@ -738,7 +740,7 @@ describe("db panel", () => {
await expect(dbManager.addNewRemoteRepo("owner1/repo1")).rejects.toThrow( await expect(dbManager.addNewRemoteRepo("owner1/repo1")).rejects.toThrow(
new Error( new Error(
"A remote repository with the name 'owner1/repo1' already exists", "A variant analysis repository with the name 'owner1/repo1' already exists",
), ),
); );
}); });
@@ -761,7 +763,7 @@ describe("db panel", () => {
await saveDbConfig(dbConfig); await saveDbConfig(dbConfig);
await expect(dbManager.addNewRemoteOwner("owner1")).rejects.toThrow( await expect(dbManager.addNewRemoteOwner("owner1")).rejects.toThrow(
new Error("A remote owner with the name 'owner1' already exists"), new Error("An owner with the name 'owner1' already exists"),
); );
}); });
}); });