Skip to content

Commit

Permalink
Fixed #1082 (#1107)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdriscoll authored Sep 12, 2019
1 parent 327a90d commit 800cbdd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"presentation": {
"reveal": "always",
"panel": "new"
}
},
"problemMatcher": []
},
{
"label": "Build Release",
Expand Down
20 changes: 20 additions & 0 deletions src/UniversalDashboard.UITest/Integration/Input.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,26 @@ $Driver = Start-SeFirefox

Describe "Input" {


Context "drops to pipeline" {
$Dashboard = New-UDDashboard -Title "Test" -Content {
New-UDInput -Title "Simple Form" -Id "Form" -Endpoint {
"This is some stuff"

New-UDInputAction -Content { New-UDElement -Tag 'div' -Id 'hello' }
}
}

$Server.DashboardService.SetDashboard($Dashboard)
Enter-SeUrl -Driver $Driver -Url "http://localhost:$BrowserPort"

It "should not spin forever if an item is dropped to the pipeline that isn't UDInputAction" {
$Button = Find-SeElement -Id "btnForm" -Driver $Driver
Invoke-SeClick $Button
Find-SeElement -Id 'hello' -Driver $Driver | should not be $null
}
}

Context "textbox" {
$Dashboard = New-UDDashboard -Title "Test" -Content {
New-UDInput -Title "Simple Form" -Id "Form" -Content {
Expand Down
6 changes: 4 additions & 2 deletions src/UniversalDashboard/Controllers/ComponentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public ComponentController(IExecutionService executionService, IDashboardService
_stateRequestService = stateRequestService;
}

private async Task<IActionResult> RunScript(Endpoint endpoint, Dictionary<string, object> parameters = null)
private async Task<IActionResult> RunScript(Endpoint endpoint, Dictionary<string, object> parameters = null, bool noSerialization = false)
{
try {
var variables = new Dictionary<string, object> {
Expand All @@ -71,6 +71,8 @@ private async Task<IActionResult> RunScript(Endpoint endpoint, Dictionary<string
}

ExecutionContext executionContext = new ExecutionContext(endpoint, variables, parameters, HttpContext?.User);
executionContext.NoSerialization = noSerialization;

if (HttpContext.Session.TryGetValue("SessionId", out byte[] sessionIdBytes))
{
var sessionId = new Guid(sessionIdBytes);
Expand Down Expand Up @@ -318,7 +320,7 @@ public async Task<IActionResult> Input([FromRoute]string id)
return NotFound();
}

return await RunScript(endpoint, variables);
return await RunScript(endpoint, variables, true);
}

[HttpPost]
Expand Down

0 comments on commit 800cbdd

Please sign in to comment.