Merge branch 'master' into feature/nativeNotebook

This commit is contained in:
AbbiePetcht
2018-10-17 10:58:49 -07:00
12 changed files with 69 additions and 21 deletions

View File

@@ -26,12 +26,6 @@
"outputChannels": [ "outputChannels": [
"sqlagent" "sqlagent"
], ],
"commands": [
{
"command": "agent.openNewStepDialog",
"title": "agent.openNewStepDialog"
}
],
"dashboard.tabs": [ "dashboard.tabs": [
{ {
"id": "data-management-agent", "id": "data-management-agent",

View File

@@ -136,8 +136,13 @@ export class JobData implements IAgentDialogData {
} }
public addJobSchedule(schedule: sqlops.AgentJobScheduleInfo) { public addJobSchedule(schedule: sqlops.AgentJobScheduleInfo) {
let existingSchedule = this.jobSchedules.find(item => item.name === schedule.name); if (this.jobSchedules) {
if (!existingSchedule) { let existingSchedule = this.jobSchedules.find(item => item.name === schedule.name);
if (!existingSchedule) {
this.jobSchedules.push(schedule);
}
} else {
this.jobSchedules = [];
this.jobSchedules.push(schedule); this.jobSchedules.push(schedule);
} }
} }

View File

@@ -13,9 +13,11 @@ export class PickScheduleData implements IAgentDialogData {
public ownerUri: string; public ownerUri: string;
public schedules: sqlops.AgentJobScheduleInfo[]; public schedules: sqlops.AgentJobScheduleInfo[];
public selectedSchedule: sqlops.AgentJobScheduleInfo; public selectedSchedule: sqlops.AgentJobScheduleInfo;
private jobName: string;
constructor(ownerUri:string) { constructor(ownerUri:string, jobName: string) {
this.ownerUri = ownerUri; this.ownerUri = ownerUri;
this.jobName = jobName;
} }
public async initialize() { public async initialize() {
@@ -27,5 +29,8 @@ export class PickScheduleData implements IAgentDialogData {
} }
public async save() { public async save() {
let agentService = await AgentUtils.getAgentService();
this.selectedSchedule.jobName = this.jobName;
let result = await agentService.createJobSchedule(this.ownerUri, this.selectedSchedule);
} }
} }

View File

@@ -108,12 +108,14 @@ export class JobDialog extends AgentDialog<JobData> {
// Alert tab controls // Alert tab controls
private alertsTable: sqlops.TableComponent; private alertsTable: sqlops.TableComponent;
private newAlertButton: sqlops.ButtonComponent; private newAlertButton: sqlops.ButtonComponent;
private isEdit: boolean = false;
constructor(ownerUri: string, jobInfo: sqlops.AgentJobInfo = undefined) { constructor(ownerUri: string, jobInfo: sqlops.AgentJobInfo = undefined) {
super( super(
ownerUri, ownerUri,
new JobData(ownerUri, jobInfo), new JobData(ownerUri, jobInfo),
jobInfo ? JobDialog.EditDialogTitle : JobDialog.CreateDialogTitle); jobInfo ? JobDialog.EditDialogTitle : JobDialog.CreateDialogTitle);
this.isEdit = jobInfo ? true : false;
} }
protected async initializeDialog() { protected async initializeDialog() {
@@ -373,12 +375,12 @@ export class JobDialog extends AgentDialog<JobData> {
label: this.PickScheduleButtonString, label: this.PickScheduleButtonString,
width: 80 width: 80
}).component(); }).component();
this.pickScheduleButton.onDidClick((e)=>{ this.pickScheduleButton.onDidClick((e)=>{
let pickScheduleDialog = new PickScheduleDialog(this.model.ownerUri); let pickScheduleDialog = new PickScheduleDialog(this.model.ownerUri, this.model.name);
pickScheduleDialog.onSuccess((dialogModel) => { pickScheduleDialog.onSuccess((dialogModel) => {
let selectedSchedule = dialogModel.selectedSchedule; let selectedSchedule = dialogModel.selectedSchedule;
if (selectedSchedule) { if (selectedSchedule) {
selectedSchedule.jobName = this.model.name;
this.model.addJobSchedule(selectedSchedule); this.model.addJobSchedule(selectedSchedule);
this.populateScheduleTable(); this.populateScheduleTable();
} }

View File

@@ -33,8 +33,8 @@ export class PickScheduleDialog {
private _onSuccess: vscode.EventEmitter<PickScheduleData> = new vscode.EventEmitter<PickScheduleData>(); private _onSuccess: vscode.EventEmitter<PickScheduleData> = new vscode.EventEmitter<PickScheduleData>();
public readonly onSuccess: vscode.Event<PickScheduleData> = this._onSuccess.event; public readonly onSuccess: vscode.Event<PickScheduleData> = this._onSuccess.event;
constructor(ownerUri: string) { constructor(ownerUri: string, jobName: string) {
this.model = new PickScheduleData(ownerUri); this.model = new PickScheduleData(ownerUri, jobName);
} }
public async showDialog() { public async showDialog() {

View File

@@ -41,12 +41,12 @@ export class MainController {
let dialog = new JobDialog(ownerUri, jobInfo); let dialog = new JobDialog(ownerUri, jobInfo);
dialog.openDialog(); dialog.openDialog();
}); });
vscode.commands.registerCommand('agent.openNewStepDialog', (ownerUri: string, server: string, jobData: JobData) => { vscode.commands.registerCommand('agent.openNewStepDialog', (ownerUri: string, server: string, jobData: JobData, jobStepInfo: sqlops.AgentJobStepInfo) => {
let dialog = new JobStepDialog(ownerUri, server, jobData); let dialog = new JobStepDialog(ownerUri, server, jobData, jobStepInfo);
dialog.openDialog(); dialog.openDialog();
}); });
vscode.commands.registerCommand('agent.openPickScheduleDialog', (ownerUri: string) => { vscode.commands.registerCommand('agent.openPickScheduleDialog', (ownerUri: string, jobName: string) => {
let dialog = new PickScheduleDialog(ownerUri); let dialog = new PickScheduleDialog(ownerUri, jobName);
dialog.showDialog(); dialog.showDialog();
}); });
vscode.commands.registerCommand('agent.openAlertDialog', (ownerUri: string, alertInfo: sqlops.AgentAlertInfo, jobs: string[]) => { vscode.commands.registerCommand('agent.openAlertDialog', (ownerUri: string, alertInfo: sqlops.AgentAlertInfo, jobs: string[]) => {

View File

@@ -39,6 +39,7 @@ export default class EditorComponent extends ComponentBase implements IComponent
private _languageMode: string; private _languageMode: string;
private _uri: string; private _uri: string;
private _isAutoResizable: boolean; private _isAutoResizable: boolean;
private _minimumHeight: number;
constructor( constructor(
@Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef, @Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef,
@@ -79,6 +80,9 @@ export default class EditorComponent extends ComponentBase implements IComponent
this._register(this._editorModel.onDidChangeContent(e => { this._register(this._editorModel.onDidChangeContent(e => {
this.content = this._editorModel.getValue(); this.content = this._editorModel.getValue();
if (this._isAutoResizable) { if (this._isAutoResizable) {
if (this._minimumHeight) {
this._editor.setMinimumHeight(this._minimumHeight);
}
this._editor.setHeightToScrollHeight(); this._editor.setHeightToScrollHeight();
} }
@@ -109,7 +113,8 @@ export default class EditorComponent extends ComponentBase implements IComponent
let height: number = this.convertSizeToNumber(this.height); let height: number = this.convertSizeToNumber(this.height);
if (this._isAutoResizable) { if (this._isAutoResizable) {
height = this._editor.scrollHeight; this._editor.setHeightToScrollHeight();
height = Math.max(this._editor.scrollHeight, this._minimumHeight ? this._minimumHeight : 0);
} }
this._editor.layout(new DOM.Dimension( this._editor.layout(new DOM.Dimension(
width && width > 0 ? width : DOM.getContentWidth(this._el.nativeElement), width && width > 0 ? width : DOM.getContentWidth(this._el.nativeElement),
@@ -152,6 +157,7 @@ export default class EditorComponent extends ComponentBase implements IComponent
// Intentionally always updating editorUri as it's wiped out by parent setProperties call. // Intentionally always updating editorUri as it's wiped out by parent setProperties call.
this.editorUri = this._uri; this.editorUri = this._uri;
this._isAutoResizable = this.isAutoResizable; this._isAutoResizable = this.isAutoResizable;
this._minimumHeight = this.minimumHeight;
} }
// CSS-bound properties // CSS-bound properties
@@ -179,6 +185,14 @@ export default class EditorComponent extends ComponentBase implements IComponent
this.setPropertyFromUI<sqlops.EditorProperties, boolean>((properties, isAutoResizable) => { properties.isAutoResizable = isAutoResizable; }, newValue); this.setPropertyFromUI<sqlops.EditorProperties, boolean>((properties, isAutoResizable) => { properties.isAutoResizable = isAutoResizable; }, newValue);
} }
public get minimumHeight(): number {
return this.getPropertyOrDefault<sqlops.EditorProperties, number>((props) => props.minimumHeight, this._editor.minimumHeight);
}
public set minimumHeight(newValue: number) {
this.setPropertyFromUI<sqlops.EditorProperties, number>((properties, minimumHeight) => { properties.minimumHeight = minimumHeight; }, newValue);
}
public get editorUri(): string { public get editorUri(): string {
return this.getPropertyOrDefault<sqlops.EditorProperties, string>((props) => props.editorUri, ''); return this.getPropertyOrDefault<sqlops.EditorProperties, string>((props) => props.editorUri, '');
} }

View File

@@ -34,6 +34,7 @@ export class QueryTextEditor extends BaseTextEditor {
public static ID = 'modelview.editors.textEditor'; public static ID = 'modelview.editors.textEditor';
private _dimension: DOM.Dimension; private _dimension: DOM.Dimension;
private _config: editorCommon.IConfiguration; private _config: editorCommon.IConfiguration;
private _minHeight: number;
constructor( constructor(
@ITelemetryService telemetryService: ITelemetryService, @ITelemetryService telemetryService: ITelemetryService,
@IInstantiationService instantiationService: IInstantiationService, @IInstantiationService instantiationService: IInstantiationService,
@@ -116,6 +117,11 @@ export class QueryTextEditor extends BaseTextEditor {
this._config = new Configuration(undefined, editorWidget.getDomNode()); this._config = new Configuration(undefined, editorWidget.getDomNode());
} }
let editorHeightUsingLines = this._config.editor.lineHeight * editorWidget.getModel().getLineCount(); let editorHeightUsingLines = this._config.editor.lineHeight * editorWidget.getModel().getLineCount();
this.setHeight(editorHeightUsingLines); let editorHeightUsingMinHeight = Math.max(editorHeightUsingLines, this._minHeight);
this.setHeight(editorHeightUsingMinHeight);
}
public setMinimumHeight(height: number) : void {
this._minHeight = height;
} }
} }

View File

@@ -184,6 +184,7 @@ export default class QueryRunner {
this._echoedResultSet.clear(); this._echoedResultSet.clear();
this._debouncedMessage.clear(); this._debouncedMessage.clear();
this._debouncedResultSet.clear(); this._debouncedResultSet.clear();
this._planXml = new Deferred<string>();
let ownerUri = this.uri; let ownerUri = this.uri;
this._batchSets = []; this._batchSets = [];
this._hasCompleted = false; this._hasCompleted = false;
@@ -343,7 +344,11 @@ export default class QueryRunner {
} }
// handle getting queryPlanxml if we need too // handle getting queryPlanxml if we need too
if (this.isQueryPlan) { if (this.isQueryPlan) {
this.getQueryRows(0, 1, 0, 0).then(e => this._planXml.resolve(e.resultSubset.rows[0][0].displayValue)); // check if this result has show plan, this needs work, it won't work for any other provider
let hasShowPlan = !!result.resultSetSummary.columnInfo.find(e => e.columnName === 'Microsoft SQL Server 2005 XML Showplan');
if (hasShowPlan) {
this.getQueryRows(0, 1, result.resultSetSummary.batchId, result.resultSetSummary.id).then(e => this._planXml.resolve(e.resultSubset.rows[0][0].displayValue));
}
} }
if (batchSet) { if (batchSet) {
// Store the result set in the batch and emit that a result set has completed // Store the result set in the batch and emit that a result set has completed

View File

@@ -41,7 +41,7 @@ export class QueryPlanView implements IPanelView {
} }
} }
container.appendChild(this.container); container.appendChild(this.container);
container.style.overflow = 'scroll'; this.container.style.overflow = 'scroll';
} }
public layout(dimension: Dimension): void { public layout(dimension: Dimension): void {

View File

@@ -595,6 +595,10 @@ declare module 'sqlops' {
* The languge mode for this text editor. The language mode is SQL by default. * The languge mode for this text editor. The language mode is SQL by default.
*/ */
languageMode?: string; languageMode?: string;
/**
* Minimum height for editor component
*/
minimumHeight?: number;
} }
export interface ButtonProperties extends ComponentProperties, ComponentWithIcon { export interface ButtonProperties extends ComponentProperties, ComponentWithIcon {
@@ -722,6 +726,11 @@ declare module 'sqlops' {
*/ */
isAutoResizable: boolean; isAutoResizable: boolean;
/**
* Minimum height for editor component
*/
minimumHeight: number;
} }
export interface ButtonComponent extends Component, ButtonProperties { export interface ButtonComponent extends Component, ButtonProperties {

View File

@@ -913,6 +913,14 @@ class EditorWrapper extends ComponentWrapper implements sqlops.EditorComponent {
this.setProperty('isAutoResizable', v); this.setProperty('isAutoResizable', v);
} }
public get minimumHeight(): number {
return this.properties['minimumHeight'];
}
public set minimumHeight(v: number) {
this.setProperty('minimumHeight', v);
}
public get onContentChanged(): vscode.Event<any> { public get onContentChanged(): vscode.Event<any> {
let emitter = this._emitterMap.get(ComponentEventType.onDidChange); let emitter = this._emitterMap.get(ComponentEventType.onDidChange);
return emitter && emitter.event; return emitter && emitter.event;