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

- old
+ new

@@ -1,47 +1,36 @@ /** @jsx React.DOM */ -/* global conjur, React */ -(function(conjur, React) { - 'use strict'; +var AnnotationsBox = React.createClass({ + render: function() { + + if (!this.props.annotations || !this.props.annotations.length>0 ) { + return <div> + <span>None</span> + </div>; + } - this.AnnotationsBox = React.createClass({ - render: function() { - if (!this.props.annotations || this.props.annotations.length === 0) { - return ( - <div> - <span>None</span> - </div> - ); - } + // 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; - // TODO: sort by date (optionally) - // TODO: table view - var annotationsList = []; + 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>); + }); - 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'; - annotationsList.push(<dt key={term}>{itemName}</dt>); - annotationsList.push(<dd key={description}>{itemValue}</dd>); - }); - - return ( - <div> + return <div> <dl className="annotations dl-horizontal"> - {annotationsList} + {annotations_list} </dl> - </div> - ); - } - }); - -}).bind(conjur.views) -( - conjur, - React + </div>; + } + } );