import React from 'react';

import HandlerMap from './HandlerMap';

const MaintenanceHost = '192.168.10.150:8777';
const MaintenancePath = 'CivManage/productCenter/product';
export default class Container extends React.Component {
  constructor(props) {
    super(props);
    this.oms = this.oms.bind(this);
    this.keyHandlerMap = new Map([[['alt+c', 'option+c'], this.oms]]);
  }

  oms(event) {
    const omsUrl = [
      `${window.location.protocol}/`,
      MaintenanceHost,
      MaintenancePath,
    ].join('/');
    window.open(omsUrl, '_blank');
  }

  render() {
    return (
      <HandlerMap keyHandlerMap={this.keyHandlerMap}>
        {this.props.children}
      </HandlerMap>
    );
  }
}
