Added a docker image and compose file for the application

This commit is contained in:
Vincent Allen
2025-09-03 13:28:56 -04:00
parent d0429ddaf4
commit 9a0661e985
192 changed files with 5369 additions and 96 deletions

View File

@@ -38,7 +38,7 @@
</MudPaper>
</ActivatorContent>
</MudFileUpload>
@if (Files.Any())
@if (Files.Any() || ExistingFiles.Any())
{
<MudPaper Style="max-height: 150px; overflow-y: auto;" Outlined="true" Class="pa-4">
@foreach (var file in Files)
@@ -49,6 +49,14 @@
Text="@file.Name"
tabindex="-1" />
}
@foreach (var filelisting in ExistingFiles)
{
<MudChip T="string"
Color="@Color.Success"
Text="@filelisting.OriginalName"
tabindex="-1" />
}
</MudPaper>
}
@@ -105,6 +113,15 @@
[Parameter]
public EventCallback ClearClicked { get; set; }
[Parameter]
public List<FilePathListing> ExistingFiles { get; set; } = new();
protected override Task OnParametersSetAsync()
{
StateHasChanged();
return base.OnParametersSetAsync();
}
private async Task ClearAsync()
{
foreach (var pair in _fileToDiskFileName)
@@ -125,6 +142,24 @@
}
}
foreach (var listing in ExistingFiles)
{
try
{
FileInfo targetFile = new(listing.Path);
if (targetFile.Exists)
{
targetFile.Delete();
}
await PathProvider.DeleteFilePathListingAsync(listing.OriginalName, listing.Path);
}
catch (Exception ex)
{
_logger.LogError(ex, $"Error deleting file {listing.Path}");
Snackbar.Add($"Error cleaning up file: {listing.OriginalName}", Severity.Warning);
}
}
_fileToDiskFileName.Clear();
Files.Clear();
await (_fileUpload?.ClearAsync() ?? Task.CompletedTask);

View File

@@ -31,13 +31,20 @@
@inject IDialogService DialogService;
@code {
/*
public async Task ShowAddGroupingDialog(ArtifactGroupingRowElement validationModel)
{
var parameters = new DialogParameters { ["Model"] = validationModel, ["IsUpdate"] = true};
var parameters = new DialogParameters { ["Model"] = validationModel};
var options = new DialogOptions { CloseOnEscapeKey = true, BackdropClick = false };
var dialog = await DialogService.ShowAsync<AddGroupingDialog>("Create a Group", parameters, options);
var result = await dialog.Result;
if (result is not null && !result.Canceled)
{
}
}
*/
}

View File

@@ -81,7 +81,8 @@
<UploadDropBox
@ref="@_uploadComponent"
FilesUploaded="OnFilesUploaded"
ClearClicked="OnClearFilesClicked"></UploadDropBox>
ClearClicked="OnClearFilesClicked"
ExistingFiles="ExistingFiles"></UploadDropBox>
</MudPaper>
@if (Model is not null)
{
@@ -101,19 +102,22 @@
</div>
<MudGrid Justify="Justify.FlexEnd" Class="pt-6">
<MudItem>
<MudCheckBox Label="Publicly Visible" T="bool"></MudCheckBox>
@*<MudCheckBox Label="Publicly Visible" T="bool" @bind-Value=Model.IsPublic></MudCheckBox>*@
</MudItem>
<MudItem>
<MudCheckBox Label="Publicly Visible" T="bool"></MudCheckBox>
@*<MudCheckBox Label="Publicly Visible" T="bool" @bind-Value=Model.IsPublic></MudCheckBox>*@
</MudItem>
@if (FormButtonsEnabled)
{
<MudItem Class="pr-0">
<MudButton Color="Color.Primary" Variant="Variant.Filled" Class="ml-4" OnClick="CancelClicked">Cancel</MudButton>
</MudItem>
<MudButton Color="Color.Primary" Variant="Variant.Filled" Class="ml-4" OnClick="CancelClicked">Cancel</MudButton>
</MudItem>
<MudItem Class="pl-2">
<MudButton Color="Color.Primary" Variant="Variant.Filled" Class="ml-4" OnClick="PublishClicked" Disabled="@(!IsValid)" >Publish</MudButton>
</MudItem>
</MudGrid>
<MudItem Class="pl-2">
<MudButton Color="Color.Primary" Variant="Variant.Filled" Class="ml-4" OnClick="PublishClicked" Disabled="@(!IsValid)" >Publish</MudButton>
</MudItem>
}
</MudGrid>
@code {
@@ -144,6 +148,13 @@
[Parameter]
public ArtifactGroupingValidationModel Model { get; set; } = new();
/// <summary>
/// Determines if the cancel and publish buttons should be show to the user or if the containing component will
/// handle their functionality (ie if used in a dialog and you want to use the dialog buttons instead of this component's handlers)
/// </summary>
[Parameter]
public bool FormButtonsEnabled { get; set; } = true;
private UploadDropBox _uploadComponent = default!;
private IdentifierTextBox _identifierTextBox = default!;
@@ -166,6 +177,10 @@
public List<ValidationResult> ValidationResults { get; private set; } = [];
// Used to store the files that have already been uploaded if this component is being displayed
// with a filled in model. Used to populate the upload drop box
private List<FilePathListing> ExistingFiles { get; set; } = new();
protected override async Task OnParametersSetAsync()
{
// Ensure to reload the component if a model has been supplied so that the full
@@ -174,7 +189,21 @@
{
await OnCategoryChanged();
}
_isFormDivVisible = true;
if (Model is not null && Model.Category is not null)
{
// The data entry should only be shown if a category has been selected
_isFormDivVisible = true;
}
if (Model is not null)
{
ExistingFiles = Model.ArtifactEntries
.Where(e => e.Files.Any())
.Select(e => e.Files[0])
.ToList();
}
StateHasChanged();
}

View File

@@ -4,7 +4,9 @@
</TitleContent>
<DialogContent>
<AddArchiveGroupingComponent Model="Model"></AddArchiveGroupingComponent>
<AddArchiveGroupingComponent
Model="Model"
FormButtonsEnabled=false></AddArchiveGroupingComponent>
</DialogContent>
<DialogActions>

View File

@@ -16,7 +16,6 @@
<Columns>
<SelectColumn T="ArtifactGroupingRowElement"/>
<PropertyColumn
Title="Id"
@@ -112,8 +111,11 @@
var result = await dialog.Result;
if (!result.Canceled)
if (result is not null && !result.Canceled)
{
var validationModel = (ArtifactGroupingValidationModel)result.Data!;
await GroupingProvider.UpdateGroupingAsync(validationModel.ToArtifactGrouping());
await DataGrid.ReloadServerData();
}
}

View File

@@ -1,12 +1,16 @@
using Microsoft.IdentityModel.Tokens;
using OpenArchival.DataAccess;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace OpenArchival.Blazor;
public class ArtifactGroupingValidationModel : IValidatableObject
{
/// <summary>
/// Used by update code to track the database record that corresponds to the data within this DTO
/// </summary>
public int? Id { get; set; }
[Required(ErrorMessage = "A grouping title is required.")]
public string? Title { get; set; }
@@ -37,6 +41,7 @@ public class ArtifactGroupingValidationModel : IValidatableObject
var grouping = new ArtifactGrouping()
{
Id = Id ?? default,
Title = Title,
Description = Description,
Category = Category,
@@ -101,6 +106,7 @@ public class ArtifactGroupingValidationModel : IValidatableObject
}
return new ArtifactGroupingValidationModel()
{
Id = grouping.Id,
Title = grouping.Title,
ArtifactEntries = entries,
Category = grouping.Category,