Merge branch 'oqtane:dev' into dev

This commit is contained in:
vnetonline 2023-06-30 07:41:49 +10:00 committed by GitHub
commit a2a64e73bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 81 deletions

View File

@ -34,13 +34,13 @@ else
<div class="row mb-1 align-items-center"> <div class="row mb-1 align-items-center">
<Label Class="col-sm-3" For="effectiveDate" HelpText="The date that this role assignment is active" ResourceKey="EffectiveDate">Effective Date: </Label> <Label Class="col-sm-3" For="effectiveDate" HelpText="The date that this role assignment is active" ResourceKey="EffectiveDate">Effective Date: </Label>
<div class="col-sm-9"> <div class="col-sm-9">
<input id="effectiveDate" class="form-control" @bind="@effectivedate" /> <input type="date" id="effectiveDate" class="form-control" @bind="@effectivedate" />
</div> </div>
</div> </div>
<div class="row mb-1 align-items-center"> <div class="row mb-1 align-items-center">
<Label Class="col-sm-3" For="expiryDate" HelpText="The date that this role assignment expires" ResourceKey="ExpiryDate">Expiry Date: </Label> <Label Class="col-sm-3" For="expiryDate" HelpText="The date that this role assignment expires" ResourceKey="ExpiryDate">Expiry Date: </Label>
<div class="col-sm-9"> <div class="col-sm-9">
<input id="expiryDate" class="form-control" @bind="@expirydate" /> <input type="date" id="expiryDate" class="form-control" @bind="@expirydate" />
</div> </div>
</div> </div>
@ -75,8 +75,8 @@ else
private string name = string.Empty; private string name = string.Empty;
private List<Role> roles; private List<Role> roles;
private int roleid = -1; private int roleid = -1;
private string effectivedate = string.Empty; private DateTime? effectivedate = null;
private string expirydate = string.Empty; private DateTime? expirydate = null;
private List<UserRole> userroles; private List<UserRole> userroles;
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Edit; public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Edit;
@ -130,23 +130,8 @@ else
var userrole = userroles.Where(item => item.UserId == userid && item.RoleId == roleid).FirstOrDefault(); var userrole = userroles.Where(item => item.UserId == userid && item.RoleId == roleid).FirstOrDefault();
if (userrole != null) if (userrole != null)
{ {
if (string.IsNullOrEmpty(effectivedate)) userrole.EffectiveDate = effectivedate;
{ userrole.ExpiryDate = expirydate;
userrole.EffectiveDate = null;
}
else
{
userrole.EffectiveDate = DateTime.Parse(effectivedate);
}
if (string.IsNullOrEmpty(expirydate))
{
userrole.ExpiryDate = null;
}
else
{
userrole.ExpiryDate = DateTime.Parse(expirydate);
}
await UserRoleService.UpdateUserRoleAsync(userrole); await UserRoleService.UpdateUserRoleAsync(userrole);
} }
else else
@ -154,25 +139,8 @@ else
userrole = new UserRole(); userrole = new UserRole();
userrole.UserId = userid; userrole.UserId = userid;
userrole.RoleId = roleid; userrole.RoleId = roleid;
userrole.EffectiveDate = effectivedate;
if (string.IsNullOrEmpty(effectivedate)) userrole.ExpiryDate = expirydate;
{
userrole.EffectiveDate = null;
}
else
{
userrole.EffectiveDate = DateTime.Parse(effectivedate);
}
if (string.IsNullOrEmpty(expirydate))
{
userrole.ExpiryDate = null;
}
else
{
userrole.ExpiryDate = DateTime.Parse(expirydate);
}
await UserRoleService.AddUserRoleAsync(userrole); await UserRoleService.AddUserRoleAsync(userrole);
} }

View File

@ -55,7 +55,7 @@
</div> </div>
<div class="col mt-2 text-end"> <div class="col mt-2 text-end">
<button type="button" class="btn btn-success" @onclick="UploadFiles">@SharedLocalizer["Upload"]</button> <button type="button" class="btn btn-success" @onclick="UploadFiles">@SharedLocalizer["Upload"]</button>
@if (ShowFiles && GetFileId() != -1) @if (GetFileId() != -1)
{ {
<button type="button" class="btn btn-danger mx-1" @onclick="DeleteFile">@SharedLocalizer["Delete"]</button> <button type="button" class="btn btn-danger mx-1" @onclick="DeleteFile">@SharedLocalizer["Delete"]</button>
} }
@ -63,7 +63,7 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col mt-1"><span id="@_progressinfoid" style="display: none;"></span></div> <div class="col mt-1"><span id="@_progressinfoid" style="display: none;"></span></div>
<div class="col text-center mt-1"><progress id="@_progressbarid" class="mt-1" style="display: none;"></progress></div> <div class="col mt-1"><progress id="@_progressbarid" class="mt-1" style="display: none;"></progress></div>
</div> </div>
} }
</div> </div>
@ -143,7 +143,7 @@
[Parameter] [Parameter]
public EventCallback<int> OnDelete { get; set; } // optional - executes a method in the calling component when a file is deleted public EventCallback<int> OnDelete { get; set; } // optional - executes a method in the calling component when a file is deleted
protected override async Task OnInitializedAsync() protected override async Task OnParametersSetAsync()
{ {
// packages folder is a framework folder for uploading installable nuget packages // packages folder is a framework folder for uploading installable nuget packages
if (Folder == Constants.PackagesFolder) if (Folder == Constants.PackagesFolder)
@ -154,11 +154,6 @@
ShowSuccess = true; ShowSuccess = true;
} }
if (!ShowFiles)
{
ShowImage = false;
}
_folders = await FolderService.GetFoldersAsync(ModuleState.SiteId); _folders = await FolderService.GetFoldersAsync(ModuleState.SiteId);
if (!string.IsNullOrEmpty(Folder) && Folder != Constants.PackagesFolder) if (!string.IsNullOrEmpty(Folder) && Folder != Constants.PackagesFolder)
@ -417,8 +412,11 @@
await logger.LogInformation("File Deleted {File}", FileId); await logger.LogInformation("File Deleted {File}", FileId);
await OnDelete.InvokeAsync(FileId); await OnDelete.InvokeAsync(FileId);
if (ShowSuccess)
{
_message = Localizer["Success.File.Delete"]; _message = Localizer["Success.File.Delete"];
_messagetype = MessageType.Success; _messagetype = MessageType.Success;
}
await GetFiles(); await GetFiles();
FileId = -1; FileId = -1;

View File

@ -124,7 +124,10 @@ namespace Oqtane.Controllers
Folder parent = _folders.GetFolder(folder.ParentId.Value); Folder parent = _folders.GetFolder(folder.ParentId.Value);
folder.Path = Utilities.UrlCombine(parent.Path, folder.Name); folder.Path = Utilities.UrlCombine(parent.Path, folder.Name);
} }
if (!folder.Path.EndsWith("/"))
{
folder.Path = folder.Path + "/"; folder.Path = folder.Path + "/";
}
folder = _folders.AddFolder(folder); folder = _folders.AddFolder(folder);
_syncManager.AddSyncEvent(_alias.TenantId, EntityNames.Folder, folder.FolderId, SyncEventActions.Create); _syncManager.AddSyncEvent(_alias.TenantId, EntityNames.Folder, folder.FolderId, SyncEventActions.Create);
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Folder Added {Folder}", folder); _logger.Log(LogLevel.Information, this, LogFunction.Create, "Folder Added {Folder}", folder);
@ -166,7 +169,10 @@ namespace Oqtane.Controllers
Folder parent = _folders.GetFolder(folder.ParentId.Value); Folder parent = _folders.GetFolder(folder.ParentId.Value);
folder.Path = Utilities.UrlCombine(parent.Path, folder.Name); folder.Path = Utilities.UrlCombine(parent.Path, folder.Name);
} }
if (!folder.Path.EndsWith("/"))
{
folder.Path = folder.Path + "/"; folder.Path = folder.Path + "/";
}
Folder _folder = _folders.GetFolder(id, false); Folder _folder = _folders.GetFolder(id, false);
if (_folder.Path != folder.Path && Directory.Exists(_folders.GetFolderPath(_folder))) if (_folder.Path != folder.Path && Directory.Exists(_folders.GetFolderPath(_folder)))

View File

@ -291,7 +291,7 @@ Oqtane.Interop = {
var progressbar = document.getElementById('ProgressBar_' + id); var progressbar = document.getElementById('ProgressBar_' + id);
progressinfo.setAttribute("style", "display: inline;"); progressinfo.setAttribute("style", "display: inline;");
progressbar.setAttribute("style", "width: 200px; display: inline;"); progressbar.setAttribute("style", "width: 100%; display: inline;");
for (var i = 0; i < files.length; i++) { for (var i = 0; i < files.length; i++) {
var FileChunk = []; var FileChunk = [];