refactor(GoogleCloud): Clean up some of the Healthcare API Adapter components (#641)

This commit is contained in:
Erik Ziegler authored and GitHub committed 2019-07-10 14:54:27 +02:00
1 parent 4a09f33446
commit 091cab49e0
21 files changed
+613 -438

No files matched your search

+40 -19
View File
@@ -1,31 +1,33 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import './googleCloud.css';
import { withTranslation } from 'react-i18next';
import { Icon } from 'react-viewerbase';
export default class DicomStoreList extends Component {
constructor(props) {
super(props);
this.state = {
search: '',
};
}
class DicomStoreList extends Component {
state = {
search: '',
};
static propTypes = {
stores: PropTypes.array,
loading: PropTypes.bool,
loading: PropTypes.bool.isRequired,
error: PropTypes.string,
onSelect: PropTypes.func,
};
static defaultProps = {};
renderTableRow(store) {
static defaultProps = {
loading: true,
};
renderTableRow = store => {
return (
<tr
key={store.name}
className={
this.state.highlightedItem === store.name
? 'studylistStudy noselect active'
: 'studylistStudy noselect'
? 'noselect active'
: 'noselect'
}
onMouseEnter={() => {
this.onHighlightItem(store.name);
@@ -37,21 +39,40 @@ export default class DicomStoreList extends Component {
<td className="project">{store.name.split('/')[7]}</td>
</tr>
);
}
};
onHighlightItem(store) {
this.setState({ highlightedItem: store });
}
render() {
if (this.props.error) {
return <p>{this.props.error}</p>;
}
const loadingIcon = (
<Icon name="circle-notch" className="loading-icon-spin loading-icon" />
);
if (this.props.loading) {
return loadingIcon;
}
const body = (
<tbody id="StoreList">{this.props.stores.map(this.renderTableRow)}</tbody>
);
return (
<table id="tblStoreList" className="studyListToolbar table noselect">
<tbody id="StoreList">
{this.props.stores.map(store => {
return this.renderTableRow(store);
})}
</tbody>
<table id="tblStoreList" className="gcp-table table noselect">
<thead>
<tr>
<th>{this.props.t('DICOM Store')}</th>
</tr>
</thead>
{this.props.stores && body}
</table>
);
}
}
export default withTranslation('Common')(DicomStoreList);