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
2 changes: 1 addition & 1 deletion extensions/ql-vscode/gulpfile.ts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const packageFiles = [
"snippets.json",
"media",
"out",
"workspace-databases-schema.json",
"databases-schema.json",
];

async function copyDirectory(
Expand Down
4 changes: 2 additions & 2 deletions extensions/ql-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@
},
"jsonValidation": [
{
"fileMatch": "workspace-databases.json",
"url": "./workspace-databases-schema.json"
"fileMatch": "GitHub.vscode-codeql/databases.json",
"url": "./databases-schema.json"
}
],
"languages": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import {
} from "../db-item";

export class DbConfigStore extends DisposableObject {
public static readonly databaseConfigFileName = "databases.json";

public readonly onDidChangeConfig: AppEvent<void>;
private readonly onDidChangeConfigEventEmitter: AppEventEmitter<void>;

Expand All @@ -49,7 +51,7 @@ export class DbConfigStore extends DisposableObject {
super();

const storagePath = app.workspaceStoragePath || app.globalStoragePath;
this.configPath = join(storagePath, "workspace-databases.json");
this.configPath = join(storagePath, DbConfigStore.databaseConfigFileName);

this.config = this.createEmptyConfig();
this.configErrors = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ export class DbConfigValidator {
private readonly schema: any;

constructor(extensionPath: string) {
const schemaPath = resolve(
extensionPath,
"workspace-databases-schema.json",
);
const schemaPath = resolve(extensionPath, "databases-schema.json");
this.schema = readJsonSync(schemaPath);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe("db config store", () => {

const configPath = join(
tempWorkspaceStoragePath,
"workspace-databases.json",
DbConfigStore.databaseConfigFileName,
);

const configStore = new DbConfigStore(app, false);
Expand Down Expand Up @@ -195,7 +195,10 @@ describe("db config store", () => {
workspaceStoragePath: tempWorkspaceStoragePath,
});

configPath = join(tempWorkspaceStoragePath, "workspace-databases.json");
configPath = join(
tempWorkspaceStoragePath,
DbConfigStore.databaseConfigFileName,
);
});

it("should add a remote repository", async () => {
Expand Down Expand Up @@ -320,7 +323,10 @@ describe("db config store", () => {
workspaceStoragePath: tempWorkspaceStoragePath,
});

configPath = join(tempWorkspaceStoragePath, "workspace-databases.json");
configPath = join(
tempWorkspaceStoragePath,
DbConfigStore.databaseConfigFileName,
);
});

it("should allow renaming a remote list", async () => {
Expand Down Expand Up @@ -492,7 +498,10 @@ describe("db config store", () => {
workspaceStoragePath: tempWorkspaceStoragePath,
});

configPath = join(tempWorkspaceStoragePath, "workspace-databases.json");
configPath = join(
tempWorkspaceStoragePath,
DbConfigStore.databaseConfigFileName,
);
});

it("should remove a single db item", async () => {
Expand Down Expand Up @@ -612,7 +621,10 @@ describe("db config store", () => {
workspaceStoragePath: tempWorkspaceStoragePath,
});

configPath = join(tempWorkspaceStoragePath, "workspace-databases.json");
configPath = join(
tempWorkspaceStoragePath,
DbConfigStore.databaseConfigFileName,
);
});

it("should set the selected item", async () => {
Expand Down Expand Up @@ -648,7 +660,10 @@ describe("db config store", () => {
workspaceStoragePath: tempWorkspaceStoragePath,
});

configPath = join(tempWorkspaceStoragePath, "workspace-databases.json");
configPath = join(
tempWorkspaceStoragePath,
DbConfigStore.databaseConfigFileName,
);
});

it("should return true if a remote owner exists", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe("db manager", () => {

dbConfigFilePath = join(
tempWorkspaceStoragePath,
"workspace-databases.json",
DbConfigStore.databaseConfigFileName,
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
import { DbListKind } from "../../../../src/databases/db-item";
import { createDbTreeViewItemSystemDefinedList } from "../../../../src/databases/ui/db-tree-view-item";
import { createRemoteSystemDefinedListDbItem } from "../../../factories/db-item-factories";
import { DbConfigStore } from "../../../../src/databases/config/db-config-store";

jest.setTimeout(60_000);

Expand Down Expand Up @@ -43,7 +44,10 @@ describe("Db panel UI commands", () => {
);

// Check db config
const dbConfigFilePath = path.join(storagePath, "workspace-databases.json");
const dbConfigFilePath = path.join(
storagePath,
DbConfigStore.databaseConfigFileName,
);
const dbConfig: DbConfig = await readJson(dbConfigFilePath);
expect(dbConfig.databases.variantAnalysis.repositoryLists).toHaveLength(1);
expect(dbConfig.databases.variantAnalysis.repositoryLists[0].name).toBe(
Expand All @@ -62,7 +66,10 @@ describe("Db panel UI commands", () => {
);

// Check db config
const dbConfigFilePath = path.join(storagePath, "workspace-databases.json");
const dbConfigFilePath = path.join(
storagePath,
DbConfigStore.databaseConfigFileName,
);
const dbConfig: DbConfig = await readJson(dbConfigFilePath);
expect(dbConfig.databases.local.lists).toHaveLength(1);
expect(dbConfig.databases.local.lists[0].name).toBe("my-list-1");
Expand All @@ -80,7 +87,10 @@ describe("Db panel UI commands", () => {
);

// Check db config
const dbConfigFilePath = path.join(storagePath, "workspace-databases.json");
const dbConfigFilePath = path.join(
storagePath,
DbConfigStore.databaseConfigFileName,
);
const dbConfig: DbConfig = await readJson(dbConfigFilePath);
expect(dbConfig.databases.variantAnalysis.repositories).toHaveLength(1);
expect(dbConfig.databases.variantAnalysis.repositories[0]).toBe(
Expand All @@ -100,7 +110,10 @@ describe("Db panel UI commands", () => {
);

// Check db config
const dbConfigFilePath = path.join(storagePath, "workspace-databases.json");
const dbConfigFilePath = path.join(
storagePath,
DbConfigStore.databaseConfigFileName,
);
const dbConfig: DbConfig = await readJson(dbConfigFilePath);
expect(dbConfig.databases.variantAnalysis.owners).toHaveLength(1);
expect(dbConfig.databases.variantAnalysis.owners[0]).toBe("owner1");
Expand All @@ -120,7 +133,10 @@ describe("Db panel UI commands", () => {
);

// Check db config
const dbConfigFilePath = path.join(storagePath, "workspace-databases.json");
const dbConfigFilePath = path.join(
storagePath,
DbConfigStore.databaseConfigFileName,
);
const dbConfig: DbConfig = await readJson(dbConfigFilePath);
expect(dbConfig.selected).toBeDefined();
expect(dbConfig.selected).toEqual({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe("db panel", () => {
const extensionPath = join(__dirname, "../../../../");
const dbConfigFilePath = join(
workspaceStoragePath,
"workspace-databases.json",
DbConfigStore.databaseConfigFileName,
);
let dbTreeDataProvider: DbTreeDataProvider;
let dbManager: DbManager;
Expand Down