Notify complete from Piscal to LeafWeb
This commit is contained in:
@@ -13,6 +13,7 @@ namespace LeafWeb.Core.Remote
|
|||||||
public string DirectoryName { get; set; }
|
public string DirectoryName { get; set; }
|
||||||
public bool SuppressStorageCopy { get; set; }
|
public bool SuppressStorageCopy { get; set; }
|
||||||
public PiscalLeafInputFile[] InputFiles { get; set; }
|
public PiscalLeafInputFile[] InputFiles { get; set; }
|
||||||
|
public string NotifyCompleteUrl { get; set; }
|
||||||
|
|
||||||
static PiscalLeafInput()
|
static PiscalLeafInput()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -73,6 +73,9 @@ namespace LeafWeb.Core.Remote
|
|||||||
if (leafInput.SuppressStorageCopy)
|
if (leafInput.SuppressStorageCopy)
|
||||||
commandText += " -t";
|
commandText += " -t";
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(leafInput.NotifyCompleteUrl))
|
||||||
|
commandText += $" -u {leafInput.NotifyCompleteUrl}";
|
||||||
|
|
||||||
var command = ssh.CreateCommand(commandText);
|
var command = ssh.CreateCommand(commandText);
|
||||||
command.Execute();
|
command.Execute();
|
||||||
ssh.Disconnect();
|
ssh.Disconnect();
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Compression;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices.ComTypes;
|
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using LeafWeb.Core.Entities;
|
using LeafWeb.Core.Entities;
|
||||||
@@ -104,15 +100,20 @@ namespace LeafWeb.Web.Controllers
|
|||||||
return View("Index", viewModel);
|
return View("Index", viewModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileContentResult DownloadResults(int d)
|
public FileContentResult DownloadResults(int id)
|
||||||
{
|
{
|
||||||
var leafInput = DataService.GetLeafInput(d);
|
var leafInput = DataService.GetLeafInput(id);
|
||||||
|
|
||||||
var zip = leafInput.GetOutputFileZip();
|
var zip = leafInput.GetOutputFileZip();
|
||||||
|
|
||||||
return new FileContentResult(zip, "application/zip") {FileDownloadName = leafInput.Identifier + ".zip"};
|
return new FileContentResult(zip, "application/zip") {FileDownloadName = leafInput.Identifier + ".zip"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void NotifyComplete()
|
||||||
|
{
|
||||||
|
HangfireStartup.TriggerPiscalProcessQueue();
|
||||||
|
}
|
||||||
|
|
||||||
private FileInfo[] GetBackloadDirectoryFiles(string directoryName)
|
private FileInfo[] GetBackloadDirectoryFiles(string directoryName)
|
||||||
{
|
{
|
||||||
var path = Path.Combine(Server.MapPath("~/Files/"), directoryName + "\\");
|
var path = Path.Combine(Server.MapPath("~/Files/"), directoryName + "\\");
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using LeafWeb.Core.Entities;
|
using LeafWeb.Core.Entities;
|
||||||
using LeafWeb.Core.Remote;
|
using LeafWeb.Core.Remote;
|
||||||
@@ -11,10 +12,14 @@ namespace LeafWeb.Web.Services.PiscalQueue
|
|||||||
public class PiscalService
|
public class PiscalService
|
||||||
{
|
{
|
||||||
private readonly IPiscalClient _piscalClient;
|
private readonly IPiscalClient _piscalClient;
|
||||||
|
private readonly string _notifyCompleteUrl;
|
||||||
|
|
||||||
public PiscalService(IPiscalClient piscalClient)
|
public PiscalService(IPiscalClient piscalClient)
|
||||||
{
|
{
|
||||||
_piscalClient = piscalClient;
|
_piscalClient = piscalClient;
|
||||||
|
_notifyCompleteUrl =
|
||||||
|
ConfigurationManager.AppSettings["LeafWebUrl"] +
|
||||||
|
ConfigurationManager.AppSettings["PiscalNotifyCompleteUrlPath"];
|
||||||
}
|
}
|
||||||
|
|
||||||
public PiscalService() : this(new PiscalSshClient(ConfigurationManager.ConnectionStrings["PiscalServer"].ConnectionString))
|
public PiscalService() : this(new PiscalSshClient(ConfigurationManager.ConnectionStrings["PiscalServer"].ConnectionString))
|
||||||
@@ -24,6 +29,10 @@ namespace LeafWeb.Web.Services.PiscalQueue
|
|||||||
public void Run(LeafInput leafInput)
|
public void Run(LeafInput leafInput)
|
||||||
{
|
{
|
||||||
var inputFile = new PiscalLeafInput(leafInput);
|
var inputFile = new PiscalLeafInput(leafInput);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(_notifyCompleteUrl))
|
||||||
|
inputFile.NotifyCompleteUrl = _notifyCompleteUrl;
|
||||||
|
|
||||||
// TODO: remove this, just for testing
|
// TODO: remove this, just for testing
|
||||||
if (string.Equals(leafInput.Email, "james.kolpack@gmail.com", StringComparison.InvariantCultureIgnoreCase))
|
if (string.Equals(leafInput.Email, "james.kolpack@gmail.com", StringComparison.InvariantCultureIgnoreCase))
|
||||||
inputFile.SuppressStorageCopy = true;
|
inputFile.SuppressStorageCopy = true;
|
||||||
|
|||||||
@@ -30,6 +30,8 @@
|
|||||||
<add key="SmtpPort" value="25"/>
|
<add key="SmtpPort" value="25"/>
|
||||||
<add key="SmtpUserName" value=""/>
|
<add key="SmtpUserName" value=""/>
|
||||||
<add key="SmtpPassword" value=""/>
|
<add key="SmtpPassword" value=""/>
|
||||||
|
<add key="LeafWebUrl" value="http://192.168.1.133:1640/" />
|
||||||
|
<add key="PiscalNotifyCompleteUrlPath" value="LeafInput/NotifyComplete" />
|
||||||
</appSettings>
|
</appSettings>
|
||||||
<system.web>
|
<system.web>
|
||||||
<compilation debug="true" targetFramework="4.5" />
|
<compilation debug="true" targetFramework="4.5" />
|
||||||
|
|||||||
Reference in New Issue
Block a user