Removed asset controllers. Started adding design section in settings

This commit is contained in:
2025-01-07 00:08:19 +01:00
parent 8372cfad1b
commit e299cde6da
10 changed files with 43 additions and 72 deletions

View File

@@ -1,26 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using Moonlight.ApiServer.Services;
using Moonlight.Shared.Http.Responses.Assets;
namespace Moonlight.ApiServer.Http.Controllers.Assets;
[ApiController]
[Route("api/assets")]
public class AssetsController : Controller
{
private readonly AssetService AssetService;
public AssetsController(AssetService assetService)
{
AssetService = assetService;
}
[HttpGet]
public async Task<FrontendAssetResponse> Get()
{
return new FrontendAssetResponse()
{
JavascriptFiles = AssetService.GetJavascriptAssets(),
};
}
}

View File

@@ -1,37 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using MoonCore.Exceptions;
using MoonCore.Models;
using Moonlight.ApiServer.Services;
namespace Moonlight.ApiServer.Http.Controllers.Assets;
[ApiController]
[Route("api/assets/plugins")]
public class AssetsPluginsController : Controller
{
private readonly PluginService PluginService;
public AssetsPluginsController(PluginService pluginService)
{
PluginService = pluginService;
}
[HttpGet]
public Task<HostedPluginsManifest> GetManifest()
{
return Task.FromResult(PluginService.HostedPluginsManifest);
}
[HttpGet("stream")]
public async Task GetAssembly([FromQuery(Name = "assembly")] string assembly)
{
var assembliesMap = PluginService.ClientAssemblyMap;
if (assembliesMap.ContainsKey(assembly))
throw new HttpApiException("The requested assembly could not be found", 404);
var path = assembliesMap[assembly];
await Results.File(path).ExecuteAsync(HttpContext);
}
}

View File

@@ -42,7 +42,7 @@ public class FrontendController : Controller
return configuration; return configuration;
} }
[HttpGet("plugins/{assemblyName}")] [HttpGet("plugins/{assemblyName}")] // TODO: Test this
public async Task GetPluginAssembly(string assemblyName) public async Task GetPluginAssembly(string assemblyName)
{ {
var assembliesMap = PluginService.ClientAssemblyMap; var assembliesMap = PluginService.ClientAssemblyMap;

View File

@@ -39,7 +39,6 @@
<ItemGroup> <ItemGroup>
<Folder Include="Database\Migrations\" /> <Folder Include="Database\Migrations\" />
<Folder Include="Http\Controllers\Frontend\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -27,7 +27,7 @@
<PackageReference Include="MoonCore" Version="1.8.1" /> <PackageReference Include="MoonCore" Version="1.8.1" />
<PackageReference Include="MoonCore.Blazor" Version="1.2.8" /> <PackageReference Include="MoonCore.Blazor" Version="1.2.8" />
<PackageReference Include="MoonCore.PluginFramework" Version="1.0.5"/> <PackageReference Include="MoonCore.PluginFramework" Version="1.0.5"/>
<PackageReference Include="MoonCore.Blazor.Tailwind" Version="1.2.4" /> <PackageReference Include="MoonCore.Blazor.Tailwind" Version="1.2.6" />
</ItemGroup> </ItemGroup>
<!-- <!--

View File

@@ -16,6 +16,7 @@ using Moonlight.Client.Implementations;
using Moonlight.Client.Interfaces; using Moonlight.Client.Interfaces;
using Moonlight.Client.Services; using Moonlight.Client.Services;
using Moonlight.Client.UI; using Moonlight.Client.UI;
using Moonlight.Client.UI.Forms;
using Moonlight.Shared.Misc; using Moonlight.Shared.Misc;
namespace Moonlight.Client; namespace Moonlight.Client;
@@ -154,6 +155,7 @@ public class Startup
{ {
FormComponentRepository.Set<string, StringComponent>(); FormComponentRepository.Set<string, StringComponent>();
FormComponentRepository.Set<int, IntComponent>(); FormComponentRepository.Set<int, IntComponent>();
FormComponentRepository.Set<DateTime, DateComponent>();
return Task.CompletedTask; return Task.CompletedTask;
} }

View File

@@ -17,21 +17,20 @@
"bg-danger-600", "bg-danger-600",
"bg-gradient-to-t", "bg-gradient-to-t",
"bg-gray-100", "bg-gray-100",
"bg-gray-200",
"bg-gray-400", "bg-gray-400",
"bg-gray-50", "bg-gray-50",
"bg-gray-700", "bg-gray-700",
"bg-gray-700/50",
"bg-gray-700/60", "bg-gray-700/60",
"bg-gray-750", "bg-gray-750",
"bg-gray-800", "bg-gray-800",
"bg-gray-800/60", "bg-gray-800/60",
"bg-gray-800/80", "bg-gray-800/80",
"bg-gray-900", "bg-gray-900",
"bg-gray-900/75",
"bg-gray-950", "bg-gray-950",
"bg-indigo-500", "bg-indigo-500",
"bg-info-400", "bg-info-400",
"bg-opacity-50",
"bg-opacity-75",
"bg-slate-900", "bg-slate-900",
"bg-success-400", "bg-success-400",
"bg-tertiary-500", "bg-tertiary-500",
@@ -51,7 +50,6 @@
"border-slate-700", "border-slate-700",
"border-t", "border-t",
"border-transparent", "border-transparent",
"bottom-0",
"bottom-full", "bottom-full",
"col-span-1", "col-span-1",
"col-span-2", "col-span-2",
@@ -60,7 +58,6 @@
"cursor-not-allowed", "cursor-not-allowed",
"cursor-pointer", "cursor-pointer",
"dark:bg-gray-700", "dark:bg-gray-700",
"dark:bg-gray-700/60",
"dark:disabled:bg-gray-800", "dark:disabled:bg-gray-800",
"dark:disabled:border-gray-700", "dark:disabled:border-gray-700",
"dark:disabled:placeholder:text-gray-600", "dark:disabled:placeholder:text-gray-600",
@@ -143,7 +140,6 @@
"h-6", "h-6",
"h-8", "h-8",
"h-[20vh]", "h-[20vh]",
"h-px",
"hidden", "hidden",
"hover:bg-gray-700", "hover:bg-gray-700",
"hover:bg-gray-800", "hover:bg-gray-800",
@@ -242,6 +238,7 @@
"mt-5", "mt-5",
"mt-8", "mt-8",
"mt-auto", "mt-auto",
"mx-2",
"mx-5", "mx-5",
"mx-auto", "mx-auto",
"my-1", "my-1",

View File

@@ -0,0 +1,25 @@
@page "/admin/system/design"
@using MoonCore.Attributes
@using MoonCore.Helpers
@attribute [RequirePermission("admin.system.design")]
@inject HttpApiClient ApiClient
<div class="mb-3">
<NavTabs Index="1" Names="UiConstants.AdminNavNames" Links="UiConstants.AdminNavLinks" />
</div>
<div class="card card-body p-3 justify-end">
</div>
@code
{
private readonly Dictionary<string, string> Colors = new();
protected override void OnInitialized()
{
}
}

View File

@@ -9,6 +9,10 @@
@inject HttpApiClient ApiClient @inject HttpApiClient ApiClient
<div class="mb-3">
<NavTabs Index="0" Names="UiConstants.AdminNavNames" Links="UiConstants.AdminNavLinks" />
</div>
<LazyLoader Load="LoadOverview"> <LazyLoader Load="LoadOverview">
<div class="gap-5 grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-4"> <div class="gap-5 grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-4">
<StatCard Title="CPU Usage" Text="@(OverviewData.CpuUsage + "%")" Icon="icon-cpu"/> <StatCard Title="CPU Usage" Text="@(OverviewData.CpuUsage + "%")" Icon="icon-cpu"/>

View File

@@ -0,0 +1,7 @@
namespace Moonlight.Client;
public static class UiConstants
{
public static readonly string[] AdminNavNames = ["Overview", "Design"];
public static readonly string[] AdminNavLinks = ["/admin/system", "/admin/system/design"];
}