Xabaril / AspNetCore.Diagnostics.HealthChecks

Enterprise HealthChecks for ASP.NET Core Diagnostics Package
Apache License 2.0
4k stars 780 forks source link

AddCustomStylesheet Not Applying Changes #435

Closed p0onage closed 4 years ago

p0onage commented 4 years ago

I've added the following into my startup class

app.UseStaticFiles();
         app.UseRouting()
                .UseEndpoints(config =>
                {
                    config.MapHealthChecksUI(setup =>
                    {
                        setup.AddCustomStylesheet("wwwroot//dotnet.css");
                    });
                });

Inside the wwwroot folder, I have the dotnet.css file

:root { --primaryColor: #5ec297 !important; --bgImageLigthen: linear-gradient( rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.8) ) !important; --logoImageUrl: url('/images/mylogo.png') !important; }

why are the override CSS styles not working?

CarlosLanderas commented 4 years ago

Hello @p0onage, I've just tried to use a custom css sheet in wwwroot and it's working for me, could you try this?: Css definition:

:root {

    --primaryColor: #68217a;
    --secondaryColor: #f4f4f4;  
    --bgMenuActive: #8e47a0;
    --bgButton: #68217a;
    --logoImageUrl: url('https://dotnetfoundation.org/img/logo_footer.png');
    --bgAside: var(--primaryColor);   
}

Code:

 app.UseRouting()
               .UseAuthentication()
               .UseAuthorization()
               .UseEndpoints(config =>
               {
                   config.MapHealthChecks("/health-random", new HealthCheckOptions
                   {
                       Predicate = r => r.Tags.Contains("random"),
                       ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
                   });

                   config.MapHealthChecks("/health-process", new HealthCheckOptions
                   {
                       Predicate = r => r.Tags.Contains("process"),
                       ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
                   });

                   config.MapHealthChecksUI(setup =>
                   {
                       setup.AddCustomStylesheet("wwwroot/dotnet.css");

                   })
                   //.RequireAuthorization("AuthUserPolicy")
                   ;

                   config.MapDefaultControllerRoute();
               });
p0onage commented 4 years ago

@CarlosLanderas, I had this at the end of my start-up using your example worked thanks!

        app.UseHealthChecksUI(config => config.UIPath = "/hc-ui");