# All files / composer/components PowerSchedulerButton.jsx

22.22% Statements 2/9
0% Branches 0/2
0% Functions 0/2
25% Lines 2/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    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

    1x

    1x

     import React from 'react';
    import PropTypes from 'prop-types';
    import A from '../components/A';
    import styles from './css/PowerSchedulerButton.css';

    const PowerSchedulerButton = (props) => {
      const alreadyHasQueryString = window.location.search !== '';
      const selectedProfileIds = props.selectedProfiles.map((profile) => profile.id).toString();
      const suffix = `${(alreadyHasQueryString ? '&' : '?')}power_scheduler=y&selected_profiles=${selectedProfileIds}`;
      const href = window.location + suffix;

      const iconClassName = [
        'bi bi-new-tab',
        styles.newTabIcon,
      ].join(' ');

      return (
        <div>
          <A href={href} target="_blank" className={styles.powerSchedulerButton}>
            <i className={iconClassName} />
            Power Scheduler
          </A>
        </div>
      );
    };

    PowerSchedulerButton.propTypes = {
      selectedProfiles: PropTypes.array,
      visibleNotifications: PropTypes.array.isRequired,
    };

    export default PowerSchedulerButton;