Skip to content

Commit

Permalink
Merge pull request #4148 from oqtane/dev
Browse files Browse the repository at this point in the history
5.1.1 release
  • Loading branch information
sbwalker authored Apr 16, 2024
2 parents 0633b28 + ed83405 commit 4479304
Show file tree
Hide file tree
Showing 62 changed files with 520 additions and 463 deletions.
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Bug Report
about: Create a bug report to help us improve the product
title: "[BUG] "
labels: ''
assignees: ''

---

### Oqtane Info

Version - #.#.#
Render Mode - Static
Interactivity - Server
Database - SQL Server

### Describe the bug


### Expected Behavior


### Steps To Reproduce


### Anything else?
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/enhancement-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Enhancement Request
about: 'Suggest a product enhancement '
title: "[ENH] "
labels: ''
assignees: ''

---

### Oqtane Info

Version - #.#.#
Render Mode - Static
Interactivity - Server
Database - SQL Server

### Describe the enhancement


### Anything else?
106 changes: 61 additions & 45 deletions Oqtane.Client/Modules/Admin/Logs/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -86,47 +86,48 @@ else
</div>
</div>
<br />
<button type="button" class="btn btn-success" @onclick="SaveSiteSettings">@SharedLocalizer["Save"]</button>
<button type="button" class="btn btn-success" @onclick="SaveSiteSettings">@SharedLocalizer["Save"]</button>
<ActionDialog Header="Clear Events" Message="Are You Sure You Wish To Remove All Log Events?" Action="DeleteLogs" Class="btn btn-danger" OnClick="@(async () => await DeleteLogs())" ResourceKey="DeleteLogs" />
</TabPanel>
</TabStrip>
}

@code {
private string _level = "-";
private string _function = "-";
private string _rows = "10";
private int _page = 1;
private List<Log> _logs;
private int _retention = 30;
private string _level = "-";
private string _function = "-";
private string _rows = "10";
private int _page = 1;
private List<Log> _logs;
private int _retention = 30;

public override string UrlParametersTemplate => "/{level}/{function}/{rows}/{page}";
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
public override string UrlParametersTemplate => "/{level}/{function}/{rows}/{page}";
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;

protected override async Task OnParametersSetAsync()
{
try
{
if (UrlParameters.ContainsKey("level"))
{
_level = UrlParameters["level"];
}
if (UrlParameters.ContainsKey("function"))
{
_function = UrlParameters["function"];
}
if (UrlParameters.ContainsKey("rows"))
{
_rows = UrlParameters["rows"];
}
if (UrlParameters.ContainsKey("page") && int.TryParse(UrlParameters["page"], out int page))
{
_page = page;
}
protected override async Task OnParametersSetAsync()
{
try
{
if (UrlParameters.ContainsKey("level"))
{
_level = UrlParameters["level"];
}
if (UrlParameters.ContainsKey("function"))
{
_function = UrlParameters["function"];
}
if (UrlParameters.ContainsKey("rows"))
{
_rows = UrlParameters["rows"];
}
if (UrlParameters.ContainsKey("page") && int.TryParse(UrlParameters["page"], out int page))
{
_page = page;
}

await GetLogs();

var settings = await SettingService.GetSiteSettingsAsync(PageState.Site.SiteId);
_retention = int.Parse( SettingService.GetSetting(settings, "LogRetention", "30"));
var settings = await SettingService.GetSiteSettingsAsync(PageState.Site.SiteId);
_retention = int.Parse( SettingService.GetSetting(settings, "LogRetention", "30"));
}
catch (Exception ex)
{
Expand Down Expand Up @@ -213,22 +214,37 @@ else
return classname;
}

private async Task SaveSiteSettings()
{
try
{
var settings = await SettingService.GetSiteSettingsAsync(PageState.Site.SiteId);
settings = SettingService.SetSetting(settings, "LogRetention", _retention.ToString(), true);
private async Task SaveSiteSettings()
{
try
{
var settings = await SettingService.GetSiteSettingsAsync(PageState.Site.SiteId);
settings = SettingService.SetSetting(settings, "LogRetention", _retention.ToString(), true);
await SettingService.UpdateSiteSettingsAsync(settings, PageState.Site.SiteId);

AddModuleMessage(Localizer["Success.SaveSiteSettings"], MessageType.Success);
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Saving Site Settings {Error}", ex.Message);
AddModuleMessage(Localizer["Error.SaveSiteSettings"], MessageType.Error);
}
}
AddModuleMessage(Localizer["Success.SaveSiteSettings"], MessageType.Success);
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Saving Site Settings {Error}", ex.Message);
AddModuleMessage(Localizer["Error.SaveSiteSettings"], MessageType.Error);
}
}

private async Task DeleteLogs()
{
try
{
await LogService.DeleteLogsAsync(PageState.Site.SiteId);
await GetLogs();
StateHasChanged();
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Deleting Logs {Error}", ex.Message);
AddModuleMessage(Localizer["Error.DeleteLogs"], MessageType.Error);
}
}

private void OnPageChange(int page)
{
Expand Down
58 changes: 20 additions & 38 deletions Oqtane.Client/Modules/Admin/Pages/Add.razor
Original file line number Diff line number Diff line change
Expand Up @@ -385,45 +385,34 @@
page.ParentId = Int32.Parse(_parentid);
}

// path can be a link to an external url
if (!_path.Contains("://"))
if (string.IsNullOrEmpty(_path))
{
if (string.IsNullOrEmpty(_path))
{
_path = _name;
}

(_path, string parameters) = Utilities.ParsePath(_path);
_path = _name;
}

if (_path.Contains("/"))
if (_path.Contains("/"))
{
if (_path.EndsWith("/") && _path != "/")
{
if (_path.EndsWith("/") && _path != "/")
{
_path = _path.Substring(0, _path.Length - 1);
}
_path = _path.Substring(_path.LastIndexOf("/") + 1);
_path = _path.Substring(0, _path.Length - 1);
}
if (_parentid == "-1")
_path = _path.Substring(_path.LastIndexOf("/") + 1);
}
if (_parentid == "-1")
{
page.Path = Utilities.GetFriendlyUrl(_path);
}
else
{
Page parent = PageState.Pages.FirstOrDefault(item => item.PageId == page.ParentId);
if (parent.Path == string.Empty)
{
page.Path = Utilities.GetFriendlyUrl(_path);
page.Path = Utilities.GetFriendlyUrl(parent.Name) + "/" + Utilities.GetFriendlyUrl(_path);
}
else
{
Page parent = PageState.Pages.FirstOrDefault(item => item.PageId == page.ParentId);
if (parent.Path == string.Empty)
{
page.Path = Utilities.GetFriendlyUrl(parent.Name) + "/" + Utilities.GetFriendlyUrl(_path);
}
else
{
page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(_path);
}
page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(_path);
}
page.Path += parameters;
}
else
{
page.Path = _path;
}

var _pages = await PageService.GetPagesAsync(PageState.Site.SiteId);
Expand Down Expand Up @@ -497,14 +486,7 @@
}
else
{
if (!page.Path.Contains("://"))
{
NavigationManager.NavigateTo(page.Path); // redirect to new page created
}
else
{
NavigationManager.NavigateTo(NavigateUrl("admin/pages"));
}
NavigationManager.NavigateTo(page.Path); // redirect to new page created
}
}
else
Expand Down
60 changes: 21 additions & 39 deletions Oqtane.Client/Modules/Admin/Pages/Edit.razor
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@
}
else
{
if (_path.Contains("/") & !_path.Contains("://"))
if (_path.Contains("/"))
{
_path = _path.Substring(_path.LastIndexOf("/") + 1);
}
Expand Down Expand Up @@ -529,45 +529,34 @@
_page.ParentId = Int32.Parse(_parentid);
}

// path can be a link to an external url
if (!_path.Contains("://"))
if (string.IsNullOrEmpty(_path))
{
if (string.IsNullOrEmpty(_path))
{
_path = _name;
}

(_path, string parameters) = Utilities.ParsePath(_path);
_path = _name;
}

if (_path.Contains("/"))
if (_path.Contains("/"))
{
if (_path.EndsWith("/") && _path != "/")
{
if (_path.EndsWith("/") && _path != "/")
{
_path = _path.Substring(0, _path.Length - 1);
}
_path = _path.Substring(_path.LastIndexOf("/") + 1);
_path = _path.Substring(0, _path.Length - 1);
}
if (_parentid == "-1")
_path = _path.Substring(_path.LastIndexOf("/") + 1);
}
if (_parentid == "-1")
{
_page.Path = Utilities.GetFriendlyUrl(_path);
}
else
{
Page parent = PageState.Pages.FirstOrDefault(item => item.PageId == _page.ParentId);
if (parent.Path == string.Empty)
{
_page.Path = Utilities.GetFriendlyUrl(_path);
_page.Path = Utilities.GetFriendlyUrl(parent.Name) + "/" + Utilities.GetFriendlyUrl(_path);
}
else
{
Page parent = PageState.Pages.FirstOrDefault(item => item.PageId == _page.ParentId);
if (parent.Path == string.Empty)
{
_page.Path = Utilities.GetFriendlyUrl(parent.Name) + "/" + Utilities.GetFriendlyUrl(_path);
}
else
{
_page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(_path);
}
_page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(_path);
}
_page.Path += parameters;
}
else
{
_page.Path = _path;
}

var _pages = await PageService.GetPagesAsync(PageState.Site.SiteId);
Expand Down Expand Up @@ -658,14 +647,7 @@
}
else
{
if (!_page.Path.Contains("://"))
{
NavigationManager.NavigateTo(NavigateUrl(), true); // redirect to page being edited
}
else
{
NavigationManager.NavigateTo(NavigateUrl("admin/pages"));
}
NavigationManager.NavigateTo(NavigateUrl(), true); // redirect to page being edited
}
}
else
Expand Down
Loading

0 comments on commit 4479304

Please sign in to comment.