-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from umbraco/v14/bugfix/fix-migrators
v14: Fix commented out migrators
- Loading branch information
Showing
16 changed files
with
475 additions
and
496 deletions.
There are no files selected for viewing
77 changes: 35 additions & 42 deletions
77
src/Umbraco.Deploy.Contrib/Migrators/Legacy/DataType/CheckBoxListDataTypeArtifactMigrator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,40 @@ | ||
//using System.Collections.Generic; | ||
//using Umbraco.Cms.Core; | ||
//using Umbraco.Cms.Core.PropertyEditors; | ||
//using Umbraco.Cms.Core.Semver; | ||
//using Umbraco.Cms.Core.Serialization; | ||
//using Umbraco.Deploy.Infrastructure.Artifacts; | ||
//using Umbraco.Deploy.Infrastructure.Migrators; | ||
using System.Collections.Generic; | ||
using Umbraco.Cms.Core; | ||
using Umbraco.Cms.Core.PropertyEditors; | ||
using Umbraco.Cms.Core.Semver; | ||
using Umbraco.Cms.Core.Serialization; | ||
using Umbraco.Deploy.Infrastructure.Artifacts; | ||
using Umbraco.Deploy.Infrastructure.Migrators; | ||
|
||
//namespace Umbraco.Deploy.Contrib.Migrators.Legacy; | ||
namespace Umbraco.Deploy.Contrib.Migrators.Legacy; | ||
|
||
///// <summary> | ||
///// Migrates the <see cref="DataTypeArtifact" /> to replace the <see cref="Constants.PropertyEditors.Aliases.CheckBoxList" /> editor configuration from Umbraco 7 to <see cref="ValueListConfiguration" />. | ||
///// </summary> | ||
//public class CheckBoxListDataTypeArtifactMigrator : DataTypeConfigurationArtifactMigratorBase<ValueListConfiguration> | ||
//{ | ||
// /// <summary> | ||
// /// Initializes a new instance of the <see cref="CheckBoxListDataTypeArtifactMigrator" /> class. | ||
// /// </summary> | ||
// /// <param name="configurationEditorJsonSerializer">The configuration editor JSON serializer.</param> | ||
// public CheckBoxListDataTypeArtifactMigrator(IConfigurationEditorJsonSerializer configurationEditorJsonSerializer) | ||
// : base(Constants.PropertyEditors.Aliases.CheckBoxList, configurationEditorJsonSerializer) | ||
// => MaxVersion = new SemVersion(3, 0, 0); | ||
/// <summary> | ||
/// Migrates the <see cref="DataTypeArtifact" /> to replace the <see cref="Constants.PropertyEditors.Aliases.CheckBoxList" /> editor configuration from Umbraco 7 to <see cref="ValueListConfiguration" />. | ||
/// </summary> | ||
public class CheckBoxListDataTypeArtifactMigrator : DataTypeConfigurationArtifactMigratorBase<ValueListConfiguration> | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="CheckBoxListDataTypeArtifactMigrator" /> class. | ||
/// </summary> | ||
/// <param name="propertyEditors">The property editors.</param> | ||
/// <param name="configurationEditorJsonSerializer">The configuration editor JSON serializer.</param> | ||
public CheckBoxListDataTypeArtifactMigrator(PropertyEditorCollection propertyEditors, IConfigurationEditorJsonSerializer configurationEditorJsonSerializer) | ||
: base(Constants.PropertyEditors.Aliases.CheckBoxList, propertyEditors, configurationEditorJsonSerializer) | ||
=> MaxVersion = new SemVersion(3, 0, 0); | ||
|
||
// /// <inheritdoc /> | ||
// protected override ValueListConfiguration? MigrateConfiguration(IDictionary<string, object?> fromConfiguration) | ||
// { | ||
// var toConfiguration = new ValueListConfiguration(); | ||
/// <inheritdoc /> | ||
protected override ValueListConfiguration? MigrateConfigurationObject(IDictionary<string, object> fromConfiguration) | ||
{ | ||
var toConfiguration = new ValueListConfiguration(); | ||
|
||
// foreach (var (key, value) in fromConfiguration) | ||
// { | ||
// if (int.TryParse(key, out var id) && value is not null) | ||
// { | ||
// toConfiguration.Items.Add(new ValueListConfiguration.ValueListItem() | ||
// { | ||
// Id = id, | ||
// Value = value.ToString() | ||
// }); | ||
// } | ||
// } | ||
foreach (var (key, value) in fromConfiguration) | ||
{ | ||
if (int.TryParse(key, out _) && value is string itemValue) | ||
{ | ||
toConfiguration.Items.Add(itemValue); | ||
} | ||
} | ||
|
||
// return toConfiguration; | ||
// } | ||
|
||
// /// <inheritdoc /> | ||
// protected override ValueListConfiguration? GetDefaultConfiguration() | ||
// => new ValueListConfiguration(); | ||
//} | ||
return toConfiguration; | ||
} | ||
} |
90 changes: 45 additions & 45 deletions
90
...raco.Deploy.Contrib/Migrators/Legacy/DataType/ColorPickerAliasDataTypeArtifactMigrator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,51 @@ | ||
//using System.Collections.Generic; | ||
//using Umbraco.Cms.Core; | ||
//using Umbraco.Cms.Core.PropertyEditors; | ||
//using Umbraco.Cms.Core.Semver; | ||
//using Umbraco.Cms.Core.Serialization; | ||
//using Umbraco.Deploy.Infrastructure.Artifacts; | ||
//using Umbraco.Deploy.Infrastructure.Migrators; | ||
using System.Collections.Generic; | ||
using Umbraco.Cms.Core; | ||
using Umbraco.Cms.Core.PropertyEditors; | ||
using Umbraco.Cms.Core.Semver; | ||
using Umbraco.Cms.Core.Serialization; | ||
using Umbraco.Deploy.Infrastructure.Artifacts; | ||
using Umbraco.Deploy.Infrastructure.Migrators; | ||
|
||
//namespace Umbraco.Deploy.Contrib.Migrators.Legacy; | ||
namespace Umbraco.Deploy.Contrib.Migrators.Legacy; | ||
|
||
///// <summary> | ||
///// Migrates the <see cref="DataTypeArtifact" /> to replace the <see cref="FromEditorAlias" /> editor with <see cref="Constants.PropertyEditors.Aliases.ColorPicker" /> and the configuration from Umbraco 7 to <see cref="ColorPickerConfiguration" />. | ||
///// </summary> | ||
//public class ColorPickerAliasDataTypeArtifactMigrator : ReplaceDataTypeArtifactMigratorBase<ColorPickerConfiguration> | ||
//{ | ||
// private const string FromEditorAlias = "Umbraco.ColorPickerAlias"; | ||
// private const string TrueValue = "1"; | ||
/// <summary> | ||
/// Migrates the <see cref="DataTypeArtifact" /> to replace the <see cref="FromEditorAlias" /> editor with <see cref="Constants.PropertyEditors.Aliases.ColorPicker" /> and the configuration from Umbraco 7 to <see cref="ColorPickerConfiguration" />. | ||
/// </summary> | ||
public class ColorPickerAliasDataTypeArtifactMigrator : ReplaceDataTypeArtifactMigratorBase<ColorPickerConfiguration> | ||
{ | ||
private const string FromEditorAlias = "Umbraco.ColorPickerAlias"; | ||
private const string TrueValue = "1"; | ||
|
||
// /// <summary> | ||
// /// Initializes a new instance of the <see cref="ColorPickerAliasDataTypeArtifactMigrator" /> class. | ||
// /// </summary> | ||
// /// <param name="propertyEditors">The property editors.</param> | ||
// /// <param name="configurationEditorJsonSerializer">The configuration editor JSON serializer.</param> | ||
// public ColorPickerAliasDataTypeArtifactMigrator(PropertyEditorCollection propertyEditors, IConfigurationEditorJsonSerializer configurationEditorJsonSerializer) | ||
// : base(FromEditorAlias, Constants.PropertyEditors.Aliases.ColorPicker, propertyEditors, configurationEditorJsonSerializer) | ||
// => MaxVersion = new SemVersion(3, 0, 0); | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ColorPickerAliasDataTypeArtifactMigrator" /> class. | ||
/// </summary> | ||
/// <param name="propertyEditors">The property editors.</param> | ||
/// <param name="configurationEditorJsonSerializer">The configuration editor JSON serializer.</param> | ||
public ColorPickerAliasDataTypeArtifactMigrator(PropertyEditorCollection propertyEditors, IConfigurationEditorJsonSerializer configurationEditorJsonSerializer) | ||
: base(FromEditorAlias, Constants.PropertyEditors.Aliases.ColorPicker, propertyEditors, configurationEditorJsonSerializer) | ||
=> MaxVersion = new SemVersion(3, 0, 0); | ||
|
||
// /// <inheritdoc /> | ||
// protected override ColorPickerConfiguration? MigrateConfiguration(IDictionary<string, object?> fromConfiguration) | ||
// { | ||
// var toConfiguration = new ColorPickerConfiguration(); | ||
/// <inheritdoc /> | ||
protected override ColorPickerConfiguration? MigrateConfigurationObject(IDictionary<string, object> fromConfiguration) | ||
{ | ||
var toConfiguration = new ColorPickerConfiguration(); | ||
|
||
// foreach (var (key, value) in fromConfiguration) | ||
// { | ||
// if (key == "useLabel") | ||
// { | ||
// toConfiguration.UseLabel = TrueValue.Equals(value); | ||
// } | ||
// else if (int.TryParse(key, out var id) && value is not null) | ||
// { | ||
// toConfiguration.Items.Add(new ValueListConfiguration.ValueListItem() | ||
// { | ||
// Id = id, | ||
// Value = value.ToString() | ||
// }); | ||
// } | ||
// } | ||
foreach (var (key, value) in fromConfiguration) | ||
{ | ||
if (key == "useLabel") | ||
{ | ||
toConfiguration.UseLabel = TrueValue.Equals(value); | ||
} | ||
else if (int.TryParse(key, out _) && value is string itemValue) | ||
{ | ||
toConfiguration.Items.Add(new ColorPickerConfiguration.ColorPickerItem() | ||
{ | ||
Label = itemValue, | ||
Value = itemValue, | ||
}); | ||
} | ||
} | ||
|
||
// return toConfiguration; | ||
// } | ||
//} | ||
return toConfiguration; | ||
} | ||
} |
44 changes: 22 additions & 22 deletions
44
src/Umbraco.Deploy.Contrib/Migrators/Legacy/DataType/DropDownDataTypeArtifactMigrator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
//using Umbraco.Cms.Core; | ||
//using Umbraco.Cms.Core.PropertyEditors; | ||
//using Umbraco.Cms.Core.Serialization; | ||
//using Umbraco.Deploy.Infrastructure.Artifacts; | ||
using Umbraco.Cms.Core; | ||
using Umbraco.Cms.Core.PropertyEditors; | ||
using Umbraco.Cms.Core.Serialization; | ||
using Umbraco.Deploy.Infrastructure.Artifacts; | ||
|
||
//namespace Umbraco.Deploy.Contrib.Migrators.Legacy; | ||
namespace Umbraco.Deploy.Contrib.Migrators.Legacy; | ||
|
||
///// <summary> | ||
///// Migrates the <see cref="DataTypeArtifact" /> to replace the <see cref="FromEditorAlias" /> editor with <see cref="Constants.PropertyEditors.Aliases.DropDownListFlexible" /> and the configuration from Umbraco 7 to <see cref="DropDownFlexibleConfiguration" />. | ||
///// </summary> | ||
//public class DropDownDataTypeArtifactMigrator : DropDownReplaceDataTypeArtifactMigratorBase | ||
//{ | ||
// private const string FromEditorAlias = "Umbraco.DropDown"; | ||
/// <summary> | ||
/// Migrates the <see cref="DataTypeArtifact" /> to replace the <see cref="FromEditorAlias" /> editor with <see cref="Constants.PropertyEditors.Aliases.DropDownListFlexible" /> and the configuration from Umbraco 7 to <see cref="DropDownFlexibleConfiguration" />. | ||
/// </summary> | ||
public class DropDownDataTypeArtifactMigrator : DropDownReplaceDataTypeArtifactMigratorBase | ||
{ | ||
private const string FromEditorAlias = "Umbraco.DropDown"; | ||
|
||
// /// <inheritdoc /> | ||
// protected override bool Multiple => false; | ||
/// <inheritdoc /> | ||
protected override bool Multiple => false; | ||
|
||
// /// <summary> | ||
// /// Initializes a new instance of the <see cref="DropDownDataTypeArtifactMigrator" /> class. | ||
// /// </summary> | ||
// /// <param name="propertyEditors">The property editors.</param> | ||
// /// <param name="configurationEditorJsonSerializer">The configuration editor JSON serializer.</param> | ||
// public DropDownDataTypeArtifactMigrator(PropertyEditorCollection propertyEditors, IConfigurationEditorJsonSerializer configurationEditorJsonSerializer) | ||
// : base(FromEditorAlias, propertyEditors, configurationEditorJsonSerializer) | ||
// { } | ||
//} | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="DropDownDataTypeArtifactMigrator" /> class. | ||
/// </summary> | ||
/// <param name="propertyEditors">The property editors.</param> | ||
/// <param name="configurationEditorJsonSerializer">The configuration editor JSON serializer.</param> | ||
public DropDownDataTypeArtifactMigrator(PropertyEditorCollection propertyEditors, IConfigurationEditorJsonSerializer configurationEditorJsonSerializer) | ||
: base(FromEditorAlias, propertyEditors, configurationEditorJsonSerializer) | ||
{ } | ||
} |
117 changes: 58 additions & 59 deletions
117
...raco.Deploy.Contrib/Migrators/Legacy/DataType/DropDownFlexibleDataTypeArtifactMigrator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,58 @@ | ||
//using System.Collections.Generic; | ||
//using Umbraco.Cms.Core; | ||
//using Umbraco.Cms.Core.PropertyEditors; | ||
//using Umbraco.Cms.Core.Semver; | ||
//using Umbraco.Cms.Core.Serialization; | ||
//using Umbraco.Deploy.Infrastructure.Artifacts; | ||
//using Umbraco.Deploy.Infrastructure.Migrators; | ||
|
||
//namespace Umbraco.Deploy.Contrib.Migrators.Legacy; | ||
|
||
///// <summary> | ||
///// Migrates the <see cref="DataTypeArtifact" /> to replace the configuration of the <see cref="Constants.PropertyEditors.Aliases.DropDownListFlexible" /> editor from Umbraco 7 to <see cref="DropDownFlexibleConfiguration" />. | ||
///// </summary> | ||
//public class DropDownFlexibleDataTypeArtifactMigrator : DataTypeConfigurationArtifactMigratorBase<DropDownFlexibleConfiguration> | ||
//{ | ||
// private const string TrueValue = "1"; | ||
|
||
// /// <summary> | ||
// /// Initializes a new instance of the <see cref="DropDownFlexibleDataTypeArtifactMigrator" /> class. | ||
// /// </summary> | ||
// /// <param name="configurationEditorJsonSerializer">The configuration editor JSON serializer.</param> | ||
// public DropDownFlexibleDataTypeArtifactMigrator(IConfigurationEditorJsonSerializer configurationEditorJsonSerializer) | ||
// : base(Constants.PropertyEditors.Aliases.DropDownListFlexible, configurationEditorJsonSerializer) | ||
// => MaxVersion = new SemVersion(3, 0, 0); | ||
|
||
// /// <inheritdoc /> | ||
// protected override DropDownFlexibleConfiguration? MigrateConfiguration(IDictionary<string, object?> fromConfiguration) | ||
// { | ||
// var toConfiguration = new DropDownFlexibleConfiguration() | ||
// { | ||
// Multiple = true | ||
// }; | ||
|
||
// foreach (var (key, value) in fromConfiguration) | ||
// { | ||
// if (key == "multiple") | ||
// { | ||
// toConfiguration.Multiple = TrueValue.Equals(value); | ||
// } | ||
// else if (int.TryParse(key, out var id) && value is not null) | ||
// { | ||
// toConfiguration.Items.Add(new ValueListConfiguration.ValueListItem() | ||
// { | ||
// Id = id, | ||
// Value = value.ToString() | ||
// }); | ||
// } | ||
// } | ||
|
||
// return toConfiguration; | ||
// } | ||
|
||
// /// <inheritdoc /> | ||
// protected override DropDownFlexibleConfiguration? GetDefaultConfiguration() | ||
// => new DropDownFlexibleConfiguration() | ||
// { | ||
// Multiple = true | ||
// }; | ||
//} | ||
using System.Collections.Generic; | ||
using Umbraco.Cms.Core; | ||
using Umbraco.Cms.Core.PropertyEditors; | ||
using Umbraco.Cms.Core.Semver; | ||
using Umbraco.Cms.Core.Serialization; | ||
using Umbraco.Deploy.Infrastructure.Artifacts; | ||
using Umbraco.Deploy.Infrastructure.Migrators; | ||
|
||
namespace Umbraco.Deploy.Contrib.Migrators.Legacy; | ||
|
||
/// <summary> | ||
/// Migrates the <see cref="DataTypeArtifact" /> to replace the configuration of the <see cref="Constants.PropertyEditors.Aliases.DropDownListFlexible" /> editor from Umbraco 7 to <see cref="DropDownFlexibleConfiguration" />. | ||
/// </summary> | ||
public class DropDownFlexibleDataTypeArtifactMigrator : DataTypeConfigurationArtifactMigratorBase<DropDownFlexibleConfiguration> | ||
{ | ||
private const string TrueValue = "1"; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="DropDownFlexibleDataTypeArtifactMigrator" /> class. | ||
/// </summary> | ||
/// <param name="propertyEditors">The property editors.</param> | ||
/// <param name="configurationEditorJsonSerializer">The configuration editor JSON serializer.</param> | ||
public DropDownFlexibleDataTypeArtifactMigrator(PropertyEditorCollection propertyEditors, IConfigurationEditorJsonSerializer configurationEditorJsonSerializer) | ||
: base(Constants.PropertyEditors.Aliases.DropDownListFlexible, propertyEditors, configurationEditorJsonSerializer) | ||
=> MaxVersion = new SemVersion(3, 0, 0); | ||
|
||
/// <inheritdoc /> | ||
protected override DropDownFlexibleConfiguration? MigrateConfigurationObject(IDictionary<string, object> fromConfiguration) | ||
{ | ||
var toConfiguration = new DropDownFlexibleConfiguration() | ||
{ | ||
Multiple = true | ||
}; | ||
|
||
foreach (var (key, value) in fromConfiguration) | ||
{ | ||
if (key == "multiple") | ||
{ | ||
toConfiguration.Multiple = TrueValue.Equals(value); | ||
} | ||
else if (int.TryParse(key, out _) && value is string itemValue) | ||
{ | ||
toConfiguration.Items.Add(itemValue); | ||
} | ||
} | ||
|
||
return toConfiguration; | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override IDictionary<string, object> GetDefaultConfiguration(IConfigurationEditor configurationEditor) | ||
{ | ||
var configuration = base.GetDefaultConfiguration(configurationEditor); | ||
configuration["multiple"] = true; | ||
|
||
return configuration; | ||
} | ||
} |
44 changes: 22 additions & 22 deletions
44
...raco.Deploy.Contrib/Migrators/Legacy/DataType/DropDownMultipleDataTypeArtifactMigrator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
//using Umbraco.Cms.Core; | ||
//using Umbraco.Cms.Core.PropertyEditors; | ||
//using Umbraco.Cms.Core.Serialization; | ||
//using Umbraco.Deploy.Infrastructure.Artifacts; | ||
using Umbraco.Cms.Core; | ||
using Umbraco.Cms.Core.PropertyEditors; | ||
using Umbraco.Cms.Core.Serialization; | ||
using Umbraco.Deploy.Infrastructure.Artifacts; | ||
|
||
//namespace Umbraco.Deploy.Contrib.Migrators.Legacy; | ||
namespace Umbraco.Deploy.Contrib.Migrators.Legacy; | ||
|
||
///// <summary> | ||
///// Migrates the <see cref="DataTypeArtifact" /> to replace the <see cref="FromEditorAlias" /> editor with <see cref="Constants.PropertyEditors.Aliases.DropDownListFlexible" /> and the configuration from Umbraco 7 to <see cref="DropDownFlexibleConfiguration" />. | ||
///// </summary> | ||
//public class DropDownMultipleDataTypeArtifactMigrator : DropDownReplaceDataTypeArtifactMigratorBase | ||
//{ | ||
// private const string FromEditorAlias = "Umbraco.DropDownMultiple"; | ||
/// <summary> | ||
/// Migrates the <see cref="DataTypeArtifact" /> to replace the <see cref="FromEditorAlias" /> editor with <see cref="Constants.PropertyEditors.Aliases.DropDownListFlexible" /> and the configuration from Umbraco 7 to <see cref="DropDownFlexibleConfiguration" />. | ||
/// </summary> | ||
public class DropDownMultipleDataTypeArtifactMigrator : DropDownReplaceDataTypeArtifactMigratorBase | ||
{ | ||
private const string FromEditorAlias = "Umbraco.DropDownMultiple"; | ||
|
||
// /// <inheritdoc /> | ||
// protected override bool Multiple => true; | ||
/// <inheritdoc /> | ||
protected override bool Multiple => true; | ||
|
||
// /// <summary> | ||
// /// Initializes a new instance of the <see cref="DropDownMultipleDataTypeArtifactMigrator" /> class. | ||
// /// </summary> | ||
// /// <param name="propertyEditors">The property editors.</param> | ||
// /// <param name="configurationEditorJsonSerializer">The configuration editor JSON serializer.</param> | ||
// public DropDownMultipleDataTypeArtifactMigrator(PropertyEditorCollection propertyEditors, IConfigurationEditorJsonSerializer configurationEditorJsonSerializer) | ||
// : base(FromEditorAlias, propertyEditors, configurationEditorJsonSerializer) | ||
// { } | ||
//} | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="DropDownMultipleDataTypeArtifactMigrator" /> class. | ||
/// </summary> | ||
/// <param name="propertyEditors">The property editors.</param> | ||
/// <param name="configurationEditorJsonSerializer">The configuration editor JSON serializer.</param> | ||
public DropDownMultipleDataTypeArtifactMigrator(PropertyEditorCollection propertyEditors, IConfigurationEditorJsonSerializer configurationEditorJsonSerializer) | ||
: base(FromEditorAlias, propertyEditors, configurationEditorJsonSerializer) | ||
{ } | ||
} |
Oops, something went wrong.