import React, { Component } from 'react'; import PropTypes from 'prop-types'; import './googleCloud.css'; import { withTranslation } from 'react-i18next'; import { Icon } from 'react-viewerbase'; class DatasetsList extends Component { state = { search: '', }; static propTypes = { datasets: PropTypes.array, loading: PropTypes.bool, error: PropTypes.string, onSelect: PropTypes.func, }; static defaultProps = { loading: true, }; renderTableRow = dataset => { return ( { this.onHighlightItem(dataset.name); }} onClick={() => { this.props.onSelect(dataset); }} > {dataset.name.split('/')[5]} ); }; onHighlightItem(dataset) { this.setState({ highlightedItem: dataset }); } render() { if (this.props.error) { return

{this.props.error}

; } const loadingIcon = ( ); if (this.props.loading) { return loadingIcon; } const body = ( {this.props.datasets.map(this.renderTableRow)} ); return ( {this.props.datasets && body}
{this.props.t('Dataset')}
); } } export default withTranslation('Common')(DatasetsList);