Merge branch 'release/17.0' into v17/dev

# Conflicts:
#	version.json
This commit is contained in:
Niels Lyngsø
2025-10-29 20:04:40 +01:00
69 changed files with 473 additions and 766 deletions

View File

@@ -5,6 +5,11 @@
/// </summary>
public class DistributedBackgroundJobModel
{
/// <summary>
/// The id of the job.
/// </summary>
public int Id { get; set; }
/// <summary>
/// Name of job.
/// </summary>

View File

@@ -90,6 +90,7 @@ internal class DistributedJobRepository(IScopeAccessor scopeAccessor) : IDistrib
private DistributedJobDto MapToDto(DistributedBackgroundJobModel model) =>
new()
{
Id = model.Id,
Name = model.Name,
Period = model.Period.Ticks,
LastRun = model.LastRun,
@@ -100,6 +101,7 @@ internal class DistributedJobRepository(IScopeAccessor scopeAccessor) : IDistrib
private DistributedBackgroundJobModel MapFromDto(DistributedJobDto jobDto) =>
new()
{
Id = jobDto.Id,
Name = jobDto.Name,
Period = TimeSpan.FromTicks(jobDto.Period),
LastRun = jobDto.LastRun,

View File

@@ -0,0 +1,43 @@
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Models.PublishedContent;
using Umbraco.Cms.Core.Serialization;
namespace Umbraco.Cms.Core.PropertyEditors.ValueConverters;
// NOTE: this class is made public on purpose because all value converters should be public
[DefaultPropertyValueConverter(typeof(JsonValueConverter))]
public sealed class EntityDataPickerValueConverter : PropertyValueConverterBase
{
private readonly IJsonSerializer _jsonSerializer;
public EntityDataPickerValueConverter(IJsonSerializer jsonSerializer)
=> _jsonSerializer = jsonSerializer;
public override bool IsConverter(IPublishedPropertyType propertyType)
=> Constants.PropertyEditors.Aliases.EntityDataPicker.Equals(propertyType.EditorAlias);
public override Type GetPropertyValueType(IPublishedPropertyType propertyType)
=> typeof(EntityDataPickerValue);
public override PropertyCacheLevel GetPropertyCacheLevel(IPublishedPropertyType propertyType)
=> PropertyCacheLevel.Element;
public override object? ConvertSourceToIntermediate(IPublishedElement owner, IPublishedPropertyType propertyType, object? source, bool preview)
{
if (source is not string sourceString
|| propertyType.DataType.ConfigurationObject is not EntityDataPickerConfiguration dataTypeConfiguration)
{
return null;
}
EntityDataPickerDto? dto = _jsonSerializer.Deserialize<EntityDataPickerDto>(sourceString);
return dto is not null
? new EntityDataPickerValue { Ids = dto.Ids, DataSource = dataTypeConfiguration.DataSource }
: null;
}
private class EntityDataPickerDto
{
public required string[] Ids { get; init; }
}
}