fix gravatars not showing
fix web config not saving Uri fix issue with token login
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
@model SharedLibraryCore.Configuration.ApplicationConfiguration
|
||||
@using SharedLibraryCore.Configuration.Attributes
|
||||
@model SharedLibraryCore.Configuration.ApplicationConfiguration
|
||||
|
||||
@{
|
||||
ViewData["Title"] = SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CONFIGURATION_TITLE"];
|
||||
@ -6,25 +7,27 @@
|
||||
string advancedText = SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CONFIGURATION_ADVANCED"];
|
||||
string addText = SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CONFIGURATION_ADD"];
|
||||
string saveText = SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CONFIGURATION_SAVE"];
|
||||
string noticeText = SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CONFIGURATION_SAVING_CHANGES"];
|
||||
string addServerText = SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CONFIGURATION_SERVER_ADD"];
|
||||
|
||||
var properties = Model.GetType().GetProperties();
|
||||
|
||||
string[] getLinkedPropertyName(System.Reflection.PropertyInfo info)
|
||||
{
|
||||
var test = (info.GetCustomAttributes(false)
|
||||
.Where(_attr => _attr.GetType() == typeof(SharedLibraryCore.Helpers.LinkedConfiguration))
|
||||
.FirstOrDefault() as SharedLibraryCore.Helpers.LinkedConfiguration);
|
||||
.Where(_attr => _attr.GetType() == typeof(ConfiguratinLinked))
|
||||
.FirstOrDefault() as ConfiguratinLinked);
|
||||
|
||||
return test?.LinkedPropertyNames ?? new string[0];
|
||||
}
|
||||
|
||||
bool shouldIgnore(System.Reflection.PropertyInfo info) => (info.GetCustomAttributes(false)
|
||||
.Where(_attr => _attr.GetType() == typeof(SharedLibraryCore.Helpers.ConfigurationIgnore))
|
||||
.FirstOrDefault() as SharedLibraryCore.Helpers.ConfigurationIgnore) != null;
|
||||
.Where(_attr => _attr.GetType() == typeof(ConfigurationIgnore))
|
||||
.FirstOrDefault() as ConfigurationIgnore) != null;
|
||||
|
||||
bool isOptional(System.Reflection.PropertyInfo info) => (info.GetCustomAttributes(false)
|
||||
.Where(_attr => _attr.GetType() == typeof(SharedLibraryCore.Helpers.ConfigurationOptional))
|
||||
.FirstOrDefault() as SharedLibraryCore.Helpers.ConfigurationOptional) != null;
|
||||
.Where(_attr => _attr.GetType() == typeof(ConfigurationOptional))
|
||||
.FirstOrDefault() as ConfigurationOptional) != null;
|
||||
|
||||
bool hasLinkedParent(System.Reflection.PropertyInfo info)
|
||||
{
|
||||
@ -34,9 +37,9 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 text-white-50 ">
|
||||
<h3 class="text-white">@ViewData["Title"]</h3>
|
||||
<h5 class="mb-4">@noticeText</h5>
|
||||
<form method="post">
|
||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||
|
||||
@foreach (var property in properties)
|
||||
{
|
||||
if (shouldIgnore(property))
|
||||
@ -59,12 +62,13 @@
|
||||
{
|
||||
if (hasLinkedParent(property))
|
||||
{
|
||||
<div id="@($"{property.Name}_content")" class="@(linkedPropertyNames.Length == 0 ? "" : "hide") bg-dark pl-3 pr-3">
|
||||
<div id="@($"{property.Name}_content")" class="@(linkedPropertyNames.Length == 0 ? "hide" : "hide") bg-dark pl-3 pr-3 pb-2">
|
||||
@if (linkedPropertyNames.Length == 0)
|
||||
{
|
||||
@Html.Label(property.Name, null, new { @class = "" })
|
||||
@Html.Label(property.Name, null, new { @class = "mt-2" })
|
||||
}
|
||||
@Html.Editor(property.Name, new { htmlAttributes = new { @class = $"form-group form-control bg-dark text-white-50 {(linkedPropertyNames.Length == 0 ? "mb-3" : "mb-0")}" } })
|
||||
<a asp-controller="Configuration" asp-action="GetNewListItem" asp-route-propertyName="@property.Name" class="btn btn-primary configuration-add-new">@addText</a>
|
||||
</div>
|
||||
}
|
||||
|
||||
@ -73,7 +77,14 @@
|
||||
@Html.Label(property.Name, null, new { @class = "bg-primary pl-3 pr-3 p-2 mb-0 w-100" })
|
||||
<div id="@($"{property.Name}_content")" class="pl-3 pr-3 pt-2 pb-3 bg-dark">
|
||||
@Html.Editor(property.Name, new { htmlAttributes = new { @class = "form-control bg-dark text-white-50 mt-3 mb-3", placeholder = isOptional(property) ? optionalText : "" } })
|
||||
<a asp-controller="Configuration" asp-action="GetNewListItem" asp-route-propertyName="@property.Name" class="btn btn-primary configuration-add-new mt-2">@addText</a>
|
||||
@if (property.PropertyType.GenericTypeArguments[0].Name == "ServerConfiguration")
|
||||
{
|
||||
<button asp-action="Edit" asp-route-addNewServer="true" class="btn btn-primary">@addServerText</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<a asp-controller="Configuration" asp-action="GetNewListItem" asp-route-propertyName="@property.Name" class="btn btn-primary configuration-add-new">@addText</a>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
@ -97,7 +108,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
<button asp-controller="Configuration" asp-action="Edit" class="btn btn-primary btn-block">@saveText</button>
|
||||
<button asp-controller="Configuration" asp-action="Edit" asp-route-shouldSave="true" class="btn btn-primary btn-block">@saveText</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,6 +1,3 @@
|
||||
@model WebfrontCore.ViewModels.ConfigurationInfo
|
||||
@{
|
||||
int index = Model.PropertyValue.Count + (Model.NewItemCount - Model.PropertyValue.Count);
|
||||
}
|
||||
|
||||
<input class="form-control bg-dark text-white-50 mb-2 text-box single-line" id="@($"{Model.PropertyName}_{index}_")" name="@($"{Model.PropertyName}[{index}]")" type="text" />
|
||||
<input class="form-control bg-dark text-white-50 mb-2 text-box single-line" id="@($"{Model.PropertyName.Replace('[', '_').Replace(']', '_').Replace('.', '_')}_{Model.NewItemCount - 1}_")" name="@($"{Model.PropertyName}[{Model.NewItemCount- 1}]")" type="text" />
|
@ -1,6 +1,52 @@
|
||||
@model List<SharedLibraryCore.Configuration.ServerConfiguration>
|
||||
@Html.EditorFor(s => s)
|
||||
@*@foreach (var server in Model)
|
||||
@model IList<SharedLibraryCore.Configuration.ServerConfiguration>
|
||||
@{
|
||||
string labelClass = "mb-2 mt-1";
|
||||
string editorClass = "form-control bg-dark text-white-50 text-box single-line mb-2 mt-0";
|
||||
string addText = SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CONFIGURATION_ADD"];
|
||||
string optionalText = SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["COMMAND_HELP_OPTIONAL"];
|
||||
int startAt = ViewBag.AddNew ?? false ? Model.Count - 1 : 0;
|
||||
}
|
||||
|
||||
@for (int i = startAt; i < Model.Count; i++)
|
||||
{
|
||||
@Html.EditorFor(s => server.EventParserVersion);
|
||||
}*@
|
||||
<div class="h4 text-white mb-0">@Model[i].IPAddress:@Model[i].Port</div>
|
||||
<div class="border-bottom mb-3">
|
||||
@Html.LabelFor(model => model[i].IPAddress, null, new { @class = labelClass })
|
||||
@Html.EditorFor(model => model[i].IPAddress, new { htmlAttributes = new { @class = editorClass } })
|
||||
|
||||
@Html.LabelFor(model => model[i].Port, null, new { @class = labelClass })
|
||||
@Html.EditorFor(model => model[i].Port, new { htmlAttributes = new { @class = editorClass } })
|
||||
|
||||
@Html.LabelFor(model => model[i].Password, null, new { @class = labelClass })
|
||||
@Html.EditorFor(model => model[i].Password, new { htmlAttributes = new { @class = editorClass } })
|
||||
|
||||
@Html.LabelFor(model => model[i].ManualLogPath, null, new { @class = labelClass })
|
||||
@Html.EditorFor(model => model[i].ManualLogPath, new { htmlAttributes = new { @class = editorClass, placeholder = optionalText } })
|
||||
|
||||
@Html.LabelFor(model => model[i].GameLogServerUrl, null, new { @class = labelClass })
|
||||
@Html.EditorFor(model => model[i].GameLogServerUrl, new { htmlAttributes = new { @class = editorClass, placeholder = optionalText } })
|
||||
|
||||
@Html.LabelFor(model => model[i].RConParserVersion, null, new { @class = labelClass })
|
||||
@Html.EditorFor(model => model[i].RConParserVersion, new { htmlAttributes = new { @class = editorClass } })
|
||||
|
||||
@Html.LabelFor(model => model[i].EventParserVersion, null, new { @class = labelClass })
|
||||
@Html.EditorFor(model => model[i].EventParserVersion, new { htmlAttributes = new { @class = editorClass } })
|
||||
|
||||
@Html.LabelFor(model => model[i].ReservedSlotNumber, null, new { @class = labelClass })
|
||||
@Html.EditorFor(model => model[i].ReservedSlotNumber, new { htmlAttributes = new { @class = editorClass } })
|
||||
|
||||
<div>
|
||||
@Html.LabelFor(model => model[i].Rules, null, new { @class = "bg-primary pl-3 pr-3 p-2 w-100 mt-3" })
|
||||
@Html.EditorFor(model => model[i].Rules, new { htmlAttributes = new { @class = editorClass } })
|
||||
<a asp-controller="Configuration" asp-action="GetNewListItem" asp-route-propertyName="@($"Servers[{i}].Rules")" class="btn btn-primary configuration-add-new mt-2">@addText</a>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
@Html.LabelFor(model => model[i].AutoMessages, null, new { @class = "bg-primary pl-3 pr-3 p-2 w-100 mt-3" })
|
||||
@Html.EditorFor(model => model[i].AutoMessages, new { htmlAttributes = new { @class = editorClass } })
|
||||
<a asp-controller="Configuration" asp-action="GetNewListItem" asp-route-propertyName="@($"Servers[{i}].Automessages")" class="btn btn-primary configuration-add-new mt-2">@addText</a>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@*<button asp-controller="Configuration" asp-action="Edit" asp-route-addNewServer="true" class="btn btn-primary">@addServerText</button>*@
|
||||
|
@ -55,22 +55,11 @@
|
||||
<a href="#" class="nav-link oi oi-person dropdown-toggle oi-fix-navbar w-100" id="account_dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></a>
|
||||
|
||||
<div class="dropdown-menu p-0" aria-labelledby="account_dropdown">
|
||||
@Html.ActionLink(loc["WEBFRONT_NAV_CONSOLE"], "Index", "Console", new { area = "" }, new
|
||||
{
|
||||
@class = "dropdown-item bg-dark text-muted text-center text-lg-left",
|
||||
title = "Web Console"
|
||||
})
|
||||
@Html.ActionLink(loc["WEBFRONT_NAV_PROFILE"], "ProfileAsync", "Client", new { id = ViewBag.User.ClientId }, new
|
||||
{
|
||||
@class = "dropdown-item bg-dark text-muted text-center text-lg-left",
|
||||
title = "Client Profile",
|
||||
})
|
||||
@Html.ActionLink(loc["WEBFRONT_NAV_LOGOUT"], "LogoutAsync", "Account", new { area = "" }, new
|
||||
{
|
||||
@class = "dropdown-item bg-dark text-muted text-center text-lg-left",
|
||||
title = "Logout of account"
|
||||
})
|
||||
<a class="dropdown-item bg-dark text-muted text-center text-lg-left profile-action" href="#" data-action="GenerateLoginToken" aria-hidden="true" title="@loc["WEBFRONT_ACTION_TOKEN"]">@loc["WEBFRONT_ACTION_TOKEN"]</a>
|
||||
<a asp-controller="Console" asp-action="Index" class="dropdown-item bg-dark text-muted text-center text-lg-left">@loc["WEBFRONT_NAV_CONSOLE"]</a>
|
||||
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@ViewBag.User.ClientId" class="dropdown-item bg-dark text-muted text-center text-lg-left">@loc["WEBFRONT_NAV_PROFILE"]</a>
|
||||
<a asp-controller="Configuration" asp-action="Edit" class="dropdown-item bg-dark text-muted text-center text-lg-left">@loc["WEBFRONT_NAV_EDIT_CONFIGURATION"]</a>
|
||||
<a class="dropdown-item bg-dark text-muted text-center text-lg-left profile-action" href="#" data-action="GenerateLoginToken" title="@loc["WEBFRONT_ACTION_TOKEN"]">@loc["WEBFRONT_ACTION_TOKEN"]</a>
|
||||
<a asp-controller="Account" asp-action="LogoutAsync" class="dropdown-item bg-dark text-muted text-center text-lg-left">@loc["WEBFRONT_NAV_LOGOUT"]</a>
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
|
Reference in New Issue
Block a user