mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Only show Create Insight button in Query Editor charts. (#9973)
This commit is contained in:
@@ -86,7 +86,7 @@ export class ChartView extends Disposable implements IPanelView {
|
|||||||
public readonly onOptionsChange: Event<IInsightOptions> = this._onOptionsChange.event;
|
public readonly onOptionsChange: Event<IInsightOptions> = this._onOptionsChange.event;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly _renderOptionsInline: boolean,
|
private readonly _isQueryEditorChart: boolean,
|
||||||
@IContextViewService private _contextViewService: IContextViewService,
|
@IContextViewService private _contextViewService: IContextViewService,
|
||||||
@IThemeService private _themeService: IThemeService,
|
@IThemeService private _themeService: IThemeService,
|
||||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||||
@@ -102,15 +102,15 @@ export class ChartView extends Disposable implements IPanelView {
|
|||||||
this.typeControls = DOM.$('div.type-controls');
|
this.typeControls = DOM.$('div.type-controls');
|
||||||
this.optionsControl.appendChild(this.typeControls);
|
this.optionsControl.appendChild(this.typeControls);
|
||||||
|
|
||||||
this._createInsightAction = this._instantiationService.createInstance(CreateInsightAction);
|
|
||||||
this._copyAction = this._instantiationService.createInstance(CopyAction);
|
this._copyAction = this._instantiationService.createInstance(CopyAction);
|
||||||
this._saveAction = this._instantiationService.createInstance(SaveImageAction);
|
this._saveAction = this._instantiationService.createInstance(SaveImageAction);
|
||||||
|
|
||||||
if (this._renderOptionsInline) {
|
if (this._isQueryEditorChart) {
|
||||||
|
this._createInsightAction = this._instantiationService.createInstance(CreateInsightAction);
|
||||||
this.taskbar.setContent([{ action: this._createInsightAction }]);
|
this.taskbar.setContent([{ action: this._createInsightAction }]);
|
||||||
} else {
|
} else {
|
||||||
this._configureChartAction = this._instantiationService.createInstance(ConfigureChartAction, this);
|
this._configureChartAction = this._instantiationService.createInstance(ConfigureChartAction, this);
|
||||||
this.taskbar.setContent([{ action: this._createInsightAction }, { action: this._configureChartAction }]);
|
this.taskbar.setContent([{ action: this._configureChartAction }]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const self = this;
|
const self = this;
|
||||||
@@ -177,7 +177,7 @@ export class ChartView extends Disposable implements IPanelView {
|
|||||||
this.container.appendChild(this.taskbarContainer);
|
this.container.appendChild(this.taskbarContainer);
|
||||||
this.container.appendChild(this.chartingContainer);
|
this.container.appendChild(this.chartingContainer);
|
||||||
this.chartingContainer.appendChild(this.insightContainer);
|
this.chartingContainer.appendChild(this.insightContainer);
|
||||||
if (this._renderOptionsInline) {
|
if (this._isQueryEditorChart) {
|
||||||
this.chartingContainer.appendChild(this.optionsControl);
|
this.chartingContainer.appendChild(this.optionsControl);
|
||||||
}
|
}
|
||||||
this.insight = new Insight(this.insightContainer, this._options, this._instantiationService);
|
this.insight = new Insight(this.insightContainer, this._options, this._instantiationService);
|
||||||
@@ -301,14 +301,15 @@ export class ChartView extends Disposable implements IPanelView {
|
|||||||
if (this.insight && this.insight.isCopyable) {
|
if (this.insight && this.insight.isCopyable) {
|
||||||
this.taskbar.context = { insight: this.insight.insight, options: this._options };
|
this.taskbar.context = { insight: this.insight.insight, options: this._options };
|
||||||
actions = [
|
actions = [
|
||||||
{ action: this._createInsightAction },
|
|
||||||
{ action: this._copyAction },
|
{ action: this._copyAction },
|
||||||
{ action: this._saveAction }
|
{ action: this._saveAction }
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
actions = [{ action: this._createInsightAction }];
|
actions = [];
|
||||||
}
|
}
|
||||||
if (!this._renderOptionsInline) {
|
if (this._isQueryEditorChart) {
|
||||||
|
actions.unshift({ action: this._createInsightAction });
|
||||||
|
} else {
|
||||||
actions.push({ action: this._configureChartAction });
|
actions.push({ action: this._configureChartAction });
|
||||||
}
|
}
|
||||||
this.taskbar.setContent(actions);
|
this.taskbar.setContent(actions);
|
||||||
|
|||||||
@@ -34,12 +34,12 @@ suite('Chart View', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function createChartView(renderOptions: boolean): ChartView {
|
function createChartView(isQueryEditorChart: boolean): ChartView {
|
||||||
const layoutService = new TestLayoutService();
|
const layoutService = new TestLayoutService();
|
||||||
const contextViewService = new ContextViewService(layoutService);
|
const contextViewService = new ContextViewService(layoutService);
|
||||||
const themeService = new TestThemeService();
|
const themeService = new TestThemeService();
|
||||||
const instantiationService = new TestInstantiationService();
|
const instantiationService = new TestInstantiationService();
|
||||||
const notificationService = new TestNotificationService();
|
const notificationService = new TestNotificationService();
|
||||||
instantiationService.stub(IThemeService, themeService);
|
instantiationService.stub(IThemeService, themeService);
|
||||||
return new ChartView(renderOptions, contextViewService, themeService, instantiationService, notificationService);
|
return new ChartView(isQueryEditorChart, contextViewService, themeService, instantiationService, notificationService);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user