ServerSys.jsx 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import React from 'react';
  2. import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
  3. import Container from '../ControlPanel/Container/Container';
  4. import ListItem from '../ControlPanel/ListItem/ListItem';
  5. import './ServerSys.scss';
  6. import { Link } from 'react-router-dom';
  7. import { useSelector } from 'react-redux';
  8. const Server = props => {
  9. const { data } = props;
  10. const { i18n } = useSelector(state => state.session);
  11. const checkItem = () => {
  12. props.checkItem(props.data.HOSTNAME);
  13. }
  14. return (
  15. <ListItem
  16. id={data.NAME}
  17. focused={data.FOCUSED}
  18. sysInfo={data.HOSTNAME}
  19. checked={data.isChecked}
  20. checkItem={checkItem}>
  21. <Container className="r-col w-85">
  22. <div className="name">{data.HOSTNAME}</div>
  23. <div className="stats">
  24. <Container className="c-1">
  25. <div className="descr"><span><span className="stat">{data.OS} {data.VERSION}</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {`(${data.ARCH})`}</span></div>
  26. </Container>
  27. <Container className="c-2">
  28. <div>{i18n['Load Average']}: <span><span className="stat">{data.LOADAVERAGE}</span></span></div>
  29. </Container>
  30. <Container className="c-3">
  31. <div><span>{i18n.Uptime}: <span className="stat">{data.UPTIME}</span></span></div>
  32. </Container>
  33. </div>
  34. </Container>
  35. <div className="actions">
  36. <div>
  37. <Link className="link-list" to={`/edit/server/`}>
  38. {i18n.configure}
  39. {data.FOCUSED ? <span className="shortcut-button html-unicode">&#8617;</span> : <FontAwesomeIcon icon="cogs" />}
  40. </Link>
  41. </div>
  42. <div>
  43. <button className="link-download restart" onClick={() => props.handleAction(`/api/v1/restart/service?srv=${data.NAME}`)}>
  44. {i18n.restart}
  45. {
  46. data.FOCUSED
  47. ? <span className="shortcut-button">R</span>
  48. : <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-arrow-repeat" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
  49. <path fill-rule="evenodd" d="M2.854 7.146a.5.5 0 0 0-.708 0l-2 2a.5.5 0 1 0 .708.708L2.5 8.207l1.646 1.647a.5.5 0 0 0 .708-.708l-2-2zm13-1a.5.5 0 0 0-.708 0L13.5 7.793l-1.646-1.647a.5.5 0 0 0-.708.708l2 2a.5.5 0 0 0 .708 0l2-2a.5.5 0 0 0 0-.708z" />
  50. <path fill-rule="evenodd" d="M8 3a4.995 4.995 0 0 0-4.192 2.273.5.5 0 0 1-.837-.546A6 6 0 0 1 14 8a.5.5 0 0 1-1.001 0 5 5 0 0 0-5-5zM2.5 7.5A.5.5 0 0 1 3 8a5 5 0 0 0 9.192 2.727.5.5 0 1 1 .837.546A6 6 0 0 1 2 8a.5.5 0 0 1 .501-.5z" />
  51. </svg>
  52. }
  53. </button>
  54. </div>
  55. </div>
  56. </ListItem>
  57. );
  58. }
  59. export default Server;