07-12-2022

This commit is contained in:
Jonathan Jenne
2022-12-07 16:45:31 +01:00
parent 248be23804
commit 7b7147eeee
28 changed files with 781 additions and 385 deletions

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/Arrays" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="ArrayOfstring">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="string" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="ArrayOfstring" nillable="true" type="tns:ArrayOfstring" />
</xs:schema>

View File

@@ -6,6 +6,7 @@
<xsd:import namespace="http://schemas.microsoft.com/2003/10/Serialization/" /> <xsd:import namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
<xsd:import namespace="http://schemas.datacontract.org/2004/07/ECM.JobRunner.Windows" /> <xsd:import namespace="http://schemas.datacontract.org/2004/07/ECM.JobRunner.Windows" />
<xsd:import namespace="http://schemas.datacontract.org/2004/07/ECM.JobRunner.Common" /> <xsd:import namespace="http://schemas.datacontract.org/2004/07/ECM.JobRunner.Common" />
<xsd:import namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
</xsd:schema> </xsd:schema>
</wsdl:types> </wsdl:types>
<wsdl:message name="IEDMIService_GetHeartbeat_InputMessage"> <wsdl:message name="IEDMIService_GetHeartbeat_InputMessage">

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:tns="http://schemas.datacontract.org/2004/07/ECM.JobRunner.Common" xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/ECM.JobRunner.Common" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:schema xmlns:tns="http://schemas.datacontract.org/2004/07/ECM.JobRunner.Common" xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/ECM.JobRunner.Common" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="http://schemas.microsoft.com/2003/10/Serialization/" /> <xs:import namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
<xs:import namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
<xs:complexType name="ArrayOfHistoryItem"> <xs:complexType name="ArrayOfHistoryItem">
<xs:sequence> <xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="HistoryItem" nillable="true" type="tns:HistoryItem" /> <xs:element minOccurs="0" maxOccurs="unbounded" name="HistoryItem" nillable="true" type="tns:HistoryItem" />
@@ -67,4 +68,17 @@
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
<xs:element name="ArrayOfJobType" nillable="true" type="tns:ArrayOfJobType" /> <xs:element name="ArrayOfJobType" nillable="true" type="tns:ArrayOfJobType" />
<xs:complexType name="ArrayOfObjectType">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="ObjectType" nillable="true" type="tns:ObjectType" />
</xs:sequence>
</xs:complexType>
<xs:element name="ArrayOfObjectType" nillable="true" type="tns:ArrayOfObjectType" />
<xs:complexType name="ObjectType">
<xs:sequence>
<xs:element xmlns:q1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" minOccurs="0" name="Indexes" nillable="true" type="q1:ArrayOfstring" />
<xs:element minOccurs="0" name="Name" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="ObjectType" nillable="true" type="tns:ObjectType" />
</xs:schema> </xs:schema>

View File

@@ -49,6 +49,7 @@
<xs:sequence> <xs:sequence>
<xs:element xmlns:q4="http://schemas.datacontract.org/2004/07/ECM.JobRunner.Common" minOccurs="0" name="JobDefinitions" nillable="true" type="q4:ArrayOfJobDefinition" /> <xs:element xmlns:q4="http://schemas.datacontract.org/2004/07/ECM.JobRunner.Common" minOccurs="0" name="JobDefinitions" nillable="true" type="q4:ArrayOfJobDefinition" />
<xs:element xmlns:q5="http://schemas.datacontract.org/2004/07/ECM.JobRunner.Common" minOccurs="0" name="JobTypes" nillable="true" type="q5:ArrayOfJobType" /> <xs:element xmlns:q5="http://schemas.datacontract.org/2004/07/ECM.JobRunner.Common" minOccurs="0" name="JobTypes" nillable="true" type="q5:ArrayOfJobType" />
<xs:element xmlns:q6="http://schemas.datacontract.org/2004/07/ECM.JobRunner.Common" minOccurs="0" name="WindreamObjectTypes" nillable="true" type="q6:ArrayOfObjectType" />
</xs:sequence> </xs:sequence>
</xs:extension> </xs:extension>
</xs:complexContent> </xs:complexContent>

View File

@@ -28,6 +28,7 @@
<MetadataFile FileName="service.xsd" MetadataType="Schema" ID="82f08b96-e901-43fd-b34f-8c5660ef7b9d" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9001/DigitalData/Services/JobRunner/mex" /> <MetadataFile FileName="service.xsd" MetadataType="Schema" ID="82f08b96-e901-43fd-b34f-8c5660ef7b9d" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9001/DigitalData/Services/JobRunner/mex" />
<MetadataFile FileName="ECM.JobRunner.Windows.xsd" MetadataType="Schema" ID="767808c0-aa74-46cc-af21-73a1ccedb8e9" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9001/DigitalData/Services/JobRunner/mex" /> <MetadataFile FileName="ECM.JobRunner.Windows.xsd" MetadataType="Schema" ID="767808c0-aa74-46cc-af21-73a1ccedb8e9" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9001/DigitalData/Services/JobRunner/mex" />
<MetadataFile FileName="ECM.JobRunner.Common.xsd" MetadataType="Schema" ID="56dce723-cc20-4004-bb74-65f4f89e0f21" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9001/DigitalData/Services/JobRunner/mex" /> <MetadataFile FileName="ECM.JobRunner.Common.xsd" MetadataType="Schema" ID="56dce723-cc20-4004-bb74-65f4f89e0f21" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9001/DigitalData/Services/JobRunner/mex" />
<MetadataFile FileName="Arrays.xsd" MetadataType="Schema" ID="908086d3-61bf-4869-9efb-ca4e72ed984a" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9001/DigitalData/Services/JobRunner/mex" />
</Metadata> </Metadata>
<Extensions> <Extensions>
<ExtensionFile FileName="configuration91.svcinfo" Name="configuration91.svcinfo" /> <ExtensionFile FileName="configuration91.svcinfo" Name="configuration91.svcinfo" />

View File

@@ -73,6 +73,7 @@
</Compile> </Compile>
<Compile Include="JobConfig\JobDefinition.vb" /> <Compile Include="JobConfig\JobDefinition.vb" />
<Compile Include="JobConfig\JobType.vb" /> <Compile Include="JobConfig\JobType.vb" />
<Compile Include="ProfileConfig\ImportProfile.vb" />
<Compile Include="JobHistory\HistoryItem.vb" /> <Compile Include="JobHistory\HistoryItem.vb" />
<Compile Include="JobStatus\StatusItem.vb" /> <Compile Include="JobStatus\StatusItem.vb" />
<Compile Include="My Project\AssemblyInfo.vb" /> <Compile Include="My Project\AssemblyInfo.vb" />
@@ -90,6 +91,7 @@
<DependentUpon>Settings.settings</DependentUpon> <DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput> <DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile> </Compile>
<Compile Include="Windream\ObjectType.vb" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="My Project\Resources.resx"> <EmbeddedResource Include="My Project\Resources.resx">
@@ -101,6 +103,9 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="app.config" /> <None Include="app.config" />
<None Include="Connected Services\JobRunnerReference\Arrays.xsd">
<SubType>Designer</SubType>
</None>
<None Include="Connected Services\JobRunnerReference\DigitalData.Services.EDMIService.wsdl" /> <None Include="Connected Services\JobRunnerReference\DigitalData.Services.EDMIService.wsdl" />
<None Include="Connected Services\JobRunnerReference\DigitalData.Services.EDMIService.xsd"> <None Include="Connected Services\JobRunnerReference\DigitalData.Services.EDMIService.xsd">
<SubType>Designer</SubType> <SubType>Designer</SubType>

View File

@@ -0,0 +1,15 @@
Public Class ImportProfile
Public Property Id As Integer
Public Property JobId As Integer
Public Property ObjectTypeName As String
Public Property SourceFolder As String
Public Property TargetFolder As String
Public Property BackupFolder As String
Public Property SubfolderDateFormat As String
Public Property FileExcludeRegex As String
Public Property DeleteFiles As Boolean
Public Property IncludeSubfolders As Boolean
End Class

View File

@@ -0,0 +1,4 @@
Public Class ObjectType
Public Name As String
Public Indexes As New List(Of String)
End Class

View File

@@ -49,7 +49,8 @@ else
</div> </div>
<div class="btn-group mt-3" role="group" aria-label="Basic example"> <div class="btn-group mt-3" role="group" aria-label="Basic example">
<a class="btn btn-secondary" href="jobs/@job.Id">
<a class="btn btn-secondary" href="@GetBackUrl()">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-left" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-left" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8z" /> <path fill-rule="evenodd" d="M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8z" />
</svg> Back </svg> Back
@@ -73,6 +74,11 @@ else
private JobDefinition? job = new(); private JobDefinition? job = new();
private List<JobType>? types; private List<JobType>? types;
protected string GetBackUrl()
{
return JobId == Constants.ENTITY_ID_NEW ? "jobs" : $"jobs/{JobId}";
}
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
types = await Jobs.GetJobTypes(); types = await Jobs.GetJobTypes();

View File

@@ -1,25 +1,27 @@
@using ECM.JobRunner.Common.JobRunnerReference; @using ECM.JobRunner.Common.JobRunnerReference;
<div class="progress"> <div class="progress" style="height: 30px;">
<div class="progress-bar" <div class="progress-bar"
role="progressbar" role="progressbar"
style="width: @getCompletedPercent(jobStatus)%" style="width: @getCompletedPercent(jobStatus)%"
aria-label="Job Status in %" aria-label="Job Status in %"
aria-valuenow="@getCompletedPercent(jobStatus)" aria-valuenow="@getCompletedPercent(jobStatus)"
aria-valuemin="0" aria-valuemin="0"
aria-valuemax="100" aria-valuemax="100"
></div> >@jobStatus.ProgressCurrent/@jobStatus.ProgressTotal</div>
</div> </div>
@code { @code {
[Parameter] [Parameter]
public StatusItem? jobStatus { get; set; } public StatusItem? jobStatus { get; set; }
protected float getCompletedPercent(StatusItem? entry) protected int getCompletedPercent(StatusItem? entry)
{ {
if (entry != null && entry.ProgressCurrent > 0 && entry.ProgressTotal > 0) if (entry != null && entry.ProgressCurrent > 0 && entry.ProgressTotal > 0)
{ {
return ((float)entry.ProgressCurrent / (float)entry.ProgressTotal) * 100; float fraction = (float)entry.ProgressCurrent / entry.ProgressTotal;
float percent = fraction * 100;
return (int)percent;
} }
else else
{ {

View File

@@ -35,9 +35,7 @@ namespace ECM.JobRunner.Web.Data
private async void PollingTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) private async void PollingTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{ {
OnDataUpdated(await GetData()); OnDataUpdated(await GetData());
} }
public async Task<DashboardResponse> GetData() public async Task<DashboardResponse> GetData()
{ {

View File

@@ -27,7 +27,6 @@ else
</svg> </svg>
<span>@entry.JobName</span> <span>@entry.JobName</span>
</div> </div>
@entry.Message
</div> </div>
<span class="badge bg-primary rounded-pill">@entry.CreatedAt.ToShortTimeString()</span> <span class="badge bg-primary rounded-pill">@entry.CreatedAt.ToShortTimeString()</span>
</li> </li>

View File

@@ -7,7 +7,7 @@
<h3>Jobs</h3> <h3>Jobs</h3>
@if (jobs == null) @if (filteredJobs == null)
{ {
<ul class="list-group"> <ul class="list-group">
<li class="list-group-item">Loading Jobs..</li> <li class="list-group-item">Loading Jobs..</li>
@@ -15,8 +15,22 @@
} }
else else
{ {
<section class="mb-3">
<input class="form-control" placeholder="Enter a filter query and press ENTER" type="text" @bind="FilterQuery" />
</section>
<div class="list-group"> <div class="list-group">
@foreach (var job in jobs) @if (filteredJobs.Count() == 0)
{
<a class="list-group-item d-flex justify-content-between align-items-start">
<div class="ms-2 me-auto">
No Jobs found.
</div>
</a>
}
@foreach (var job in filteredJobs)
{ {
<a class="list-group-item list-group-item-action d-flex justify-content-between align-items-start" href="/jobs/@job.Id"> <a class="list-group-item list-group-item-action d-flex justify-content-between align-items-start" href="/jobs/@job.Id">
<div class="ms-2 me-auto"> <div class="ms-2 me-auto">
@@ -44,7 +58,7 @@ else
@if (job.Active) @if (job.Active)
{ {
<span class="badge bg-primary rounded-pill">Running</span> <span class="badge bg-success rounded-pill">Running</span>
} }
else else
{ {
@@ -66,11 +80,36 @@ else
} }
@code { @code {
private List<JobDefinition>? jobs; private IEnumerable<JobDefinition>? jobs;
private IEnumerable<JobDefinition>? filteredJobs;
private string filterQuery = "";
private string FilterQuery {
get { return filterQuery; }
set {
filterQuery = value;
OnFilterChanged();
}
}
protected async override void OnInitialized() protected async override void OnInitialized()
{ {
jobs = await Jobs.GetJobs(); jobs = await Jobs.GetJobs();
filteredJobs = jobs;
StateHasChanged(); StateHasChanged();
} }
protected void OnFilterChanged()
{
if (jobs != null)
{
filteredJobs = jobs.Where(j => j.Name.Contains(FilterQuery, StringComparison.OrdinalIgnoreCase));
} else
{
filteredJobs = null;
}
}
} }

View File

@@ -20,9 +20,20 @@
} }
else else
{ {
<h3>@job.Name</h3> <h3>@job.Name</h3>
<ul class="list-group"> <ul class="list-group">
<li class="list-group-item d-flex justify-content-between align-items-start">
<div class="ms-2 me-auto">
<div class="fw-bold">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-square" viewBox="0 0 16 16">
<path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z" />
<path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z" />
</svg> Active
</div>
@job.Active
</div>
</li>
<li class="list-group-item d-flex justify-content-between align-items-start"> <li class="list-group-item d-flex justify-content-between align-items-start">
<div class="ms-2 me-auto"> <div class="ms-2 me-auto">
<div class="fw-bold"> <div class="fw-bold">
@@ -102,8 +113,10 @@ else
bool confirmed = await JsRuntime.InvokeAsync<bool>("confirm", "Are you sure?"); bool confirmed = await JsRuntime.InvokeAsync<bool>("confirm", "Are you sure?");
if (confirmed) if (confirmed)
{ {
await Jobs.DeleteJob(job); if (await Jobs.DeleteJob(job) == true)
Navigation.NavigateTo($"/jobs"); {
Navigation.NavigateTo($"/jobs");
};
} }
} }
} }

View File

@@ -22,7 +22,7 @@
if (result == true) if (result == true)
{ {
Navigation.NavigateTo($"/jobs"); Navigation.NavigateTo("/jobs");
} }
} }
} }

View File

@@ -2,7 +2,7 @@
@using ECM.JobRunner.Common.JobRunnerReference; @using ECM.JobRunner.Common.JobRunnerReference;
@using ECM.JobRunner.Web.Components.Status; @using ECM.JobRunner.Web.Components.Status;
@using ECM.JobRunner.Web.Data; @using ECM.JobRunner.Web.Data;
@inject DashboardService Api @inject DashboardService Dashboard;
<PageTitle>Status</PageTitle> <PageTitle>Status</PageTitle>
@@ -31,17 +31,16 @@
<ul class="list-group"> <ul class="list-group">
@foreach (var entry in executingEntries) @foreach (var entry in executingEntries)
{ {
<li class="list-group-item"> <li class="list-group-item" @key="entry.Id">
<div class="d-flex justify-content-between align-items-start mb-3"> <div class="d-flex justify-content-between align-items-start mb-3">
<div class="ms-2 me-auto w-100"> <div class="ms-2 me-auto w-100">
<div class="fw-bold"> <div class="fw-bold">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-check-circle text-success" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-gear text-primary" viewBox="0 0 16 16">
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" /> <path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492zM5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0z" />
<path d="M10.97 4.97a.235.235 0 0 0-.02.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-1.071-1.05z" /> <path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52l-.094-.319zm-2.633.283c.246-.835 1.428-.835 1.674 0l.094.319a1.873 1.873 0 0 0 2.693 1.115l.291-.16c.764-.415 1.6.42 1.184 1.185l-.159.292a1.873 1.873 0 0 0 1.116 2.692l.318.094c.835.246.835 1.428 0 1.674l-.319.094a1.873 1.873 0 0 0-1.115 2.693l.16.291c.415.764-.42 1.6-1.185 1.184l-.291-.159a1.873 1.873 0 0 0-2.693 1.116l-.094.318c-.246.835-1.428.835-1.674 0l-.094-.319a1.873 1.873 0 0 0-2.692-1.115l-.292.16c-.764.415-1.6-.42-1.184-1.185l.159-.291A1.873 1.873 0 0 0 1.945 8.93l-.319-.094c-.835-.246-.835-1.428 0-1.674l.319-.094A1.873 1.873 0 0 0 3.06 4.377l-.16-.292c-.415-.764.42-1.6 1.185-1.184l.292.159a1.873 1.873 0 0 0 2.692-1.115l.094-.319z" />
</svg> </svg>
<span>@entry.Name</span> <span>@entry.Name</span>
</div> </div>
</div> </div>
<span class="badge bg-primary rounded-pill">Started @entry.StartTime.ToLongTimeString()</span> <span class="badge bg-primary rounded-pill">Started @entry.StartTime.ToLongTimeString()</span>
</div> </div>
@@ -91,7 +90,7 @@ else
<li>Completed: @entry.CompleteTime.ToLongTimeString()</li> <li>Completed: @entry.CompleteTime.ToLongTimeString()</li>
</ul> </ul>
</div> </div>
<span class="badge bg-primary rounded-pill">Completed @entry.CompleteTime.ToLongTimeString()</span> <span class="badge bg-success rounded-pill">Completed @entry.CompleteTime.ToLongTimeString()</span>
</li> </li>
} }
</ul> </ul>
@@ -105,13 +104,13 @@ else
protected async override void OnInitialized() protected async override void OnInitialized()
{ {
DashboardResponse data = await Api.GetData(); DashboardResponse data = await Dashboard.GetData();
UpdateData(data); UpdateData(data);
Api.DataUpdated += Api_DataUpdated; Dashboard.DataUpdated += Dashboard_DataUpdated;
} }
protected void Api_DataUpdated(object sender, DashboardResponse e) protected void Dashboard_DataUpdated(object sender, DashboardResponse e)
{ {
UpdateData(e); UpdateData(e);
} }

View File

@@ -8,4 +8,13 @@ Public Class Config
Public Property Host As String = "localhost" Public Property Host As String = "localhost"
Public Property Port As Integer = 9000 Public Property Port As Integer = 9000
Public Property Name As String = "JobRunner" Public Property Name As String = "JobRunner"
Public Property Windream As New WindreamConfig
Public Class WindreamConfig
Public Server As String = "localhost"
Public Username As String = "DD_ECM"
Public Password As String = "DD_ECM"
Public Domain As String = "dd-gan"
Public DriveLetter As String = "W"
End Class
End Class End Class

View File

@@ -8,4 +8,9 @@
Public Const JOB_CONFIG_DATABASE = "__Database" Public Const JOB_CONFIG_DATABASE = "__Database"
Public Const JOB_CONFIG_STATE = "__State" Public Const JOB_CONFIG_STATE = "__State"
End Class End Class
Public Class Jobs
Public Const JOB_TYPE_IMPORT = 1
Public Const JOB_TYPE_INDEX = 2
End Class
End Class End Class

View File

@@ -67,6 +67,9 @@
<Reference Include="DigitalData.Modules.Messaging"> <Reference Include="DigitalData.Modules.Messaging">
<HintPath>..\..\DDModules\Messaging\bin\Debug\DigitalData.Modules.Messaging.dll</HintPath> <HintPath>..\..\DDModules\Messaging\bin\Debug\DigitalData.Modules.Messaging.dll</HintPath>
</Reference> </Reference>
<Reference Include="DigitalData.Modules.Windream">
<HintPath>..\..\DDModules\Windream\bin\Debug\DigitalData.Modules.Windream.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> <Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath> <HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference> </Reference>

View File

@@ -97,6 +97,7 @@ Namespace Scheduler
.Name = pJob.Name, .Name = pJob.Name,
.Enabled = pJob.Active, .Enabled = pJob.Active,
.Arguments = New Dictionary(Of String, String) From { .Arguments = New Dictionary(Of String, String) From {
{"Id", pJob.Id},
{"Name", pJob.Name} {"Name", pJob.Name}
}, },
.CronSchedule = pJob.CronSchedule .CronSchedule = pJob.CronSchedule

View File

@@ -10,17 +10,24 @@ Namespace Scheduler.Jobs
Friend Database As MSSQLServer Friend Database As MSSQLServer
Friend State As State Friend State As State
Friend Id As Integer
Friend Name As String
Private ctx As IJobExecutionContext Private ctx As IJobExecutionContext
Public Function InitializeJob(context As IJobExecutionContext) As Dictionary(Of String, String) Public Function InitializeJob(context As IJobExecutionContext) As Dictionary(Of String, String)
ctx = context ctx = context
Dim oJobData = context.MergedJobDataMap Dim oJobData = context.MergedJobDataMap
Dim oArgs As Dictionary(Of String, String) = oJobData.Item(Constants.Scheduler.JOB_CONFIG_ARGUMENTS)
LogConfig = oJobData.Item(Constants.Scheduler.JOB_CONFIG_LOGCONFIG) LogConfig = oJobData.Item(Constants.Scheduler.JOB_CONFIG_LOGCONFIG)
Database = oJobData.Item(Constants.Scheduler.JOB_CONFIG_DATABASE) Database = oJobData.Item(Constants.Scheduler.JOB_CONFIG_DATABASE)
State = oJobData.Item(Constants.Scheduler.JOB_CONFIG_STATE) State = oJobData.Item(Constants.Scheduler.JOB_CONFIG_STATE)
Logger = LogConfig.GetLogger() Logger = LogConfig.GetLogger()
Id = Integer.Parse(oArgs.Item("Id"))
Name = oArgs.Item("Name")
State.JobStatus.Start(ctx) State.JobStatus.Start(ctx)
Return oJobData.Item(Constants.Scheduler.JOB_CONFIG_ARGUMENTS) Return oJobData.Item(Constants.Scheduler.JOB_CONFIG_ARGUMENTS)
End Function End Function

View File

@@ -8,10 +8,9 @@ Namespace Scheduler.Jobs
Private Function IJob_Execute(context As IJobExecutionContext) As Task Implements IJob.Execute Private Function IJob_Execute(context As IJobExecutionContext) As Task Implements IJob.Execute
Dim oArgs = MyBase.InitializeJob(context) Dim oArgs = MyBase.InitializeJob(context)
Dim oArg1 = oArgs.Item("Arg1")
Logger.Info("I'm a debug Job!") Logger.Info("I'm a debug Job!")
Logger.Info("Arg1: [{0}]", oArg1) Logger.Info("Name: [{0}]", Name)
Dim oResult = New JobResult() With { Dim oResult = New JobResult() With {
.Description = $"I'm a debug job and my result was [{Guid.NewGuid}]." .Description = $"I'm a debug job and my result was [{Guid.NewGuid}]."

View File

@@ -2,31 +2,107 @@
Imports Quartz Imports Quartz
Namespace Scheduler.Jobs Namespace Scheduler.Jobs
''' <summary>
'''
''' Parameters / Properties
''' =======================
'''
''' - SourceDirectory
''' - TargetDirectory
''' - Include Subdirectories
''' - Delete Subdirectories
''' - Backup
''' - BackupFolder
''' - Overwrite
''' - Windream DocType
''' - Delete Files
''' - Delete Directory
''' - Delay
'''
''' Rules
''' ======
'''
''' - TargetIndex
''' - Active
''' - Index From
''' - Static
''' - Static Value
''' - File
''' - Folder
''' - Index Type
''' - Separator
''' - Current Date
''' - Current Short Date
''' - KOMPLETT
''' - BEREICH
''' - REST
''' - TRENNZEICHEN
''' - Separator
''' - Remove Zeroes
''' - Include Extension
''' - OrderKey
'''
''' </summary>
Public Class FileImportJob Public Class FileImportJob
Inherits BaseJob Inherits BaseJob
Implements IJob Implements IJob
Public Function Execute(context As IJobExecutionContext) As Task Implements IJob.Execute Public Function Execute(context As IJobExecutionContext) As Task Implements IJob.Execute
Dim oArgs = MyBase.InitializeJob(context) Dim oArgs = MyBase.InitializeJob(context)
Dim oName = oArgs.Item("Name")
Logger.Info("Running File Import [{0}]", oName) Try
Logger.Info("Running File Import [{0}]", Name)
Dim oMax = 100 Dim oProfile = State.ProfileDefintions.ImportProfiles.Where(Function(p) p.JobId = Id).SingleOrDefault()
For index = 1 To oMax
UpdateProgress(index, oMax)
Threading.Thread.Sleep(100)
Next
Dim oResult = New JobResult() With { Dim oSourceDirectory As String = oProfile.SourceFolder
.Description = $"File Import Job [{oName}] completed!" Dim oRecursive As Boolean = oProfile.IncludeSubfolders
} Dim oFiles = GetFiles(oSourceDirectory, oRecursive)
context.Result = oResult If oFiles.Count = 0 Then
Logger.Info("No Files for Profile [{0}]", Name)
Return Task.FromResult(True)
End If
CompleteJob() 'Dim oMax = 100
Return Task.FromResult(True) 'For index = 1 To oMax
' UpdateProgress(index, oMax)
' Threading.Thread.Sleep(100)
'Next
Dim oResult = New JobResult() With {
.Description = $"File Import Job [{Name}] completed!"
}
context.Result = oResult
Return Task.FromResult(True)
Catch ex As Exception
Logger.Error(ex)
Return Task.FromResult(False)
Finally
CompleteJob()
End Try
End Function
Private Function GetFiles(pDirectory As String, pRecursive As Boolean) As String()
Dim oFiles As String()
If pRecursive Then
oFiles = IO.Directory.GetFiles(pDirectory, "*.*", IO.SearchOption.AllDirectories)
Logger.Info("Found [{0}] files in Folder [{1}] (and subdirectories)", oFiles.Count, pDirectory)
Else
oFiles = IO.Directory.GetFiles(pDirectory, "*.*", IO.SearchOption.TopDirectoryOnly)
Logger.Info("Found [{0}] files in Folder [{1}]", oFiles.Count, pDirectory)
End If
Return oFiles
End Function End Function
End Class End Class

View File

@@ -8,12 +8,11 @@ Namespace Scheduler.Jobs
Public Function Execute(context As IJobExecutionContext) As Task Implements IJob.Execute Public Function Execute(context As IJobExecutionContext) As Task Implements IJob.Execute
Dim oArgs = MyBase.InitializeJob(context) Dim oArgs = MyBase.InitializeJob(context)
Dim oName = oArgs.Item("Name")
Logger.Info("Running File Index [{0}]", oName) Logger.Info("Running File Index [{0}]", Name)
Dim oResult = New JobResult() With { Dim oResult = New JobResult() With {
.Description = $"File Index Job [{oName}] completed!" .Description = $"File Index Job [{Name}] completed!"
} }
context.Result = oResult context.Result = oResult

View File

@@ -2,6 +2,7 @@
Imports DigitalData.Modules.Config Imports DigitalData.Modules.Config
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Messaging.WCF Imports DigitalData.Modules.Messaging.WCF
Imports DigitalData.Modules.Windream
Public Class Service Public Class Service
@@ -16,6 +17,7 @@ Public Class Service
Private Scheduler As Scheduler.JobScheduler Private Scheduler As Scheduler.JobScheduler
Private Database As MSSQLServer Private Database As MSSQLServer
Private State As State Private State As State
Private Windream As Windream
Protected Overrides Async Sub OnStart(ByVal args() As String) Protected Overrides Async Sub OnStart(ByVal args() As String)
' Code zum Starten des Dienstes hier einfügen. Diese Methode sollte Vorgänge ' Code zum Starten des Dienstes hier einfügen. Diese Methode sollte Vorgänge
@@ -37,8 +39,13 @@ Public Class Service
' set logging debug flag from config ' set logging debug flag from config
LogConfig.Debug = Config.Debug LogConfig.Debug = Config.Debug
' Initialize Windream
Dim oWindream = Config.Windream
Windream = New Windream(LogConfig, True, oWindream.DriveLetter, "/", True,
oWindream.Server, oWindream.Username, oWindream.Password, oWindream.Domain)
' initialize global state ' initialize global state
State = New State(LogConfig, Database) State = New State(LogConfig, Database, Windream)
' start the scheduler ' start the scheduler
Scheduler = New Scheduler.JobScheduler(LogConfig, Database, State) Scheduler = New Scheduler.JobScheduler(LogConfig, Database, State)

View File

@@ -4,34 +4,86 @@ Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Language Imports DigitalData.Modules.Language
Imports ECM.JobRunner.Common Imports ECM.JobRunner.Common
Imports ECM.JobRunner.Windows.Scheduler Imports ECM.JobRunner.Windows.Scheduler
Imports System.Runtime.InteropServices Imports DigitalData.Modules.Windream
Public Class State Public Class State
Inherits BaseClass Inherits BaseClass
Private ReadOnly Database As MSSQLServer Private ReadOnly Database As MSSQLServer
Private ReadOnly Windream As Windream
Public ReadOnly JobHistory As JobHistory Public ReadOnly JobHistory As JobHistory
Public ReadOnly JobStatus As JobStatus Public ReadOnly JobStatus As JobStatus
Public ReadOnly Property JobTypes As New List(Of JobType) Public ReadOnly Property JobTypes As New List(Of JobType)
Public ReadOnly Property ObjectTypes As New List(Of ObjectType)
Public ReadOnly Property JobDefinitions As New List(Of JobDefinition) Public ReadOnly Property JobDefinitions As New List(Of JobDefinition)
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer) Public ReadOnly Property ProfileDefintions As New ProfileDefinitions
Public Class ProfileDefinitions
Public Property ImportProfiles As New List(Of ImportProfile)
End Class
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer, pWindream As Windream)
MyBase.New(pLogConfig) MyBase.New(pLogConfig)
Database = pDatabase Database = pDatabase
Windream = pWindream
JobHistory = New JobHistory(pLogConfig) JobHistory = New JobHistory(pLogConfig)
JobStatus = New JobStatus(pLogConfig) JobStatus = New JobStatus(pLogConfig)
_JobTypes = GetJobTypes() LoadData()
_JobDefinitions = GetJobDefinitions(_JobTypes)
End Sub End Sub
Public Sub Reload() Public Sub Reload()
_JobTypes = GetJobTypes() LoadData()
_JobDefinitions = GetJobDefinitions(_JobTypes)
End Sub End Sub
Private Sub LoadData()
_JobTypes = GetJobTypes()
_ObjectTypes = GetObjectTypes()
_JobDefinitions = GetJobDefinitions(_JobTypes)
_ProfileDefintions.ImportProfiles = GetImportProfiles()
End Sub
Private Function GetObjectTypes() As List(Of ObjectType)
Dim oObjectTypes As New List(Of ObjectType)
Try
Logger.Info("Loading Windream Object Types..")
Dim oObjectTypesNames = Windream.ObjectTypes
Logger.Info("[{0}] Windream Object Types loaded!", oObjectTypes.Count)
For Each oObjectTypeName In oObjectTypesNames
Dim oObjectType = New ObjectType With {
.Name = oObjectTypeName,
.Indexes = GetIndexesFor(oObjectTypeName)
}
oObjectTypes.Add(oObjectType)
Next
Return oObjectTypes
Catch ex As Exception
Logger.Error(ex)
Return oObjectTypes
End Try
End Function
Private Function GetIndexesFor(pObjectType As String) As List(Of String)
Dim oIndexes As New List(Of String)
Try
Logger.Info("Loading Windream Indexes for [{0}]..", pObjectType)
oIndexes = Windream.GetIndiciesByObjecttype(pObjectType)
Logger.Info("[{0}] Windream Indexes loaded!", oIndexes.Count)
Return oIndexes
Catch ex As Exception
Logger.Error(ex)
Return oIndexes
End Try
End Function
Private Function GetJobTypes() As List(Of JobType) Private Function GetJobTypes() As List(Of JobType)
Dim oTypes As New List(Of JobType) Dim oTypes As New List(Of JobType)
Try Try
@@ -67,6 +119,44 @@ Public Class State
End Try End Try
End Function End Function
Private Function GetImportProfiles() As List(Of ImportProfile)
Dim oProfiles As New List(Of ImportProfile)
Try
Logger.Info("Loading Profiles..")
Dim oSQL As String = "SELECT * FROM TBECM_JR_FIW_PROFILE"
Dim oTable As DataTable = Database.GetDatatable(oSQL)
If oTable Is Nothing Then
Logger.Warn("Database Error while loading Profiles!")
Return oProfiles
End If
Logger.Info("[{0}] Profiles loaded!", oTable.Rows.Count)
For Each oRow As DataRow In oTable.Rows
Dim oTypeId = oRow.ItemEx("JOB_TYPE_ID", 0)
Dim oProfile As New ImportProfile With {
.Id = oRow.ItemEx("GUID", 0),
.JobId = oRow.ItemEx("JR_JOB_ID", 0),
.SourceFolder = oRow.ItemEx("SOURCE_FOLDER", "")
}
oProfiles.Add(oProfile)
Logger.Debug("Adding Profile for Folder [{0}]", oProfile.SourceFolder)
Next
Return oProfiles
Catch ex As Exception
Logger.Error(ex)
Return oProfiles
End Try
End Function
Private Function GetJobDefinitions(pJobTypes As List(Of JobType)) As List(Of JobDefinition) Private Function GetJobDefinitions(pJobTypes As List(Of JobType)) As List(Of JobDefinition)
Dim oJobs As New List(Of JobDefinition) Dim oJobs As New List(Of JobDefinition)
@@ -92,7 +182,8 @@ Public Class State
.Name = oRow.ItemEx("TITLE", ""), .Name = oRow.ItemEx("TITLE", ""),
.Active = oRow.ItemEx("ACTIVE", 0), .Active = oRow.ItemEx("ACTIVE", 0),
.CronSchedule = oRow.ItemEx("QUARTZ_DEF", "") .CronSchedule = oRow.ItemEx("QUARTZ_DEF", "")
} }
oJobs.Add(oJob) oJobs.Add(oJob)
Logger.Debug("Adding Job [{0}]", oJob.Name) Logger.Debug("Adding Job [{0}]", oJob.Name)

View File

@@ -15,7 +15,11 @@ Public Class GetJobConfig
Public Function Run() As GetJobConfigResponse Public Function Run() As GetJobConfigResponse
Return New GetJobConfigResponse With { Return New GetJobConfigResponse With {
.JobTypes = State.JobTypes, .JobTypes = State.JobTypes,
.JobDefinitions = State.JobDefinitions .JobDefinitions = State.JobDefinitions,
.ProfileDefinitions = New GetJobConfigResponse.ProfileDefinitionConfig With {
.ImportProfiles = State.ProfileDefintions.ImportProfiles
},
.WindreamObjectTypes = State.ObjectTypes
} }
End Function End Function
End Class End Class
@@ -26,8 +30,18 @@ Public Class GetJobConfig
<DataMember> <DataMember>
Public Property JobTypes As List(Of JobType) Public Property JobTypes As List(Of JobType)
<DataMember>
Public Property WindreamObjectTypes As List(Of ObjectType)
<DataMember> <DataMember>
Public Property JobDefinitions As List(Of JobDefinition) Public Property JobDefinitions As List(Of JobDefinition)
<DataMember>
Public Property ProfileDefinitions As New ProfileDefinitionConfig
Public Class ProfileDefinitionConfig
Public Property ImportProfiles As List(Of ImportProfile)
End Class
End Class End Class
End Class End Class