mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 09:35:36 -05:00
Introducing Visualizer to SQL Query Editor (#6422)
* extension recommendation on application launch * Introducing Visualizer (SandDance) to the SQL Query Editor. (#6347) * Created Visualizer icon in the results grid. Utilized a context key so that the icon only shows if Visualizer extensions (currently, just SandDance) is installed. Visualizer icon open up SandDance in a top-level document. * When the user clicks on Charts, visualizer recommendation popup appears. User can click on "Install Extensions" to download the visualizer extensions. * Enabled SQL Query Editor to pass query data to SandDance extension. * Introducing Visualizer (SandDance) to the SQL Query Editor. (#6347) * Created Visualizer icon in the results grid. Utilized a context key so that the icon only shows if Visualizer extensions (currently, just SandDance) is installed. Visualizer icon open up SandDance in a top-level document. * When the user clicks on Charts, visualizer recommendation popup appears. User can click on "Install Extensions" to download the visualizer extensions. * Enabled SQL Query Editor to pass query data to SandDance extension. * Cleaned code; made changes according to PR comments * removed the test service for extensions gallary * Cleaned up code according to PR changes * unid changes to build/azure-piplines * Removed all the build/azure-pipelines changes * removed changes on media/language.svg * refactored extension recommendation system to allow it to be generic * updated extensionsViews to support generic extension query search; added localized constants for visualizer extensions * Made syntax and error message changes acccording to PR comments. * Updated recommendation message according to scenario type
This commit is contained in:
committed by
Rachel Kim
parent
720a7fbfa2
commit
2c8a22bb0d
6
src/sql/workbench/contrib/extensions/constants.ts
Normal file
6
src/sql/workbench/contrib/extensions/constants.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
export const visualizerExtensions = 'visualizerExtensions';
|
||||
79
src/sql/workbench/contrib/extensions/extensionsActions.ts
Normal file
79
src/sql/workbench/contrib/extensions/extensionsActions.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import { IAction, Action } from 'vs/base/common/actions';
|
||||
import { ShowViewletAction } from 'vs/workbench/browser/viewlet';
|
||||
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||
import { IExtension, ExtensionState, IExtensionsWorkbenchService, VIEWLET_ID, IExtensionsViewlet, AutoUpdateConfigurationKey, IExtensionContainer, EXTENSIONS_CONFIG, ExtensionsPolicy, ExtensionsPolicyKey } from 'vs/workbench/contrib/extensions/common/extensions';
|
||||
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IExtensionRecommendation, IExtensionManagementServerService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { PagedModel } from 'vs/base/common/paging';
|
||||
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||
|
||||
function getScenarioID(scenarioType: string) {
|
||||
return 'workbench.extensions.action.show' + scenarioType;
|
||||
}
|
||||
|
||||
export class ShowRecommendedExtensionsByScenarioAction extends Action {
|
||||
constructor(
|
||||
private readonly scenarioType: string,
|
||||
@IViewletService private readonly viewletService: IViewletService
|
||||
) {
|
||||
super(getScenarioID(scenarioType), localize('showRecommendations', "Show Recommendations"), undefined, true);
|
||||
}
|
||||
|
||||
run(): Promise<void> {
|
||||
return this.viewletService.openViewlet(VIEWLET_ID, true)
|
||||
.then(viewlet => viewlet as IExtensionsViewlet)
|
||||
.then(viewlet => {
|
||||
viewlet.search('@' + this.scenarioType);
|
||||
viewlet.focus();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class InstallRecommendedExtensionsByScenarioAction extends Action {
|
||||
private _recommendations: IExtensionRecommendation[] = [];
|
||||
get recommendations(): IExtensionRecommendation[] { return this._recommendations; }
|
||||
set recommendations(recommendations: IExtensionRecommendation[]) { this._recommendations = recommendations; this.enabled = this._recommendations.length > 0; }
|
||||
|
||||
constructor(
|
||||
private readonly scenarioType: string,
|
||||
recommendations: IExtensionRecommendation[],
|
||||
@IViewletService private readonly viewletService: IViewletService,
|
||||
@INotificationService private readonly notificationService: INotificationService,
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||
@IOpenerService private readonly openerService: IOpenerService,
|
||||
@IExtensionsWorkbenchService private readonly extensionWorkbenchService: IExtensionsWorkbenchService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService
|
||||
) {
|
||||
super(getScenarioID(scenarioType), localize('Install Extensions', "Install Extensions"), 'extension-action');
|
||||
this.recommendations = recommendations;
|
||||
}
|
||||
|
||||
run(): Promise<any> {
|
||||
if (!this.recommendations.length) { return Promise.resolve(); }
|
||||
return this.viewletService.openViewlet(VIEWLET_ID, true)
|
||||
.then(viewlet => viewlet as IExtensionsViewlet)
|
||||
.then(viewlet => {
|
||||
viewlet.search('@' + this.scenarioType);
|
||||
viewlet.focus();
|
||||
const names = this.recommendations.map(({ extensionId }) => extensionId);
|
||||
return this.extensionWorkbenchService.queryGallery({ names, source: 'install-' + this.scenarioType }, CancellationToken.None).then(pager => {
|
||||
let installPromises: Promise<any>[] = [];
|
||||
let model = new PagedModel(pager);
|
||||
for (let i = 0; i < pager.total; i++) {
|
||||
installPromises.push(model.resolve(i, CancellationToken.None).then(e => this.extensionWorkbenchService.install(e)));
|
||||
}
|
||||
return Promise.all(installPromises);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user