/** * The panel to edit the filter * */ import React, { PropTypes } from 'react'; import ReactDOM from 'react-dom'; import ClassBind from 'classnames/bind'; import { connect } from 'react-redux'; import { message, Button, Spin } from 'antd'; import ResizablePanel from 'component/resizable-panel'; import { hideRootCA, updateIsRootCAExists } from 'action/globalStatusAction'; import { MenuKeyMap } from 'common/Constant'; import { getJSON, ajaxGet, postJSON } from 'common/ApiUtil'; import Style from './download-root-ca.less'; import CommonStyle from '../style/common.less'; class DownloadRootCA extends React.Component { constructor () { super(); this.state = { loadingCAQr: false, generatingCA: false }; this.onClose = this.onClose.bind(this); this.getQrCodeContent = this.getQrCodeContent.bind(this); } static propTypes = { dispatch: PropTypes.func, globalStatus: PropTypes.object } fetchData () { this.setState({ loadingCAQr: true }); getJSON('/api/getQrCode') .then((response) => { this.setState({ loadingCAQr: false, CAQrCodeImageDom: response.qrImgDom, isRootCAFileExists: response.isRootCAFileExists, url: response.url }); }) .catch((error) => { console.error(error); message.error(error.errorMsg || 'Failed to get the QR code of RootCA path.'); }); } onClose () { this.props.dispatch(hideRootCA()); } getQrCodeContent () { const imgDomContent = { __html: this.state.CAQrCodeImageDom }; const content = (