From e549f887e8b8774460d1d3cd43f56901a21bc463 Mon Sep 17 00:00:00 2001 From: Jari Bakken Date: Fri, 24 Oct 2014 10:49:10 +0200 Subject: [PATCH] Add ErrorMessages --- unleash-server/public/js/unleash.jsx | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/unleash-server/public/js/unleash.jsx b/unleash-server/public/js/unleash.jsx index 6395a7d707..a9701ce6ef 100644 --- a/unleash-server/public/js/unleash.jsx +++ b/unleash-server/public/js/unleash.jsx @@ -71,9 +71,33 @@ var FeatureList = React.createClass({ }); +var ErrorMessages = React.createClass({ + + + render: function() { + if (!this.props.errors.length) { + return
; + } + + var errorNodes = this.props.errors.map(function(e) { + return (
  • {e}
  • ); + }); + + return ( +
    +
      {errorNodes}
    +
    + ); + } +}); + var Unleash = React.createClass({ getInitialState: function() { - return { savedFeatures: [], unsavedFeatures: [] }; + return { + savedFeatures: [], + unsavedFeatures: [], + errors: [] + }; }, componentDidMount: function () { @@ -90,7 +114,6 @@ var Unleash = React.createClass({ }, handleError: function (error) { - // TODO: ErrorComponent could use window.alert(error); }, @@ -122,6 +145,7 @@ var Unleash = React.createClass({ return (
    +