import React, { Component } from 'react';
import PropTypes from 'prop-types';
import './googleCloud.css';
import { withTranslation } from 'react-i18next';
import { Icon } from '@ohif/ui';
class DicomStoreList extends Component {
state = {
search: '',
};
static propTypes = {
stores: PropTypes.array,
loading: PropTypes.bool.isRequired,
error: PropTypes.string,
onSelect: PropTypes.func,
};
static defaultProps = {
loading: true,
};
renderTableRow = store => {
return (
{
this.onHighlightItem(store.name);
}}
onClick={() => {
this.props.onSelect(store);
}}
>
| {store.name.split('/')[7]} |
);
};
onHighlightItem(store) {
this.setState({ highlightedItem: store });
}
render() {
const { loading, stores, filter, error } = this.props;
if (error) {
return {error}
;
}
const loadingIcon = (
);
if (loading) {
return loadingIcon;
}
const body = (
{
stores.filter(store => (store.name.split('/')[7].toLowerCase().includes(filter.toLowerCase()) || filter=="")).map(this.renderTableRow)}
);
return (
| {this.props.t('DICOM Store')} |
{stores && body}
);
}
}
export default withTranslation('Common')(DicomStoreList);