Compare commits

...

8 Commits

Author SHA1 Message Date
Karl Burtram
5fdb967ffc Enable visualizer recommendaton prompt in stable build (#6737) 2019-08-13 18:03:59 -07:00
Charles Gagnon
4a911b60f7 Bump required azdata engine version for schema compare (#6717) 2019-08-13 15:42:51 -07:00
Cory Rivera
3cc849a999 Correctly set focus on new Notebook cells after clicking on inline buttons. (#6708) 2019-08-13 15:41:41 -07:00
Alan Ren
1a5469b7a1 revert the icon (#6733) 2019-08-13 15:41:15 -07:00
Anthony Dresser
c042aacd17 add sanity check when adding tables to the results (#6714) 2019-08-13 15:40:53 -07:00
Charles Gagnon
9bd007a555 Fix resultSerializer to correctly check returned file picker path (#6713) 2019-08-13 15:40:20 -07:00
Kim Santiago
75b9ab643d fix default connection not always being correct (#6711) 2019-08-13 15:35:28 -07:00
Lucy Zhang
c4d3a90266 Fix Books Unit Tests (#6702)
* wait for all toc.yml to be found

* add event to signal all toc.yml files read

* add workspae folder parameter back

* remove toc filter
2019-08-13 15:34:48 -07:00
11 changed files with 54 additions and 38 deletions

View File

@@ -52,6 +52,9 @@ export abstract class BasePage {
return undefined; return undefined;
} }
// reverse list so that most recent connections are first
cons.reverse();
let count = -1; let count = -1;
let idx = -1; let idx = -1;
@@ -99,9 +102,6 @@ export abstract class BasePage {
return uniqueValues; return uniqueValues;
}, []); }, []);
// reverse list so that most recent connections show first
values.reverse();
return values; return values;
} }

View File

@@ -24,12 +24,17 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
private _extensionContext: vscode.ExtensionContext; private _extensionContext: vscode.ExtensionContext;
private _throttleTimer: any; private _throttleTimer: any;
private _resource: string; private _resource: string;
private _onReadAllTOCFiles: vscode.EventEmitter<void> = new vscode.EventEmitter<void>();
constructor(workspaceFolders: vscode.WorkspaceFolder[], extensionContext: vscode.ExtensionContext) { constructor(workspaceFolders: vscode.WorkspaceFolder[], extensionContext: vscode.ExtensionContext) {
this.getTableOfContentFiles(workspaceFolders).then(() => undefined, (err) => { console.log(err); }); this.getTableOfContentFiles(workspaceFolders).then(() => undefined, (err) => { console.log(err); });
this._extensionContext = extensionContext; this._extensionContext = extensionContext;
} }
public get onReadAllTOCFiles(): vscode.Event<void> {
return this._onReadAllTOCFiles.event;
}
async getTableOfContentFiles(workspaceFolders: vscode.WorkspaceFolder[]): Promise<void> { async getTableOfContentFiles(workspaceFolders: vscode.WorkspaceFolder[]): Promise<void> {
let notebookConfig = vscode.workspace.getConfiguration(notebookConfigKey); let notebookConfig = vscode.workspace.getConfiguration(notebookConfigKey);
let maxDepth = notebookConfig[maxBookSearchDepth]; let maxDepth = notebookConfig[maxBookSearchDepth];
@@ -46,6 +51,7 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
} }
let bookOpened: boolean = this._tableOfContentPaths.length > 0; let bookOpened: boolean = this._tableOfContentPaths.length > 0;
vscode.commands.executeCommand('setContext', 'bookOpened', bookOpened); vscode.commands.executeCommand('setContext', 'bookOpened', bookOpened);
this._onReadAllTOCFiles.fire();
} }
async openNotebook(resource: string): Promise<void> { async openNotebook(resource: string): Promise<void> {

View File

@@ -73,26 +73,30 @@ describe('BookTreeViewProvider.getChildren', function (): void {
}); });
it('should return all book nodes when element is undefined', async function (): Promise<void> { it('should return all book nodes when element is undefined', async function (): Promise<void> {
const children = await bookTreeViewProvider.getChildren(); bookTreeViewProvider.onReadAllTOCFiles(async () => {
should(children).be.Array(); const children = await bookTreeViewProvider.getChildren();
should(children.length).equal(1); should(children).be.Array();
book = children[0]; should(children.length).equal(1);
should(book.title).equal(expectedBook.title); book = children[0];
should(book.title).equal(expectedBook.title);
});
}); });
it('should return all page nodes when element is a book', async function (): Promise<void> { it('should return all page nodes when element is a book', async function (): Promise<void> {
const children = await bookTreeViewProvider.getChildren(book); bookTreeViewProvider.onReadAllTOCFiles(async () => {
should(children).be.Array(); const children = await bookTreeViewProvider.getChildren(book);
should(children.length).equal(3); should(children).be.Array();
const notebook = children[0]; should(children.length).equal(3);
const markdown = children[1]; const notebook = children[0];
const externalLink = children[2]; const markdown = children[1];
should(notebook.title).equal(expectedNotebook.title); const externalLink = children[2];
should(notebook.uri).equal(expectedNotebook.url); should(notebook.title).equal(expectedNotebook.title);
should(markdown.title).equal(expectedMarkdown.title); should(notebook.uri).equal(expectedNotebook.url);
should(markdown.uri).equal(expectedMarkdown.url); should(markdown.title).equal(expectedMarkdown.title);
should(externalLink.title).equal(expectedExternalLink.title); should(markdown.uri).equal(expectedMarkdown.url);
should(externalLink.uri).equal(expectedExternalLink.url); should(externalLink.title).equal(expectedExternalLink.title);
should(externalLink.uri).equal(expectedExternalLink.url);
});
}); });
this.afterAll(async function () { this.afterAll(async function () {

View File

@@ -7,7 +7,7 @@
"preview": true, "preview": true,
"engines": { "engines": {
"vscode": "^1.25.0", "vscode": "^1.25.0",
"azdata": ">=1.9.0" "azdata": ">=1.10.0"
}, },
"license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/master/extensions/import/Microsoft_SQL_Server_Import_Extension_and_Tools_Import_Flat_File_Preview.docx", "license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/master/extensions/import/Microsoft_SQL_Server_Import_Extension_and_Tools_Import_Flat_File_Preview.docx",
"icon": "images/sqlserver.png", "icon": "images/sqlserver.png",

View File

@@ -1,3 +1 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#f6f6f6;}.icon-canvas-transparent{opacity:0;}.icon-vs-action-green{fill:#388a34;}</style></defs><title>continue</title><g id="canvas"><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/></g><g id="outline" style="display: none;"><path class="icon-vs-out" d="M14.334,8,3.667,16H3V0h.667Z"/></g><g id="iconBg"><path class="icon-vs-action-green" d="M4,1.5v13L12.667,8,4,1.5Z"/></g></svg>
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 2V14.4805L12.9146 8.24024L4 2ZM11.1809 8.24024L4.995 12.5684V3.91209L11.1809 8.24024Z" fill="#C5C5C5"/>
</svg>

Before

Width:  |  Height:  |  Size: 259 B

After

Width:  |  Height:  |  Size: 506 B

View File

@@ -1,3 +1 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#252526;}.icon-canvas-transparent{opacity:0;}.icon-vs-action-green{fill:#89d185;}</style></defs><title>continue</title><g id="canvas"><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/></g><g id="outline" style="display: none;"><path class="icon-vs-out" d="M14.334,8,3.667,16H3V0h.667Z"/></g><g id="iconBg"><path class="icon-vs-action-green" d="M4,1.5v13L12.667,8,4,1.5Z"/></g></svg>
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 2V14.4805L12.9146 8.24024L4 2ZM11.1809 8.24024L4.995 12.5684V3.91209L11.1809 8.24024Z" fill="#424242"/>
</svg>

Before

Width:  |  Height:  |  Size: 259 B

After

Width:  |  Height:  |  Size: 506 B

View File

@@ -11,11 +11,11 @@
<loading-spinner [loading]="isLoading"></loading-spinner> <loading-spinner [loading]="isLoading"></loading-spinner>
<div class="hoverButtonsContainer" *ngIf="(cells && cells.length > 0) && !isLoading"> <div class="hoverButtonsContainer" *ngIf="(cells && cells.length > 0) && !isLoading">
<span class="containerBackground"></span> <span class="containerBackground"></span>
<button class="hoverButton" (click)="addCell('code', 0)"> <button class="hoverButton" (click)="addCell('code', 0, $event)">
<div class="addCodeIcon"></div> <div class="addCodeIcon"></div>
<span>{{addCodeLabel}}</span> <span>{{addCodeLabel}}</span>
</button> </button>
<button class="hoverButton" (click)="addCell('markdown', 0)"> <button class="hoverButton" (click)="addCell('markdown', 0, $event)">
<div class="addTextIcon"></div> <div class="addTextIcon"></div>
<span>{{addTextLabel}}</span> <span>{{addTextLabel}}</span>
</button> </button>
@@ -29,11 +29,11 @@
</div> </div>
<div class="hoverButtonsContainer"> <div class="hoverButtonsContainer">
<span class="containerBackground"></span> <span class="containerBackground"></span>
<button class="hoverButton" (click)="addCell('code', findCellIndex(cell) + 1)"> <button class="hoverButton" (click)="addCell('code', findCellIndex(cell) + 1, $event)">
<div class="addCodeIcon"></div> <div class="addCodeIcon"></div>
<span>{{addCodeLabel}}</span> <span>{{addCodeLabel}}</span>
</button> </button>
<button class="hoverButton" (click)="addCell('markdown', findCellIndex(cell) + 1)"> <button class="hoverButton" (click)="addCell('markdown', findCellIndex(cell) + 1, $event)">
<div class="addTextIcon"></div> <div class="addTextIcon"></div>
<span>{{addTextLabel}}</span> <span>{{addTextLabel}}</span>
</button> </button>

View File

@@ -200,7 +200,10 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
} }
// Add cell based on cell type // Add cell based on cell type
public addCell(cellType: CellType, index?: number) { public addCell(cellType: CellType, index?: number, event?: Event) {
if (event) {
event.stopPropagation();
}
this._model.addCell(cellType, index); this._model.addCell(cellType, index);
} }

View File

@@ -219,10 +219,10 @@ export class ChartDataAction extends Action {
} }
public run(context: IGridActionContext): Promise<boolean> { public run(context: IGridActionContext): Promise<boolean> {
// show the visualizer extension recommendation notification
this.extensionTipsService.promptRecommendedExtensionsByScenario(Constants.visualizerExtensions);
const activeEditor = this.editorService.activeControl as QueryEditor; const activeEditor = this.editorService.activeControl as QueryEditor;
if (this.environmentService.appQuality !== 'stable') {
this.extensionTipsService.promptRecommendedExtensionsByScenario(Constants.visualizerExtensions);
}
activeEditor.chart({ batchId: context.batchId, resultId: context.resultId }); activeEditor.chart({ batchId: context.batchId, resultId: context.resultId });
return Promise.resolve(true); return Promise.resolve(true);
} }

View File

@@ -203,6 +203,10 @@ export class GridPanel {
let tables: GridTable<any>[] = []; let tables: GridTable<any>[] = [];
for (let set of resultSet) { for (let set of resultSet) {
// ensure we aren't adding a resultSet that is already visible
if (this.tables.find(t => t.resultSet.batchId === set.batchId && t.resultSet.id === set.id)) {
continue;
}
let tableState: GridTableState; let tableState: GridTableState;
if (this.state) { if (this.state) {
tableState = this.state.tableStates.find(e => e.batchId === set.batchId && e.resultId === set.id); tableState = this.state.tableStates.find(e => e.batchId === set.batchId && e.resultId === set.id);

View File

@@ -130,7 +130,7 @@ export class ResultSerializer {
} }
private promptForFilepath(format: SaveFormat, resourceUri: string): Thenable<string> { private promptForFilepath(format: SaveFormat, resourceUri: string): Thenable<string | undefined> {
let filepathPlaceHolder = prevSavePath ? path.dirname(prevSavePath) : resolveCurrentDirectory(resourceUri, this.rootPath); let filepathPlaceHolder = prevSavePath ? path.dirname(prevSavePath) : resolveCurrentDirectory(resourceUri, this.rootPath);
if (filepathPlaceHolder) { if (filepathPlaceHolder) {
filepathPlaceHolder = path.join(filepathPlaceHolder, this.getResultsDefaultFilename(format)); filepathPlaceHolder = path.join(filepathPlaceHolder, this.getResultsDefaultFilename(format));
@@ -141,8 +141,11 @@ export class ResultSerializer {
defaultUri: filepathPlaceHolder ? URI.file(filepathPlaceHolder) : undefined, defaultUri: filepathPlaceHolder ? URI.file(filepathPlaceHolder) : undefined,
filters: this.getResultsFileExtension(format) filters: this.getResultsFileExtension(format)
}).then(filePath => { }).then(filePath => {
prevSavePath = filePath.fsPath; if (filePath) {
return filePath.fsPath; prevSavePath = filePath.fsPath;
return filePath.fsPath;
}
return undefined;
}); });
} }