mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-11 02:32:40 -05:00
Remove InsightsGenerator project (#1764)
This commit is contained in:
@@ -19,7 +19,6 @@ using Microsoft.SqlTools.ServiceLayer.DisasterRecovery;
|
||||
using Microsoft.SqlTools.ServiceLayer.EditData;
|
||||
using Microsoft.SqlTools.ServiceLayer.FileBrowser;
|
||||
using Microsoft.SqlTools.ServiceLayer.Hosting;
|
||||
using Microsoft.SqlTools.ServiceLayer.InsightsGenerator;
|
||||
using Microsoft.SqlTools.ServiceLayer.LanguageExtensibility;
|
||||
using Microsoft.SqlTools.ServiceLayer.LanguageServices;
|
||||
using Microsoft.SqlTools.ServiceLayer.Metadata;
|
||||
@@ -160,9 +159,6 @@ namespace Microsoft.SqlTools.ServiceLayer
|
||||
NotebookConvertService.Instance.InitializeService(serviceHost);
|
||||
serviceProvider.RegisterSingleService(NotebookConvertService.Instance);
|
||||
|
||||
InsightsGeneratorService.Instance.InitializeService(serviceHost);
|
||||
serviceProvider.RegisterSingleService(InsightsGeneratorService.Instance);
|
||||
|
||||
#if INCLUDE_MIGRATION
|
||||
MigrationService.Instance.InitializeService(serviceHost);
|
||||
serviceProvider.RegisterSingleService(MigrationService.Instance);
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||
using Microsoft.SqlTools.Utility;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.InsightsGenerator.Contracts
|
||||
{
|
||||
public class AccessibleChartData
|
||||
{
|
||||
public string[] Columns { get; set; }
|
||||
public string[][] Rows { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Query insights generator parameters
|
||||
/// </summary>
|
||||
public class QueryInsightsGeneratorParams : GeneralRequestDetails
|
||||
{
|
||||
public AccessibleChartData Data { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Query insights generator result
|
||||
/// </summary>
|
||||
public class InsightsGeneratorResult : ResultStatus
|
||||
{
|
||||
public string InsightsText { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Query insights generato request type
|
||||
/// </summary>
|
||||
public class QueryInsightsGeneratorRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Request definition
|
||||
/// </summary>
|
||||
public static readonly
|
||||
RequestType<QueryInsightsGeneratorParams, InsightsGeneratorResult> Type =
|
||||
RequestType<QueryInsightsGeneratorParams, InsightsGeneratorResult>.Create("insights/query");
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.SqlTools.Hosting.Protocol;
|
||||
using Microsoft.SqlTools.ServiceLayer.Hosting;
|
||||
using Microsoft.SqlTools.ServiceLayer.InsightsGenerator.Contracts;
|
||||
using Microsoft.InsightsGenerator;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.InsightsGenerator
|
||||
{
|
||||
/// <summary>
|
||||
/// Service responsible for securing credentials in a platform-neutral manner. This provides
|
||||
/// a generic API for read, save and delete credentials
|
||||
/// </summary>
|
||||
public class InsightsGeneratorService
|
||||
{
|
||||
/// <summary>
|
||||
/// Singleton service instance
|
||||
/// </summary>
|
||||
private static Lazy<InsightsGeneratorService> instance
|
||||
= new Lazy<InsightsGeneratorService>(() => new InsightsGeneratorService());
|
||||
|
||||
/// <summary>
|
||||
/// Gets the singleton service instance
|
||||
/// </summary>
|
||||
public static InsightsGeneratorService Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
return instance.Value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the service instance
|
||||
/// </summary>
|
||||
public void InitializeService(ServiceHost serviceHost)
|
||||
{
|
||||
// Insights Generatoe request handlers
|
||||
serviceHost.SetRequestHandler(QueryInsightsGeneratorRequest.Type, HandleQueryInsightGeneratorRequest);
|
||||
}
|
||||
|
||||
internal async Task HandleQueryInsightGeneratorRequest(QueryInsightsGeneratorParams parameters, RequestContext<InsightsGeneratorResult> requestContext)
|
||||
{
|
||||
Microsoft.InsightsGenerator.DataArray dataArray = new Microsoft.InsightsGenerator.DataArray(){
|
||||
ColumnNames = parameters.Data.Columns,
|
||||
Cells = parameters.Data.Rows
|
||||
};
|
||||
|
||||
Workflow insightWorkFlow = new Workflow();
|
||||
|
||||
try
|
||||
{
|
||||
string insightText = await insightWorkFlow.ProcessInputData(dataArray);
|
||||
insightText = insightText.Replace("\\n", "");
|
||||
|
||||
await requestContext.SendResult(new InsightsGeneratorResult()
|
||||
{
|
||||
InsightsText = insightText,
|
||||
Success = true,
|
||||
ErrorMessage = null
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await requestContext.SendResult(new InsightsGeneratorResult()
|
||||
{
|
||||
Success = false,
|
||||
ErrorMessage = ex.Message
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,6 @@
|
||||
<ProjectReference Include="../Microsoft.SqlTools.Hosting/Microsoft.SqlTools.Hosting.csproj" />
|
||||
<ProjectReference Include="../Microsoft.SqlTools.Credentials/Microsoft.SqlTools.Credentials.csproj" />
|
||||
<ProjectReference Include="../Microsoft.SqlTools.ManagedBatchParser/Microsoft.SqlTools.ManagedBatchParser.csproj" />
|
||||
<ProjectReference Include="../Microsoft.InsightsGenerator/Microsoft.InsightsGenerator.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="..\..\Notice.txt">
|
||||
|
||||
Reference in New Issue
Block a user