mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-13 17:22:15 -05:00
Respect message settings (#2614)
* add results view stating * working through the bugs * handle various resizing bugs * gnale resizing better * add configuration to state * address comments
This commit is contained in:
committed by
Karl Burtram
parent
4d9cc604b9
commit
c8c6d072f6
@@ -14,16 +14,21 @@ import { GridPanelState } from 'sql/parts/query/editor/gridPanel';
|
||||
import { MessagePanelState } from 'sql/parts/query/editor/messagePanel';
|
||||
import { QueryPlanState } from 'sql/parts/queryPlan/queryPlan';
|
||||
import { ChartState } from 'sql/parts/query/editor/charting/chartView';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
|
||||
export class ResultsViewState {
|
||||
public gridPanelState: GridPanelState = new GridPanelState();
|
||||
public messagePanelState: MessagePanelState = new MessagePanelState();
|
||||
public messagePanelState: MessagePanelState = new MessagePanelState(this.configurationService);
|
||||
public chartState: ChartState = new ChartState();
|
||||
public queryPlanState: QueryPlanState = new QueryPlanState();
|
||||
public gridPanelSize: number;
|
||||
public messagePanelSize: number;
|
||||
public activeTab: string;
|
||||
public visibleTabs: Set<string> = new Set<string>();
|
||||
|
||||
constructor(@IConfigurationService private configurationService: IConfigurationService) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,9 +50,11 @@ export class QueryResultsInput extends EditorInput {
|
||||
public readonly onRestoreViewStateEmitter = new Emitter<void>();
|
||||
public readonly onSaveViewStateEmitter = new Emitter<void>();
|
||||
|
||||
public readonly state = new ResultsViewState();
|
||||
public readonly state = new ResultsViewState(this.configurationService);
|
||||
|
||||
constructor(private _uri: string) {
|
||||
constructor(private _uri: string,
|
||||
@IConfigurationService private configurationService: IConfigurationService
|
||||
) {
|
||||
super();
|
||||
this._visible = false;
|
||||
this._hasBootstrapped = false;
|
||||
|
||||
@@ -25,7 +25,7 @@ import { OpenMode, ClickBehavior, ICancelableEvent, IControllerOptions } from 'v
|
||||
import { WorkbenchTreeController } from 'vs/platform/list/browser/listService';
|
||||
import { IMouseEvent } from 'vs/base/browser/mouseEvent';
|
||||
import { $ } from 'vs/base/browser/builder';
|
||||
import { isArray } from 'vs/base/common/types';
|
||||
import { isArray, isUndefinedOrNull } from 'vs/base/common/types';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditor } from 'vs/editor/common/editorCommon';
|
||||
@@ -62,6 +62,13 @@ const TemplateIds = {
|
||||
export class MessagePanelState {
|
||||
public scrollPosition: number;
|
||||
public collapsed = false;
|
||||
|
||||
constructor(@IConfigurationService configurationService: IConfigurationService) {
|
||||
let messagesOpenedSettings = configurationService.getValue<boolean>('sql.messagesDefaultOpen');
|
||||
if (!isUndefinedOrNull(messagesOpenedSettings)) {
|
||||
this.collapsed = !messagesOpenedSettings;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class MessagePanel extends ViewletPanel {
|
||||
|
||||
@@ -110,18 +110,26 @@ suite('SQL QueryEditor Tests', () => {
|
||||
editorDescriptorService = TypeMoq.Mock.ofType(EditorDescriptorService, TypeMoq.MockBehavior.Loose);
|
||||
editorDescriptorService.setup(x => x.getEditor(TypeMoq.It.isAny())).returns(() => descriptor);
|
||||
|
||||
configurationService = TypeMoq.Mock.ofInstance({
|
||||
getValue: () => undefined,
|
||||
onDidChangeConfiguration: () => undefined
|
||||
} as any);
|
||||
configurationService.setup(x => x.getValue(TypeMoq.It.isAny())).returns(() => {
|
||||
return { enablePreviewFeatures: true };
|
||||
});
|
||||
|
||||
// Create a QueryInput
|
||||
let filePath = 'someFile.sql';
|
||||
let uri: URI = URI.parse(filePath);
|
||||
let fileInput = new UntitledEditorInput(uri, false, '', '', '', instantiationService.object, undefined, undefined, undefined);
|
||||
let queryResultsInput: QueryResultsInput = new QueryResultsInput(uri.fsPath);
|
||||
let queryResultsInput: QueryResultsInput = new QueryResultsInput(uri.fsPath, configurationService.object);
|
||||
queryInput = new QueryInput('first', fileInput, queryResultsInput, undefined, undefined, undefined, undefined, undefined);
|
||||
|
||||
// Create a QueryInput to compare to the previous one
|
||||
let filePath2 = 'someFile2.sql';
|
||||
let uri2: URI = URI.parse(filePath2);
|
||||
let fileInput2 = new UntitledEditorInput(uri2, false, '', '', '', instantiationService.object, undefined, undefined, undefined);
|
||||
let queryResultsInput2: QueryResultsInput = new QueryResultsInput(uri2.fsPath);
|
||||
let queryResultsInput2: QueryResultsInput = new QueryResultsInput(uri2.fsPath, configurationService.object);
|
||||
queryInput2 = new QueryInput('second', fileInput2, queryResultsInput2, undefined, undefined, undefined, undefined, undefined);
|
||||
|
||||
// Mock IMessageService
|
||||
@@ -136,14 +144,6 @@ suite('SQL QueryEditor Tests', () => {
|
||||
|
||||
// Create a QueryModelService
|
||||
queryModelService = new QueryModelService(instantiationService.object, notificationService.object);
|
||||
|
||||
configurationService = TypeMoq.Mock.ofInstance({
|
||||
getValue: () => undefined,
|
||||
onDidChangeConfiguration: () => undefined
|
||||
} as any);
|
||||
configurationService.setup(x => x.getValue(TypeMoq.It.isAny())).returns(() => {
|
||||
return { enablePreviewFeatures: true };
|
||||
});
|
||||
});
|
||||
|
||||
test('createEditor creates only the taskbar', (done) => {
|
||||
@@ -393,7 +393,7 @@ suite('SQL QueryEditor Tests', () => {
|
||||
done();
|
||||
});
|
||||
test('Test that we attempt to dispose query when the queryInput is disposed', (done) => {
|
||||
let queryResultsInput = new QueryResultsInput('testUri');
|
||||
let queryResultsInput = new QueryResultsInput('testUri', configurationService.object);
|
||||
queryInput['_results'] = queryResultsInput;
|
||||
queryInput.dispose();
|
||||
queryModelService.verify(x => x.disposeQuery(TypeMoq.It.isAnyString()), TypeMoq.Times.once());
|
||||
|
||||
Reference in New Issue
Block a user