-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Extending ISetupEventHandler
with new events
#14184
Conversation
@jtkech I am noticing an issue here that I can't seem to explain. public class SelfTenantSetupHandler : TenantSetupHandlerBase
{
private readonly INotifier _notifier;
private readonly IHtmlLocalizer H;
public TestSetup(
INotifier notifier,
IHtmlLocalizer<TestSetup> localizer)
{
_notifier = notifier;
H = localizer;
}
public override async Task SuccessAsync()
{
await _notifier.SuccessAsync(H["You successfully have setup your website!"]);
}
} When the tenant is done setting up, we set set it's status to running and then reload the site. So Either way, the new |
Yes Yes I closed my PR to make a pause around this, waiting for after the incoming release and because I have some works in late, but I'm not against so let's restart the discussion ;) Maybe we could have kept the existing I like the method names, if we use
Just saw that if we failed to init the data store we alreay have enlisted an error, I think we are missing the following check also before reloading the shell.
Or maybe handlers would have to check if there is already an error if we don't add the above check, but yes existing handlers don't have a direct access to the setup context, maybe there is a good reason. Not fully sure we need a I'm stopping, I will think about it and review it more in depth when I will have time. |
That would be a breaking change which is I am trying to avoid. Other people may already be implementing Not sure I follow you on the I'll rename events as per your suggestions. Also check the condition that returns null. |
Yes I know that's why in my other PR (whose goal was not the same) I let it as is and only added a new handler. Here I thought about what would be better at the end, sometimes we can introduce intentionally a well documented breaking change, but as said I was not fully sure, and yes here maybe not worth to do. Hmm, maybe a compromise would be to keep Otherwise why not, maybe I'm wrong, only thinkings on the fly, as said would need to focus on it a little more. You already described a little what you may do in a setup succeeded event, can you describe what you may do in a setup failed event? |
@jtkech I went ahead and did some cleanup in the Let me know if you see any issues with the presented PR. |
Okay, Looks like you did too much changes and are doing things in some places that may not be correct. I will review and comment it asap. |
@jtkech I reverted some changes here and tested it. Everything seems to be still working as expected. I'll await your reply to my comments before making the other changes. I also changed where we fire the new events based on your recommendation. |
Okay, can't right know but will review asap |
src/OrchardCore/OrchardCore.Setup.Abstractions/Events/ISetupEventHandler.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Settings/Services/SetupEventHandler.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore/OrchardCore.Setup.Abstractions/Events/ITenantSetupHandler.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore/OrchardCore.Setup.Abstractions/TenantSetupHandlerBase.cs
Outdated
Show resolved
Hide resolved
@jtkech I think I addressed all you feedback. Let me know if I missed anything. |
Okay, looks good, will review tomorrow. |
ISetupEventHandler
with ITenantSetupHandler
.ISetupEventHandler
with ITenantSetupEventHandler
.
@MikeAlhayek will test default interfance implementations |
ISetupEventHandler
with ITenantSetupEventHandler
.ISetupEventHandler
with new events
src/OrchardCore/OrchardCore.Setup.Abstractions/Events/ISetupEventHandler.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore/OrchardCore.Setup.Abstractions/Events/ISetupEventHandler.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore/OrchardCore.Setup.Abstractions/SetupEventHandler.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Settings/Services/GeneralSetupEventHandler.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Users/Services/AdminSetupEventHandler.cs
Outdated
Show resolved
Hide resolved
@jtkech Made all the requested changed.... Last changes? hopefully... |
Yes, sorry for being too strict sometimes, maybe because it's too hot in France ;) |
/// <param name="context"></param> | ||
/// <returns></returns> | ||
Task SetupAsync(SetupContext context) | ||
=> Task.CompletedTask; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the meantime I will approve
But as a last idea the default implementation of SetupAsync()
could be to call Setup()
so that we don't need to call the obsolete Setup()
from the SetupService
and only use the rule pragma here, all in one place.
Something like this, quickly written so may need to be tweaked.
Task SetupAsync(SetupContext context) =>
Setup(context.Properties, (key, message) => context.Errors[key] = message );
Weather in Romans is 29c, weather in Las Vegas 37c :) no problem. |
I think you missed my last comment Did you tried my last suggestion here #14184 (comment) Yes, now 29c because at midnight ;) |
Fix #14170
@jtkech we discussed this in #14172.
This is the approach I had in mind. With the new
ITenantSetupHandler
, one can perform some setup logic after the tenant is setup.Thoughts?