mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-28 17:23:19 -05:00
Add grid streaming support for notebooks (#12175)
* add onResultUpdate handler in gridoutput * convert rows to mimetype and html * wait for data conversion to finish before saving * detach changeRef after output is created * fix save grid action * move data conversion check to each cell * move conversion logic to dataprovider * notify data converting when user saves * add comments and remove unused methods * fix method return type * fix tests * fix convertData method header * move azdata changes to azdata proposed * address PR comments * display top rows message * fix messages/table ordering and query 100 rows * add missing escape import * set default max rows to 5000 * add undefined check to updateResultSet * change gridDataConversionComplete return type
This commit is contained in:
@@ -10,6 +10,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { NotebookInput } from 'sql/workbench/contrib/notebook/browser/models/notebookInput';
|
||||
import { INotebookService } from 'sql/workbench/services/notebook/browser/notebookService';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
|
||||
export class FileNotebookInput extends NotebookInput {
|
||||
public static ID: string = 'workbench.editorinputs.fileNotebookInput';
|
||||
@@ -21,9 +22,10 @@ export class FileNotebookInput extends NotebookInput {
|
||||
@ITextModelService textModelService: ITextModelService,
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@INotebookService notebookService: INotebookService,
|
||||
@IExtensionService extensionService: IExtensionService
|
||||
@IExtensionService extensionService: IExtensionService,
|
||||
@INotificationService notificationService: INotificationService
|
||||
) {
|
||||
super(title, resource, textInput, textModelService, instantiationService, notebookService, extensionService);
|
||||
super(title, resource, textInput, textModelService, instantiationService, notebookService, extensionService, notificationService);
|
||||
}
|
||||
|
||||
public get textInput(): FileEditorInput {
|
||||
|
||||
@@ -33,6 +33,9 @@ import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileE
|
||||
import { BinaryEditorModel } from 'vs/workbench/common/editor/binaryEditorModel';
|
||||
import { NotebookFindModel } from 'sql/workbench/contrib/notebook/browser/find/notebookFindModel';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { INotification, INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import * as nls from 'vs/nls';
|
||||
|
||||
export type ModeViewSaveHandler = (handle: number) => Thenable<boolean>;
|
||||
|
||||
@@ -221,7 +224,8 @@ export abstract class NotebookInput extends EditorInput {
|
||||
@ITextModelService private textModelService: ITextModelService,
|
||||
@IInstantiationService private instantiationService: IInstantiationService,
|
||||
@INotebookService private notebookService: INotebookService,
|
||||
@IExtensionService private extensionService: IExtensionService
|
||||
@IExtensionService private extensionService: IExtensionService,
|
||||
@INotificationService private notificationService: INotificationService
|
||||
) {
|
||||
super();
|
||||
this._standardKernels = [];
|
||||
@@ -290,6 +294,16 @@ export abstract class NotebookInput extends EditorInput {
|
||||
}
|
||||
|
||||
async save(groupId: number, options?: ITextFileSaveOptions): Promise<IEditorInput | undefined> {
|
||||
const conversionNotification: INotification = {
|
||||
severity: Severity.Info,
|
||||
message: nls.localize('convertingData', "Waiting for table data conversion to complete..."),
|
||||
progress: {
|
||||
infinite: true // Keep showing conversion notification until notificationHandle is closed
|
||||
}
|
||||
};
|
||||
const notificationHandle = this.notificationService.notify(conversionNotification);
|
||||
await this._model.getNotebookModel().gridDataConversionComplete;
|
||||
notificationHandle.close();
|
||||
this.updateModel();
|
||||
let input = await this.textInput.save(groupId, options);
|
||||
await this.setTrustForNewEditor(input);
|
||||
|
||||
@@ -10,6 +10,7 @@ import { IExtensionService } from 'vs/workbench/services/extensions/common/exten
|
||||
import { NotebookInput } from 'sql/workbench/contrib/notebook/browser/models/notebookInput';
|
||||
import { INotebookService } from 'sql/workbench/services/notebook/browser/notebookService';
|
||||
import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
|
||||
export class UntitledNotebookInput extends NotebookInput {
|
||||
public static ID: string = 'workbench.editorinputs.untitledNotebookInput';
|
||||
@@ -21,9 +22,10 @@ export class UntitledNotebookInput extends NotebookInput {
|
||||
@ITextModelService textModelService: ITextModelService,
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@INotebookService notebookService: INotebookService,
|
||||
@IExtensionService extensionService: IExtensionService
|
||||
@IExtensionService extensionService: IExtensionService,
|
||||
@INotificationService notificationService: INotificationService
|
||||
) {
|
||||
super(title, resource, textInput, textModelService, instantiationService, notebookService, extensionService);
|
||||
super(title, resource, textInput, textModelService, instantiationService, notebookService, extensionService, notificationService);
|
||||
}
|
||||
|
||||
public get textInput(): UntitledTextEditorInput {
|
||||
|
||||
Reference in New Issue
Block a user