import React, { FC } from 'react';
import styles from './index.less';
import { RedoOutlined } from '@ant-design/icons';
import { useParams } from 'umi';
import { message } from 'antd';

interface PageProps { }

const RestartService: FC<PageProps> = ({ }) => {
  const urlParams = useParams();
  let sysData = localStorage.getItem(`${urlParams?.fileType}`);
  let info = sysData ? JSON.parse(sysData) : null;

  return <div className={styles.index_con}>
    <div style={{
      width: 100, 
      height: 100, 
      background: 'rgba(0,0,0,.2)', 
      display: 'flex', 
      alignContent: 'center', 
      justifyContent: 'center',
      flexWrap: 'wrap',
      cursor: 'pointer'
    }}
    onClick={() => {
      message.success('重启服务成功！')
      localStorage.setItem(`${urlParams?.fileType}`, JSON.stringify({ ...info, restartService: true }))
    }}
    >
      <RedoOutlined  style={{fontSize: 30}}/>
      <div style={{width: '100%', textAlign: 'center', marginTop: 10}}>重启服务</div>
    </div>
  </div>
}

export default RestartService;
