Renamed 'interface managers' to something more specific (#1510)
This commit is contained in:
@@ -22,7 +22,7 @@ export type InterfacePanelConfig = {
|
||||
additionalOptions?: WebviewPanelOptions & WebviewOptions;
|
||||
}
|
||||
|
||||
export abstract class AbstractInterfaceManager<ToMessage extends WebviewMessage, FromMessage extends WebviewMessage> extends DisposableObject {
|
||||
export abstract class AbstractWebview<ToMessage extends WebviewMessage, FromMessage extends WebviewMessage> extends DisposableObject {
|
||||
protected panel: WebviewPanel | undefined;
|
||||
protected panelLoaded = false;
|
||||
protected panelLoadedCallBacks: (() => void)[] = [];
|
||||
@@ -17,14 +17,14 @@ import resultsDiff from './resultsDiff';
|
||||
import { CompletedLocalQueryInfo } from '../query-results';
|
||||
import { getErrorMessage } from '../pure/helpers-pure';
|
||||
import { HistoryItemLabelProvider } from '../history-item-label-provider';
|
||||
import { AbstractInterfaceManager, InterfacePanelConfig } from '../abstract-interface-manager';
|
||||
import { AbstractWebview, InterfacePanelConfig } from '../abstract-webview';
|
||||
|
||||
interface ComparePair {
|
||||
from: CompletedLocalQueryInfo;
|
||||
to: CompletedLocalQueryInfo;
|
||||
}
|
||||
|
||||
export class CompareInterfaceManager extends AbstractInterfaceManager<ToCompareViewMessage, FromCompareViewMessage> {
|
||||
export class CompareView extends AbstractWebview<ToCompareViewMessage, FromCompareViewMessage> {
|
||||
private comparePair: ComparePair | undefined;
|
||||
|
||||
constructor(
|
||||
@@ -68,7 +68,7 @@ import {
|
||||
} from './helpers';
|
||||
import { asError, assertNever, getErrorMessage } from './pure/helpers-pure';
|
||||
import { spawnIdeServer } from './ide-server';
|
||||
import { InterfaceManager } from './interface';
|
||||
import { ResultsView } from './interface';
|
||||
import { WebviewReveal } from './interface-utils';
|
||||
import { ideServerLogger, logger, queryServerLogger } from './logging';
|
||||
import { QueryHistoryManager } from './query-history';
|
||||
@@ -78,7 +78,7 @@ import { displayQuickQuery } from './quick-query';
|
||||
import { compileAndRunQueryAgainstDatabase, createInitialQueryInfo } from './run-queries';
|
||||
import { QLTestAdapterFactory } from './test-adapter';
|
||||
import { TestUIService } from './test-ui';
|
||||
import { CompareInterfaceManager } from './compare/compare-interface';
|
||||
import { CompareView } from './compare/compare-view';
|
||||
import { gatherQlFiles } from './pure/files';
|
||||
import { initializeTelemetry } from './telemetry';
|
||||
import {
|
||||
@@ -102,7 +102,7 @@ import { EvalLogViewer } from './eval-log-viewer';
|
||||
import { SummaryLanguageSupport } from './log-insights/summary-language-support';
|
||||
import { JoinOrderScannerProvider } from './log-insights/join-order';
|
||||
import { LogScannerService } from './log-insights/log-scanner-service';
|
||||
import { VariantAnalysisInterfaceManager } from './remote-queries/variant-analysis-interface';
|
||||
import { VariantAnalysisView } from './remote-queries/variant-analysis-view';
|
||||
|
||||
/**
|
||||
* extension.ts
|
||||
@@ -461,8 +461,8 @@ async function activateWithInstalledDistribution(
|
||||
const labelProvider = new HistoryItemLabelProvider(queryHistoryConfigurationListener);
|
||||
|
||||
void logger.log('Initializing results panel interface.');
|
||||
const intm = new InterfaceManager(ctx, dbm, cliServer, queryServerLogger, labelProvider);
|
||||
ctx.subscriptions.push(intm);
|
||||
const localQueryResultsView = new ResultsView(ctx, dbm, cliServer, queryServerLogger, labelProvider);
|
||||
ctx.subscriptions.push(localQueryResultsView);
|
||||
|
||||
void logger.log('Initializing variant analysis manager.');
|
||||
const rqm = new RemoteQueriesManager(ctx, cliServer, queryStorageDir, logger);
|
||||
@@ -472,7 +472,7 @@ async function activateWithInstalledDistribution(
|
||||
const qhm = new QueryHistoryManager(
|
||||
qs,
|
||||
dbm,
|
||||
intm,
|
||||
localQueryResultsView,
|
||||
rqm,
|
||||
evalLogViewer,
|
||||
queryStorageDir,
|
||||
@@ -494,8 +494,8 @@ async function activateWithInstalledDistribution(
|
||||
void logger.log('Reading query history');
|
||||
await qhm.readQueryHistory();
|
||||
|
||||
void logger.log('Initializing compare panel interface.');
|
||||
const cmpm = new CompareInterfaceManager(
|
||||
void logger.log('Initializing compare view.');
|
||||
const compareView = new CompareView(
|
||||
ctx,
|
||||
dbm,
|
||||
cliServer,
|
||||
@@ -503,7 +503,7 @@ async function activateWithInstalledDistribution(
|
||||
labelProvider,
|
||||
showResults
|
||||
);
|
||||
ctx.subscriptions.push(cmpm);
|
||||
ctx.subscriptions.push(compareView);
|
||||
|
||||
void logger.log('Initializing source archive filesystem provider.');
|
||||
archiveFilesystemProvider.activate(ctx);
|
||||
@@ -513,7 +513,7 @@ async function activateWithInstalledDistribution(
|
||||
to: CompletedLocalQueryInfo
|
||||
): Promise<void> {
|
||||
try {
|
||||
await cmpm.showResults(from, to);
|
||||
await compareView.showResults(from, to);
|
||||
} catch (e) {
|
||||
void showAndLogErrorMessage(getErrorMessage(e));
|
||||
}
|
||||
@@ -523,7 +523,7 @@ async function activateWithInstalledDistribution(
|
||||
query: CompletedLocalQueryInfo,
|
||||
forceReveal: WebviewReveal
|
||||
): Promise<void> {
|
||||
await intm.showResults(query, forceReveal, false);
|
||||
await localQueryResultsView.showResults(query, forceReveal, false);
|
||||
}
|
||||
|
||||
async function compileAndRunQuery(
|
||||
@@ -922,7 +922,7 @@ async function activateWithInstalledDistribution(
|
||||
|
||||
ctx.subscriptions.push(
|
||||
commandRunner('codeQL.mockVariantAnalysisView', async () => {
|
||||
const variantAnalysisView = new VariantAnalysisInterfaceManager(ctx);
|
||||
const variantAnalysisView = new VariantAnalysisView(ctx);
|
||||
variantAnalysisView.openView();
|
||||
})
|
||||
);
|
||||
|
||||
@@ -44,7 +44,7 @@ import {
|
||||
} from './interface-utils';
|
||||
import { getDefaultResultSetName, ParsedResultSets } from './pure/interface-types';
|
||||
import { RawResultSet, transformBqrsResultSet, ResultSetSchema } from './pure/bqrs-cli-types';
|
||||
import { AbstractInterfaceManager, InterfacePanelConfig } from './abstract-interface-manager';
|
||||
import { AbstractWebview, InterfacePanelConfig } from './abstract-webview';
|
||||
import { PAGE_SIZE } from './config';
|
||||
import { CompletedLocalQueryInfo } from './query-results';
|
||||
import { HistoryItemLabelProvider } from './history-item-label-provider';
|
||||
@@ -120,7 +120,7 @@ function numInterpretedPages(interpretation: Interpretation | undefined): number
|
||||
return Math.ceil(n / pageSize);
|
||||
}
|
||||
|
||||
export class InterfaceManager extends AbstractInterfaceManager<IntoResultsViewMsg, FromResultsViewMsg> {
|
||||
export class ResultsView extends AbstractWebview<IntoResultsViewMsg, FromResultsViewMsg> {
|
||||
private _displayedQuery?: CompletedLocalQueryInfo;
|
||||
private _interpretation?: Interpretation;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ import { Credentials } from './authentication';
|
||||
import { cancelRemoteQuery } from './remote-queries/gh-actions-api-client';
|
||||
import { RemoteQueriesManager } from './remote-queries/remote-queries-manager';
|
||||
import { RemoteQueryHistoryItem } from './remote-queries/remote-query-history-item';
|
||||
import { InterfaceManager } from './interface';
|
||||
import { ResultsView } from './interface';
|
||||
import { WebviewReveal } from './interface-utils';
|
||||
import { EvalLogViewer } from './eval-log-viewer';
|
||||
import EvalLogTreeBuilder from './eval-log-tree-builder';
|
||||
@@ -331,7 +331,7 @@ export class QueryHistoryManager extends DisposableObject {
|
||||
constructor(
|
||||
private readonly qs: QueryServerClient,
|
||||
private readonly dbm: DatabaseManager,
|
||||
private readonly localQueriesInterfaceManager: InterfaceManager,
|
||||
private readonly localQueriesResultsView: ResultsView,
|
||||
private readonly remoteQueriesManager: RemoteQueriesManager,
|
||||
private readonly evalLogViewer: EvalLogViewer,
|
||||
private readonly queryStorageDir: string,
|
||||
@@ -1360,7 +1360,7 @@ the file in the file explorer and dragging it into the workspace.`
|
||||
|
||||
private async openQueryResults(item: QueryHistoryInfo) {
|
||||
if (item.t === 'local') {
|
||||
await this.localQueriesInterfaceManager.showResults(item as CompletedLocalQueryInfo, WebviewReveal.Forced, false);
|
||||
await this.localQueriesResultsView.showResults(item as CompletedLocalQueryInfo, WebviewReveal.Forced, false);
|
||||
}
|
||||
else if (item.t === 'remote') {
|
||||
await this.remoteQueriesManager.openRemoteQueryResults(item.queryId);
|
||||
|
||||
@@ -10,7 +10,7 @@ import { ProgressCallback } from '../commandRunner';
|
||||
import { createTimestampFile, showAndLogErrorMessage, showAndLogInformationMessage, showInformationMessageWithAction } from '../helpers';
|
||||
import { Logger } from '../logging';
|
||||
import { runRemoteQuery } from './run-remote-query';
|
||||
import { RemoteQueriesInterfaceManager } from './remote-queries-interface';
|
||||
import { RemoteQueriesView } from './remote-queries-view';
|
||||
import { RemoteQuery } from './remote-query';
|
||||
import { RemoteQueriesMonitor } from './remote-queries-monitor';
|
||||
import { getRemoteQueryIndex, getRepositoriesMetadata, RepositoriesMetadata } from './gh-actions-api-client';
|
||||
@@ -56,7 +56,7 @@ export class RemoteQueriesManager extends DisposableObject {
|
||||
|
||||
private readonly remoteQueriesMonitor: RemoteQueriesMonitor;
|
||||
private readonly analysesResultsManager: AnalysesResultsManager;
|
||||
private readonly interfaceManager: RemoteQueriesInterfaceManager;
|
||||
private readonly view: RemoteQueriesView;
|
||||
|
||||
constructor(
|
||||
private readonly ctx: ExtensionContext,
|
||||
@@ -66,7 +66,7 @@ export class RemoteQueriesManager extends DisposableObject {
|
||||
) {
|
||||
super();
|
||||
this.analysesResultsManager = new AnalysesResultsManager(ctx, cliServer, storagePath, logger);
|
||||
this.interfaceManager = new RemoteQueriesInterfaceManager(ctx, logger, this.analysesResultsManager);
|
||||
this.view = new RemoteQueriesView(ctx, logger, this.analysesResultsManager);
|
||||
this.remoteQueriesMonitor = new RemoteQueriesMonitor(ctx, logger);
|
||||
|
||||
this.remoteQueryAddedEventEmitter = this.push(new EventEmitter<NewQueryEvent>());
|
||||
@@ -76,7 +76,7 @@ export class RemoteQueriesManager extends DisposableObject {
|
||||
this.onRemoteQueryRemoved = this.remoteQueryRemovedEventEmitter.event;
|
||||
this.onRemoteQueryStatusUpdate = this.remoteQueryStatusUpdateEventEmitter.event;
|
||||
|
||||
this.push(this.interfaceManager);
|
||||
this.push(this.view);
|
||||
}
|
||||
|
||||
public async rehydrateRemoteQuery(queryId: string, query: RemoteQuery, status: QueryStatus) {
|
||||
@@ -192,7 +192,7 @@ export class RemoteQueriesManager extends DisposableObject {
|
||||
await this.analysesResultsManager.loadAnalysesResults(
|
||||
analysesToDownload,
|
||||
token,
|
||||
results => this.interfaceManager.setAnalysisResults(results, queryResult.queryId));
|
||||
results => this.view.setAnalysisResults(results, queryResult.queryId));
|
||||
}
|
||||
|
||||
public async copyRemoteQueryRepoListToClipboard(queryId: string) {
|
||||
@@ -248,7 +248,7 @@ export class RemoteQueriesManager extends DisposableObject {
|
||||
}
|
||||
|
||||
public async openResults(query: RemoteQuery, queryResult: RemoteQueryResult) {
|
||||
await this.interfaceManager.showResults(query, queryResult);
|
||||
await this.view.showResults(query, queryResult);
|
||||
}
|
||||
|
||||
private async askToOpenResults(query: RemoteQuery, queryResult: RemoteQueryResult): Promise<void> {
|
||||
|
||||
@@ -32,9 +32,9 @@ import { SHOW_QUERY_TEXT_MSG } from '../query-history';
|
||||
import { AnalysesResultsManager } from './analyses-results-manager';
|
||||
import { AnalysisResults } from './shared/analysis-result';
|
||||
import { humanizeUnit } from '../pure/time';
|
||||
import { AbstractInterfaceManager, InterfacePanelConfig } from '../abstract-interface-manager';
|
||||
import { AbstractWebview, InterfacePanelConfig } from '../abstract-webview';
|
||||
|
||||
export class RemoteQueriesInterfaceManager extends AbstractInterfaceManager<ToRemoteQueriesMessage, FromRemoteQueriesMessage> {
|
||||
export class RemoteQueriesView extends AbstractWebview<ToRemoteQueriesMessage, FromRemoteQueriesMessage> {
|
||||
private currentQueryId: string | undefined;
|
||||
|
||||
constructor(
|
||||
@@ -1,9 +1,9 @@
|
||||
import { ViewColumn } from 'vscode';
|
||||
import { AbstractInterfaceManager, InterfacePanelConfig } from '../abstract-interface-manager';
|
||||
import { AbstractWebview, InterfacePanelConfig } from '../abstract-webview';
|
||||
import { WebviewMessage } from '../interface-utils';
|
||||
import { logger } from '../logging';
|
||||
|
||||
export class VariantAnalysisInterfaceManager extends AbstractInterfaceManager<WebviewMessage, WebviewMessage> {
|
||||
export class VariantAnalysisView extends AbstractWebview<WebviewMessage, WebviewMessage> {
|
||||
public openView() {
|
||||
this.getPanel().reveal(undefined, true);
|
||||
}
|
||||
@@ -19,7 +19,7 @@ import { tmpDir } from '../../helpers';
|
||||
import { getErrorMessage } from '../../pure/helpers-pure';
|
||||
import { HistoryItemLabelProvider } from '../../history-item-label-provider';
|
||||
import { RemoteQueriesManager } from '../../remote-queries/remote-queries-manager';
|
||||
import { InterfaceManager } from '../../interface';
|
||||
import { ResultsView } from '../../interface';
|
||||
import { EvalLogViewer } from '../../eval-log-viewer';
|
||||
|
||||
describe('query-history', () => {
|
||||
@@ -32,7 +32,7 @@ describe('query-history', () => {
|
||||
let queryHistoryManager: QueryHistoryManager | undefined;
|
||||
let doCompareCallback: sinon.SinonStub;
|
||||
|
||||
let localQueriesInterfaceManagerStub: InterfaceManager;
|
||||
let localQueriesResultsViewStub: ResultsView;
|
||||
let remoteQueriesManagerStub: RemoteQueriesManager;
|
||||
|
||||
let tryOpenExternalFile: Function;
|
||||
@@ -55,9 +55,9 @@ describe('query-history', () => {
|
||||
tryOpenExternalFile = (QueryHistoryManager.prototype as any).tryOpenExternalFile;
|
||||
configListener = new QueryHistoryConfigListener();
|
||||
doCompareCallback = sandbox.stub();
|
||||
localQueriesInterfaceManagerStub = {
|
||||
localQueriesResultsViewStub = {
|
||||
showResults: sandbox.stub()
|
||||
} as any as InterfaceManager;
|
||||
} as any as ResultsView;
|
||||
remoteQueriesManagerStub = {
|
||||
onRemoteQueryAdded: sandbox.stub(),
|
||||
onRemoteQueryRemoved: sandbox.stub(),
|
||||
@@ -205,7 +205,7 @@ describe('query-history', () => {
|
||||
|
||||
await queryHistoryManager.handleItemClicked(allHistory[0], [allHistory[0]]);
|
||||
|
||||
expect(localQueriesInterfaceManagerStub.showResults).to.have.been.calledOnceWith(allHistory[0]);
|
||||
expect(localQueriesResultsViewStub.showResults).to.have.been.calledOnceWith(allHistory[0]);
|
||||
expect(queryHistoryManager.treeDataProvider.getCurrent()).to.eq(allHistory[0]);
|
||||
});
|
||||
|
||||
@@ -214,7 +214,7 @@ describe('query-history', () => {
|
||||
|
||||
await queryHistoryManager.handleItemClicked(allHistory[0], [allHistory[0], allHistory[1]]);
|
||||
|
||||
expect(localQueriesInterfaceManagerStub.showResults).not.to.have.been.called;
|
||||
expect(localQueriesResultsViewStub.showResults).not.to.have.been.called;
|
||||
expect(queryHistoryManager.treeDataProvider.getCurrent()).to.be.undefined;
|
||||
});
|
||||
|
||||
@@ -223,7 +223,7 @@ describe('query-history', () => {
|
||||
|
||||
await queryHistoryManager.handleItemClicked(undefined!, []);
|
||||
|
||||
expect(localQueriesInterfaceManagerStub.showResults).not.to.have.been.called;
|
||||
expect(localQueriesResultsViewStub.showResults).not.to.have.been.called;
|
||||
expect(queryHistoryManager.treeDataProvider.getCurrent()).to.be.undefined;
|
||||
});
|
||||
});
|
||||
@@ -252,7 +252,7 @@ describe('query-history', () => {
|
||||
expect(queryHistoryManager.treeDataProvider.allHistory).not.to.contain(toDelete);
|
||||
|
||||
// the same item should be selected
|
||||
expect(localQueriesInterfaceManagerStub.showResults).to.have.been.calledOnceWith(selected);
|
||||
expect(localQueriesResultsViewStub.showResults).to.have.been.calledOnceWith(selected);
|
||||
});
|
||||
|
||||
it('should remove an item and select a new one', async () => {
|
||||
@@ -272,7 +272,7 @@ describe('query-history', () => {
|
||||
expect(queryHistoryManager.treeDataProvider.allHistory).not.to.contain(toDelete);
|
||||
|
||||
// the current item should have been selected
|
||||
expect(localQueriesInterfaceManagerStub.showResults).to.have.been.calledOnceWith(newSelected);
|
||||
expect(localQueriesResultsViewStub.showResults).to.have.been.calledOnceWith(newSelected);
|
||||
});
|
||||
|
||||
describe('Compare callback', () => {
|
||||
@@ -798,7 +798,7 @@ describe('query-history', () => {
|
||||
const qhm = new QueryHistoryManager(
|
||||
{} as QueryServerClient,
|
||||
{} as DatabaseManager,
|
||||
localQueriesInterfaceManagerStub,
|
||||
localQueriesResultsViewStub,
|
||||
remoteQueriesManagerStub,
|
||||
{} as EvalLogViewer,
|
||||
'xxx',
|
||||
|
||||
@@ -18,7 +18,7 @@ import { walkDirectory } from '../../../helpers';
|
||||
import { getErrorMessage } from '../../../pure/helpers-pure';
|
||||
import { HistoryItemLabelProvider } from '../../../history-item-label-provider';
|
||||
import { RemoteQueriesManager } from '../../../remote-queries/remote-queries-manager';
|
||||
import { InterfaceManager } from '../../../interface';
|
||||
import { ResultsView } from '../../../interface';
|
||||
import { EvalLogViewer } from '../../../eval-log-viewer';
|
||||
|
||||
/**
|
||||
@@ -33,7 +33,7 @@ describe('Remote queries and query history manager', function() {
|
||||
|
||||
let sandbox: sinon.SinonSandbox;
|
||||
let qhm: QueryHistoryManager;
|
||||
let localQueriesInterfaceManagerStub: InterfaceManager;
|
||||
let localQueriesResultsViewStub: ResultsView;
|
||||
let remoteQueriesManagerStub: RemoteQueriesManager;
|
||||
let rawQueryHistory: any;
|
||||
let remoteQueryResult0: RemoteQueryResult;
|
||||
@@ -57,9 +57,9 @@ describe('Remote queries and query history manager', function() {
|
||||
|
||||
sandbox = sinon.createSandbox();
|
||||
|
||||
localQueriesInterfaceManagerStub = {
|
||||
localQueriesResultsViewStub = {
|
||||
showResults: sandbox.stub()
|
||||
} as any as InterfaceManager;
|
||||
} as any as ResultsView;
|
||||
|
||||
rehydrateRemoteQueryStub = sandbox.stub();
|
||||
removeRemoteQueryStub = sandbox.stub();
|
||||
@@ -92,7 +92,7 @@ describe('Remote queries and query history manager', function() {
|
||||
qhm = new QueryHistoryManager(
|
||||
{} as QueryServerClient,
|
||||
{} as DatabaseManager,
|
||||
localQueriesInterfaceManagerStub,
|
||||
localQueriesResultsViewStub,
|
||||
remoteQueriesManagerStub,
|
||||
{} as EvalLogViewer,
|
||||
STORAGE_DIR,
|
||||
|
||||
Reference in New Issue
Block a user