From 54b4d6f8d184714c2f0ed827d6eaea0433bce5bf Mon Sep 17 00:00:00 2001 From: nzdev <834725+nzdev@users.noreply.github.com> Date: Tue, 13 Jul 2021 19:46:27 +1200 Subject: [PATCH 1/7] Compress true/false from int to bool --- .../UnPublishedContentPropertyCacheCompressionOptions.cs | 5 +++++ .../NuCache/DataSource/MsgPackContentNestedDataSerializer.cs | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/Umbraco.Core/PropertyEditors/UnPublishedContentPropertyCacheCompressionOptions.cs b/src/Umbraco.Core/PropertyEditors/UnPublishedContentPropertyCacheCompressionOptions.cs index ece25479cc..954390ca1e 100644 --- a/src/Umbraco.Core/PropertyEditors/UnPublishedContentPropertyCacheCompressionOptions.cs +++ b/src/Umbraco.Core/PropertyEditors/UnPublishedContentPropertyCacheCompressionOptions.cs @@ -14,6 +14,11 @@ namespace Umbraco.Core.PropertyEditors //Only compress non published content that supports publishing and the property is text return true; } + if (propertyType.ValueStorageType == ValueStorageType.Integer && Umbraco.Core.Constants.PropertyEditors.Aliases.Boolean.Equals(dataEditor.Alias)) + { + //Compress boolean values from int to bool + return true; + } return false; } } diff --git a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/MsgPackContentNestedDataSerializer.cs b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/MsgPackContentNestedDataSerializer.cs index f1400382e6..bfbe1d8818 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/MsgPackContentNestedDataSerializer.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/MsgPackContentNestedDataSerializer.cs @@ -101,6 +101,10 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource { property.Value = LZ4Pickler.Pickle(Encoding.UTF8.GetBytes((string)property.Value), LZ4Level.L00_FAST); } + foreach (var property in propertyAliasToData.Value.Where(x => x.Value != null && x.Value is int intVal)) + { + property.Value = Convert.ToBoolean((int)property.Value); + } } } } From 6f8749bc528b112ccfd1af73f3cfb29d6969032e Mon Sep 17 00:00:00 2001 From: nzdev <834725+nzdev@users.noreply.github.com> Date: Tue, 13 Jul 2021 19:55:45 +1200 Subject: [PATCH 2/7] Automatically intern contentType Alias and propertyType Alias when querying the database to save on memory and speed up comparisons. --- src/Umbraco.Core/Persistence/Dtos/ContentTypeDto.cs | 3 ++- src/Umbraco.Core/Persistence/Dtos/PropertyTypeDto.cs | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Core/Persistence/Dtos/ContentTypeDto.cs b/src/Umbraco.Core/Persistence/Dtos/ContentTypeDto.cs index 68036dab4b..58ecd0cd39 100644 --- a/src/Umbraco.Core/Persistence/Dtos/ContentTypeDto.cs +++ b/src/Umbraco.Core/Persistence/Dtos/ContentTypeDto.cs @@ -9,6 +9,7 @@ namespace Umbraco.Core.Persistence.Dtos internal class ContentTypeDto { public const string TableName = Constants.DatabaseSchema.Tables.ContentType; + private string _alias; [Column("pk")] [PrimaryKeyColumn(IdentitySeed = 700)] @@ -21,7 +22,7 @@ namespace Umbraco.Core.Persistence.Dtos [Column("alias")] [NullSetting(NullSetting = NullSettings.Null)] - public string Alias { get; set; } + public string Alias { get => _alias; set => _alias = value == null ? null : string.Intern(value); } [Column("icon")] [Index(IndexTypes.NonClustered)] diff --git a/src/Umbraco.Core/Persistence/Dtos/PropertyTypeDto.cs b/src/Umbraco.Core/Persistence/Dtos/PropertyTypeDto.cs index f22e4453f4..d5ce28d3b5 100644 --- a/src/Umbraco.Core/Persistence/Dtos/PropertyTypeDto.cs +++ b/src/Umbraco.Core/Persistence/Dtos/PropertyTypeDto.cs @@ -10,6 +10,8 @@ namespace Umbraco.Core.Persistence.Dtos [ExplicitColumns] internal class PropertyTypeDto { + private string _alias; + [Column("id")] [PrimaryKeyColumn(IdentitySeed = 100)] public int Id { get; set; } @@ -29,7 +31,7 @@ namespace Umbraco.Core.Persistence.Dtos [Index(IndexTypes.NonClustered, Name = "IX_cmsPropertyTypeAlias")] [Column("Alias")] - public string Alias { get; set; } + public string Alias { get => _alias; set => _alias = value == null ? null : string.Intern(value); } [Column("Name")] [NullSetting(NullSetting = NullSettings.Null)] From 67e812d93cf1d13e7aa0dec85f3adf4e2e869cd6 Mon Sep 17 00:00:00 2001 From: Chad Currie Date: Sun, 11 Jul 2021 19:41:39 +1200 Subject: [PATCH 3/7] Don't create new empty arrays --- .../DataSource/BTree.DictionaryOfPropertyDataSerializer.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/BTree.DictionaryOfPropertyDataSerializer.cs b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/BTree.DictionaryOfPropertyDataSerializer.cs index 304fc6def0..f9a44adab1 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/BTree.DictionaryOfPropertyDataSerializer.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/BTree.DictionaryOfPropertyDataSerializer.cs @@ -11,6 +11,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource /// internal class DictionaryOfPropertyDataSerializer : SerializerBase, ISerializer>, IDictionaryOfPropertyDataSerializer { + private static readonly PropertyData[] Empty = Array.Empty(); public IDictionary ReadFrom(Stream stream) { // read properties count @@ -25,6 +26,11 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource // read values count var vcount = PrimitiveSerializer.Int32.ReadFrom(stream); + if(vcount == 0) + { + dict[key] = Empty; + continue; + } // create pdata and add to the dictionary var pdatas = new PropertyData[vcount]; From 9a16adcb18ef0065f5df1b1bcefb6ebb8b0e1f54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Fri, 6 Aug 2021 12:54:46 +0200 Subject: [PATCH 4/7] append a input with ng-model which matches the field coming from model state --- .../mediapicker3/umb-media-picker3-property-editor.html | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker3/umb-media-picker3-property-editor.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker3/umb-media-picker3-property-editor.html index cb6d9e5e26..d523bc6f2d 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker3/umb-media-picker3-property-editor.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker3/umb-media-picker3-property-editor.html @@ -52,6 +52,7 @@ + From c1956882fef9022217c583cec168100fa1cd5f85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Fri, 6 Aug 2021 12:54:46 +0200 Subject: [PATCH 5/7] append a input with ng-model which matches the field coming from model state (cherry picked from commit 9a16adcb18ef0065f5df1b1bcefb6ebb8b0e1f54) --- .../mediapicker3/umb-media-picker3-property-editor.html | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker3/umb-media-picker3-property-editor.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker3/umb-media-picker3-property-editor.html index cb6d9e5e26..d523bc6f2d 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker3/umb-media-picker3-property-editor.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker3/umb-media-picker3-property-editor.html @@ -52,6 +52,7 @@ + From cf64430116f6339f8954048d618967f575e540af Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Wed, 30 Jun 2021 15:41:07 +0200 Subject: [PATCH 6/7] #10520 Correct mandatory markers in nested content (#10563) (cherry picked from commit c1a4e07e87df428d71314174854c954749842144) --- .../src/less/components/umb-nested-content.less | 11 ----------- .../src/views/components/property/umb-property.html | 2 +- .../nestedcontent/nestedcontent.editor.html | 2 +- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/less/components/umb-nested-content.less b/src/Umbraco.Web.UI.Client/src/less/components/umb-nested-content.less index 9dd40a4386..f6c252cc4d 100644 --- a/src/Umbraco.Web.UI.Client/src/less/components/umb-nested-content.less +++ b/src/Umbraco.Web.UI.Client/src/less/components/umb-nested-content.less @@ -15,17 +15,6 @@ pointer-events: none; } -.umb-nested-content--mandatory { - /* - yeah so this is a pain, but we must be super specific in targeting the mandatory property labels, - otherwise all properties within a reqired, nested, nested content property will all appear mandatory - */ - .umb-property > ng-form > .control-group > .umb-el-wrap > .control-header label:after { - content: '*'; - color: @red; - } -} - .umb-nested-content-overlay { position: absolute; top: 0; diff --git a/src/Umbraco.Web.UI.Client/src/views/components/property/umb-property.html b/src/Umbraco.Web.UI.Client/src/views/components/property/umb-property.html index 5b8e6d8f04..51a6f65c9c 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/property/umb-property.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/property/umb-property.html @@ -16,7 +16,7 @@ {{vm.property.label}} - + * diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.editor.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.editor.html index 125e920fe6..e14bd03291 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.editor.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.editor.html @@ -4,7 +4,7 @@ From 9ccabd51b9783bd68d2a3dcf68827976bf167e00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Fri, 6 Aug 2021 12:54:46 +0200 Subject: [PATCH 7/7] append a input with ng-model which matches the field coming from model state (cherry picked from commit 9a16adcb18ef0065f5df1b1bcefb6ebb8b0e1f54) --- .../mediapicker3/umb-media-picker3-property-editor.html | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker3/umb-media-picker3-property-editor.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker3/umb-media-picker3-property-editor.html index aa9f50b7df..295d3843fd 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker3/umb-media-picker3-property-editor.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker3/umb-media-picker3-property-editor.html @@ -52,6 +52,7 @@ +