Skip to content

Commit

Permalink
Merge pull request #45 from swagfin/feature/optimizations
Browse files Browse the repository at this point in the history
Feature/optimizations
  • Loading branch information
swagfin authored Jul 13, 2024
2 parents 6fc3334 + 007a12f commit 85d3655
Show file tree
Hide file tree
Showing 18 changed files with 354 additions and 479 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ public class BackupRecordRepositoryLiteDb : IBackupRecordRepository

public BackupRecordRepositoryLiteDb(IEnumerable<IRecordStatusChangedNotifier> backupRecordStatusChangedNotifiers, IContentDeliveryRecordRepository contentDeliveryRecordPersistanceService, IDatabaseInfoRepository databaseInfoRepository)
{
#if DEBUG
this._db = new LiteDatabaseAsync(new ConnectionString(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data", "backup-records.dev.db")) { Password = "12345678", Connection = ConnectionType.Shared });
#else
this._db = new LiteDatabaseAsync(new ConnectionString(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data", "backup-records.db")) { Password = "12345678", Connection = ConnectionType.Shared });
#endif
this._db = new LiteDatabaseAsync(new ConnectionString(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data", "backup-records.db")) { Connection = ConnectionType.Shared });
//Init
this._db.PragmaAsync("UTC_DATE", true).GetAwaiter().GetResult();
//Proceed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ public class BackupScheduleRepositoryLiteDb : IBackupScheduleRepository

public BackupScheduleRepositoryLiteDb(IDatabaseInfoRepository databaseInfoRepository)
{
#if DEBUG
this._db = new LiteDatabaseAsync(new ConnectionString(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data", "backup-schedules.dev.db")) { Password = "12345678", Connection = ConnectionType.Shared });
#else
this._db = new LiteDatabaseAsync(new ConnectionString(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data", "backup-schedules.db")) { Password = "12345678", Connection = ConnectionType.Shared });
#endif
this._db = new LiteDatabaseAsync(new ConnectionString(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data", "backup-schedules.db")) { Connection = ConnectionType.Shared });
//Init
this._db.PragmaAsync("UTC_DATE", true).GetAwaiter().GetResult();
this._databaseInfoRepository = databaseInfoRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ public class ContentDeliveryRecordRepositoryLiteDb : IContentDeliveryRecordRepos

public ContentDeliveryRecordRepositoryLiteDb(IEnumerable<IRecordStatusChangedNotifier> backupRecordStatusChangedNotifiers)
{
#if DEBUG
this._db = new LiteDatabaseAsync(new ConnectionString(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data", "backup-record-deliveries.dev.db")) { Password = "12345678", Connection = ConnectionType.Shared });
#else
this._db = new LiteDatabaseAsync(new ConnectionString(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data", "backup-record-deliveries.db")) { Password = "12345678", Connection = ConnectionType.Shared });
#endif
this._db = new LiteDatabaseAsync(new ConnectionString(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data", "backup-record-deliveries.db")) { Connection = ConnectionType.Shared });
//Init
this._db.PragmaAsync("UTC_DATE", true).GetAwaiter().GetResult();
//Proceed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ public class DatabaseInfoRepositoryLiteDb : IDatabaseInfoRepository

public DatabaseInfoRepositoryLiteDb()
{
#if DEBUG
this._db = new LiteDatabaseAsync(new ConnectionString(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data", "database-infos.dev.db")) { Password = "12345678", Connection = ConnectionType.Shared });
#else
this._db = new LiteDatabaseAsync(new ConnectionString(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data", "database-infos.db")) { Password = "12345678", Connection = ConnectionType.Shared });
#endif
this._db = new LiteDatabaseAsync(new ConnectionString(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data", "database-infos.db")) { Connection = ConnectionType.Shared });
//Init
this._db.PragmaAsync("UTC_DATE", true).GetAwaiter().GetResult();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ public class ResourceGroupRepositoryLiteDb : IResourceGroupRepository

public ResourceGroupRepositoryLiteDb(IBackupRecordRepository backupRecordPersistanceService, IBackupScheduleRepository backupSchedulePersistanceService, IDatabaseInfoRepository databaseInfoPersistanceService)
{
#if DEBUG
this._db = new LiteDatabaseAsync(new ConnectionString(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data", "resource-groups.dev.db")) { Password = "12345678", Connection = ConnectionType.Shared });
#else
this._db = new LiteDatabaseAsync(new ConnectionString(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data", "resource-groups.db")) { Password = "12345678", Connection = ConnectionType.Shared });
#endif
this._db = new LiteDatabaseAsync(new ConnectionString(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data", "resource-groups.db")) { Connection = ConnectionType.Shared });
//Init
this._db.PragmaAsync("UTC_DATE", true).GetAwaiter().GetResult();
//Proceed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ public class UserAccountRepositoryLiteDb : IUserAccountRepository

public UserAccountRepositoryLiteDb()
{
#if DEBUG
this._db = new LiteDatabaseAsync(new ConnectionString(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data", "user-accounts.dev.db")) { Password = "12345678", Connection = ConnectionType.Shared });
#else
this._db = new LiteDatabaseAsync(new ConnectionString(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data", "user-accounts.db")) { Password = "12345678", Connection = ConnectionType.Shared });
#endif
this._db = new LiteDatabaseAsync(new ConnectionString(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data", "user-accounts.db")) { Connection = ConnectionType.Shared });
//Init
this._db.PragmaAsync("UTC_DATE", true).GetAwaiter().GetResult();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
<ProjectReference Include="..\SemanticBackup.Core\SemanticBackup.Core.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Azure.Storage.Blobs" Version="12.19.1" />
<PackageReference Include="Dropbox.Api" Version="6.37.0" />
<PackageReference Include="LiteDB.Async" Version="0.1.7" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.20.0" />
<PackageReference Include="Dropbox.Api" Version="7.0.0" />
<PackageReference Include="LiteDB.Async" Version="0.1.8" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageReference Include="MySqlBackup.NET" Version="2.3.8" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="SharpZipLib" Version="1.4.2" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
<PackageReference Include="System.Drawing.Common" Version="8.0.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
<PackageReference Include="System.Drawing.Common" Version="8.0.7" />
</ItemGroup>
<ItemGroup>
<None Update="Data\README.txt">
Expand Down
4 changes: 2 additions & 2 deletions SemanticBackup/Pages/Dashboard/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@
</div><!-- row -->
</div>
<!-- container -->
@section Scripts{
@section Scripts {
<script src="/lib/signalr/dist/browser/signalr.js"></script>
<script type="text/javascript" src="/assets/js/dashboard.js?v=3"></script>
<script type="text/javascript">
var resourcegroupId = @(Html.Raw(Json.Serialize(Model.CurrentResourceGroup.Id)));
</script>
<script type="text/javascript" src="/assets/js/dashboard.js?cache=@Html.Raw(DateTime.UtcNow.ToString("yyyyMMddHHmm"))"></script>
}
1 change: 0 additions & 1 deletion SemanticBackup/Pages/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@
<script src="/lib/jquery/jquery.min.js"></script>
<script src="/lib/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="/lib/feather-icons/feather.min.js"></script>
<script src="/lib/perfect-scrollbar/perfect-scrollbar.min.js"></script>
<script src="/lib/chart.js/Chart.bundle.min.js"></script>
<script src="/lib/jquery.flot/jquery.flot.js"></script>
<script src="/lib/jquery.flot/jquery.flot.stack.js"></script>
Expand Down
5 changes: 4 additions & 1 deletion SemanticBackup/Pages/Shared/_LayoutNoDirectory.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
<li class="nav-label">Resource Groups</li>
<li class="nav-item"><a href="/resource-groups/create" class="nav-link"><i data-feather="plus"></i> <span>Add Resource Group</span></a></li>
<li class="nav-item"><a href="/resource-groups" class="nav-link"><i data-feather="grid"></i> <span>Resource Groups</span></a></li>

<li class="nav-label mg-t-25">Account</li>
<li class="nav-item"><a href="/account" class="nav-link"><i data-feather="user"></i> <span>My Account</span></a></li>
<li class="nav-item"><a href="/account/logout" class="nav-link"><i data-feather="log-out"></i> <span>Sign Out</span></a></li>
</ul>
</div>
</aside>
Expand Down Expand Up @@ -86,7 +90,6 @@
<script src="/lib/jquery/jquery.min.js"></script>
<script src="/lib/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="/lib/feather-icons/feather.min.js"></script>
<script src="/lib/perfect-scrollbar/perfect-scrollbar.min.js"></script>
<script src="/lib/chart.js/Chart.bundle.min.js"></script>
<script src="/lib/jquery.flot/jquery.flot.js"></script>
<script src="/lib/jquery.flot/jquery.flot.stack.js"></script>
Expand Down
1 change: 0 additions & 1 deletion SemanticBackup/Pages/Shared/_LayoutNotLoggedIn.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
<script src="/lib/jquery/jquery.min.js"></script>
<script src="/lib/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="/lib/feather-icons/feather.min.js"></script>
<script src="/lib/perfect-scrollbar/perfect-scrollbar.min.js"></script>
<script src="/lib/chart.js/Chart.bundle.min.js"></script>
<script src="/lib/jquery.flot/jquery.flot.js"></script>
<script src="/lib/jquery.flot/jquery.flot.stack.js"></script>
Expand Down
6 changes: 3 additions & 3 deletions SemanticBackup/SemanticBackup.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<TargetFramework>net8.0</TargetFramework>
<UserSecretsId>98e83838-8ab0-44d3-a023-52d80ba01705</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<AssemblyVersion>5.0.1</AssemblyVersion>
<FileVersion>5.0.1</FileVersion>
<AssemblyVersion>5.0.2</AssemblyVersion>
<FileVersion>5.0.2</FileVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 1 addition & 3 deletions SemanticBackup/SignalRHubs/DashboardRefreshHubDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ private async Task SendMetricsAsync(string groupRecord)
DateTime currentTimeUTC = DateTime.UtcNow;

DashboardClientGroup clientGrp = DashboardRefreshHubClientStorage.GetClientGroups().FirstOrDefault(x => x.Name == groupRecord);
DateTime metricsFromDatUTC = currentTimeUTC.AddHours(-24);// 24hrs Ago
//Clear All
DateTime metricsFromDatUTC = currentTimeUTC.AddHours(-24);
clientGrp.Metric.AvgMetrics = new List<RealTimeViewModel>();

var recordsLatest = await backupRecordPersistanceService.GetAllByRegisteredDateByStatusAsync(resourcegroup, metricsFromDatUTC, subscriberGroup);
Expand Down Expand Up @@ -198,7 +197,6 @@ private async Task SendMetricsAsync(string groupRecord)
catch (Exception ex)
{
_logger.LogError(ex.ToString());
//throw;
}
}
}
Expand Down
Loading

0 comments on commit 85d3655

Please sign in to comment.