public/js/views/owned.js in conjur-asset-ui-1.3.0 vs public/js/views/owned.js in conjur-asset-ui-1.3.1
- old
+ new
@@ -1,8 +1,9 @@
/** @jsx React.DOM */
+/* global conjur, React, _ */
-(function(conjur, _, React) {
+(function(conjur, React, _) {
'use strict';
var knownTypes = ['user', 'group', 'layer', 'host', 'variable', 'policy'];
var OwnedResourcesBox = this.OwnedResourcesBox = React.createClass({
@@ -32,15 +33,20 @@
// TODO: sort by kind with custom weights, by id, by creation date
// automatically gives sort by kind, id
return a.id.toLowerCase().localeCompare(b.id.toLowerCase());
}).map(function(resource) {
var kind = resource.id.split(':')[1];
+
filters.push(kind);
- if ((this.state.filter === '')
- || (this.state.filter != 'other' && this.state.filter === kind)
- || (this.state.filter === 'other' && _.intersection([kind], knownTypes).length === 0)) {
+ if ((this.state.filter === '') ||
+ (this.state.filter !== 'other' && this.state.filter === kind) ||
+ (this.state.filter === 'other' &&
+ _.intersection([kind], knownTypes).length === 0)) {
+
+ var ResourceLink = conjur.views.ResourceLink;
+
return (
<li className="list-group-item list-group-item-noborder">
<ResourceLink data={resource} />
</li>
);
@@ -59,11 +65,11 @@
);
}
var filterSelect = '';
- if (this.props.resources.length > 9 || this.state.filter != '') {
+ if (this.props.resources.length > 9 || this.state.filter !== '') {
// TODO: sort, when done with previous TODO
filterSelect = _.intersection(_.uniq(filters, true), knownTypes).map(function(f) {
return (
<option value={f}>{_.str.capitalize(conjur.utils.pluralize(f))}</option>
);
@@ -125,11 +131,11 @@
</div>
);
}
});
- var OwnedResources = this.OwnedResources = React.createClass({
+ this.OwnedResources = React.createClass({
getInitialState: function() {
return {
expanded: false
};
},
@@ -171,8 +177,8 @@
});
}).bind(conjur.views)
(
conjur,
- _,
- React
+ React,
+ _
);