mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-02 09:35:40 -05:00
add ability for md + text reports (#18667)
* add ability for md + text reports * change report type * re add types for ads * match fields and add enum for mimetype * rename preview report * update type * rename generate report type * fix comment
This commit is contained in:
@@ -20,6 +20,7 @@ import { attachModalDialogStyler } from 'sql/workbench/common/styler';
|
||||
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { MarkdownRenderer } from 'vs/editor/browser/core/markdownRenderer';
|
||||
import { Mimes } from 'vs/base/common/mime';
|
||||
|
||||
const OkText: string = localize('tableDesigner.UpdateDatabase', "Update Database");
|
||||
const CancelText: string = localize('tableDesigner.cancel', "Cancel");
|
||||
@@ -34,6 +35,7 @@ export enum TableDesignerPublishDialogResult {
|
||||
export class TableDesignerPublishDialog extends Modal {
|
||||
|
||||
private _report?: string;
|
||||
private _mimeType: string = Mimes.text;
|
||||
private _okButton?: Button;
|
||||
private _generateScriptButton?: Button;
|
||||
private _cancelButton?: Button;
|
||||
@@ -54,8 +56,9 @@ export class TableDesignerPublishDialog extends Modal {
|
||||
this._markdownRenderer = instantiationService.createInstance(MarkdownRenderer, {});
|
||||
}
|
||||
|
||||
public open(report: string): Promise<TableDesignerPublishDialogResult> {
|
||||
public open(report: string, mimeType: string = Mimes.text): Promise<TableDesignerPublishDialogResult> {
|
||||
this._report = report;
|
||||
this._mimeType = mimeType;
|
||||
this.render();
|
||||
this.show();
|
||||
const promise = new Promise<TableDesignerPublishDialogResult>((resolve) => {
|
||||
@@ -78,8 +81,13 @@ export class TableDesignerPublishDialog extends Modal {
|
||||
|
||||
protected renderBody(container: HTMLElement) {
|
||||
const body = DOM.append(container, DOM.$('.table-designer-publish-dialog'));
|
||||
const markdownElement = this._markdownRenderer.render({ value: this._report }).element;
|
||||
DOM.append(body, markdownElement);
|
||||
if (this._mimeType === Mimes.markdown) {
|
||||
const markdownElement = this._markdownRenderer.render({ value: this._report }).element;
|
||||
DOM.append(body, markdownElement);
|
||||
} else {
|
||||
// default to plain text
|
||||
body.innerText = this._report;
|
||||
}
|
||||
}
|
||||
|
||||
protected layout(height?: number): void {
|
||||
|
||||
Reference in New Issue
Block a user