Skip to content

Commit

Permalink
Merge pull request #1198 from ironmansoftware/1078
Browse files Browse the repository at this point in the history
Fixes #1078
  • Loading branch information
adamdriscoll authored Sep 29, 2019
2 parents 0d72b96 + e9a2ea4 commit f782449
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ class UDSideNavItem extends React.Component {
if (!url.startsWith("/")) {
url = "/" + url;
}
this.props.history.push(`${url.replace(/ /g, "-")}`);
this.props.history.push(`${window.baseUrl + url.replace(/ /g, "-")}`);
}
else if (this.props.name != null) {
this.props.history.push(`/${this.props.name.replace(/ /g, "-")}`);
this.props.history.push(window.baseUrl + `/${this.props.name.replace(/ /g, "-")}`);
}

if (!this.props.fixed) {
Expand Down
14 changes: 9 additions & 5 deletions src/UniversalDashboard/Controllers/ComponentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using UniversalDashboard.Interfaces;
using UniversalDashboard.Models.Basics;
using System.Security;
using StackExchange.Profiling;

namespace UniversalDashboard.Controllers
{
Expand Down Expand Up @@ -80,13 +81,16 @@ private async Task<IActionResult> RunScript(Endpoint endpoint, Dictionary<string
executionContext.ConnectionId = _memoryCache.Get(executionContext.SessionId) as string;
}

return await Task.Run(() =>
using (MiniProfiler.Current.Step($"Execute: {endpoint.Name}"))
{
var result = _executionService.ExecuteEndpoint(executionContext, endpoint);
var actionResult = ConvertToActionResult(result);
return await Task.Run(() =>
{
var result = _executionService.ExecuteEndpoint(executionContext, endpoint);
var actionResult = ConvertToActionResult(result);

return actionResult;
});
return actionResult;
});
}
}
catch (Exception ex) {
Log.Warn("RunScript() " + ex.Message + Environment.NewLine + ex.StackTrace);
Expand Down
7 changes: 4 additions & 3 deletions src/UniversalDashboard/Server/ServerStartup.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
Expand All @@ -15,7 +13,6 @@
using Microsoft.Extensions.Hosting;
using UniversalDashboard.Interfaces;
using Microsoft.AspNetCore.Mvc.Filters;
using UniversalDashboard.Controllers;
using System.IO;
using UniversalDashboard.Utilities;

Expand Down Expand Up @@ -71,6 +68,8 @@ public void ConfigureServices(IServiceCollection services)
options.Cookie.SecurePolicy = CookieSecurePolicy.SameAsRequest;
});

services.AddMiniProfiler();

var serviceDescriptor = services.FirstOrDefault(descriptor => descriptor.ServiceType.Name == "IRegistryPolicyResolver");
services.Remove(serviceDescriptor);
}
Expand Down Expand Up @@ -152,6 +151,8 @@ public void Configure(IApplicationBuilder app, Microsoft.AspNetCore.Hosting.IHos

app.UseSession();

app.UseMiniProfiler();

app.UseMvc();
}
}
Expand Down
1 change: 1 addition & 0 deletions src/UniversalDashboard/UniversalDashboard.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv" Version="2.1.3" />
<PackageReference Include="MiniProfiler.AspNetCore.Mvc" Version="4.1.0" />
<PackageReference Include="System.Reflection.Emit" Version="4.3.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="2.1.2" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
Expand Down
6 changes: 3 additions & 3 deletions src/client/src/app/ud-dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -350,15 +350,15 @@ export default class UdDashboard extends React.Component {
<Switch>
{staticPages}
{dynamicPages}
<Route exact path="/" render={this.redirectToHomePage.bind(this)} />
<Route path="/" render={() => <NotFound/>} />
<Route exact path={window.baseUrl + `/`} render={this.redirectToHomePage.bind(this)} />
<Route path={window.baseUrl + `/`} render={() => <NotFound/>} />
</Switch>
</main>,
<Suspense fallback={<div></div>}>
<UdModalComponent />
</Suspense>,
<UdFooter backgroundColor={this.state.dashboard.navBarColor} fontColor={this.state.dashboard.navBarFontColor} footer={this.state.dashboard.footer} demo={this.state.dashboard.demo} />,
<Route path="/" render={function (x) {
<Route path={window.baseUrl + `/`} render={function (x) {
return <Suspense fallback={<div></div>}>
<UdPageCyclerComponent history={x.history} pages={this.state.dashboard.pages} cyclePages={this.state.dashboard.cyclePages && !this.state.pausePageCycle} cyclePagesInterval={this.state.dashboard.cyclePagesInterval} />
</Suspense>
Expand Down

0 comments on commit f782449

Please sign in to comment.