Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/umbraco v14 backoffice #31

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions samples/UmbracoV14/Relewise.UmbracoV14.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<ItemGroup>
<!-- Opt-in to app-local ICU to ensure consistent globalization APIs across different platforms -->
<PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="72.1.0.3" />
<!--<ProjectReference Include="..\..\src\Integrations.Umbraco\Integrations.Umbraco.csproj" />-->
<RuntimeHostConfigurationOption Include="System.Globalization.AppLocalIcu" Value="72.1.0.3" Condition="$(RuntimeIdentifier.StartsWith('linux')) or $(RuntimeIdentifier.StartsWith('win')) or ('$(RuntimeIdentifier)' == '' and !$([MSBuild]::IsOSPlatform('osx')))" />
</ItemGroup>

Expand Down
6 changes: 5 additions & 1 deletion samples/UmbracoV14/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,9 @@
"AllowConcurrentLogins": false
}
}
},
"ConnectionStrings": {
"umbracoDbDSN": "Server=.\\SQLExpress;Database=umb14;Integrated Security=true;TrustServerCertificate=true;",
"umbracoDbDSN_ProviderName": "Microsoft.Data.SqlClient"
}
}
}
27 changes: 17 additions & 10 deletions src/Integrations.Umbraco/Controllers/DashboardApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,36 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Asp.Versioning;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Relewise.Client;
using Relewise.Client.Extensions;
using Relewise.Client.Search;
using Relewise.Integrations.Umbraco.Infrastructure.Mvc.Middlewares;
using Relewise.Integrations.Umbraco.Services;
using Umbraco.Cms.Web.BackOffice.Filters;
using Umbraco.Cms.Api.Common.Attributes;
using Umbraco.Cms.Web.Common.Attributes;
using Umbraco.Cms.Web.Common.Controllers;
using Umbraco.Cms.Web.Common.Authorization;
using Umbraco.Cms.Web.Common.Routing;

namespace Relewise.Integrations.Umbraco.Controllers;

/// <summary>
/// Defines endpoints for the Dashboard
/// </summary>
[JsonCamelCaseFormatter]
[PluginController("Relewise")]
public class DashboardApiController : UmbracoAuthorizedController
[ApiController]
[BackOfficeRoute("relewise/api/v{version:apiVersion}/relewise")]
[Authorize(Policy = "New" + AuthorizationPolicies.BackOfficeAccess)]
[MapToApi("relewise")]
[ApiVersion("1.0")]
[ApiExplorerSettings(GroupName = "relewise")]
public class DashboardApiController : ControllerBase
{
// https://dev.to/kevinjump/early-adopters-guide-to-umbraco-v14-packages-communicating-with-the-server-part-1-38lb

private readonly IExportContentService _exportContent;
private readonly IServiceProvider _provider;
private readonly RelewiseUmbracoConfiguration _configuration;
Expand All @@ -44,10 +54,8 @@ public DashboardApiController(IExportContentService exportContent, IServiceProvi
/// <summary>
/// Performs a full content export
/// </summary>
/// <param name="permanentlyDelete"></param>
/// <param name="token"></param>
/// <returns></returns>
[HttpPost]
[ProducesResponseType(200)]
public async Task<IActionResult> ContentExport([FromQuery] bool permanentlyDelete, CancellationToken token)
{
await _exportContent.ExportAll(new ExportAllContent(permanentlyDelete), token);
Expand All @@ -58,7 +66,6 @@ public async Task<IActionResult> ContentExport([FromQuery] bool permanentlyDelet
/// <summary>
/// Returns the current Relewise configuration
/// </summary>
/// <returns></returns>
[HttpGet]
public IActionResult Configuration()
{
Expand All @@ -73,7 +80,7 @@ public IActionResult Configuration()
}
catch (Exception ex)
{
return Ok(new
return Ok(new // TODO: Add a specific Response (so we can use it in the Produces...-attribute
{
FactoryFailed = true,
ErrorMessage = ex.Message
Expand Down Expand Up @@ -118,7 +125,7 @@ public IActionResult Configuration()
// we'll just ignore this exception as it just means that there no default client has been configured, which is okay
}

return Ok(new
return Ok(new // TODO: Add a specific Response (so we can use it in the Produces...-attribute
{
_configuration.TrackedContentTypes,
_configuration.ExportedContentTypes,
Expand Down
18 changes: 9 additions & 9 deletions src/Integrations.Umbraco/Dashboards/RelewiseDashboard.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using System;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.Dashboards;
//using Umbraco.Cms.Core.Dashboards;

namespace Relewise.Integrations.Umbraco.Dashboards;

[Weight(40)]
internal class RelewiseDashboard : IDashboard
{
public string Alias => "relewiseDashboard";
public string View => "/App_Plugins/Relewise.Dashboard/dashboard.html?v=4";
public string[] Sections => new[] { "Settings" };
public IAccessRule[] AccessRules => Array.Empty<IAccessRule>();
}
//[Weight(40)]
//internal class RelewiseDashboard : IDashboard
//{
// public string Alias => "relewiseDashboard";
// public string View => "/App_Plugins/Relewise.Dashboard/dashboard.html?v=4";
// public string[] Sections => new[] { "Settings" };
// public IAccessRule[] AccessRules => Array.Empty<IAccessRule>();
//}
26 changes: 18 additions & 8 deletions src/Integrations.Umbraco/Integrations.Umbraco.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<!--<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>-->
<TargetFrameworks>net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<WarningsAsErrors>true</WarningsAsErrors>
Expand Down Expand Up @@ -30,27 +31,36 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Relewise.Client" Version="[1.96.0, 2)" />
<PackageReference Include="Relewise.Client.Extensions" Version="[1.4.1, 2)" />
<PackageReference Include="Relewise.Client" Version="[1.150.0, 2)" />
<PackageReference Include="Relewise.Client.Extensions" Version="[1.5.0, 2)" />
<PackageReference Include="Umbraco.Cms.Api.Common" Version="14.0.0-rc1" />
<!--<PackageReference Include="Umbraco.Cms.Web.BackOffice" Version="14.0.0-rc2" />-->
<PackageReference Include="Umbraco.Cms.Web.Common" Version="14.0.0-rc2" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<!-- Version 10-13 -->
<!--<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Umbraco.Cms.Web.Common">
<Version>14.0.0-rc2</Version>
</PackageReference>
</ItemGroup>-->

<!--<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
--><!-- Version 10-13 --><!--
<PackageReference Include="Umbraco.Cms.Web.BackOffice" Version="[10.0.0,14)" />
<PackageReference Include="Umbraco.Cms.Web.Common" Version="[10.0.0,14)" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<!-- Version 10-12 -->
--><!-- Version 10-12 --><!--
<PackageReference Include="Umbraco.Cms.Web.BackOffice" Version="[10.0.0,13)" />
<PackageReference Include="Umbraco.Cms.Web.Common" Version="[10.0.0,13)" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<!-- Version 9-10 -->
--><!-- Version 9-10 --><!--
<PackageReference Include="Umbraco.Cms.Web.BackOffice" Version="[9.0.0,11)" />
<PackageReference Include="Umbraco.Cms.Web.Common" Version="[9.0.0,11)" />
</ItemGroup>
</ItemGroup>-->

<ItemGroup>
<Content Include="App_Plugins\Relewise.Dashboard\**\*.*">
Expand Down
2 changes: 1 addition & 1 deletion src/Integrations.Umbraco/UmbracoBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static IUmbracoBuilder AddRelewise(this IUmbracoBuilder builder, Action<R
builder.AddNotificationAsyncHandler<ContentMovedNotification, RelewiseContentMovedNotificationHandler>();
builder.AddNotificationAsyncHandler<ContentMovedToRecycleBinNotification, RelewiseContentMovedToRecycleBinNotificationHandler>();

builder.Dashboards().Add<RelewiseDashboard>();
//builder.Dashboards().Add<RelewiseDashboard>();

builder.Services.Configure<UmbracoPipelineOptions>(umbPipOptions =>
{
Expand Down