mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Allow action bar to be hidden on Plotly tables (#16178)
Allow action bar to be hidden on tables
This commit is contained in:
@@ -325,10 +325,17 @@ export interface IDataSet {
|
|||||||
|
|
||||||
export interface IGridTableOptions {
|
export interface IGridTableOptions {
|
||||||
actionOrientation: ActionsOrientation;
|
actionOrientation: ActionsOrientation;
|
||||||
|
showActionBar?: boolean;
|
||||||
inMemoryDataProcessing: boolean;
|
inMemoryDataProcessing: boolean;
|
||||||
inMemoryDataCountThreshold?: number;
|
inMemoryDataCountThreshold?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const defaultGridTableOptions: IGridTableOptions = {
|
||||||
|
showActionBar: true,
|
||||||
|
inMemoryDataProcessing: false,
|
||||||
|
actionOrientation: ActionsOrientation.VERTICAL
|
||||||
|
};
|
||||||
|
|
||||||
export abstract class GridTableBase<T> extends Disposable implements IView {
|
export abstract class GridTableBase<T> extends Disposable implements IView {
|
||||||
private table: Table<T>;
|
private table: Table<T>;
|
||||||
private actionBar: ActionBar;
|
private actionBar: ActionBar;
|
||||||
@@ -375,10 +382,7 @@ export abstract class GridTableBase<T> extends Disposable implements IView {
|
|||||||
constructor(
|
constructor(
|
||||||
state: GridTableState,
|
state: GridTableState,
|
||||||
protected _resultSet: ResultSetSummary,
|
protected _resultSet: ResultSetSummary,
|
||||||
private readonly options: IGridTableOptions = {
|
private readonly options: IGridTableOptions,
|
||||||
inMemoryDataProcessing: false,
|
|
||||||
actionOrientation: ActionsOrientation.VERTICAL
|
|
||||||
},
|
|
||||||
@IContextMenuService private readonly contextMenuService: IContextMenuService,
|
@IContextMenuService private readonly contextMenuService: IContextMenuService,
|
||||||
@IInstantiationService protected readonly instantiationService: IInstantiationService,
|
@IInstantiationService protected readonly instantiationService: IInstantiationService,
|
||||||
@IEditorService private readonly editorService: IEditorService,
|
@IEditorService private readonly editorService: IEditorService,
|
||||||
@@ -390,6 +394,9 @@ export abstract class GridTableBase<T> extends Disposable implements IView {
|
|||||||
@INotificationService private readonly notificationService: INotificationService
|
@INotificationService private readonly notificationService: INotificationService
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
this.options = { ...defaultGridTableOptions, ...options };
|
||||||
|
|
||||||
let config = this.configurationService.getValue<{ rowHeight: number }>('resultsGrid');
|
let config = this.configurationService.getValue<{ rowHeight: number }>('resultsGrid');
|
||||||
this.rowHeight = config && config.rowHeight ? config.rowHeight : ROW_HEIGHT;
|
this.rowHeight = config && config.rowHeight ? config.rowHeight : ROW_HEIGHT;
|
||||||
this.state = state;
|
this.state = state;
|
||||||
@@ -559,7 +566,6 @@ export abstract class GridTableBase<T> extends Disposable implements IView {
|
|||||||
this.actionBar.context = this.generateContext();
|
this.actionBar.context = this.generateContext();
|
||||||
});
|
});
|
||||||
this.rebuildActionBar();
|
this.rebuildActionBar();
|
||||||
|
|
||||||
this.selectionModel.onSelectedRangesChanged.subscribe(async e => {
|
this.selectionModel.onSelectedRangesChanged.subscribe(async e => {
|
||||||
if (this.state) {
|
if (this.state) {
|
||||||
this.state.selection = this.selectionModel.getSelectedRanges();
|
this.state.selection = this.selectionModel.getSelectedRanges();
|
||||||
@@ -736,7 +742,20 @@ export abstract class GridTableBase<T> extends Disposable implements IView {
|
|||||||
private rebuildActionBar() {
|
private rebuildActionBar() {
|
||||||
let actions = this.getCurrentActions();
|
let actions = this.getCurrentActions();
|
||||||
this.actionBar.clear();
|
this.actionBar.clear();
|
||||||
this.actionBar.push(actions, { icon: true, label: false });
|
if (this.options.showActionBar) {
|
||||||
|
this.actionBar.push(actions, { icon: true, label: false });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public get showActionBar(): boolean {
|
||||||
|
return this.options.showActionBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public set showActionBar(v: boolean) {
|
||||||
|
if (this.options.showActionBar !== v) {
|
||||||
|
this.options.showActionBar = v;
|
||||||
|
this.rebuildActionBar();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract getCurrentActions(): IAction[];
|
protected abstract getCurrentActions(): IAction[];
|
||||||
@@ -884,6 +903,7 @@ class GridTable<T> extends GridTableBase<T> {
|
|||||||
super(state, resultSet, {
|
super(state, resultSet, {
|
||||||
actionOrientation: ActionsOrientation.VERTICAL,
|
actionOrientation: ActionsOrientation.VERTICAL,
|
||||||
inMemoryDataProcessing: true,
|
inMemoryDataProcessing: true,
|
||||||
|
showActionBar: true,
|
||||||
inMemoryDataCountThreshold: configurationService.getValue<IQueryEditorConfiguration>('queryEditor').results.inMemoryDataProcessingThreshold,
|
inMemoryDataCountThreshold: configurationService.getValue<IQueryEditorConfiguration>('queryEditor').results.inMemoryDataProcessingThreshold,
|
||||||
}, contextMenuService, instantiationService, editorService, untitledEditorService, configurationService, queryModelService, themeService, contextViewService, notificationService);
|
}, contextMenuService, instantiationService, editorService, untitledEditorService, configurationService, queryModelService, themeService, contextViewService, notificationService);
|
||||||
this._gridDataProvider = this.instantiationService.createInstance(QueryGridDataProvider, this._runner, resultSet.batchId, resultSet.id);
|
this._gridDataProvider = this.instantiationService.createInstance(QueryGridDataProvider, this._runner, resultSet.batchId, resultSet.id);
|
||||||
|
|||||||
Reference in New Issue
Block a user