coravelpro
coravelpro copied to clipboard
Configurable Dashboard URL
Original at https://github.com/jamesmh/coravel/issues/104
So there is really no chance to allow to change it?
It's something I'll have to look into more, but ATM it's all autoconfigured using routing from a razor library (e.g. it depends on the directory paths of the files in the Coravel Pro package)
I am also facing issues with the URL of the dashboard. When I configure my website as an application in some folder structure in IIS then the functionality won't work because it expects a different URL.
For example: http://mysite.com/dir1/sub1/app
When navigating to http://mysite.com/dir1/sub1/app/coravel/scheduling the page loads fine at first sight, but the action links (Schedule) are not working (as it expects a URL of http://mysite.com/coravel/scheduling).
I had this issue once but works for me now.
Note: Updated: After some research.
You should be able to override routes by using the following code.
builder.Services.Configure<RazorPagesOptions>(options =>
{
options.Conventions.AddAreaPageRoute(
"Coravel",
"/Dashboard",
"/My-Custom-Dashboard"
);
});
This will at least change route generation when using the ASP.NET Core tag helpers. For example.
<li class="nav-item">
<a class="nav-link text-dark" asp-area="Coravel" asp-page="/Dashboard">
Dashboard
</a>
</li>

The issue I'm seeing is when in the dashboard, the routes in the dashboard aren't changing. I can't see the code, but I'm guessing those routes are hard-coded using strings like /Coravel/Dashboard
instead of the tag helpers or they are not including the asp-area
attribute.

Once the Razor Pages are updated, it's a matter of creating a helper method around IServicesCollection
that allows folks to configure and register an instance of an Options class.
Cheers :)