public/js/views/annotations.js in conjur-asset-ui-1.3.0 vs public/js/views/annotations.js in conjur-asset-ui-1.3.1

- old
+ new

@@ -1,36 +1,47 @@ /** @jsx React.DOM */ +/* global conjur, React */ -var AnnotationsBox = React.createClass({ - render: function() { - - if (!this.props.annotations || !this.props.annotations.length>0 ) { - return <div> - <span>None</span> - </div>; - } +(function(conjur, React) { + 'use strict'; - // TODO: sort by date (optionally) - // TODO: table view - var annotations_list = []; - this.props.annotations.sort(function(a,b) { - return a.name.toLowerCase().localeCompare(b.name.toLowerCase()); - }).forEach(function(item){ - var itemname = item.name; - var itemvalue = item.value; + this.AnnotationsBox = React.createClass({ + render: function() { + if (!this.props.annotations || this.props.annotations.length === 0) { + return ( + <div> + <span>None</span> + </div> + ); + } - var dt_key = "annotation_"+itemname+"_key"; - var dd_key = "annotation_"+itemname+"_value"; - - annotations_list.push(<dt key={dt_key}>{itemname}</dt>); - annotations_list.push(<dd key={dd_key}>{itemvalue}</dd>); - }); + // TODO: sort by date (optionally) + // TODO: table view + var annotationsList = []; + this.props.annotations.sort(function(a, b) { + return a.name.toLowerCase().localeCompare(b.name.toLowerCase()); + }).forEach(function(item) { + var itemName = item.name, + itemValue = item.value, + term = 'annotation_' + itemName + '_key', + description = 'annotation_' + itemName + '_value'; - return <div> + annotationsList.push(<dt key={term}>{itemName}</dt>); + annotationsList.push(<dd key={description}>{itemValue}</dd>); + }); + + return ( + <div> <dl className="annotations dl-horizontal"> - {annotations_list} + {annotationsList} </dl> - </div>; - } - } + </div> + ); + } + }); + +}).bind(conjur.views) +( + conjur, + React );