public/js/views/generic.js in conjur-asset-ui-1.3.0 vs public/js/views/generic.js in conjur-asset-ui-1.3.1
- old
+ new
@@ -1,16 +1,19 @@
/** @jsx React.DOM */
+/* global conjur, React, _ */
-(function(conjur, React) {
+(function(conjur, React, _) {
'use strict';
+ var RoleLink = conjur.views.RoleLink;
+
var GenericListItem = React.createClass({
render: function() {
- var recordUrl = '/ui/'
- + this.props.data.kind
- + '/'
- + window.encodeURIComponent(this.props.data.record.identifier);
+ var recordUrl = '/ui/' +
+ this.props.data.kind +
+ '/' +
+ window.encodeURIComponent(this.props.data.record.identifier);
return (
<tr>
<td className="id">
<a href={recordUrl}>
@@ -23,11 +26,11 @@
</tr>
);
}
});
- var GenericList = this.GenericList = React.createClass({
+ this.GenericList = React.createClass({
getInitialState: function() {
return {
sort: {
column: this.props.defaultColumn || 'id',
order: this.props.defaultOrder || 'asc'
@@ -51,11 +54,11 @@
return function(e) {
e.preventDefault();
var order = (this.state.sort.order === 'asc') ? 'desc' : 'asc';
- if (this.state.sort.column != column) {
+ if (this.state.sort.column !== column) {
order = this.state.columns[column].defaultSortOrder;
}
this.setState({sort: {column: column, order: order}});
}.bind(this);
@@ -72,12 +75,15 @@
var items = this.props.data.members.map(function(o) {
return o;
});
items = _.sortBy(items, this.state.sort.column);
- if (this.state.sort.order === 'desc') items.reverse();
+ if (this.state.sort.order === 'desc') {
+ items.reverse();
+ }
+
var rows = items.map(function (o) {
var componentName = _.str.capitalize(
this.props.data.kind.substring(0, this.props.data.kind.length-1)
) + 'ListItem';
@@ -109,7 +115,8 @@
});
}).bind(conjur.views)
(
conjur,
- React
+ React,
+ _
);