11import React , { Component } from 'react' ;
2- import { Dropdown , Button , Ref } from 'semantic-ui-react' ;
2+ import { Dropdown } from 'semantic-ui-react' ;
33import PropTypes from 'prop-types' ;
4- import classNames from 'classnames' ;
54
5+ import DbBtn from './dbBtn' ;
66import Popup from '../../popup' ;
77
88export default class DbSummaryKey extends Component {
@@ -28,38 +28,19 @@ export default class DbSummaryKey extends Component {
2828 return null ;
2929 }
3030
31- const successFetchDbDetails = fetchDbDetails . filter ( d => d . success ) ;
32- const isFailed = successFetchDbDetails . length !== fetchDbDetails . length ;
33- const value = `${ successFetchDbDetails . length } /${ fetchDbDetails . length } ` ;
3431 const additionalInfo = fetchDbDetails . map ( ( { url, status, success} ) => (
3532 < Dropdown . Item key = { url } className = "db-info__row" >
3633 { ' ' }
3734 { url } responded with
3835 < span className = { success ? 'db-info__row_success' : 'db-info__row_fail' } > { ' ' + status } </ span >
3936 </ Dropdown . Item >
4037 ) ) ;
41- const title = `Databases loaded: ${ value } ` ;
42- const btnClassNames = classNames (
43- 'db-info' ,
44- { 'db-info_failed' : isFailed }
45- ) ;
46-
47- const DbBtn = React . forwardRef ( ( props , ref ) => (
48- < Ref innerRef = { ref } >
49- < Button
50- content = { title }
51- icon = "angle down"
52- className = { btnClassNames }
53- basic
54- />
55- </ Ref >
56- ) ) ;
5738
5839 return (
5940 < Popup
6041 className = "db-info__popup"
6142 action = "hover"
62- target = { < DbBtn /> }
43+ target = { < DbBtn fetchDbDetails = { fetchDbDetails } /> }
6344 >
6445 { additionalInfo }
6546 </ Popup >
0 commit comments