-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/bb-io/XTM into develop
- Loading branch information
Showing
19 changed files
with
592 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -354,3 +354,4 @@ healthchecksdb | |
*.DS_Store | ||
*.dmg | ||
*.env | ||
/ConsoleApp1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
using Apps.XTM.Constants; | ||
using Apps.XTM.Invocables; | ||
using Apps.XTM.Models.Request; | ||
using Apps.XTM.Models.Response; | ||
using Apps.XTM.Models.Response.Customers; | ||
using Blackbird.Applications.Sdk.Common; | ||
using Blackbird.Applications.Sdk.Common.Actions; | ||
using Blackbird.Applications.Sdk.Common.Invocation; | ||
using DocumentFormat.OpenXml.Bibliography; | ||
using RestSharp; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Apps.XTM.Actions | ||
{ | ||
[ActionList] | ||
public class LqaActions : XtmInvocable | ||
{ | ||
public LqaActions(InvocationContext invocationContext) : base(invocationContext) | ||
{ | ||
} | ||
|
||
[Action("Search LQA reports", Description = "Define criteria to search LQA reports")] | ||
public async Task<List<LqaResponse>> SearchLqa([ActionParameter] LQARequest input) | ||
{ | ||
var Params = new List<string>(); | ||
if (input.DateFrom is not null) Params.Add($"completeDateFrom={input.DateFrom:yyyy-MM-dd}"); | ||
if (input.DateTo is not null) Params.Add($"completeDateTo={input.DateTo:yyyy-MM-dd}"); | ||
if (input.TargetLangs is not null) Params.Add($"targetLanguages={String.Join(",",input.TargetLangs)}"); | ||
if (input.Type is not null) Params.Add($"type={input.Type}"); | ||
|
||
var endpoint = $"{ApiEndpoints.Projects}/lqa/download"; | ||
if (Params is not null && Params.Count > 0) | ||
{ endpoint = endpoint + "?"+String.Join("&",Params); } | ||
|
||
var response = await Client.ExecuteXtmWithJson<List<LqaDto>>(endpoint, | ||
Method.Get, | ||
null, | ||
Creds); | ||
|
||
return FixDate(response); | ||
} | ||
|
||
private List<LqaResponse> FixDate(List<LqaDto> response) | ||
{ | ||
var updated = new List<LqaResponse>(); | ||
foreach (var item in response) | ||
{ | ||
|
||
updated.Add(new LqaResponse | ||
{ | ||
id = item.id, | ||
completeDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds(long.Parse(item.completeDate)).ToString("yyyy-MM-dd"), | ||
severityMultiplierNeutral = item.severityMultipliers.Neutral, | ||
severityMultiplierCritical = item.severityMultipliers.Critical, | ||
severityMultiplierMajor = item.severityMultipliers.Major, | ||
severityMultiplierMinor = item.severityMultipliers.Minor, | ||
evaluee = item.evaluee.userName, | ||
evaluator = item.evaluator.userName, | ||
customer = item.customer.name, | ||
projectId = item.project.id.ToString(), | ||
projectName = item.project.name, | ||
projectWordcount = item.project.wordCount, | ||
projectTotal = item.project.Total, | ||
projectErrors = item.project.Errors, | ||
SubjectMatter = item.project.subjectMatter.Name, | ||
languageCode = item.language.code, | ||
languageWordcount = item.language.wordCount, | ||
languageTotal = item.language.Total, | ||
languageErrors = item.language.Errors, | ||
files = item.files, | ||
}); | ||
} | ||
|
||
return updated; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
Apps.XTM/DataSourceHandlers/EnumHandlers/LqaTypeDataHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Blackbird.Applications.Sdk.Utils.Sdk.DataSourceHandlers; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Apps.XTM.DataSourceHandlers.EnumHandlers | ||
{ | ||
public class LqaTypeDataHandler : EnumDataHandler | ||
{ | ||
protected override Dictionary<string, string> EnumValues => new() | ||
{ | ||
{"LANGUAGE", "Language"}, | ||
{"FILE", "File"} | ||
}; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
Apps.XTM/DataSourceHandlers/EnumHandlers/ProjectStatusHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Blackbird.Applications.Sdk.Common.Dictionaries; | ||
|
||
namespace Apps.XTM.DataSourceHandlers.EnumHandlers; | ||
|
||
public class ProjectStatusHandler : IStaticDataSourceHandler | ||
{ | ||
public Dictionary<string, string> GetData() | ||
{ | ||
return new() | ||
{ | ||
["NOT_STARTED"] = "Not started", | ||
["STARTED"] = "Started", | ||
["FINISHED"] = "Finished" | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
| ||
|
||
using Apps.XTM.DataSourceHandlers.EnumHandlers; | ||
using Blackbird.Applications.Sdk.Common; | ||
using Blackbird.Applications.Sdk.Common.Dynamic; | ||
|
||
namespace Apps.XTM.Models.Request | ||
{ | ||
public class LQARequest | ||
{ | ||
[Display("Date from")] | ||
public DateTime? DateFrom { get; set; } | ||
|
||
[Display("Date to")] | ||
public DateTime? DateTo { get; set; } | ||
|
||
[DataSource(typeof(LanguageDataHandler))] | ||
[Display("Target languages")] | ||
public List<string>? TargetLangs { get; set; } | ||
|
||
[DataSource(typeof(LqaTypeDataHandler))] | ||
[Display("LQA type")] | ||
public string? Type { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.