Skip to content

Commit

Permalink
V8/v8.5.1 (#86)
Browse files Browse the repository at this point in the history
* #82 Support for Sort order on Content Type Allowed Items

* Add Version checking ping.

* - DataType Serializers for core pickers.

* Tidy up function names.

* Fix - for items nested inside nested items json not serialized correctly.

* DataTypeSerializer package.

* Update comment in delete.

* Fix: Dictionary items should sync based on level.

* 8.5.1 - Release Versions

Co-authored-by: Kevin Jump <[email protected]>
  • Loading branch information
KevinJump and Kevin Jump authored Mar 19, 2020
1 parent 3902f00 commit a1eac5f
Show file tree
Hide file tree
Showing 33 changed files with 545 additions and 62 deletions.
3 changes: 3 additions & 0 deletions Dist/package.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ nuget pack ..\uSync8.Community.Contrib\uSync.Community.Contrib.nuspec -OutputDi
nuget pack ..\uSync8.ContentEdition\uSync.ContentEdition.nuspec -OutputDirectory %1 -build -version %1 -properties "depends=%1;Configuration=release"
nuget pack ..\uSync8.ContentEdition\uSync.ContentEdition.Core.nuspec -OutputDirectory %1 -build -version %1 -properties "depends=%1;Configuration=release"

nuget pack ..\uSync8.Community.DataTypeSerializers\uSync.Community.DataTypeSerializers.nuspec -OutputDirectory %1 -build -version %1 -properties "depends=%1;Configuration=release"


nuget pack ..\uSync.Console\uSync.Console.nuspec -OutputDirectory %1 -build -version %1 -properties "depends=%1;Configuration=release"

call CreatePackages %1
Expand Down
10 changes: 10 additions & 0 deletions Dist/single.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@REM build a single
@REM single [project] [nuspec] [version] [depends]
@REM single uSync8.Community.Contrib uSync.Community.Contrib 8.5.0.1 8.5.1

@echo off

@Echo Packaging
nuget pack ..\%1\%2.nuspec -build -OutputDirectory %3 -version %3 -properties "depends=%4;Configuration=release"

XCOPY %3\*.nupkg c:\source\localgit /y
2 changes: 2 additions & 0 deletions uSync8.BackOffice/App_Plugins/uSync8/lang/en-US.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
<area alias="usync">
<key alias="name">uSync 8</key>
<key alias="intro">Database elements to and from disk</key>

<key alias="newer">There is a newer version of uSync avalible</key>

<key alias="import">Import</key>
<key alias="importforce">Full Import</key>
Expand Down
2 changes: 1 addition & 1 deletion uSync8.BackOffice/App_Plugins/uSync8/package.manifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"javascript": [
"~/App_Plugins/uSync8/backoffice/uSync8/uSyncDashboardController.js?",
"~/App_Plugins/uSync8/backoffice/uSync8/uSyncDashboardController.js?uv=851",
"~/App_Plugins/uSync8/settings/settingsController.js",
"~/App_Plugins/uSync8/settings/expansionController.js",
"~/App_Plugins/uSync8/settings/uSyncController.js",
Expand Down
15 changes: 12 additions & 3 deletions uSync8.BackOffice/App_Plugins/uSync8/settings/default.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<div ng-controller="uSync8Controller as vm">

<div ng-if="vm.versionInfo.IsCurrent != true" class="alert alert-info usync-alert">
<localize key="usync_newer"></localize> [v{{vm.versionInfo.VersionInfo.Core}}]
<span ng-if="vm.versionInfo.VersionInfo.Message">
<a href="{{vm.versionInfo.VersionInfo.Link}}" target="_blank">
{{vm.versionInfo.VersionInfo.Message}}
</a>
</span>
</div>

<umb-box>
<umb-box-content>
<div class="flex justify-between items-center">
Expand Down Expand Up @@ -49,10 +58,10 @@
</umb-box>

<div ng-if="vm.reported">
<usync-report-view actions="vm.actions"
results="vm.results"
<usync-report-view actions="vm.actions"
results="vm.results"
hide-action="true"
hide-link="vm.hideLink"/>
hide-link="vm.hideLink" />
</div>

</div>
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
};

vm.report = report;
vm.versionInfo = {
IsCurrent: true
};

vm.exportItems = exportItems;
vm.importForce = importForce;
Expand Down Expand Up @@ -86,6 +89,11 @@
vm.handlers = result.data;
vm.status.Handlers = vm.handlers;
});

uSync8DashboardService.checkVersion()
.then(function (result) {
vm.versionInfo = result.data;
})
}

///////////
Expand Down
8 changes: 7 additions & 1 deletion uSync8.BackOffice/App_Plugins/uSync8/uSyncService.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
getAddOns: getAddOns,
getAddOnSplash: getAddOnSplash,

getHandlerGroups: getHandlerGroups
getHandlerGroups: getHandlerGroups,

checkVersion: checkVersion
};

return service;
Expand Down Expand Up @@ -84,6 +86,10 @@
function getHandlerGroups() {
return $http.get(serviceRoot + 'GetHandlerGroups');
}

function checkVersion() {
return $http.get(serviceRoot + 'CheckVersion');
}
}

angular.module('umbraco.services')
Expand Down
4 changes: 4 additions & 0 deletions uSync8.BackOffice/App_Plugins/uSync8/usync.css
Original file line number Diff line number Diff line change
Expand Up @@ -310,4 +310,8 @@

.usync-table-message-cell {
flex-basis: 25%;
}

.usync-alert a {
text-decoration: underline;
}
92 changes: 92 additions & 0 deletions uSync8.BackOffice/Controllers/uSyncDashboardApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http;

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;

using Umbraco.Core.Cache;
using Umbraco.Core.Logging;
using Umbraco.Core.Composing;
using Umbraco.Core.IO;
using Umbraco.Web.Mvc;
Expand Down Expand Up @@ -213,5 +217,93 @@ public AddOnInfo GetAddOns()

return addOnInfo;
}

[HttpGet]
public async Task<uSyncVersionCheck> CheckVersion()
{
var cacheInfo = AppCaches.RuntimeCache.GetCacheItem<uSyncVersionCheck>("usync_vcheck");
if (cacheInfo != null) return cacheInfo;

var info = await PerformCheck();
AppCaches.RuntimeCache.InsertCacheItem("usync_vcheck", () => info, new TimeSpan(6, 0, 0));
return info;
}

private async Task<uSyncVersionCheck> PerformCheck()
{
// phone home to get the latest version
var addOnInfo = GetAddOns();

try
{
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("https://jumoo.co.uk");
// client.BaseAddress = new Uri("http://jumoo.local");

var url = $"/usync/version/?u={addOnInfo.Version}";
if (addOnInfo.AddOns.Any())
{
url += "&a=" + string.Join(":", addOnInfo.AddOns.Select(x => $"{x.Name},{x.Version}"));
}

var response = await client.GetAsync(url);
var content = await response.Content.ReadAsStringAsync();
if (response.IsSuccessStatusCode)
{
var info = JsonConvert.DeserializeObject<uSyncVersionInfo>(content);

var check = new uSyncVersionCheck()
{
VersionInfo = info,
Remote = true,
};

if (check.VersionInfo.Core.CompareTo(addOnInfo.Version) <= 0)
{
check.IsCurrent = true;
}

return check;
}
else
{
Logger.Debug<uSyncDashboardApiController>("Failed to get version info, {Content}", content);
}
}
}
catch (Exception ex)
{
// can't ping.
Logger.Debug<uSyncDashboardApiController>("Can't ping for version, {Exception}", ex.Message);
}

return new uSyncVersionCheck()
{
IsCurrent = true,
VersionInfo = new uSyncVersionInfo()
{
Core = addOnInfo.Version
}
};
}
}

[JsonObject(NamingStrategyType = typeof(DefaultNamingStrategy))]
public class uSyncVersionInfo
{
public string Core { get; set; }
public string Complete { get; set; }
public string Link { get; set; }
public string Message { get; set; }
}

[JsonObject(NamingStrategyType = typeof(DefaultNamingStrategy))]
public class uSyncVersionCheck
{
public uSyncVersionInfo VersionInfo { get; set; }
public bool Remote { get; set; } = false;

public bool IsCurrent { get; set; }
}
}
6 changes: 3 additions & 3 deletions uSync8.BackOffice/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
Expand Down Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("8.5.0")]
[assembly: AssemblyFileVersion("8.5.0")]
[assembly: AssemblyVersion("8.5.1.0")]
[assembly: AssemblyFileVersion("8.5.1.0")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using System;

using Newtonsoft.Json;

using Umbraco.Core.Services;
using Umbraco.Web.PropertyEditors;

using uSync8.Core.DataTypes;

namespace uSync8.Community.DataTypeSerializers.CoreTypes
{
public class ContentPickerConfigSerializer : SyncDataTypeSerializerBase, IConfigurationSerializer
{
public ContentPickerConfigSerializer(IEntityService entityService)
: base(entityService)
{ }

public string Name => "ContentPickerNodeSerializer";

public string[] Editors => new string[] { "Umbraco.ContentPicker" };

public override string SerializeConfig(object configuration)
{

if (configuration is ContentPickerConfiguration pickerConfig)
{
var contentPickerConfig = new MappedPathConfigBase<ContentPickerConfiguration>();

contentPickerConfig.Config = new ContentPickerConfiguration()
{
IgnoreUserStartNodes = pickerConfig.IgnoreUserStartNodes,
StartNodeId = null,
ShowOpenButton = pickerConfig.ShowOpenButton
};

if (pickerConfig.StartNodeId != null)
contentPickerConfig.MappedPath = UdiToEntityPath(pickerConfig.StartNodeId);

return base.SerializeConfig(contentPickerConfig);
}

return base.SerializeConfig(configuration);
}


public override object DeserializeConfig(string config, Type configType)
{
if (configType == typeof(ContentPickerConfiguration))
{
var mappedConfig = JsonConvert.DeserializeObject<MappedPathConfigBase<ContentPickerConfiguration>>(config);

if (!string.IsNullOrWhiteSpace(mappedConfig.MappedPath))
{
mappedConfig.Config.StartNodeId = PathToUdi(mappedConfig.MappedPath);
}

return mappedConfig.Config;
}

return base.DeserializeConfig(config, configType);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
using System;

using Newtonsoft.Json;

using Umbraco.Core.Services;
using Umbraco.Web.PropertyEditors;

using uSync8.Core.DataTypes;

namespace uSync8.Community.DataTypeSerializers.CoreTypes
{
public class MNTPickerConfigSerializer : SyncDataTypeSerializerBase, IConfigurationSerializer
{
public MNTPickerConfigSerializer(IEntityService entityService)
: base(entityService)
{ }

public string Name => "MNTPNodeSerializer";

public string[] Editors => new string[] { "Umbraco.MultiNodeTreePicker" };

public override string SerializeConfig(object configuration)
{
var MNTPMappedConfig = new MappedPathConfigBase<MultiNodePickerConfiguration>();

if (configuration is MultiNodePickerConfiguration pickerConfig)
{
MNTPMappedConfig.Config = new MultiNodePickerConfiguration()
{
IgnoreUserStartNodes = pickerConfig.IgnoreUserStartNodes,
Filter = pickerConfig.Filter,
MaxNumber = pickerConfig.MaxNumber,
MinNumber = pickerConfig.MinNumber,
ShowOpen = pickerConfig.ShowOpen,
TreeSource = new MultiNodePickerConfigurationTreeSource()
{
ObjectType = pickerConfig.TreeSource.ObjectType,
StartNodeId = pickerConfig.TreeSource.StartNodeId,
StartNodeQuery = pickerConfig.TreeSource.StartNodeQuery
}

};

if (pickerConfig?.TreeSource?.StartNodeId != null)
{
MNTPMappedConfig.MappedPath = UdiToEntityPath(pickerConfig.TreeSource.StartNodeId);
}

return base.SerializeConfig(MNTPMappedConfig);
}

return base.SerializeConfig(configuration);
}


public override object DeserializeConfig(string config, Type configType)
{
if (configType == typeof(MultiNodePickerConfiguration))
{
var mappedConfig = JsonConvert.DeserializeObject<MappedPathConfigBase<MultiNodePickerConfiguration>>(config);

if (!string.IsNullOrWhiteSpace(mappedConfig.MappedPath))
{
mappedConfig.Config.TreeSource.StartNodeId = PathToUdi(mappedConfig.MappedPath);
}

return mappedConfig.Config;
}

return base.DeserializeConfig(config, configType);
}
}
}
Loading

0 comments on commit a1eac5f

Please sign in to comment.