Skip to content

Commit

Permalink
Handle legacy models without a "result" field gracefully in the clien…
Browse files Browse the repository at this point in the history
…t code. Closes #430.
  • Loading branch information
tshead2 committed May 20, 2015
1 parent 0a7cfed commit 76cba95
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions web-server/js/slycat-navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ define("slycat-navbar", ["slycat-server-root", "slycat-web-client", "slycat-chan
if(model.state() == "running")
alerts.push({"type":"success", "message":"The model is being computed. Patience!", "detail":null})

if(model.result() == "failed")
if(model.result && model.result() == "failed")
alerts.push({"type":"danger", "message":"Model failed to build. Here's what was happening when things went wrong:", "detail": model.message()})
}

Expand Down Expand Up @@ -326,7 +326,7 @@ define("slycat-navbar", ["slycat-server-root", "slycat-web-client", "slycat-chan
<!-- ko foreach: finished_models --> \
<li> \
<a data-bind="attr:{href:$parent.server_root + \'models/\' + $data._id()},popover:{trigger:\'hover\',content:$data.message()}"> \
<button type="button" class="btn btn-default btn-xs" data-bind="click:$parent.close_model,clickBubble:false,css:{\'btn-success\':$data.result()===\'succeeded\',\'btn-danger\':$data.result()!==\'succeeded\'}"><span class="fa fa-check"></span></button> \
<button type="button" class="btn btn-default btn-xs" data-bind="click:$parent.close_model,clickBubble:false,css:{\'btn-success\':$data.result && $data.result()===\'succeeded\',\'btn-danger\':$data.result && $data.result()!==\'succeeded\'}"><span class="fa fa-check"></span></button> \
<span data-bind="text:name"></span> \
</a> \
</li> \
Expand Down
2 changes: 1 addition & 1 deletion web-server/templates/slycat-project.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ <h3>Models</h3>
<span class="label label-default" data-bind="text:$data['model-type']() + ' model'"></span>
<strong data-bind="text:name"></strong>
<div class="pull-right" style="display: inline-block" data-bind="html:$parent.badge($data.marking())"></div>
<span class="label label-danger" data-bind="visible:result() == 'failed',popover:{placement:'right', trigger:'hover', content:message}">Failed</span>
<span class="label label-danger" data-bind="visible:$data.result && $data.result() == 'failed',popover:{placement:'right', trigger:'hover', content:message}">Failed</span>
<p>
<small>
<span data-bind="text:description"></span>
Expand Down

0 comments on commit 76cba95

Please sign in to comment.