# All files / src/components/server-version server-version.jsx

88.52% Statements 54/61
60.98% Branches 25/41
100% Functions 12/12
92.68% Lines 38/41

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40

    1x

    1x

    1x

    1x

    1x

    1x

    1x

    1x

    1x

    1x

    1x

    1x

    4x

    4x

    4x

    1x

    1x
    1x

    4ximport React, { Component } from 'react';
    import PropTypes from 'prop-types';
    import classnames from 'classnames';
    import { ENTERPRISE, COMMUNITY } from 'constants/server-version';

    import styles from './server-version.less';

    class ServerVersion extends Component {IEE
      static displayName = 'ServerVersionComponent';

      static propTypes = {
        versionNumber: PropTypes.string,
        versionDistro: PropTypes.oneOf(['', ENTERPRISE, COMMUNITY])
      };

      static defaultProps = {
        versionNumber: '',
        versionDistro: ''
      };

      /**
       * Render ServerVersion component.
       *
       * @returns {React.Component} The rendered component.
       */
      render() {
        if (this.props.versionNumber === '' || this.props.versionDistro === '') {
          return null;
        }
        return (I
          <div className={classnames(styles['server-version'])} data-test-id="server-version">
            MongoDB {this.props.versionNumber} {this.pIrops.versionDistro}
          </div>
        );EI
      }
    }

    export default ServerVersion;
    export { ServerVersion };