public/js/views/generic.js in conjur-asset-ui-1.3.1 vs public/js/views/generic.js in conjur-asset-ui-1.3.2
- old
+ new
@@ -1,19 +1,16 @@
/** @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}>
@@ -26,11 +23,11 @@
</tr>
);
}
});
- this.GenericList = React.createClass({
+ var GenericList = this.GenericList = React.createClass({
getInitialState: function() {
return {
sort: {
column: this.props.defaultColumn || 'id',
order: this.props.defaultOrder || 'asc'
@@ -54,11 +51,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);
@@ -75,15 +72,12 @@
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';
@@ -115,8 +109,7 @@
});
}).bind(conjur.views)
(
conjur,
- React,
- _
+ React
);