Merge pull request #1 from oqtane/master

sync
This commit is contained in:
Shaun Walker 2020-04-07 10:55:37 -04:00 committed by GitHub
commit 0714ba9ece
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 252 additions and 233 deletions

View File

@ -27,7 +27,7 @@
<table class="table table-borderless">
<tr>
<td>
<label class="control-label">Upload: </label>
<Label For="upload" HelpText="Upload the file you want">Upload: </Label>
</td>
<td>
<FileManager UploadMultiple="true" ShowFiles="false" FolderId="@_folderId.ToString()" />
@ -39,18 +39,18 @@
<table class="table table-borderless">
<tr>
<td>
<label class="control-label">Url: </label>
<Label For="url" HelpText="Enter the file url">Url: </Label>
</td>
<td>
<input class="form-control" @bind="@url" />
<input id="url" class="form-control" @bind="@url" />
</td>
</tr>
<tr>
<td>
<label class="control-label">Folder: </label>
<Label For="folder" HelpText="Select the folder the file is in">Folder: </Label>
</td>
<td>
<select class="form-control" @bind="@_folderId">
<select id="folder" class="form-control" @bind="@_folderId">
<option value="-1">&lt;Select Folder&gt;</option>
@foreach (Folder folder in _folders)
{

View File

@ -8,10 +8,10 @@
<table class="table table-borderless">
<tr>
<td>
<label class="control-label">Parent: </label>
<Label For="parent" HelpText="Select the parent folder">Parent: </Label>
</td>
<td>
<select class="form-control" @bind="@_parentId">
<select id="parent" class="form-control" @bind="@_parentId">
@if (PageState.QueryString.ContainsKey("id"))
{
<option value="-1">&lt;No Parent&gt;</option>
@ -25,15 +25,15 @@
</tr>
<tr>
<td>
<label class="control-label">Name: </label>
<Label for="name" HelpText="Enter the file name">Name: </Label>
</td>
<td>
<input class="form-control" @bind="@_name" />
<input id="name" class="form-control" @bind="@_name" />
</td>
</tr>
<tr>
<td colspan="2" align="center">
<label class="control-label">Permissions: </label>
<Label For="permissions" HelpText="Select the permissions you want for the file">Permissions: </Label>
<PermissionGrid EntityName="@EntityNames.Folder" PermissionNames="Browse,View,Edit" Permissions="@_permissions" @ref="_permissionGrid" />
</td>
</tr>

View File

@ -3,73 +3,73 @@
@inject NavigationManager NavigationManager
@inject IJobService JobService
<table class="table table-borderless">
<tr>
<td>
<label class="control-label">Name: </label>
</td>
<td>
<input class="form-control" @bind="@_name" />
</td>
</tr>
<tr>
<td>
<label class="control-label">Type: </label>
</td>
<td>
<input class="form-control" @bind="@_jobType" />
</td>
</tr>
<tr>
<td>
<label class="control-label">Enabled? </label>
</td>
<td>
<select class="form-control" @bind="@_isEnabled">
<option value="True">Yes</option>
<option value="False">No</option>
</select>
</td>
</tr>
<tr>
<td>
<label class="control-label">Runs Every: </label>
</td>
<td>
<input class="form-control" @bind="@_interval" />
<select class="form-control" @bind="@_frequency">
<option value="m">Minute(s)</option>
<option value="H">Hour(s)</option>
<option value="d">Day(s)</option>
<option value="M">Month(s)</option>
</select>
</td>
</tr>
<tr>
<td>
<label class="control-label">Starting: </label>
</td>
<td>
<input class="form-control" @bind="@_startDate" />
</td>
</tr>
<tr>
<td>
<label class="control-label">Ending: </label>
</td>
<td>
<input class="form-control" @bind="@_endDate" />
</td>
</tr>
<tr>
<td>
<label class="control-label">Retention Log (Items): </label>
</td>
<td>
<input class="form-control" @bind="@_retentionHistory" />
</td>
</tr>
</table>
<table class="table table-borderless">
<tr>
<td>
<Label For="name" HelpText="Enter the job name">Name: </Label>
</td>
<td>
<input id="name" class="form-control" @bind="@_name" />
</td>
</tr>
<tr>
<td>
<Label For="type" HelpText="Enter the job type">Type: </Label>
</td>
<td>
<input id="type" class="form-control" @bind="@_jobType" />
</td>
</tr>
<tr>
<td>
<Label For="enabled" HelpText="Select whether you want the job enabled or not">Enabled? </Label>
</td>
<td>
<select id="enabled" class="form-control" @bind="@_isEnabled">
<option value="True">Yes</option>
<option value="False">No</option>
</select>
</td>
</tr>
<tr>
<td>
<Label For="runs-every" HelpText="Select how often you want the job to run">Runs Every: </Label>
</td>
<td>
<input id="runs-every" class="form-control" @bind="@_interval" />
<select id="runs-every" class="form-control" @bind="@_frequency">
<option value="m">Minute(s)</option>
<option value="H">Hour(s)</option>
<option value="d">Day(s)</option>
<option value="M">Month(s)</option>
</select>
</td>
</tr>
<tr>
<td>
<Label For="starting" HelpText="What time do you want the job to start">Starting: </Label>
</td>
<td>
<input id="starting" class="form-control" @bind="@_startDate" />
</td>
</tr>
<tr>
<td>
<Label For="ending" HelpText="When do you want the job to end">Ending: </Label>
</td>
<td>
<input id="ending" class="form-control" @bind="@_endDate" />
</td>
</tr>
<tr>
<td>
<Label For="retention-log" HelpText="What items do you want in the retention log">Retention Log (Items): </Label>
</td>
<td>
<input id="retention-log" class="form-control" @bind="@_retentionHistory" />
</td>
</tr>
</table>
<button type="button" class="btn btn-success" @onclick="SaveJob">Save</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>

View File

@ -3,73 +3,73 @@
@inject NavigationManager NavigationManager
@inject IJobService JobService
<table class="table table-borderless">
<tr>
<td>
<label class="control-label">Name: </label>
</td>
<td>
<input class="form-control" @bind="@_name" />
</td>
</tr>
<tr>
<td>
<label class="control-label">Type: </label>
</td>
<td>
<input class="form-control" @bind="@_jobType" />
</td>
</tr>
<tr>
<td>
<label class="control-label">Enabled? </label>
</td>
<td>
<select class="form-control" @bind="@_isEnabled">
<option value="True">Yes</option>
<option value="False">No</option>
</select>
</td>
</tr>
<tr>
<td>
<label class="control-label">Runs Every: </label>
</td>
<td>
<input class="form-control" @bind="@_interval" />
<select class="form-control" @bind="@_frequency">
<option value="m">Minute(s)</option>
<option value="H">Hour(s)</option>
<option value="d">Day(s)</option>
<option value="M">Month(s)</option>
</select>
</td>
</tr>
<tr>
<td>
<label class="control-label">Starting: </label>
</td>
<td>
<input class="form-control" @bind="@_startDate" />
</td>
</tr>
<tr>
<td>
<label class="control-label">Ending: </label>
</td>
<td>
<input class="form-control" @bind="@_endDate" />
</td>
</tr>
<tr>
<td>
<label class="control-label">Retention Log (Items): </label>
</td>
<td>
<input class="form-control" @bind="@_retentionHistory" />
</td>
</tr>
</table>
<table class="table table-borderless">
<tr>
<td>
<Label For="name" HelpText="Enter the job name">Name: </Label>
</td>
<td>
<input id="name" class="form-control" @bind="@_name" />
</td>
</tr>
<tr>
<td>
<Label For="type" HelpText="Enter the job type">Type: </Label>
</td>
<td>
<input id="type" class="form-control" @bind="@_jobType" />
</td>
</tr>
<tr>
<td>
<Label For="enabled" HelpText="Select whether you want the job enabled or not">Enabled? </Label>
</td>
<td>
<select id="enabled" class="form-control" @bind="@_isEnabled">
<option value="True">Yes</option>
<option value="False">No</option>
</select>
</td>
</tr>
<tr>
<td>
<Label For="runs-every" HelpText="Select how often you want the job to run">Runs Every: </Label>
</td>
<td>
<input id="runs-every" class="form-control" @bind="@_interval" />
<select id="runs-every" class="form-control" @bind="@_frequency">
<option value="m">Minute(s)</option>
<option value="H">Hour(s)</option>
<option value="d">Day(s)</option>
<option value="M">Month(s)</option>
</select>
</td>
</tr>
<tr>
<td>
<Label For="starting" HelpText="What time do you want the job to start">Starting: </Label>
</td>
<td>
<input id="starting" class="form-control" @bind="@_startDate" />
</td>
</tr>
<tr>
<td>
<Label For="ending" HelpText="When do you want the job to end">Ending: </Label>
</td>
<td>
<input id="ending" class="form-control" @bind="@_endDate" />
</td>
</tr>
<tr>
<td>
<Label For="retention-log" HelpText="What items do you want in the retention log">Retention Log (Items): </Label>
</td>
<td>
<input id="retention-log" class="form-control" @bind="@_retentionHistory" />
</td>
</tr>
</table>
<button type="button" class="btn btn-success" @onclick="SaveJob">Save</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>

View File

@ -9,34 +9,34 @@
<table class="table table-borderless">
<tr>
<td>
<label for="Name" class="control-label">Name: </label>
<Label For="Name" HelpText="Enter the page name">Name: </Label>
</td>
<td>
<input class="form-control" @bind="@_name" />
<input id="Name" class="form-control" @bind="@_name" />
</td>
</tr>
<tr>
<td>
<label for="Title" class="control-label">Title: </label>
<Label For="Title" HelpText="Enter the page title">Title: </Label>
</td>
<td>
<input class="form-control" @bind="@_title" />
<input id="Title" class="form-control" @bind="@_title" />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Path: </label>
<Label For="Path" HelpText="Enter the path for the page">Path: </Label>
</td>
<td>
<input class="form-control" @bind="@_path" />
<input id="Path" class="form-control" @bind="@_path" />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Parent: </label>
<Label For="Parent" HelpText="Select the parent for the page">Parent: </Label>
</td>
<td>
<select class="form-control" @onchange="(e => ParentChanged(e))">
<select id="Parent" class="form-control" @onchange="(e => ParentChanged(e))">
<option value="-1">&lt;Site Root&gt;</option>
@foreach (Page page in _pageList)
{
@ -47,10 +47,10 @@
</tr>
<tr>
<td>
<label for="Name" class="control-label">Insert: </label>
<Label For="Insert" HelpText="Select the insert for the page">Insert: </Label>
</td>
<td>
<select class="form-control" @bind="@_insert">
<select id="Insert" class="form-control" @bind="@_insert">
<option value="<<">At Beginning</option>
@if (_children != null && _children.Count > 0)
{
@ -61,7 +61,7 @@
</select>
@if (_children != null && _children.Count > 0 && (_insert == "<" || _insert == ">"))
{
<select class="form-control" @bind="@_childid">
<select id="Insert" class="form-control" @bind="@_childid">
<option value="-1">&lt;Select Page&gt;</option>
@foreach (Page page in _children)
{
@ -73,10 +73,10 @@
</tr>
<tr>
<td>
<label for="Name" class="control-label">Navigation? </label>
<Label For="Navigation" HelpText="Select whether the page has navigation bar">Navigation? </Label>
</td>
<td>
<select class="form-control" @bind="@_isnavigation">
<select id="Navigation" class="form-control" @bind="@_isnavigation">
<option value="True">Yes</option>
<option value="False">No</option>
</select>
@ -84,18 +84,18 @@
</tr>
<tr>
<td>
<label for="Url" class="control-label">Url: </label>
<Label For="Url" HelpText="Enter the url for the page">Url: </Label>
</td>
<td>
<input class="form-control" @bind="@_url" />
<input id="Url" class="form-control" @bind="@_url" />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Personalizable? </label>
<Label For="Personalizable" HelpText="Do you want the page to be personalized by users">Personalizable? </Label>
</td>
<td>
<select class="form-control" @bind="@_ispersonalizable">
<select id="Personalizable" class="form-control" @bind="@_ispersonalizable">
<option value="True">Yes</option>
<option value="False">No</option>
</select>
@ -103,10 +103,10 @@
</tr>
<tr>
<td>
<label for="Name" class="control-label">Default Mode? </label>
<Label For="Default-Mode" HelpText="Select the default mode you want for the page">Default Mode? </Label>
</td>
<td>
<select class="form-control" @bind="@_mode">
<select id="Default-Mode" class="form-control" @bind="@_mode">
<option value="view">View Mode</option>
<option value="edit">Edit Mode</option>
</select>
@ -114,10 +114,10 @@
</tr>
<tr>
<td>
<label for="Name" class="control-label">Theme: </label>
<Label For="Theme" HelpText="Select the theme you want for the page">Theme: </Label>
</td>
<td>
<select class="form-control" @onchange="(e => ThemeChanged(e))">
<select id="Theme" class="form-control" @onchange="(e => ThemeChanged(e))">
<option value="">&lt;Select Theme&gt;</option>
@foreach (KeyValuePair<string, string> item in _themes)
{
@ -128,10 +128,10 @@
</tr>
<tr>
<td>
<label for="Name" class="control-label">Layout: </label>
<Label For="Layout" HelpText="Select the layout for the page">Layout: </Label>
</td>
<td>
<select class="form-control" @bind="@_layouttype">
<select id="Layout" class="form-control" @bind="@_layouttype">
<option value="">&lt;Select Layout&gt;</option>
@foreach (KeyValuePair<string, string> panelayout in _panelayouts)
{
@ -142,15 +142,15 @@
</tr>
<tr>
<td>
<label for="Name" class="control-label">Icon: </label>
<Label For="Icon" HelpText="Enter the icon for the page">Icon: </Label>
</td>
<td>
<input class="form-control" @bind="@_icon" />
<input id="Icon" class="form-control" @bind="@_icon" />
</td>
</tr>
<tr>
<td colspan="2" align="center">
<label for="Name" class="control-label">Permissions: </label>
<Label For="Permissions" HelpText="Select the permissions you want for the page">Permissions: </Label>
<PermissionGrid EntityName="@EntityNames.Page" Permissions="@_permissions" @ref="_permissionGrid" />
</td>
</tr>

View File

@ -9,34 +9,34 @@
<table class="table table-borderless">
<tr>
<td>
<label for="Name" class="control-label">Name: </label>
<Label For="Name" HelpText="Enter the page name">Name: </Label>
</td>
<td>
<input class="form-control" @bind="@_name" />
<input id="name" class="form-control" @bind="@_name" />
</td>
</tr>
<tr>
<td>
<label for="Title" class="control-label">Title: </label>
<Label For="Title" HelpText="Enter the page title">Title: </Label>
</td>
<td>
<input class="form-control" @bind="@_title" />
<input id="Title" class="form-control" @bind="@_title" />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Path: </label>
<Label For="Path" HelpText="Enter the path for the page">Path: </Label>
</td>
<td>
<input class="form-control" @bind="@_path" />
<input id="Path" class="form-control" @bind="@_path" />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Parent: </label>
<Label For="Parent" HelpText="Select the parent for the page">Parent: </Label>
</td>
<td>
<select class="form-control" @onchange="(e => ParentChanged(e))">
<select id="Parent" class="form-control" @onchange="(e => ParentChanged(e))">
<option value="-1">&lt;Site Root&gt;</option>
@foreach (Page page in _pageList)
{
@ -54,10 +54,10 @@
</tr>
<tr>
<td>
<label for="Name" class="control-label">Move: </label>
<Label For="Move" HelpText="Select where you wan to move the page">Move: </Label>
</td>
<td>
<select class="form-control" @bind="@_insert">
<select id="Move" class="form-control" @bind="@_insert">
@if (_parentid == _currentparentid)
{
<option value="=">&lt;Maintain Current Location&gt;</option>
@ -72,7 +72,7 @@
</select>
@if (_children != null && _children.Count > 0 && (_insert == "<" || _insert == ">"))
{
<select class="form-control" @bind="@_childid">
<select id="Move" class="form-control" @bind="@_childid">
<option value="-1">&lt;Select Page&gt;</option>
@foreach (Page page in _children)
{
@ -84,18 +84,18 @@
</tr>
<tr>
<td>
<label for="Url" class="control-label">Url: </label>
<Label for="Url" HelpText="Enter the url for the page">Url: </Label>
</td>
<td>
<input class="form-control" @bind="@_url" />
<input id="Url" class="form-control" @bind="@_url" />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Navigation? </label>
<Label For="Navigation" HelpText="Select whether the page has navigation bar">Navigation? </Label>
</td>
<td>
<select class="form-control" @bind="@_isnavigation">
<select id="Navigation" class="form-control" @bind="@_isnavigation">
<option value="True">Yes</option>
<option value="False">No</option>
</select>
@ -103,10 +103,10 @@
</tr>
<tr>
<td>
<label for="Name" class="control-label">Personalizable? </label>
<Label For="Personalizable" HelpText="Do you want the page to be personalized by users">Personalizable? </Label>
</td>
<td>
<select class="form-control" @bind="@_ispersonalizable">
<select id="Personalizable" class="form-control" @bind="@_ispersonalizable">
<option value="True">Yes</option>
<option value="False">No</option>
</select>
@ -114,10 +114,10 @@
</tr>
<tr>
<td>
<label for="Name" class="control-label">Default Mode? </label>
<Label For="Default-Mode" HelpText="Select the default mode you want for the page">Default Mode? </Label>
</td>
<td>
<select class="form-control" @bind="@_mode">
<select id="Default-Mode" class="form-control" @bind="@_mode">
<option value="view">View Mode</option>
<option value="edit">Edit Mode</option>
</select>
@ -125,10 +125,10 @@
</tr>
<tr>
<td>
<label for="Name" class="control-label">Theme: </label>
<Label For="Theme" HelpText="Select the theme you want for the page">Theme: </Label>
</td>
<td>
<select class="form-control" @onchange="(e => ThemeChanged(e))">
<select id="Theme" class="form-control" @onchange="(e => ThemeChanged(e))">
<option value="">&lt;Select Theme&gt;</option>
@foreach (KeyValuePair<string, string> item in _themes)
{
@ -146,10 +146,10 @@
</tr>
<tr>
<td>
<label for="Name" class="control-label">Layout: </label>
<Label For="Layout" HelpText="Select the layout for the page">Layout: </Label>
</td>
<td>
<select class="form-control" @bind="@_layouttype">
<select id="Layout" class="form-control" @bind="@_layouttype">
<option value="">&lt;Select Layout&gt;</option>
@foreach (KeyValuePair<string, string> panelayout in _panelayouts)
{
@ -160,15 +160,15 @@
</tr>
<tr>
<td>
<label for="Name" class="control-label">Icon: </label>
<Label For="Icon" HelpText="Enter the icon for the page">Icon: </Label>
</td>
<td>
<input class="form-control" @bind="@_icon" />
<input id="Icon" class="form-control" @bind="@_icon" />
</td>
</tr>
<tr>
<td colspan="2" align="center">
<label for="Name" class="control-label">Permissions: </label>
<Label For="Permissions" HelpText="Select the permissions you want for the page">Permissions: </Label>
<PermissionGrid EntityName="@EntityNames.Page" Permissions="@_permissions" @ref="_permissionGrid" />
</td>
</tr>

View File

@ -14,30 +14,18 @@ namespace Oqtane.Shared
var assemblyName = assemblyFullName.Substring(0, assemblyFullName.IndexOf(",", StringComparison.Ordinal));
return $"{type.Namespace}, {assemblyName}";
}
public static string NavigateUrl(string alias, string path, string parameters)
{
string url = "";
if (alias != "")
var uriBuilder = new UriBuilder
{
url += alias + "/";
}
if (path != "" && path != "/")
{
url += path + "/";
}
if (url.EndsWith("/"))
{
url = url.Substring(0, url.Length - 1);
}
if (!string.IsNullOrEmpty(parameters))
{
url += "?" + parameters;
}
if (!url.StartsWith("/"))
{
url = "/" + url;
}
return url;
Path = !string.IsNullOrEmpty(alias)
? $"{alias}/{path}"
: $"{path}",
Query = parameters
};
return uriBuilder.Uri.PathAndQuery;
}
public static string EditUrl(string alias, string path, int moduleid, string action, string parameters)

View File

@ -0,0 +1,31 @@
using Oqtane.Shared;
using Xunit;
namespace Oqtane.Test.Oqtane.Shared.Tests
{
public class UtilitiesTests
{
[Theory]
[InlineData("contoso", "login", "returnUrl=/admin", "/contoso/login?returnUrl=/admin")]
[InlineData("contoso", "admin", "", "/contoso/admin")]
[InlineData("contoso", "", "pageId=4", "/contoso?pageId=4")]
[InlineData("contoso", "", "pageId=4&moduleId=10", "/contoso?pageId=4&moduleId=10")]
[InlineData("contoso", "", "", "/contoso/")]
[InlineData("", "login", "returnUrl=/admin", "/login?returnUrl=/admin")]
[InlineData("", "admin", "", "/admin")]
[InlineData("", "", "pageId=4", "?pageId=4")]
[InlineData("", "", "pageId=4&moduleId=10", "?pageId=4&moduleId=10")]
[InlineData("", "", "", "/")]
public void NavigateUrlTest(string alias, string path, string parameters, string expectedUrl)
{
// Arrange
var navigatedUrl = string.Empty;
// Act
navigatedUrl = Utilities.NavigateUrl(alias, path, parameters);
// Assert
Assert.Equal(expectedUrl, navigatedUrl);
}
}
}