mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 01:25:40 -05:00
Change preview report type (#1418)
* change report type * PR comments * fix doc for report * rename format to mimetype * nitpicks * edit comments * default to plain text
This commit is contained in:
@@ -7,6 +7,23 @@ using Microsoft.SqlTools.Hosting.Protocol.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.TableDesigner.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// The service request to generate preview report describing the changes.
|
||||
/// </summary>
|
||||
|
||||
public class GeneratePreviewReportResult
|
||||
{
|
||||
/// <summary>
|
||||
/// The report generated for publish preview
|
||||
/// </summary>
|
||||
public string Report;
|
||||
|
||||
/// <summary>
|
||||
/// format (mimetype) of the string
|
||||
/// </summary>
|
||||
public string MimeType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The service request to generate preview report describing the changes.
|
||||
/// </summary>
|
||||
@@ -15,6 +32,6 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner.Contracts
|
||||
/// <summary>
|
||||
/// Request definition
|
||||
/// </summary>
|
||||
public static readonly RequestType<TableInfo, string> Type = RequestType<TableInfo, string>.Create("tabledesigner/generatepreviewreport");
|
||||
public static readonly RequestType<TableInfo, GeneratePreviewReportResult> Type = RequestType<TableInfo, GeneratePreviewReportResult>.Create("tabledesigner/generatepreviewreport");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,13 +161,17 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
|
||||
});
|
||||
}
|
||||
|
||||
private Task HandleGeneratePreviewReportRequest(TableInfo tableInfo, RequestContext<string> requestContext)
|
||||
private Task HandleGeneratePreviewReportRequest(TableInfo tableInfo, RequestContext<GeneratePreviewReportResult> requestContext)
|
||||
{
|
||||
return this.HandleRequest<string>(requestContext, async () =>
|
||||
return this.HandleRequest<GeneratePreviewReportResult>(requestContext, async () =>
|
||||
{
|
||||
var table = this.GetTableDesigner(tableInfo);
|
||||
var report = table.GenerateReport();
|
||||
await requestContext.SendResult(report);
|
||||
var generatePreviewReportResult = new GeneratePreviewReportResult();
|
||||
// TODO - set report type by caohai
|
||||
generatePreviewReportResult.Report = report;
|
||||
generatePreviewReportResult.MimeType = "text/plain";
|
||||
await requestContext.SendResult(generatePreviewReportResult);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user