|
@@ -8,6 +8,7 @@ using InABox.WPF;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Diagnostics.CodeAnalysis;
|
|
|
+using System.IO;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading;
|
|
@@ -19,15 +20,14 @@ public class IssuesGrid : DynamicGrid<Kanban>, ISpecificGrid
|
|
|
{
|
|
|
private readonly int ChunkSize = 500;
|
|
|
|
|
|
- private IClient<Kanban> _client;
|
|
|
+ public IQueryProviderFactory ClientFactory { get; set; }
|
|
|
|
|
|
- public Func<Type, IClient> ClientFactory { get; set; }
|
|
|
-
|
|
|
- private IClient<Kanban> Client
|
|
|
+ private IQueryProvider<Kanban> _client;
|
|
|
+ private IQueryProvider<Kanban> Client
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
- _client ??= (ClientFactory(typeof(Kanban)) as IClient<Kanban>)!;
|
|
|
+ _client ??= ClientFactory.Create<Kanban>();
|
|
|
return _client;
|
|
|
}
|
|
|
}
|
|
@@ -70,14 +70,37 @@ public class IssuesGrid : DynamicGrid<Kanban>, ISpecificGrid
|
|
|
if (row is null) return;
|
|
|
|
|
|
var menu = column.GetMenu();
|
|
|
- menu.AddItem("Add Note", null, row, AddNote_Click);
|
|
|
- menu.AddItem("Close Issue", null, row, CloseTask_Click);
|
|
|
+ menu.AddItem("Add note", null, row, AddNote_Click);
|
|
|
+ menu.AddItem("Attach system logs", null, row, AttachLogs_Click);
|
|
|
+ menu.AddSeparator();
|
|
|
+ menu.AddItem("Close issue", null, row, CloseTask_Click);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void AttachLogs_Click(CoreRow row)
|
|
|
+ {
|
|
|
+ var logFile = CoreUtils.GetLogFile();
|
|
|
+ var data = File.ReadAllBytes(logFile);
|
|
|
+ var doc = new Document();
|
|
|
+ doc.Data = data;
|
|
|
+ doc.CRC = CoreUtils.CalculateCRC(data);
|
|
|
+ doc.FileName = Path.GetFileName(logFile);
|
|
|
+ doc.TimeStamp = File.GetLastWriteTime(logFile);
|
|
|
+
|
|
|
+ ClientFactory.Save(doc, "Attached logs to task.");
|
|
|
+
|
|
|
+ var kanbanDocument = new KanbanDocument();
|
|
|
+ kanbanDocument.DocumentLink.CopyFrom(doc);
|
|
|
+ kanbanDocument.EntityLink.CopyFrom(row.ToObject<Kanban>());
|
|
|
+ ClientFactory.Save(kanbanDocument, "Attached logs to task.");
|
|
|
}
|
|
|
|
|
|
public override Kanban CreateItem()
|
|
|
{
|
|
|
var item = base.CreateItem();
|
|
|
item.UserProperties["CustomerID"] = CustomerID.ToString();
|
|
|
+ item.Notes = [
|
|
|
+ $"Created on PRS {CoreUtils.GetVersion()}"
|
|
|
+ ];
|
|
|
// item.Status = KanbanStatus.Open;
|
|
|
return item;
|
|
|
}
|
|
@@ -122,7 +145,7 @@ public class IssuesGrid : DynamicGrid<Kanban>, ISpecificGrid
|
|
|
|
|
|
public virtual CoreTable LookupValues(DataLookupEditor editor, Type parent, string columnname, BaseObject[]? items)
|
|
|
{
|
|
|
- var client = ClientFactory(editor.Type);
|
|
|
+ var client = ClientFactory.Create(editor.Type);
|
|
|
|
|
|
var filter = LookupFactory.DefineLookupFilter(parent, editor.Type, columnname, items ?? (Array.CreateInstance(parent, 0) as BaseObject[])!);
|
|
|
var columns = LookupFactory.DefineLookupColumns(parent, editor.Type, columnname);
|
|
@@ -192,7 +215,10 @@ public class IssuesGrid : DynamicGrid<Kanban>, ISpecificGrid
|
|
|
{
|
|
|
var pages = new DynamicEditorPages
|
|
|
{
|
|
|
- //new DynamicDocumentGrid<KanbanDocument, Kanban, KanbanLink>()
|
|
|
+ new DynamicDocumentGrid<KanbanDocument, Kanban, KanbanLink>
|
|
|
+ {
|
|
|
+ Client = ClientFactory
|
|
|
+ }
|
|
|
};
|
|
|
return pages;
|
|
|
}
|