Skip to content
Merged
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
27 changes: 27 additions & 0 deletions src/Our.Umbraco.UiExamples/Build/Our.Umbraco.UiExamples.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<uiexamplesContentFilesPath>$(MSBuildThisFileDirectory)..\content\App_Plugins\uiexamples\**\*.*</uiexamplesContentFilesPath>
</PropertyGroup>

<Target Name="CopyuiexamplesAssets" BeforeTargets="Build">
<ItemGroup>
<uiexamplesContentFiles Include="$(uiexamplesContentFilesPath)" />
</ItemGroup>
<Message Text="Copying uiexamples files: $(uiexamplesContentFilesPath) - #@(uiexamplesContentFiles->Count()) files" Importance="high" />
<Copy
SourceFiles="@(uiexamplesContentFiles)"
DestinationFiles="@(uiexamplesContentFiles->'$(MSBuildProjectDirectory)\App_Plugins\uiexamples\%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="true" />

</Target>

<Target Name="ClearuiexamplesAssets" BeforeTargets="Clean">
<ItemGroup>
<uiexamplesDir Include="$(MSBuildProjectDirectory)\App_Plugins\uiexamples\" />
</ItemGroup>
<Message Text="Clear old uiexamples data" Importance="high" />
<RemoveDir Directories="@(uiexamplesDir)" />
</Target>

</Project>
44 changes: 0 additions & 44 deletions src/Our.Umbraco.UiExamples/Migrations/AddSectionForAdmins.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,57 @@
using Umbraco.Core.Logging;

#if NETCOREAPP
using Umbraco.Cms.Core.Scoping;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core;
using Umbraco.Cms.Infrastructure.Migrations;
using Umbraco.Cms.Core.Logging;
using Umbraco.Cms.Core.Web;
#else
using Umbraco.Core;
using Umbraco.Core.Migrations;
using Umbraco.Core.Scoping;
using Umbraco.Core.Services;
using Umbraco.Web;
#endif


namespace Our.Umbraco.UiExamples.Migrations
{
public class AddSectionToAdminsMigration : MigrationBase
{
public AddSectionToAdminsMigration( IMigrationContext context) : base(context) { }
private readonly IUmbracoContextFactory _context;
private readonly IScopeProvider _scopeProvider;
private readonly IUserService _userService;

public AddSectionToAdminsMigration(IMigrationContext context,
IUmbracoContextFactory umbracoContextFactory,
IScopeProvider scopeProvider,
IUserService userService) : base(context)
{
_userService = userService;
_context = umbracoContextFactory;
_scopeProvider = scopeProvider;
}

#if NETCOREAPP
protected override void Migrate()
#else
public override void Migrate()
#endif
{
Context.Logger.Info<AddSectionToAdminsMigration>("Starting migration to add UI Examples section to the admin usergroup");
Context.AddPostMigration<AddSectionForAdmins>();
Context.Logger.Info<AddSectionToAdminsMigration>("Migration completed");
using (UmbracoContextReference umbracoContextReference = _context.EnsureUmbracoContext())
{
using (var scope = _scopeProvider.CreateScope())
{
var adminGroup = _userService.GetUserGroupByAlias(Constants.Security.AdminGroupAlias);
adminGroup.AddAllowedSection("uiExamples");

_userService.Save(adminGroup);

scope.Complete();
}
}

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//
// FRAMEWORK ONLY CODE
//
#if NETFRAMEWORK
using Umbraco.Core.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.Migrations;
using Umbraco.Core.Migrations.Upgrade;
using Umbraco.Core.Scoping;
using Umbraco.Core.Services;

namespace Our.Umbraco.UiExamples.Migrations
{
public class UiExamplesMigrationComponent : IComponent
{
private readonly IScopeProvider _scopeProvider;
private readonly IMigrationBuilder _migrationBuilder;
private readonly IKeyValueService _keyValueService;
private readonly IProfilingLogger _profilingLogger;

public UiExamplesMigrationComponent(IScopeProvider scopeProvider, IMigrationBuilder migrationBuilder, IKeyValueService keyValueService, IProfilingLogger profilingLogger)
{
_scopeProvider = scopeProvider;
_migrationBuilder = migrationBuilder;
_keyValueService = keyValueService;
_profilingLogger = profilingLogger;
}


public void Initialize()
{
var upgrader = new Upgrader(new UiExamplesMigrationPlan());
upgrader.Execute(_scopeProvider, _migrationBuilder, _keyValueService, _profilingLogger);
}

public void Terminate()
{ }
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,40 +1,35 @@
using Umbraco.Core;
#if NETCOREAPP
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Notifications;
#else
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.Migrations;
using Umbraco.Core.Migrations.Upgrade;
using Umbraco.Core.Scoping;
using Umbraco.Core.Services;
#endif


namespace Our.Umbraco.UiExamples.Migrations
{
[RuntimeLevel(MinLevel = RuntimeLevel.Run)]
public class UiExamplesMigrationComposer : ComponentComposer<UiExamplesMigrationComponent>, IUserComposer
{ }

public class UiExamplesMigrationComponent : IComponent
{
private readonly IScopeProvider _scopeProvider;
private readonly IMigrationBuilder _migrationBuilder;
private readonly IKeyValueService _keyValueService;
private readonly IProfilingLogger _profilingLogger;
#if NETCOREAPP

public UiExamplesMigrationComponent(IScopeProvider scopeProvider, IMigrationBuilder migrationBuilder, IKeyValueService keyValueService, IProfilingLogger profilingLogger)
public class UiExamplesMigrationComposer : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
_scopeProvider = scopeProvider;
_migrationBuilder = migrationBuilder;
_keyValueService = keyValueService;
_profilingLogger = profilingLogger;
builder.AddNotificationHandler<UmbracoApplicationStartingNotification, UmbracoAppStartingHandler>();
}
}


#else
[RuntimeLevel(MinLevel = RuntimeLevel.Run)]
public class UiExamplesMigrationComposer : ComponentComposer<UiExamplesMigrationComponent>, IUserComposer
{ }
#endif



public void Initialize()
{
var upgrader = new Upgrader(new UiExamplesMigrationPlan());
upgrader.Execute(_scopeProvider, _migrationBuilder, _keyValueService, _profilingLogger);
}

public void Terminate()
{ }
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
using Umbraco.Core.Migrations;

#if NETCOREAPP
using Umbraco.Cms.Infrastructure.Migrations;
#else
using Umbraco.Core.Migrations;
#endif

namespace Our.Umbraco.UiExamples.Migrations
{
Expand Down
43 changes: 43 additions & 0 deletions src/Our.Umbraco.UiExamples/Migrations/UmbracoAppStartingHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#if NETCOREAPP

using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Migrations;
using Umbraco.Cms.Core.Notifications;
using Umbraco.Cms.Core.Scoping;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Infrastructure.Migrations.Upgrade;

namespace Our.Umbraco.UiExamples.Migrations
{
public class UmbracoAppStartingHandler
: INotificationHandler<UmbracoApplicationStartingNotification>
{
private readonly IRuntimeState _runtimeState;
private readonly IMigrationPlanExecutor _migrationPlanExecutor;
private readonly IScopeProvider _scopeProvider;
private readonly IKeyValueService _keyValueService;

public UmbracoAppStartingHandler(IRuntimeState runtimeState,
IMigrationPlanExecutor migrationPlanExecutor,
IScopeProvider scopeProvider,
IKeyValueService keyValueService
)
{
_runtimeState = runtimeState;

_migrationPlanExecutor = migrationPlanExecutor;
_scopeProvider = scopeProvider;
_keyValueService = keyValueService;
}
public void Handle(UmbracoApplicationStartingNotification notification)
{
if (_runtimeState.Level == global::Umbraco.Cms.Core.RuntimeLevel.Run)
{
var upgrader = new Upgrader(new UiExamplesMigrationPlan());
upgrader.Execute(_migrationPlanExecutor, _scopeProvider, _keyValueService);

}
}
}
}
#endif
65 changes: 60 additions & 5 deletions src/Our.Umbraco.UiExamples/Our.Umbraco.UiExamples.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,66 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<TargetFrameworks>net472;net50</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="UmbracoCms.Web" Version="8.10.1" />
</ItemGroup>
<!-- nuget package stuff -->
<PropertyGroup>
<PackageId>Our.Umbraco.UIExamples</PackageId>
<Version>2.0-beta001</Version>

<PackageIconUrl></PackageIconUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://our.umbraco.com/packages/developer-tools/ui-examples/</PackageProjectUrl>
<PackageTags>Umbraco</PackageTags>

<RepositoryUrl>https://github.com/umbraco/UI-Examples</RepositoryUrl>

<Description>A collection of backoffice elements designed to help Umbraco developers extend the backoffice.</Description>
<PackageReleaseNotes>
1.0 - Initial version
2.0 - Multi-targeted v8/v9 version
</PackageReleaseNotes>

<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>

<ContentTargetFolders>content</ContentTargetFolders>

<PackageOutputPath>../../output</PackageOutputPath>

</PropertyGroup>

<!-- package files -->
<ItemGroup>
<Content Include="App_Plugins\**\*.*">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
</Content>

<!-- target file to copy app_plugins in .netcore -->
<None Include="build\**\*.*">
<Pack>True</Pack>
<PackagePath>buildTransitive</PackagePath>
</None>

</ItemGroup>


<ItemGroup Condition="'$(TargetFramework)' == 'net472'">
<PackageReference Include="UmbracoCms.Web" Version="8.10.1" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net50'">
<PackageReference Include="Umbraco.Cms.Web.Website" Version="9.0.0-rc001" />
<PackageReference Include="Umbraco.Cms.Web.BackOffice" Version="9.0.0-rc001" />
</ItemGroup>

<Target Name="RemoveLuceneAnalyzer" BeforeTargets="CoreCompile">
<ItemGroup>
<Analyzer Remove="@(Analyzer)" Condition="%(FileName) == 'Lucene.Net.CodeAnalysis.CSharp'" />
</ItemGroup>
</Target>

</Project>
Loading