Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCC-245: Update OC preview version and fix breaking changes #265

Merged
merged 66 commits into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
ee33953
Update OC preview version.
sarahelsaig May 28, 2024
32a76f5
Fix breaking changes.
sarahelsaig May 28, 2024
ca1bf51
Gut obsolete class.
sarahelsaig May 30, 2024
e1520e9
Update OC preview version.
sarahelsaig May 30, 2024
598d327
Remove extension method because now OrchardCore.Abstractions has the …
sarahelsaig May 30, 2024
17d2374
Add NuGet.Config.
sarahelsaig Jun 3, 2024
5021758
Revert "Add NuGet.Config."
sarahelsaig Jun 3, 2024
e626beb
Update OC preview version.
sarahelsaig Jun 5, 2024
31bcc5e
Update after API change.
sarahelsaig Jun 5, 2024
655dbd7
Merge branch 'task/system-text-json-migration' into issue/OCC-245
sarahelsaig Jun 6, 2024
98c6f06
Merge branch 'task/system-text-json-migration' into issue/OCC-245
sarahelsaig Jun 6, 2024
db22445
Copy NuGet.config.
sarahelsaig Jun 6, 2024
ad32829
Tyy adding package source mapping too.
sarahelsaig Jun 6, 2024
43319a1
diagnostics
sarahelsaig Jun 6, 2024
324cf80
diagnostics
sarahelsaig Jun 6, 2024
1782b5b
also restore
sarahelsaig Jun 6, 2024
e58446d
more testing
sarahelsaig Jun 6, 2024
b985722
Revert nuget.config chages.
sarahelsaig Jun 6, 2024
b327d1a
Merge branch 'task/system-text-json-migration' into issue/OCC-245
sarahelsaig Jun 14, 2024
66ce87d
Copy NuGet.config from NEST.
sarahelsaig Jun 17, 2024
50d1347
Update OC version.
sarahelsaig Jun 18, 2024
d225f86
Update class after interface change.
sarahelsaig Jun 18, 2024
40eb6c7
Update OC version.
sarahelsaig Jun 19, 2024
f86de9a
LocalizedHtmlStringConverter is not needed.
sarahelsaig Jun 19, 2024
c1bfc94
Update OC preview version.
sarahelsaig Jun 20, 2024
0699806
Update OC preview version.
sarahelsaig Jun 21, 2024
a81eb67
Merge remote-tracking branch 'origin/issue/OCC-245' into issue/OCC-245
sarahelsaig Jun 21, 2024
f26e618
Remove LocalizedHtmlStringConverter reference.
sarahelsaig Jun 21, 2024
398a98a
spelling
sarahelsaig Jun 21, 2024
7140386
Remove unneeded test.
sarahelsaig Jun 24, 2024
ae1c83d
Switch publish action branch.
sarahelsaig Jun 24, 2024
71e7bb2
Disable add-source-link-package because it breaks dotnet restore.
sarahelsaig Jun 24, 2024
4d79620
Merge branch 'task/system-text-json-migration' into issue/OCC-245
sarahelsaig Jun 24, 2024
fd27f14
Update OC NuGet versions.
sarahelsaig Jun 24, 2024
b26be2a
Update to latest OC preview version.
sarahelsaig Jul 2, 2024
c0ee56a
Update OC preview version.
sarahelsaig Jul 11, 2024
f24bdc5
Merge remote-tracking branch 'origin/dev' into issue/OCC-245
sarahelsaig Jul 11, 2024
4458bec
Merge remote-tracking branch 'origin/task/system-text-json-migration'…
sarahelsaig Jul 12, 2024
a941653
Updating Refit to 7.1.2
Piedone Jul 13, 2024
4ef75ce
Merge remote-tracking branch 'origin/issue/OCC-245' into issue/OCORE-191
Piedone Jul 13, 2024
616a1ce
Update CreateModelMaybeAsync to return the viewmodel even if the TryU…
sarahelsaig Jul 14, 2024
69087bd
Use CreateModelMaybeAsync.
sarahelsaig Jul 14, 2024
e1ffcf2
Merge remote-tracking branch 'origin/issue/OCC-245' into issue/OCORE-191
Piedone Jul 14, 2024
e9e7da3
Merge pull request #275 from Lombiq/issue/OCORE-191
Piedone Jul 14, 2024
e296600
Add ConfigureAsync support to InlineStartup.
sarahelsaig Jul 16, 2024
f7436a6
Merge remote-tracking branch 'origin/issue/OCC-245' into issue/OCC-245
sarahelsaig Jul 16, 2024
ef2b6ba
Make them nullable.
sarahelsaig Jul 16, 2024
da2f829
Add PrepareShapeTable.
sarahelsaig Jul 16, 2024
6462b48
Add Cloudsmith badge
sarahelsaig Jul 16, 2024
97661f1
This is not actually helpful.
sarahelsaig Jul 16, 2024
f304eb9
Update Readme.md
sarahelsaig Jul 16, 2024
67adcf7
Update OC preview versions.
sarahelsaig Jul 24, 2024
d71255b
Merge branch 'task/system-text-json-migration' into issue/OCC-245
sarahelsaig Jul 24, 2024
c5899d3
Mark ConfigureSmtpSettings obsolete.
sarahelsaig Jul 26, 2024
9c78566
Add tags-ignore.
sarahelsaig Jul 27, 2024
080b03f
Try a different way.
sarahelsaig Jul 27, 2024
131b5fb
Use if condition instead.
sarahelsaig Jul 27, 2024
c8881a8
Use issue branch in publish-nuget.yml too.
sarahelsaig Jul 27, 2024
d23b078
Update UITT version.
sarahelsaig Jul 27, 2024
8ab13ea
NuGet.config
sarahelsaig Jul 27, 2024
7de5784
Obsolete CreateAdHocShape.
sarahelsaig Jul 27, 2024
b341fc1
Try fixing it for real.
sarahelsaig Jul 27, 2024
039f062
Fix ScriptModuleResourceFilter finally.
sarahelsaig Jul 27, 2024
5359efa
Add HttpRequestInfo.
sarahelsaig Jul 28, 2024
923d3f0
Update .github/workflows/publish-nuget.yml
sarahelsaig Jul 28, 2024
b7e6247
Make ShapeTables created by PerTenantShapeTableManager frozen
sarahelsaig Jul 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/publish-cloudsmith.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
publish-nuget:
uses: Lombiq/GitHub-Actions/.github/workflows/publish-nuget.yml@issue/OCC-245
uses: Lombiq/GitHub-Actions/.github/workflows/publish-nuget.yml@dev
with:
source: https://nuget.cloudsmith.io/lombiq/open-source-orchard-core-extensions/v3/index.json
secrets:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

jobs:
publish-nuget:
if: ${{ ! contains(github.ref_name, '-preview.') }}
sarahelsaig marked this conversation as resolved.
Show resolved Hide resolved
uses: Lombiq/GitHub-Actions/.github/workflows/publish-nuget.yml@dev
secrets:
API_KEY: ${{ secrets.DEFAULT_NUGET_PUBLISH_API_KEY }}
37 changes: 37 additions & 0 deletions Lombiq.HelpfulLibraries.AspNetCore/Mvc/HttpRequestInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#nullable enable

using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;
using System.Collections.Generic;
using System.Text.Json;

namespace Lombiq.HelpfulLibraries.AspNetCore.Mvc;

/// <summary>
/// A simplified intermediate type that can be used to debug <see cref="HttpRequest"/>.
/// </summary>
public record HttpRequestInfo(
string Url,
string? ContentType,
IHeaderDictionary Headers,
IDictionary<string, string> Form,
IRequestCookieCollection Cookies)
{
public HttpRequestInfo(HttpRequest request)
: this(
request.GetDisplayUrl(),
request.ContentType,
request.Headers,
request.HasFormContentType ?
request.Form.ToDictionaryIgnoreCase(pair => pair.Key, pair => pair.Value.ToString()) :
new Dictionary<string, string>(),
request.Cookies)
{
}

public override string ToString() => $"HTTP Request at \"{Url}\"";

public string ToJson() => JsonSerializer.Serialize(this);

public static string? ToJson(HttpRequest? request) => request == null ? null : new HttpRequestInfo(request).ToJson();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#nullable enable

using Microsoft.AspNetCore.Html;
using OrchardCore.DisplayManagement;
using OrchardCore.DisplayManagement.Html;
using OrchardCore.DisplayManagement.Shapes;
using System;
using System.Collections.Frozen;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Text.Encodings.Web;
using System.Threading.Tasks;

namespace Lombiq.HelpfulLibraries.OrchardCore.ResourceManagement;

public class HtmlShape : IHtmlContent, IPositioned, IShape
{
private static readonly IDictionary<string, string> _dummyAttributes = new Dictionary<string, string>().ToFrozenDictionary();
private static readonly IDictionary<string, object> _dummyProperties = new Dictionary<string, object>().ToFrozenDictionary();

private readonly Func<IHtmlContent?> _getHtml;

public string? Position { get; set; }

public ShapeMetadata Metadata { get; set; } = new();

public string? Id { get; set; }

public string? TagName { get; set; }

public IList<string> Classes => [];

public IDictionary<string, string> Attributes => _dummyAttributes;

public IDictionary<string, object> Properties => _dummyProperties;

public IReadOnlyList<IPositioned> Items => [];

public HtmlShape(Func<IHtmlContent?> getHtml, string? position = null)
{
_getHtml = getHtml;
Position = position;
}

public HtmlShape(IHtmlContent? value, string? position = null)
: this(() => value, position)
{
}

public HtmlShape(string? value, string? position = null)
: this(new HtmlContentString(value ?? string.Empty), position)
{
}

public void WriteTo(TextWriter writer, HtmlEncoder encoder) => _getHtml.Invoke()?.WriteTo(writer, encoder);

public ValueTask<IShape> AddAsync(object item, string position) => throw new ReadOnlyException();
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using OrchardCore.DisplayManagement.Implementation;
using OrchardCore.DisplayManagement.Layout;
using OrchardCore.ResourceManagement;
using System;
Expand All @@ -25,11 +24,11 @@ public record ScriptModuleResourceFilter(ILayoutAccessor LayoutAccessor) : IAsyn
{
public async Task OnResultExecutionAsync(ResultExecutingContext context, ResultExecutionDelegate next)
{
var shape = await context.HttpContext.RequestServices.CreateAdHocShapeForCurrentThemeAsync(
nameof(ScriptModuleResourceFilter),
displayContext => Task.FromResult(DisplayScriptModuleResources(displayContext.ServiceProvider)));
await LayoutAccessor.AddShapeToZoneAsync(
CommonLocationNames.Content,
new HtmlShape(() => DisplayScriptModuleResources(context.HttpContext.RequestServices)),
"After");

await LayoutAccessor.AddShapeToZoneAsync("Content", shape, "After");
await next();
}

Expand Down
3 changes: 3 additions & 0 deletions Lombiq.HelpfulLibraries.OrchardCore/Shapes/ShapeExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Lombiq.HelpfulLibraries.OrchardCore.ResourceManagement;
using Microsoft.AspNetCore.Html;
using Microsoft.Extensions.DependencyInjection;
using OrchardCore.DisplayManagement.Descriptors;
Expand Down Expand Up @@ -60,6 +61,7 @@ public static T As<T>(this IShape shape)
/// name="shapeTable"/>, then a new descriptor is added with binding that uses <paramref name="displayAsync"/>.
/// If <paramref name="type"/> is null or empty, a new random unique name is generated.
/// </summary>
[Obsolete($"This no longer works with the {nameof(DefaultShapeTableManager)}. Use {nameof(HtmlShape)} instead.")]
Piedone marked this conversation as resolved.
Show resolved Hide resolved
public static IShape CreateAdHocShape(this ShapeTable shapeTable, string type, Func<DisplayContext, Task<IHtmlContent>> displayAsync)
{
if (string.IsNullOrEmpty(type)) type = $"AdHocShape_{Guid.NewGuid():D}";
Expand Down Expand Up @@ -102,6 +104,7 @@ public static IShape CreateAdHocShape(this ShapeTable shapeTable, string type, F
/// uses <paramref name="displayAsync"/>. If <paramref name="type"/> is null or empty, a new random unique name is
/// generated.
/// </summary>
[Obsolete($"This no longer works with the {nameof(DefaultShapeTableManager)}. Use {nameof(HtmlShape)} instead.")]
public static async Task<IShape> CreateAdHocShapeForCurrentThemeAsync(
this IServiceProvider provider,
string type,
Expand Down
4 changes: 0 additions & 4 deletions NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<!-- Ignore global configuration -->
<clear />
<!-- Here so the Visual Studio package manager won't default to the next feed below. -->
<add key="OrchardCoreCommercePreview" value="https://nuget.cloudsmith.io/orchardcore/commerce/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="OrchardCorePreview" value="https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json" />
</packageSources>
Expand All @@ -14,9 +13,6 @@
<!-- OrchardCore.Translations.All is on a separate repo and doesn't have a preview -->
<package pattern="OrchardCore.Translations.*" />
</packageSource>
<packageSource key="OrchardCoreCommercePreview">
<package pattern="OrchardCore.Commerce*" />
</packageSource>
<packageSource key="OrchardCorePreview">
<package pattern="OrchardCore*" />
<!-- OrchardCore theme packages -->
Expand Down