Merge pull request #2090 from github/elena/install-csv-depenedencies

Install dependencies for tutorial query in codespace
This commit is contained in:
Elena Tanasoiu
2023-02-27 20:24:04 +00:00
committed by GitHub

View File

@@ -390,6 +390,7 @@ export class DatabaseUI extends DisposableObject {
);
}
await this.databaseManager.setCurrentDatabaseItem(databaseItem);
await this.handleTourDependencies();
}
} catch (e) {
// rethrow and let this be handled by default error handling.
@@ -401,6 +402,22 @@ export class DatabaseUI extends DisposableObject {
}
};
private handleTourDependencies = async (): Promise<void> => {
if (!workspace.workspaceFolders?.length) {
throw new Error("No workspace folder is open.");
} else {
const tutorialQueriesPath = join(
workspace.workspaceFolders[0].uri.fsPath,
"tutorial-queries",
);
const cli = this.queryServer?.cliServer;
if (!cli) {
throw new Error("No CLI server found");
}
await cli.packInstall(tutorialQueriesPath);
}
};
handleRemoveOrphanedDatabases = async (): Promise<void> => {
void extLogger.log("Removing orphaned databases from workspace storage.");
let dbDirs = undefined;