mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-13 19:48:37 -05:00
Add "preview features" config switch (#2334)
* Initial working commit for preview features config * Clean up code * Update tests * Remove unused imports * Update message and options * Update don't show again message
This commit is contained in:
@@ -44,6 +44,7 @@ import { IQueryModelService } from 'sql/parts/query/execution/queryModel';
|
||||
import { IEditorDescriptorService } from 'sql/parts/query/editor/editorDescriptorService';
|
||||
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
||||
import { attachEditableDropdownStyler } from 'sql/common/theme/styler';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
|
||||
@@ -96,7 +97,8 @@ export class QueryEditor extends BaseEditor {
|
||||
@IQueryModelService private _queryModelService: IQueryModelService,
|
||||
@IEditorDescriptorService private _editorDescriptorService: IEditorDescriptorService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||
@IConfigurationService private _configurationService: IConfigurationService
|
||||
) {
|
||||
super(QueryEditor.ID, _telemetryService, themeService);
|
||||
|
||||
@@ -446,6 +448,16 @@ export class QueryEditor extends BaseEditor {
|
||||
this._estimatedQueryPlanAction = this._instantiationService.createInstance(EstimatedQueryPlanAction, this);
|
||||
this._actualQueryPlanAction = this._instantiationService.createInstance(ActualQueryPlanAction, this);
|
||||
|
||||
this.setTaskbarContent();
|
||||
|
||||
this._configurationService.onDidChangeConfiguration(e => {
|
||||
if (e.affectedKeys.includes('workbench.enablePreviewFeatures')) {
|
||||
this.setTaskbarContent();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private setTaskbarContent(): void {
|
||||
// Create HTML Elements for the taskbar
|
||||
let separator = Taskbar.createTaskbarSeparator();
|
||||
|
||||
@@ -460,6 +472,13 @@ export class QueryEditor extends BaseEditor {
|
||||
{ element: separator },
|
||||
{ action: this._estimatedQueryPlanAction }
|
||||
];
|
||||
|
||||
// Remove the estimated query plan action if preview features are not enabled
|
||||
let previewFeaturesEnabled = this._configurationService.getValue('workbench')['enablePreviewFeatures'];
|
||||
if (!previewFeaturesEnabled) {
|
||||
content = content.slice(0, -2);
|
||||
}
|
||||
|
||||
this._taskbar.setContent(content);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import { PanelComponent, IPanelOptions } from 'sql/base/browser/ui/panel/panel.c
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
|
||||
export const QUERY_OUTPUT_SELECTOR: string = 'query-output-component';
|
||||
|
||||
@@ -66,7 +67,8 @@ export class QueryOutputComponent implements OnDestroy {
|
||||
constructor(
|
||||
@Inject(forwardRef(() => ElementRef)) el: ElementRef,
|
||||
@Inject(forwardRef(() => ChangeDetectorRef)) private _cd: ChangeDetectorRef,
|
||||
@Inject(IBootstrapParams) public queryParameters: IQueryComponentParams
|
||||
@Inject(IBootstrapParams) public queryParameters: IQueryComponentParams,
|
||||
@Inject(IConfigurationService) private _configurationService: IConfigurationService
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -75,12 +77,14 @@ export class QueryOutputComponent implements OnDestroy {
|
||||
*/
|
||||
public ngAfterViewInit(): void {
|
||||
this._disposables.push(toDisposableSubscription(this.queryComponent.queryPlanAvailable.subscribe((xml) => {
|
||||
this.hasQueryPlan = true;
|
||||
this._cd.detectChanges();
|
||||
this._panel.selectTab(this.topOperationsTabIdentifier);
|
||||
this.topOperationsComponent.planXml = xml;
|
||||
this._panel.selectTab(this.queryPlanTabIdentifier);
|
||||
this.queryPlanComponent.planXml = xml;
|
||||
if (this._configurationService.getValue('workbench')['enablePreviewFeatures']) {
|
||||
this.hasQueryPlan = true;
|
||||
this._cd.detectChanges();
|
||||
this._panel.selectTab(this.topOperationsTabIdentifier);
|
||||
this.topOperationsComponent.planXml = xml;
|
||||
this._panel.selectTab(this.queryPlanTabIdentifier);
|
||||
this.queryPlanComponent.planXml = xml;
|
||||
}
|
||||
})));
|
||||
|
||||
this._disposables.push(toDisposableSubscription(this.queryComponent.showChartRequested.subscribe((dataSet) => {
|
||||
|
||||
Reference in New Issue
Block a user