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

Migrate nuPickers to v8 #199

Open
wants to merge 46 commits into
base: v8
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
3e3f636
Initial commit for v8
Aug 10, 2019
bc3ef7c
Move events to components, migrate shared logic
Aug 10, 2019
81e898f
ignore rider files, migrate editor to v8
Aug 10, 2019
768555f
Migrated enumpicker
Aug 10, 2019
0c7022f
First changes for EnumCheckboxPicker
Aug 10, 2019
bc04073
Enum Labels Editor
Aug 11, 2019
9e47684
Enum Lables Editor, Enum PrefetchList Picker
Aug 11, 2019
dcb48f4
MIgrate DonetPagedListPicker, move unit testing to Nunit
Aug 11, 2019
35dc368
JsonLabels and Jsondropdown
Aug 11, 2019
36c2321
Lucene Picker
Aug 11, 2019
30318a6
LuceneLabels
Aug 11, 2019
2ba874c
enum,json, lucene pickers
Aug 11, 2019
5e7aff6
bum minimal umbraco version to 8.1.1.
Aug 12, 2019
728b5f7
correct building process, working on http handler
Aug 12, 2019
745c75c
restore original file extensions
Aug 12, 2019
61d2340
Solve problem with embed resources
Aug 12, 2019
86da127
sql dropdown picker
Aug 12, 2019
c06bd3b
DotNet Pickers
Aug 12, 2019
fad6667
get list of all searchers
Aug 12, 2019
94728d6
adjust namespace, refactor from propertyeditor to dataeditor
Aug 12, 2019
0e5fb1b
Migrate next DataEditors, refactor names,
Aug 12, 2019
ce4f7a3
migrate next DataType Editors, refactor names
Aug 12, 2019
097bacd
Json type a head data editor
Aug 12, 2019
62a7ef5
Lucene Checkbox, refactor name of lucene, sql picker
Aug 13, 2019
11527b3
Lucene Prefetch editor, replace PropertyEditorConstants with DataEdit…
Aug 13, 2019
9e2f7c7
adjust namespace in not included editors yet
Aug 13, 2019
649d81c
Mass replace PropertyEditor with dataeditor, migrate LuceneRadioButton
Aug 13, 2019
24c3109
Replace PreValueField, prevalueeditor with configuration, migrate Rel…
Aug 13, 2019
abecc82
Mass add name of Fields, unification of names
Aug 13, 2019
58dca5f
Correct earlier Mass replacement
Aug 13, 2019
bf3c6b0
Migrate sqlcheckboxpicker
Aug 13, 2019
a3e5310
migrate sql labels
Aug 13, 2019
fa6a884
migrate last sql pickers
Aug 13, 2019
757b1db
Use correct Configuration
Aug 14, 2019
27ed7c9
Restore original building script
Aug 14, 2019
218212a
remove idea rider files
Aug 14, 2019
9262563
use owner IPublishedContent instead of assign content
Aug 14, 2019
04cf3da
Fix for empty prevalues
Aug 15, 2019
92a7436
Change Value Convert to use Picker instead of String
Nov 8, 2019
651efc0
remove notimplemented which is currently generating errors in log
ismailmayat Nov 13, 2019
2f3d835
Ensure that saveFormat is saved as a string for every property editor
bowserm Jan 16, 2020
8d7c218
Merge pull request #1 from bowserm/v8/develop
bielu Jan 17, 2020
7f93b1f
upgraded to latest version of Umbraco + fixed issue with null check o…
May 5, 2020
884fa5d
Merge pull request #2 from Ric-Carey/v8/develop
May 6, 2020
0510f38
Fixed issue for nuPickers added to Membertypes
niekvanderreest Nov 9, 2020
98708a9
Merge pull request #3 from niekvanderreest/patch-1
Sep 22, 2021
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,4 @@ package/nuPickers*.zip
# Exclude local test sites
www*/
source/nuWebTestSite/
source/.idea/
7 changes: 4 additions & 3 deletions build-appveyor.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ IF NOT EXIST "%toolsFolder%" (
IF NOT EXIST "%toolsFolder%vswhere.exe" (
ECHO vswhere not found - fetching now
nuget install vswhere -Version 2.3.2 -Source nuget.org -OutputDirectory tools
FOR /f "delims=" %%A in ('dir "%toolsFolder%vswhere.*" /b') DO SET "vswhereExePath=%toolsFolder%%%A"
MOVE "%vswhereExePath%tools\vswhere.exe" "%toolsFolder%vswhere.exe"
)

FOR /f "delims=" %%A in ('dir "%toolsFolder%vswhere.*" /b') DO SET "vswhereExePath=%toolsFolder%%%A\"
MOVE "%vswhereExePath%tools\vswhere.exe" "%toolsFolder%vswhere.exe"


for /f "usebackq tokens=1* delims=: " %%i in (`"%CD%\tools\vswhere.exe" -latest -requires Microsoft.Component.MSBuild`) do (
if /i "%%i"=="installationPath" set InstallDir=%%j
Expand All @@ -31,7 +32,7 @@ ECHO.
ECHO Visual Studio is installed in: %InstallDir%

CALL "%InstallDir%\MSBuild\15.0\Bin\amd64\MsBuild.exe" nupickers.proj %~1

//CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\amd64\MsBuild.exe" nupickers.proj %~1
@IF %ERRORLEVEL% NEQ 0 GOTO err
@EXIT /B 0
:err
Expand Down
4 changes: 2 additions & 2 deletions build/nuPickers.proj
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<!-- SHARED PROPERTIES -->
<PropertyGroup>
<PackageName>nuPickers</PackageName>
<MinUmbracoVersion>7.2.3</MinUmbracoVersion>
<Readme>nuPickers is a collection of Umbraco v7 Property Editors</Readme>
<MinUmbracoVersion>8.1.1</MinUmbracoVersion>
<Readme>nuPickers is a collection of Umbraco v8 Property Editors</Readme>
<AuthorName>The nuPickers Team</AuthorName>
<AuthorUrl>https://github.com/uComponents/nuPickers/graphs/contributors</AuthorUrl>
<PackageLicenseName>MIT license</PackageLicenseName>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,77 +1,76 @@
namespace nuPickers.Tests.EmbeddedResource
{
using Microsoft.VisualStudio.TestTools.UnitTesting;
using nuPickers.EmbeddedResource;
using nuPickers.EmbeddedResource;

[TestClass]
namespace nuPickers.Tests.EmbeddedResource
{
using NUnit.Framework;
public class HelperEmbeddedResourceHelperTests
{
// reference to known embedded resources (picked first folder in shared)
private const string HTML_RESOURCE = "CheckBoxPicker.CheckBoxPickerEditor.html";
private const string CSS_RESOURCE = "CheckBoxPicker.CheckBoxPickerEditor.css";
private const string JS_RESOURCE = "CheckBoxPicker.CheckBoxPickerEditorController.js";
private const string HtmlResource = "CheckBoxPicker.CheckBoxPickerEditor.html";
private const string CssResource = "CheckBoxPicker.CheckBoxPickerEditor.css";
private const string JsResource = "CheckBoxPicker.CheckBoxPickerEditorController.js";

[TestMethod]
[Test]
public void ResourceNamesThatDoNotExist()
{
Assert.IsFalse(EmbeddedResourceHelper.ResourceExists(null));
Assert.IsFalse(EmbeddedResourceHelper.ResourceExists(string.Empty));
// file extension is for client dependency framework, so used not needed for html files
Assert.IsFalse(EmbeddedResourceHelper.ResourceExists(EmbeddedResource.RESOURCE_PREFIX + CSS_RESOURCE + EmbeddedResource.FILE_EXTENSION));
Assert.IsFalse(EmbeddedResourceHelper.ResourceExists(EmbeddedResource.RESOURCE_PREFIX + JS_RESOURCE + EmbeddedResource.FILE_EXTENSION));
Assert.IsFalse(EmbeddedResourceHelper.ResourceExists(nuPickers.EmbeddedResource.EmbeddedResource.RESOURCE_PREFIX + CssResource + nuPickers.EmbeddedResource.EmbeddedResource.FILE_EXTENSION));
Assert.IsFalse(EmbeddedResourceHelper.ResourceExists(nuPickers.EmbeddedResource.EmbeddedResource.RESOURCE_PREFIX + JsResource + nuPickers.EmbeddedResource.EmbeddedResource.FILE_EXTENSION));
}

[TestMethod]
[Test]
public void ResourceNamesThatExist()
{
Assert.IsTrue(EmbeddedResourceHelper.ResourceExists(EmbeddedResource.RESOURCE_PREFIX + HTML_RESOURCE));
Assert.IsTrue(EmbeddedResourceHelper.ResourceExists(EmbeddedResource.RESOURCE_PREFIX + CSS_RESOURCE));
Assert.IsTrue(EmbeddedResourceHelper.ResourceExists(EmbeddedResource.RESOURCE_PREFIX + JS_RESOURCE));
Assert.IsTrue(EmbeddedResourceHelper.ResourceExists(nuPickers.EmbeddedResource.EmbeddedResource.RESOURCE_PREFIX + HtmlResource));
Assert.IsTrue(EmbeddedResourceHelper.ResourceExists(nuPickers.EmbeddedResource.EmbeddedResource.RESOURCE_PREFIX + CssResource));
Assert.IsTrue(EmbeddedResourceHelper.ResourceExists(nuPickers.EmbeddedResource.EmbeddedResource.RESOURCE_PREFIX + JsResource));
}

[TestMethod]
[Test]
public void GetResourcesThatDoNotExist()
{
Assert.IsNull(EmbeddedResourceHelper.GetResource(null));
Assert.IsNull(EmbeddedResourceHelper.GetResource(string.Empty));
// file extension is for client dependency framework, so used not needed for html files
Assert.IsNull(EmbeddedResourceHelper.GetResource(EmbeddedResource.RESOURCE_PREFIX + CSS_RESOURCE + EmbeddedResource.FILE_EXTENSION));
Assert.IsNull(EmbeddedResourceHelper.GetResource(EmbeddedResource.RESOURCE_PREFIX + JS_RESOURCE + EmbeddedResource.FILE_EXTENSION));
Assert.IsNull(EmbeddedResourceHelper.GetResource(nuPickers.EmbeddedResource.EmbeddedResource.RESOURCE_PREFIX + CssResource + nuPickers.EmbeddedResource.EmbeddedResource.FILE_EXTENSION));
Assert.IsNull(EmbeddedResourceHelper.GetResource(nuPickers.EmbeddedResource.EmbeddedResource.RESOURCE_PREFIX + JsResource + nuPickers.EmbeddedResource.EmbeddedResource.FILE_EXTENSION));
}

[TestMethod]
[Test]
public void GetResourcesThatExist()
{
Assert.IsNotNull(EmbeddedResourceHelper.GetResource(EmbeddedResource.RESOURCE_PREFIX + HTML_RESOURCE));
Assert.IsNotNull(EmbeddedResourceHelper.GetResource(EmbeddedResource.RESOURCE_PREFIX + CSS_RESOURCE));
Assert.IsNotNull(EmbeddedResourceHelper.GetResource(EmbeddedResource.RESOURCE_PREFIX + JS_RESOURCE));
Assert.IsNotNull(EmbeddedResourceHelper.GetResource(nuPickers.EmbeddedResource.EmbeddedResource.RESOURCE_PREFIX + HtmlResource));
Assert.IsNotNull(EmbeddedResourceHelper.GetResource(nuPickers.EmbeddedResource.EmbeddedResource.RESOURCE_PREFIX + CssResource));
Assert.IsNotNull(EmbeddedResourceHelper.GetResource(nuPickers.EmbeddedResource.EmbeddedResource.RESOURCE_PREFIX + JsResource));
}

[TestMethod]
[Test]
public void GetResourceNameFromValidPath()
{
Assert.AreEqual(
EmbeddedResource.RESOURCE_PREFIX,
EmbeddedResourceHelper.GetResourceNameFromPath(EmbeddedResource.ROOT_URL));
nuPickers.EmbeddedResource.EmbeddedResource.RESOURCE_PREFIX,
EmbeddedResourceHelper.GetResourceNameFromPath(nuPickers.EmbeddedResource.EmbeddedResource.ROOT_URL));

Assert.AreEqual(
EmbeddedResource.RESOURCE_PREFIX + "folder.file.ext",
EmbeddedResourceHelper.GetResourceNameFromPath(EmbeddedResource.ROOT_URL + "folder/file.ext"));
nuPickers.EmbeddedResource.EmbeddedResource.RESOURCE_PREFIX + "folder.file.ext",
EmbeddedResourceHelper.GetResourceNameFromPath(nuPickers.EmbeddedResource.EmbeddedResource.ROOT_URL + "folder/file.ext"));

Assert.AreEqual(
EmbeddedResource.RESOURCE_PREFIX + "folder.file.ext",
EmbeddedResourceHelper.GetResourceNameFromPath(EmbeddedResource.ROOT_URL + "folder/file.ext" + EmbeddedResource.FILE_EXTENSION));
nuPickers.EmbeddedResource.EmbeddedResource.RESOURCE_PREFIX + "folder.file.ext",
EmbeddedResourceHelper.GetResourceNameFromPath(nuPickers.EmbeddedResource.EmbeddedResource.ROOT_URL + "folder/file.ext" + nuPickers.EmbeddedResource.EmbeddedResource.FILE_EXTENSION));
}

[TestMethod]
[Test]
public void GetResourceNameFromInvalidPath()
{
Assert.IsNull(EmbeddedResourceHelper.GetResourceNameFromPath(null));
Assert.IsNull(EmbeddedResourceHelper.GetResourceNameFromPath(string.Empty));
Assert.IsNull(EmbeddedResourceHelper.GetResourceNameFromPath("folder/file.ext"));
Assert.IsNull(EmbeddedResourceHelper.GetResourceNameFromPath("/folder/file.ext"));
Assert.IsNull(EmbeddedResourceHelper.GetResourceNameFromPath("~/folder/file.ext"));
Assert.IsNull(EmbeddedResourceHelper.GetResourceNameFromPath("~/folder/file.ext" + EmbeddedResource.FILE_EXTENSION));
Assert.IsNull(EmbeddedResourceHelper.GetResourceNameFromPath("~/folder/file.ext" + nuPickers.EmbeddedResource.EmbeddedResource.FILE_EXTENSION));
}
}
}
19 changes: 18 additions & 1 deletion source/nuPickers.Tests/nuPickers.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\NUnit.3.12.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand All @@ -8,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>nuPickers.Tests</RootNamespace>
<AssemblyName>nuPickers.Tests</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
Expand All @@ -35,6 +36,10 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb">
<HintPath>..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
</ItemGroup>
<Choose>
Expand All @@ -61,6 +66,12 @@
<Name>nuPickers</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="DataSources" />
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
Expand All @@ -81,6 +92,12 @@
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.12.0\build\NUnit.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
4 changes: 4 additions & 0 deletions source/nuPickers.Tests/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit" version="3.12.0" targetFramework="net472" />
</packages>
39 changes: 0 additions & 39 deletions source/nuPickers/Caching/CacheInvalidation.cs

This file was deleted.

69 changes: 69 additions & 0 deletions source/nuPickers/Components/CacheInvalidationComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
using System;
using System.ComponentModel;
using System.Linq;
using nuPickers.Caching;
using Umbraco.Core.Events;
using Umbraco.Core.Models;
using Umbraco.Core.Services;
using Umbraco.Core.Services.Implement;

namespace nuPickers.Components
{
public class CacheInvalidationComponent : IComponent, Umbraco.Core.Composing.IComponent
{
private ContentService _contentService;
private DataTypeService _dataTypeService;

public CacheInvalidationComponent(ContentService contentService, DataTypeService dataTypeService)
{
_contentService = contentService;
_dataTypeService = dataTypeService;
}

public void Dispose()
{

}

public ISite Site { get; set; }
public event EventHandler Disposed;

public void Initialize()
{
ContentService.Saved += this.ContentService_Saved;
ContentService.Deleted += this.ContentService_Deleted;

DataTypeService.Saved += this.DataTypeService_Saved;
DataTypeService.Deleted += this.DataTypeService_Deleted;
}

public void Terminate()
{

}

private void ContentService_Saved(IContentService sender, SaveEventArgs<IContent> e)
{
e.SavedEntities.ToList().ForEach(x =>
Cache.Instance.Remove(y => y.StartsWith(CacheConstants.PickedKeysPrefix + x.Id.ToString())));
}

private void ContentService_Deleted(IContentService sender, DeleteEventArgs<IContent> e)
{
e.DeletedEntities.ToList().ForEach(x =>
Cache.Instance.Remove(y => y.StartsWith(CacheConstants.PickedKeysPrefix + x.Id.ToString())));
}

private void DataTypeService_Saved(IDataTypeService sender, SaveEventArgs<IDataType> e)
{
e.SavedEntities.ToList().ForEach(
x => Cache.Instance.Remove(CacheConstants.DataTypePreValuesPrefix + x.Id.ToString()));
}

private void DataTypeService_Deleted(IDataTypeService sender, DeleteEventArgs<IDataType> e)
{
e.DeletedEntities.ToList().ForEach(x =>
Cache.Instance.Remove(CacheConstants.DataTypePreValuesPrefix + x.Id.ToString()));
}
}
}
52 changes: 52 additions & 0 deletions source/nuPickers/Components/EmbeddedResourceCompontent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System;
using System.ComponentModel;
using System.Web.Mvc;
using System.Web.Routing;
using ClientDependency.Core;
using nuPickers.EmbeddedResource;
using Umbraco.Core.Logging;

namespace nuPickers.Components
{
public class EmbeddedResourceCompontent : IComponent, Umbraco.Core.Composing.IComponent
{
private readonly IProfilingLogger _logger;

public EmbeddedResourceCompontent(IProfilingLogger profilingLogger)
{
_logger = profilingLogger;
}


public void Dispose()
{

}

public ISite Site { get; set; }
public event EventHandler Disposed;

public void Initialize()
{
RouteTable
.Routes
.MapRoute(
name: "nuPickersShared",
url: EmbeddedResource.EmbeddedResource.ROOT_URL.TrimStart("~/".ToCharArray()) + "{folder}/{file}",
defaults: new
{
controller = "EmbeddedResource",
action = "GetSharedResource"
},
namespaces: new[] {"nuPickers.EmbeddedResource"});

FileWriters.AddWriterForExtension(EmbeddedResource.EmbeddedResource.FILE_EXTENSION,
new EmbeddedResourceVirtualFileWriter(_logger));
}

public void Terminate()
{

}
}
}
Loading