Skip to content

Commit

Permalink
Add Email Alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
DotJoshJohnson committed Nov 25, 2020
1 parent 9e611be commit c2705be
Show file tree
Hide file tree
Showing 31 changed files with 370 additions and 848 deletions.
14 changes: 14 additions & 0 deletions CloudFtpBridge.sln
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
README.md = README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudFtpBridge.Infrastructure.Smtp", "src\CloudFtpBridge.Infrastructure.Smtp\CloudFtpBridge.Infrastructure.Smtp.csproj", "{AB3C17C0-1FB9-4EB1-9B61-ED55646E4B4B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudFtpBridge.Infrastructure.Json", "src\CloudFtpBridge.Infrastructure.Json\CloudFtpBridge.Infrastructure.Json.csproj", "{A6D99988-DB0B-4DCC-9A81-08A802526FFC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -51,6 +55,14 @@ Global
{9BA84E2D-1E91-4F85-854B-90DF0BC5461E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9BA84E2D-1E91-4F85-854B-90DF0BC5461E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9BA84E2D-1E91-4F85-854B-90DF0BC5461E}.Release|Any CPU.Build.0 = Release|Any CPU
{AB3C17C0-1FB9-4EB1-9B61-ED55646E4B4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AB3C17C0-1FB9-4EB1-9B61-ED55646E4B4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AB3C17C0-1FB9-4EB1-9B61-ED55646E4B4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AB3C17C0-1FB9-4EB1-9B61-ED55646E4B4B}.Release|Any CPU.Build.0 = Release|Any CPU
{A6D99988-DB0B-4DCC-9A81-08A802526FFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A6D99988-DB0B-4DCC-9A81-08A802526FFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A6D99988-DB0B-4DCC-9A81-08A802526FFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A6D99988-DB0B-4DCC-9A81-08A802526FFC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -62,6 +74,8 @@ Global
{703E6A19-7B7E-4832-8327-30644AD87099} = {C27977BE-7208-4B2A-8DC9-47EE43386957}
{D22FD528-FE43-4698-9AE0-ADB6771F1167} = {C27977BE-7208-4B2A-8DC9-47EE43386957}
{9BA84E2D-1E91-4F85-854B-90DF0BC5461E} = {CA2FA16E-EF5A-42C1-90F4-0A9351CE1A22}
{AB3C17C0-1FB9-4EB1-9B61-ED55646E4B4B} = {C27977BE-7208-4B2A-8DC9-47EE43386957}
{A6D99988-DB0B-4DCC-9A81-08A802526FFC} = {C27977BE-7208-4B2A-8DC9-47EE43386957}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B3E20D95-3A68-4E34-ADCB-83BD3A715038}
Expand Down
2 changes: 2 additions & 0 deletions src/CloudFtpBridge.BlazorApp/CloudFtpBridge.BlazorApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
<ItemGroup>
<ProjectReference Include="..\CloudFtpBridge.Core\CloudFtpBridge.Core.csproj" />
<ProjectReference Include="..\CloudFtpBridge.Infrastructure.FluentFTP\CloudFtpBridge.Infrastructure.FluentFTP.csproj" />
<ProjectReference Include="..\CloudFtpBridge.Infrastructure.Json\CloudFtpBridge.Infrastructure.Json.csproj" />
<ProjectReference Include="..\CloudFtpBridge.Infrastructure.LiteDB\CloudFtpBridge.Infrastructure.LiteDB.csproj" />
<ProjectReference Include="..\CloudFtpBridge.Infrastructure.LocalFileSystem\CloudFtpBridge.Infrastructure.LocalFileSystem.csproj" />
<ProjectReference Include="..\CloudFtpBridge.Infrastructure.Smtp\CloudFtpBridge.Infrastructure.Smtp.csproj" />
</ItemGroup>

</Project>
14 changes: 11 additions & 3 deletions src/CloudFtpBridge.BlazorApp/Pages/Index.razor
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
@page "/"

<h1>Hello, world!</h1>
@inject NavigationManager NavigationManager

Welcome to your new app.
<br />

@code
{

protected override void OnAfterRender(bool firstRender)
{
NavigationManager.NavigateTo("workflows");
}
}

<SurveyPrompt Title="How is Blazor working for you?" />
119 changes: 119 additions & 0 deletions src/CloudFtpBridge.BlazorApp/Pages/Mail/MailSettingsPage.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
@page "/email-alert-settings"

@inject IMailSettingsProvider MailSettingsProvider
@inject IMailSender MailSender
@inject IJSRuntime JSRuntime

<div class="container">

@if (!MailSettings.Enabled)
{
<div class="alert alert-warning text-center mb-4" role="alert">
<span>Mail alerts are currently disabled.</span>
</div>
}

<div class="row">
<div class="col">
<p class="text-center">Provide your SMTP server information below to allow Cloud FTP Bridge to send email alerts if a failure occurs during a file transfer.</p>
</div>
</div>
<div class="row">
<div class="col-10">
<div class="form-group">
<label>SMTP Host</label>
<input @bind="MailSettings.Host" class="form-control" type="text" />
</div>
</div>
<div class="col-2">
<div class="form-group">
<label>SMTP Port</label>
<input @bind="MailSettings.Port" class="form-control" type="number" />
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="form-group">
<label>SMTP Username</label>
<input @bind="MailSettings.Username" class="form-control" type="text" />
</div>
</div>
<div class="col">
<div class="form-group">
<label>SMTP Password</label>
<input @bind="MailSettings.Password" class="form-control" type="password" />
</div>
</div>
</div>
<div class="row mb-2">
<div class="col">
<div class="form-group">
<label>From Address</label>
<input @bind="MailSettings.FromAddress" class="form-control" type="text" />
</div>
</div>
<div class="col">
<div class="form-group">
<label>To Addresses</label>
<input @bind="ToAddressList" class="form-control" type="text" />
<small class="form-text text-muted">Separate multiple addresses with a comma (,).</small>
</div>
</div>
</div>
<div class="row">
<div class="col">
<button @onclick="OnClickSave" class="btn btn-success mr-2" style="min-width:100px;">Save</button>
<button @onclick="() => { }" class="btn btn-outline-secondary" style="min-width:100px;">Test</button>
</div>
<div class="col d-flex justify-content-end">
<EditForm Model="new { }">
<div class="custom-control custom-checkbox">
<InputCheckbox @bind-Value="MailSettings.Enabled" class="custom-control-input" id="MailSettings_Enabled" />
<label class="custom-control-label" for="MailSettings_Enabled">Enabled</label>
</div>
</EditForm>
</div>
</div>
</div>

@code
{
protected MailSettings MailSettings { get; set; } = new MailSettings();

protected string ToAddressList
{
get
{
return string.Join(", ", MailSettings.ToAddresses);
}

set
{
MailSettings.ToAddresses = value
.Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries)
.Select(a => a.Trim())
.ToList();
}
}

public async Task Refresh()
{
MailSettings = await MailSettingsProvider.Get();
}

protected async Task OnClickSave()
{
await MailSettingsProvider.Save(MailSettings);
}

protected async Task OnClickTest()
{
await MailSender.Send("Cloud FTP Bridge: Test Email", "<strong>This is a test email from the Cloud FTP Bridge application.</strong>");
}

protected override async Task OnParametersSetAsync()
{
await Refresh();
}
}
11 changes: 4 additions & 7 deletions src/CloudFtpBridge.BlazorApp/Program.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;

using CloudFtpBridge.Core.Utils;

using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

using Serilog;
using Serilog.Extensions.Logging;

using CloudFtpBridge.Core.Utils;

namespace CloudFtpBridge.BlazorApp
{
public class Program
Expand Down Expand Up @@ -51,7 +46,9 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
{
services.AddCloudFtpBridge(app =>
{
app.UseJsonMailSettingsProvider();
app.UseLiteDBStorage();
app.UseSmtpMailSender();

app.UseFluentFTPFileSystem();
app.UseLocalFileSystem();
Expand Down
32 changes: 22 additions & 10 deletions src/CloudFtpBridge.BlazorApp/Shared/MainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@

<div class="d-flex flex-column h-100">

<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand">Cloud FTP Bridge</a>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark flex-column">
<div>
<h3 class="text-light">Cloud FTP Bridge</h3>
</div>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav justify-content-end">
<NavLink class="nav-link" href="audit-log">Audit Log</NavLink>
<NavLink class="nav-link" href="workflows">Workflows</NavLink>
<div class="collapse navbar-collapse justify-content-center" id="navbarNavAltMarkup">
<div class="navbar-nav">
<NavLink class="nav-link px-3" href="workflows">Workflows</NavLink>
<NavLink class="nav-link px-3" href="email-alert-settings">Email Alerts</NavLink>
<NavLink class="nav-link px-3" href="audit-log">Audit Log</NavLink>
</div>
</div>
</nav>
Expand All @@ -20,16 +23,25 @@
</main>

<footer class="bg-light">
<div class="text-center text-muted" style="font-size:0.75rem;">
<span>v2.0.0</span>
<div class="text-center text-muted mb-2" style="font-size:0.75rem;">
<span>
<a class="btn btn-sm btn-link" href="https://github.com/TrueCommerce/CloudFtpBridge/releases/v3.0.0" target="_blank">v3.0.0</a>
</span>
<span>&nbsp; | &nbsp;</span>
<span>
<a class="btn btn-sm btn-link" href="" target="_blank">Documentation</a>
<a class="btn btn-sm btn-link" href="https://github.com/TrueCommerce/CloudFtpBridge/wiki" target="_blank">Documentation</a>
</span>
<span>&nbsp; | &nbsp;</span>
<span>
<a class="btn btn-sm btn-link" href="" target="_blank">Source</a>
<a class="btn btn-sm btn-link" href="https://github.com/TrueCommerce/CloudFtpBridge" target="_blank">Source</a>
</span>
<span>&nbsp; | &nbsp;</span>
<span>
<a class="btn btn-sm btn-link" href="https://github.com/TrueCommerce/CloudFtpBridge/blob/master/LICENSE" target="_blank">License</a>
</span>
</div>
<div class="text-center text-muted" style="font-size:0.75rem;">
<span>Copyright @DateTime.Now.Year - TrueCommerce, Inc.</span>
</div>
</footer>

Expand Down
3 changes: 0 additions & 3 deletions src/CloudFtpBridge.BlazorApp/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
using System.Linq;
using System.Threading.Tasks;

using CloudFtpBridge.BlazorApp.Data;

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Hosting;
Expand All @@ -30,7 +28,6 @@ public void ConfigureServices(IServiceCollection services)
{
services.AddRazorPages();
services.AddServerSideBlazor();
services.AddSingleton<WeatherForecastService>();
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
Expand Down

This file was deleted.

This file was deleted.

86 changes: 0 additions & 86 deletions src/CloudFtpBridge.BlazorApp/wwwroot/css/open-iconic/FONT-LICENSE

This file was deleted.

21 changes: 0 additions & 21 deletions src/CloudFtpBridge.BlazorApp/wwwroot/css/open-iconic/ICON-LICENSE

This file was deleted.

Loading

0 comments on commit c2705be

Please sign in to comment.