From 989fd8ea5c40431220dc3b69cc1b7d43849cde77 Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Fri, 18 Dec 2015 14:59:15 +0100 Subject: [PATCH] Fix React warnings --- .../piece_list_toolbar_filter_widget.js | 8 +++----- .../piece_list_toolbar_order_widget.js | 5 ++--- .../ascribe_table/table_item_acl_filtered.js | 19 +++++++++---------- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/js/components/ascribe_piece_list_toolbar/piece_list_toolbar_filter_widget.js b/js/components/ascribe_piece_list_toolbar/piece_list_toolbar_filter_widget.js index c463330c..7b8a9955 100644 --- a/js/components/ascribe_piece_list_toolbar/piece_list_toolbar_filter_widget.js +++ b/js/components/ascribe_piece_list_toolbar/piece_list_toolbar_filter_widget.js @@ -90,10 +90,8 @@ let PieceListToolbarFilterWidget = React.createClass({ label also iterate over its items, to get all filterable options */} {this.props.filterParams.map(({ label, items }, i) => { return ( -
-
  • +
    +
  • {label}:
  • {items.map((param, j) => { @@ -117,7 +115,7 @@ let PieceListToolbarFilterWidget = React.createClass({ return (
  • diff --git a/js/components/ascribe_piece_list_toolbar/piece_list_toolbar_order_widget.js b/js/components/ascribe_piece_list_toolbar/piece_list_toolbar_order_widget.js index c38144b0..cfd1e108 100644 --- a/js/components/ascribe_piece_list_toolbar/piece_list_toolbar_order_widget.js +++ b/js/components/ascribe_piece_list_toolbar/piece_list_toolbar_order_widget.js @@ -62,9 +62,8 @@ let PieceListToolbarOrderWidget = React.createClass({
  • {this.props.orderParams.map((param) => { return ( -
    +
  • @@ -85,4 +84,4 @@ let PieceListToolbarOrderWidget = React.createClass({ } }); -export default PieceListToolbarOrderWidget; \ No newline at end of file +export default PieceListToolbarOrderWidget; diff --git a/js/components/ascribe_table/table_item_acl_filtered.js b/js/components/ascribe_table/table_item_acl_filtered.js index 22a28130..9ca91bcf 100644 --- a/js/components/ascribe_table/table_item_acl_filtered.js +++ b/js/components/ascribe_table/table_item_acl_filtered.js @@ -3,15 +3,15 @@ import React from 'react'; -let TableItemAclFiltered = React.createClass({ +const TableItemAclFiltered = React.createClass({ propTypes: { content: React.PropTypes.object, - notifications: React.PropTypes.string + notifications: React.PropTypes.array }, render() { - var availableAcls = ['acl_consign', 'acl_loan', 'acl_transfer', 'acl_view', 'acl_share', 'acl_unshare', 'acl_delete']; - if (this.props.notifications && this.props.notifications.length > 0){ + const availableAcls = ['acl_consign', 'acl_loan', 'acl_transfer', 'acl_view', 'acl_share', 'acl_unshare', 'acl_delete']; + if (this.props.notifications && this.props.notifications.length) { return ( {this.props.notifications[0].action_str} @@ -19,15 +19,14 @@ let TableItemAclFiltered = React.createClass({ ); } - let filteredAcls = Object.keys(this.props.content).filter((key) => { - return availableAcls.indexOf(key) > -1 && this.props.content[key]; - }); - - filteredAcls = filteredAcls.map((acl) => acl.split('acl_')[1]); + const filteredAcls = Object.keys(this.props.content) + .filter((key) => availableAcls.indexOf(key) > -1 && this.props.content[key]) + .map((acl) => acl.split('acl_')[1]) + .join('/'); return ( - {filteredAcls.join('/')} + {filteredAcls} ); }