Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { useContext, useState } from 'react';
- import { useSelector, useDispatch } from "react-redux";
- import classes from './cases.module.css';
- import { alluxioCasesAction, eventsAction } from "../../../store/actions/autoActions";
- import { GlobalContext } from "../../../context/global";
- export const RunTests = props => {
- const [clicked, setClicked] = useState(false);
- // store data
- const { user_name } = useSelector(state => state.auth.userData); // user
- const dispatch = useDispatch();
- const { jira_id } = useContext(GlobalContext);
- const runAlluxioTests = async () => {
- setClicked(true);
- const values = { user: user_name, jira_id, action: 'runtests' };
- await dispatch(alluxioCasesAction(values));
- await dispatch(eventsAction(jira_id));
- };
- return (
- <>
- <label className={`${classes.label} mt-5 mb-2`}>
- <p className="text-gray-500">Run tests</p>
- </label>
- <button onClick={ runAlluxioTests }
- type={`button`}
- hidden={ clicked }
- Run tests
- </button>
- </>
- );
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement