New endpoint for web profiling dashboard (#13038)
* Endpoint for web profiling dashboard * Add profiling API contract
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NSwag.Annotations;
|
||||
using Umbraco.New.Cms.Web.Common.Routing;
|
||||
|
||||
namespace Umbraco.Cms.ManagementApi.Controllers.Profiling;
|
||||
|
||||
[ApiVersion("1.0")]
|
||||
[ApiController]
|
||||
[BackOfficeRoute("api/v{version:apiVersion}/profiling")]
|
||||
[OpenApiTag("Profiling")]
|
||||
public class ProfilingControllerBase : ManagementApiControllerBase
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Core.Hosting;
|
||||
using Umbraco.Cms.ManagementApi.ViewModels.Profiling;
|
||||
|
||||
namespace Umbraco.Cms.ManagementApi.Controllers.Profiling;
|
||||
|
||||
public class StatusProfilingController : ProfilingControllerBase
|
||||
{
|
||||
private readonly IHostingEnvironment _hosting;
|
||||
|
||||
public StatusProfilingController(IHostingEnvironment hosting) => _hosting = hosting;
|
||||
|
||||
[HttpGet("status")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(ProfilingStatusViewModel), StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<ProfilingStatusViewModel>> Status()
|
||||
=> await Task.FromResult(Ok(new ProfilingStatusViewModel(_hosting.IsDebugMode)));
|
||||
}
|
||||
@@ -253,6 +253,26 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/umbraco/api/v1/profiling/status": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Profiling"
|
||||
],
|
||||
"operationId": "StatusProfiling_Status",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProfilingStatusViewModel"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
@@ -535,6 +555,15 @@
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ProfilingStatusViewModel": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -545,6 +574,9 @@
|
||||
{
|
||||
"name": "Server"
|
||||
},
|
||||
{
|
||||
"name": "Profiling"
|
||||
},
|
||||
{
|
||||
"name": "Install"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Umbraco.Cms.ManagementApi.ViewModels.Profiling;
|
||||
|
||||
public class ProfilingStatusViewModel
|
||||
{
|
||||
public ProfilingStatusViewModel(bool enabled) => Enabled = enabled;
|
||||
|
||||
public bool Enabled { get; }
|
||||
}
|
||||
Reference in New Issue
Block a user