- Added properties for managing container logs, including log entries, service filters, and auto-refresh options. - Introduced commands for refreshing logs, toggling auto-refresh, and closing the logs panel. - Implemented log fetching logic with error handling and status messages. - Integrated log display in the InstancesView with a dedicated logs panel. feat: Enhance navigation to Instances page with auto-selection - Added method to navigate to the Instances page and auto-select an instance based on abbreviation. feat: Update SettingsViewModel to load and save Bitwarden configuration - Integrated Bitwarden configuration loading from IOptions and saving to appsettings.json. - Added properties for Bitwarden instance project ID and connection status. - Updated UI to reflect Bitwarden settings and connection status. feat: Add advanced options for instance creation - Introduced a new expander in CreateInstanceView for advanced options, including purging stale volumes. feat: Improve InstanceDetailsWindow with pending setup banner - Added a banner to indicate pending setup for Xibo OAuth credentials, with editable fields for client ID and secret. fix: Update appsettings.json to include Bitwarden configuration structure - Added Bitwarden section to appsettings.json for storing configuration values. chore: Update Docker Compose template with health checks - Added health check configuration for web service in template.yml to ensure service availability. refactor: Drop AppSettings table from database - Removed AppSettings table and related migration files as part of database cleanup. feat: Create ServiceLogEntry DTO for log management - Added ServiceLogEntry class to represent individual log entries from Docker services.
54 lines
1.9 KiB
C#
54 lines
1.9 KiB
C#
using Microsoft.AspNetCore.DataProtection;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
using OTSSignsOrchestrator.Core.Models.Entities;
|
|
|
|
namespace OTSSignsOrchestrator.Core.Data;
|
|
|
|
public class XiboContext : DbContext
|
|
{
|
|
private readonly IDataProtectionProvider? _dataProtection;
|
|
|
|
public XiboContext(DbContextOptions<XiboContext> options, IDataProtectionProvider? dataProtection = null)
|
|
: base(options)
|
|
{
|
|
_dataProtection = dataProtection;
|
|
}
|
|
|
|
public DbSet<SshHost> SshHosts => Set<SshHost>();
|
|
public DbSet<OperationLog> OperationLogs => Set<OperationLog>();
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
base.OnModelCreating(modelBuilder);
|
|
|
|
// --- SshHost ---
|
|
modelBuilder.Entity<SshHost>(entity =>
|
|
{
|
|
entity.HasIndex(e => e.Label).IsUnique();
|
|
|
|
if (_dataProtection != null)
|
|
{
|
|
var protector = _dataProtection.CreateProtector("OTSSignsOrchestrator.SshHost");
|
|
var passphraseConverter = new ValueConverter<string?, string?>(
|
|
v => v != null ? protector.Protect(v) : null,
|
|
v => v != null ? protector.Unprotect(v) : null);
|
|
var passwordConverter = new ValueConverter<string?, string?>(
|
|
v => v != null ? protector.Protect(v) : null,
|
|
v => v != null ? protector.Unprotect(v) : null);
|
|
|
|
entity.Property(e => e.KeyPassphrase).HasConversion(passphraseConverter);
|
|
entity.Property(e => e.Password).HasConversion(passwordConverter);
|
|
}
|
|
});
|
|
|
|
// --- OperationLog ---
|
|
modelBuilder.Entity<OperationLog>(entity =>
|
|
{
|
|
entity.HasIndex(e => e.Timestamp);
|
|
entity.HasIndex(e => e.StackName);
|
|
entity.HasIndex(e => e.Operation);
|
|
});
|
|
}
|
|
}
|