diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index b40cf850da..48ce1063ee 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -36,7 +36,6 @@ jobs: uses: docker/build-push-action@v6.7.0 with: load: true - build-args: "SQUIDEX__RUNTIME__VERSION=7.0.0-dev-${{ env.BUILD_NUMBER }}" cache-from: type=gha cache-to: type=gha,mode=max tags: squidex-local diff --git a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/Extensions.cs b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/Extensions.cs index 1eed5872b9..07fbf78c4b 100644 --- a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/Extensions.cs +++ b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/Extensions.cs @@ -129,7 +129,7 @@ await collection.Aggregate() PipelineDefinitionBuilder.For() .Match(LookupMatch) .Project( - BuildProjection2(q.Fields)), + BuildProjection(q.Fields)), x => x.Joined) .Project( Builders.Projection.Include(x => x.Joined)) @@ -165,15 +165,15 @@ public static Task> FindStatusAsync(this IMongoCollection SelectFields(this IFindFluent find, IEnumerable? fields) { - return find.Project(BuildProjection2(fields)); + return find.Project(BuildProjection(fields)); } public static IAggregateFluent SelectFields(this IAggregateFluent find, IEnumerable? fields) { - return find.Project(BuildProjection2(fields)); + return find.Project(BuildProjection(fields)); } - public static ProjectionDefinition BuildProjection2(IEnumerable? fields) + public static ProjectionDefinition BuildProjection(IEnumerable? fields) { var projector = Builders.Projection; var projections = new List>(); @@ -210,7 +210,7 @@ static IEnumerable GetDataFields(IEnumerable fields) foreach (var field in allFields) { // If there is at least one field that is a prefix of the current field, we cannot add that. - if (addedFields.Exists(x => field.StartsWith(x, StringComparison.Ordinal))) + if (addedFields.Exists(x => IsPrefix(field, x))) { continue; } @@ -227,5 +227,15 @@ static IEnumerable GetDataFields(IEnumerable fields) } return projector.Combine(projections); + + static bool IsPrefix(string field, string prefix) + { + if (!field.StartsWith(prefix, StringComparison.Ordinal)) + { + return false; + } + + return field.Length == prefix.Length || field[prefix.Length] == '.'; + } } } diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ExtensionsTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ExtensionsTests.cs index de7a36476a..48206b17e7 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ExtensionsTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ExtensionsTests.cs @@ -22,7 +22,7 @@ public ExtensionsTests() [Fact] public void Should_build_projection_without_fields() { - var projection = ExtensionSut.BuildProjection2(null); + var projection = ExtensionSut.BuildProjection(null); AssertProjection(projection, "{ 'dd' : 0 }"); } @@ -30,7 +30,7 @@ public void Should_build_projection_without_fields() [Fact] public void Should_build_projection_with_data_prefix() { - var projection = ExtensionSut.BuildProjection2(["data.myField"]); + var projection = ExtensionSut.BuildProjection(["data.myField"]); AssertProjection(projection, "{ '_ai' : 1, '_id' : 1, '_si' : 1, 'ai' : 1, 'cb' : 1, 'ct' : 1, 'dl' : 1, 'do.myField' : 1, 'id' : 1, 'is' : 1, 'mb' : 1, 'mt' : 1, 'ns' : 1, 'rf' : 1, 'sa' : 1, 'si' : 1, 'sj' : 1, 'ss' : 1, 'ts' : 1, 'vs' : 1 }"); } @@ -38,7 +38,7 @@ public void Should_build_projection_with_data_prefix() [Fact] public void Should_build_projection_without_data_prefix() { - var projection = ExtensionSut.BuildProjection2(["myField"]); + var projection = ExtensionSut.BuildProjection(["myField"]); AssertProjection(projection, "{ '_ai' : 1, '_id' : 1, '_si' : 1, 'ai' : 1, 'cb' : 1, 'ct' : 1, 'dl' : 1, 'do.myField' : 1, 'id' : 1, 'is' : 1, 'mb' : 1, 'mt' : 1, 'ns' : 1, 'rf' : 1, 'sa' : 1, 'si' : 1, 'sj' : 1, 'ss' : 1, 'ts' : 1, 'vs' : 1 }"); } @@ -46,15 +46,23 @@ public void Should_build_projection_without_data_prefix() [Fact] public void Should_build_projection_without_included_field() { - var projection = ExtensionSut.BuildProjection2(["myField.special", "myField"]); + var projection = ExtensionSut.BuildProjection(["myField.special", "myField"]); AssertProjection(projection, "{ '_ai' : 1, '_id' : 1, '_si' : 1, 'ai' : 1, 'cb' : 1, 'ct' : 1, 'dl' : 1, 'do.myField' : 1, 'id' : 1, 'is' : 1, 'mb' : 1, 'mt' : 1, 'ns' : 1, 'rf' : 1, 'sa' : 1, 'si' : 1, 'sj' : 1, 'ss' : 1, 'ts' : 1, 'vs' : 1 }"); } + [Fact] + public void Should_build_projection_with_prefix_field() + { + var projection = ExtensionSut.BuildProjection(["myField", "myField2"]); + + AssertProjection(projection, "{ '_ai' : 1, '_id' : 1, '_si' : 1, 'ai' : 1, 'cb' : 1, 'ct' : 1, 'dl' : 1, 'do.myField' : 1, 'do.myField2' : 1, 'id' : 1, 'is' : 1, 'mb' : 1, 'mt' : 1, 'ns' : 1, 'rf' : 1, 'sa' : 1, 'si' : 1, 'sj' : 1, 'ss' : 1, 'ts' : 1, 'vs' : 1 }"); + } + [Fact] public void Should_build_projection_with_status_data_field() { - var projection = ExtensionSut.BuildProjection2(["data.Status"]); + var projection = ExtensionSut.BuildProjection(["data.Status"]); AssertProjection(projection, "{ '_ai' : 1, '_id' : 1, '_si' : 1, 'ai' : 1, 'cb' : 1, 'ct' : 1, 'dl' : 1, 'do.Status' : 1, 'id' : 1, 'is' : 1, 'mb' : 1, 'mt' : 1, 'ns' : 1, 'rf' : 1, 'sa' : 1, 'si' : 1, 'sj' : 1, 'ss' : 1, 'ts' : 1, 'vs' : 1 }"); } @@ -62,7 +70,7 @@ public void Should_build_projection_with_status_data_field() [Fact] public void Should_build_projection_with_meta_status_field() { - var projection = ExtensionSut.BuildProjection2(["status"]); + var projection = ExtensionSut.BuildProjection(["status"]); AssertProjection(projection, "{ '_ai' : 1, '_id' : 1, '_si' : 1, 'ai' : 1, 'cb' : 1, 'ct' : 1, 'dl' : 1, 'do.status' : 1, 'id' : 1, 'is' : 1, 'mb' : 1, 'mt' : 1, 'ns' : 1, 'rf' : 1, 'sa' : 1, 'si' : 1, 'sj' : 1, 'ss' : 1, 'ts' : 1, 'vs' : 1 }"); } diff --git a/frontend/src/app/features/content/shared/forms/field-editor.component.scss b/frontend/src/app/features/content/shared/forms/field-editor.component.scss index 8b232c78fb..6e2f3fc596 100644 --- a/frontend/src/app/features/content/shared/forms/field-editor.component.scss +++ b/frontend/src/app/features/content/shared/forms/field-editor.component.scss @@ -7,7 +7,7 @@ } &-disabled { - color: $color-border-dark; + color: $color-text-decent; font-size: $font-smallest; font-weight: normal; }