From 375bb7032ae8f01e98db92edf207bb51b23f1970 Mon Sep 17 00:00:00 2001 From: Ace Pace Date: Thu, 30 Apr 2020 12:26:22 +0300 Subject: [PATCH] Move to only using modern imports --- monkey/monkey_island/cc/ui/server.js | 8 ++++---- monkey/monkey_island/cc/ui/src/components/Main.js | 8 ++++---- .../cc/ui/src/components/pages/NotFoundPage.js | 2 +- .../ui/src/components/report-components/SecurityReport.js | 3 +-- .../report-components/attack/SelectedTechnique.js | 2 +- .../report-components/attack/TechniqueDropdowns.js | 2 +- .../components/report-components/common/ReportHeader.js | 2 +- .../report-components/zerotrust/EventsTimeline.js | 4 ++-- .../monkey_island/cc/ui/src/server_config/ServerConfig.js | 2 +- 9 files changed, 16 insertions(+), 17 deletions(-) diff --git a/monkey/monkey_island/cc/ui/server.js b/monkey/monkey_island/cc/ui/server.js index 49045359e..f49ab21c1 100644 --- a/monkey/monkey_island/cc/ui/server.js +++ b/monkey/monkey_island/cc/ui/server.js @@ -1,9 +1,9 @@ /*eslint no-console:0 */ 'use strict'; -require('core-js/fn/object/assign'); -const webpack = require('webpack'); -const WebpackDevServer = require('webpack-dev-server'); -const config = require('./webpack.config'); +import assign from 'core-js/fn/object' +import webpack from 'webpack' +import WebpackDevServer from 'webpack-dev-server' +import config from './webpack.config' /** * Flag indicating whether webpack compiled for the first time. diff --git a/monkey/monkey_island/cc/ui/src/components/Main.js b/monkey/monkey_island/cc/ui/src/components/Main.js index 67eb409c3..3564a8362 100644 --- a/monkey/monkey_island/cc/ui/src/components/Main.js +++ b/monkey/monkey_island/cc/ui/src/components/Main.js @@ -26,10 +26,10 @@ import 'react-toggle/style.css'; import 'react-table/react-table.css'; import VersionComponent from './side-menu/VersionComponent'; -let logoImage = require('../images/monkey-icon.svg'); -let infectionMonkeyImage = require('../images/infection-monkey.svg'); -let guardicoreLogoImage = require('../images/guardicore-logo.png'); -let notificationIcon = require('../images/notification-logo-512x512.png'); +import logoImage from '../images/monkey-icon.svg'; +import infectionMonkeyImage from '../images/infection-monkey.svg'; +import guardicoreLogoImage from '../images/guardicore-logo.png'; +import notificationIcon from '../images/notification-logo-512x512.png'; const reportZeroTrustRoute = '/report/zeroTrust'; diff --git a/monkey/monkey_island/cc/ui/src/components/pages/NotFoundPage.js b/monkey/monkey_island/cc/ui/src/components/pages/NotFoundPage.js index e46970ac4..f5bce4497 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/NotFoundPage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/NotFoundPage.js @@ -2,7 +2,7 @@ import React from 'react'; import '../../styles/NotFoundPage.scss'; -let monkeyDetective = require('../../images/detective-monkey.svg'); +import monkeyDetective from '../../images/detective-monkey.svg'; class ConfigurePageComponent extends React.Component{ constructor(props) { diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/SecurityReport.js b/monkey/monkey_island/cc/ui/src/components/report-components/SecurityReport.js index 76076ca4c..e25b7f126 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/SecurityReport.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/SecurityReport.js @@ -17,8 +17,7 @@ import PrintReportButton from './common/PrintReportButton'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faMinus } from '@fortawesome/free-solid-svg-icons/faMinus'; - -let guardicoreLogoImage = require('../../images/guardicore-logo.png'); +import guardicoreLogoImage from '../../images/guardicore-logo.png' class ReportPageComponent extends AuthComponent { diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/attack/SelectedTechnique.js b/monkey/monkey_island/cc/ui/src/components/report-components/attack/SelectedTechnique.js index b522c50cd..be117d0be 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/attack/SelectedTechnique.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/attack/SelectedTechnique.js @@ -5,7 +5,7 @@ import AttackReport from '../AttackReport'; import {FontAwesomeIcon} from '@fortawesome/react-fontawesome'; import {faQuestionCircle} from '@fortawesome/free-solid-svg-icons/faQuestionCircle'; -const classNames = require('classnames'); +import classNames from 'classnames'; class SelectedTechnique extends React.Component { diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/attack/TechniqueDropdowns.js b/monkey/monkey_island/cc/ui/src/components/report-components/attack/TechniqueDropdowns.js index be66a9e4b..fd7dcf901 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/attack/TechniqueDropdowns.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/attack/TechniqueDropdowns.js @@ -9,7 +9,7 @@ import { faToggleOn } from '@fortawesome/free-solid-svg-icons/faToggleON' import {Button} from 'react-bootstrap'; import AttackReport from '../AttackReport'; -const classNames = require('classnames'); +import classNames from 'classnames'; class TechniqueDropdowns extends React.Component{ diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/common/ReportHeader.js b/monkey/monkey_island/cc/ui/src/components/report-components/common/ReportHeader.js index 39efc0a01..1a4b5a635 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/common/ReportHeader.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/common/ReportHeader.js @@ -2,7 +2,7 @@ import React, {Component} from 'react'; import {Col} from 'react-bootstrap'; import * as PropTypes from 'prop-types'; -let monkeyLogoImage = require('../../../images/monkey-icon.svg'); +import monkeyLogoImage from '../../../images/monkey-icon.svg'; export const ReportTypes = { zeroTrust: 'Zero Trust', diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/EventsTimeline.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/EventsTimeline.js index 04b10f333..a3ca03156 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/EventsTimeline.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/EventsTimeline.js @@ -2,8 +2,8 @@ import React, {Component} from 'react'; import {Timeline, TimelineEvent} from 'react-event-timeline'; import * as PropTypes from 'prop-types'; -let monkeyLocalIcon = require('../../../images/zerotrust/im-alert-machine-icon.svg'); -let monkeyNetworkIcon = require('../../../images/zerotrust/im-alert-network-icon.svg'); +import monkeyLocalIcon from '../../../images/zerotrust/im-alert-machine-icon.svg'; +import monkeyNetworkIcon from '../../../images/zerotrust/im-alert-network-icon.svg'; const eventTypeToIcon = { 'monkey_local': monkeyLocalIcon, diff --git a/monkey/monkey_island/cc/ui/src/server_config/ServerConfig.js b/monkey/monkey_island/cc/ui/src/server_config/ServerConfig.js index bd71817e1..14bd5c3ba 100644 --- a/monkey/monkey_island/cc/ui/src/server_config/ServerConfig.js +++ b/monkey/monkey_island/cc/ui/src/server_config/ServerConfig.js @@ -2,7 +2,7 @@ import StandardConfig from './StandardConfig'; import AwsConfig from './AwsConfig'; import PasswordConfig from './PasswordConfig'; -const SERVER_CONFIG_JSON = require('../../../server_config.json'); +import SERVER_CONFIG_JSON from '../../../server_config.json'; const CONFIG_DICT = {