Rename feature flag (#1961)
This commit is contained in:
@@ -1294,7 +1294,7 @@
|
||||
{
|
||||
"id": "codeQLVariantAnalysisRepositories",
|
||||
"name": "Variant Analysis Repositories",
|
||||
"when": "config.codeQL.canary && config.codeQL.newQueryRunExperience"
|
||||
"when": "config.codeQL.canary && config.codeQL.variantAnalysis.repositoriesPanel"
|
||||
},
|
||||
{
|
||||
"id": "codeQLQueryHistory",
|
||||
|
||||
@@ -476,7 +476,7 @@ export const NO_CACHE_AST_VIEWER = new Setting(
|
||||
);
|
||||
|
||||
// Settings for variant analysis
|
||||
const REMOTE_QUERIES_SETTING = new Setting("variantAnalysis", ROOT_SETTING);
|
||||
const VARIANT_ANALYSIS_SETTING = new Setting("variantAnalysis", ROOT_SETTING);
|
||||
|
||||
/**
|
||||
* Lists of GitHub repositories that you want to query remotely via the "Run Variant Analysis" command.
|
||||
@@ -487,7 +487,7 @@ const REMOTE_QUERIES_SETTING = new Setting("variantAnalysis", ROOT_SETTING);
|
||||
*/
|
||||
const REMOTE_REPO_LISTS = new Setting(
|
||||
"repositoryLists",
|
||||
REMOTE_QUERIES_SETTING,
|
||||
VARIANT_ANALYSIS_SETTING,
|
||||
);
|
||||
|
||||
export function getRemoteRepositoryLists():
|
||||
@@ -513,7 +513,7 @@ export async function setRemoteRepositoryLists(
|
||||
*/
|
||||
const REPO_LISTS_PATH = new Setting(
|
||||
"repositoryListsPath",
|
||||
REMOTE_QUERIES_SETTING,
|
||||
VARIANT_ANALYSIS_SETTING,
|
||||
);
|
||||
|
||||
export function getRemoteRepositoryListsPath(): string | undefined {
|
||||
@@ -528,7 +528,7 @@ export function getRemoteRepositoryListsPath(): string | undefined {
|
||||
*/
|
||||
const REMOTE_CONTROLLER_REPO = new Setting(
|
||||
"controllerRepo",
|
||||
REMOTE_QUERIES_SETTING,
|
||||
VARIANT_ANALYSIS_SETTING,
|
||||
);
|
||||
|
||||
export function getRemoteControllerRepo(): string | undefined {
|
||||
@@ -544,7 +544,7 @@ export async function setRemoteControllerRepo(repo: string | undefined) {
|
||||
* Default value is "main".
|
||||
* Note: This command is only available for internal users.
|
||||
*/
|
||||
const ACTION_BRANCH = new Setting("actionBranch", REMOTE_QUERIES_SETTING);
|
||||
const ACTION_BRANCH = new Setting("actionBranch", VARIANT_ANALYSIS_SETTING);
|
||||
|
||||
export function getActionBranch(): string {
|
||||
return ACTION_BRANCH.getValue<string>() || "main";
|
||||
@@ -559,16 +559,15 @@ export function isVariantAnalysisLiveResultsEnabled(): boolean {
|
||||
}
|
||||
|
||||
/**
|
||||
* A flag indicating whether to use the new query run experience which involves
|
||||
* using a new database panel.
|
||||
* A flag indicating whether to use the new "variant analysis repositories" panel.
|
||||
*/
|
||||
const NEW_QUERY_RUN_EXPERIENCE = new Setting(
|
||||
"newQueryRunExperience",
|
||||
ROOT_SETTING,
|
||||
const VARIANT_ANALYSIS_REPOS_PANEL = new Setting(
|
||||
"repositoriesPanel",
|
||||
VARIANT_ANALYSIS_SETTING,
|
||||
);
|
||||
|
||||
export function isNewQueryRunExperienceEnabled(): boolean {
|
||||
return !!NEW_QUERY_RUN_EXPERIENCE.getValue<boolean>();
|
||||
export function isVariantAnalysisReposPanelEnabled(): boolean {
|
||||
return !!VARIANT_ANALYSIS_REPOS_PANEL.getValue<boolean>();
|
||||
}
|
||||
|
||||
// Settings for mocking the GitHub API.
|
||||
|
||||
@@ -6,7 +6,7 @@ import { DbConfigStore } from "./config/db-config-store";
|
||||
import { DbManager } from "./db-manager";
|
||||
import { DbPanel } from "./ui/db-panel";
|
||||
import { DbSelectionDecorationProvider } from "./ui/db-selection-decoration-provider";
|
||||
import { isCanary, isNewQueryRunExperienceEnabled } from "../config";
|
||||
import { isCanary, isVariantAnalysisReposPanelEnabled } from "../config";
|
||||
|
||||
export class DbModule extends DisposableObject {
|
||||
public readonly dbManager: DbManager;
|
||||
@@ -36,7 +36,7 @@ export class DbModule extends DisposableObject {
|
||||
return true;
|
||||
}
|
||||
|
||||
return isCanary() && isNewQueryRunExperienceEnabled();
|
||||
return isCanary() && isVariantAnalysisReposPanelEnabled();
|
||||
}
|
||||
|
||||
private async initialize(): Promise<void> {
|
||||
|
||||
@@ -642,7 +642,7 @@ async function activateWithInstalledDistribution(
|
||||
cliServer,
|
||||
variantAnalysisStorageDir,
|
||||
variantAnalysisResultsManager,
|
||||
dbModule?.dbManager, // the dbModule is only needed when the newQueryRunExperience is enabled
|
||||
dbModule?.dbManager, // the dbModule is only needed when variantAnalysisReposPanel is enabled
|
||||
);
|
||||
ctx.subscriptions.push(variantAnalysisManager);
|
||||
ctx.subscriptions.push(variantAnalysisResultsManager);
|
||||
|
||||
@@ -4,7 +4,7 @@ import { extLogger } from "../common";
|
||||
import {
|
||||
getRemoteRepositoryLists,
|
||||
getRemoteRepositoryListsPath,
|
||||
isNewQueryRunExperienceEnabled,
|
||||
isVariantAnalysisReposPanelEnabled,
|
||||
} from "../config";
|
||||
import { OWNER_REGEX, REPO_REGEX } from "../pure/helpers-pure";
|
||||
import { UserCancellationException } from "../commandRunner";
|
||||
@@ -36,7 +36,7 @@ interface RepoList {
|
||||
export async function getRepositorySelection(
|
||||
dbManager?: DbManager,
|
||||
): Promise<RepositorySelection> {
|
||||
if (isNewQueryRunExperienceEnabled()) {
|
||||
if (isVariantAnalysisReposPanelEnabled()) {
|
||||
const selectedDbItem = dbManager?.getSelectedDbItem();
|
||||
if (selectedDbItem) {
|
||||
switch (selectedDbItem.kind) {
|
||||
|
||||
@@ -225,7 +225,7 @@ export async function prepareRemoteQueryRun(
|
||||
uri: Uri | undefined,
|
||||
progress: ProgressCallback,
|
||||
token: CancellationToken,
|
||||
dbManager?: DbManager, // the dbManager is only needed when the newQueryRunExperience is enabled
|
||||
dbManager?: DbManager, // the dbManager is only needed when variantAnalysisReposPanel is enabled
|
||||
): Promise<PreparedRemoteQuery> {
|
||||
if (!(await cliServer.cliConstraints.supportsRemoteQueries())) {
|
||||
throw new Error(
|
||||
|
||||
@@ -61,7 +61,7 @@ import {
|
||||
} from "../pure/variant-analysis-filter-sort";
|
||||
import { URLSearchParams } from "url";
|
||||
import { DbManager } from "../databases/db-manager";
|
||||
import { isNewQueryRunExperienceEnabled } from "../config";
|
||||
import { isVariantAnalysisReposPanelEnabled } from "../config";
|
||||
|
||||
export class VariantAnalysisManager
|
||||
extends DisposableObject
|
||||
@@ -103,7 +103,7 @@ export class VariantAnalysisManager
|
||||
private readonly cliServer: CodeQLCliServer,
|
||||
private readonly storagePath: string,
|
||||
private readonly variantAnalysisResultsManager: VariantAnalysisResultsManager,
|
||||
private readonly dbManager?: DbManager, // the dbManager is only needed when the newQueryRunExperience is enabled
|
||||
private readonly dbManager?: DbManager, // the dbManager is only needed when variantAnalysisReposPanel is enabled
|
||||
) {
|
||||
super();
|
||||
this.variantAnalysisMonitor = this.push(
|
||||
@@ -622,7 +622,7 @@ export class VariantAnalysisManager
|
||||
}
|
||||
|
||||
let text: string[];
|
||||
if (isNewQueryRunExperienceEnabled()) {
|
||||
if (isVariantAnalysisReposPanelEnabled()) {
|
||||
text = [
|
||||
"{",
|
||||
` "name": "new-repo-list",`,
|
||||
|
||||
@@ -1009,10 +1009,10 @@ describe("Variant Analysis Manager", () => {
|
||||
expect(writeTextStub).toBeCalledTimes(1);
|
||||
});
|
||||
|
||||
describe("newQueryRunExperience true", () => {
|
||||
describe("variantAnalysisReposPanel true", () => {
|
||||
beforeEach(() => {
|
||||
jest
|
||||
.spyOn(config, "isNewQueryRunExperienceEnabled")
|
||||
.spyOn(config, "isVariantAnalysisReposPanelEnabled")
|
||||
.mockReturnValue(true);
|
||||
});
|
||||
|
||||
@@ -1077,7 +1077,7 @@ describe("Variant Analysis Manager", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
describe("newQueryRunExperience false", () => {
|
||||
describe("variantAnalysisReposPanel false", () => {
|
||||
it("should be valid JSON when put in object", async () => {
|
||||
await variantAnalysisManager.copyRepoListToClipboard(
|
||||
variantAnalysis.id,
|
||||
|
||||
@@ -12,10 +12,10 @@ import {
|
||||
} from "../../../../src/databases/db-item";
|
||||
|
||||
describe("repository selection", () => {
|
||||
describe("newQueryRunExperience true", () => {
|
||||
describe("variantAnalysisReposPanel true", () => {
|
||||
beforeEach(() => {
|
||||
jest
|
||||
.spyOn(config, "isNewQueryRunExperienceEnabled")
|
||||
.spyOn(config, "isVariantAnalysisReposPanelEnabled")
|
||||
.mockReturnValue(true);
|
||||
});
|
||||
|
||||
@@ -115,7 +115,7 @@ describe("repository selection", () => {
|
||||
}
|
||||
});
|
||||
|
||||
describe("newQueryRunExperience false", () => {
|
||||
describe("variantAnalysisReposPanel false", () => {
|
||||
let quickPickSpy: jest.SpiedFunction<typeof window.showQuickPick>;
|
||||
let showInputBoxSpy: jest.SpiedFunction<typeof window.showInputBox>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user