From 145a41ffcf4029c7c26e69ebf7875d4c1f06b9fa Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 26 Jan 2021 15:46:57 -0500 Subject: [PATCH] ui: move getDefaultPaneParams() to InfoPane.js --- .../src/components/ui-components/AdvancedMultiSelect.js | 4 ++-- .../cc/ui/src/components/ui-components/InfoPane.js | 8 +++++++- .../ui/src/components/ui-components/JsonSchemaHelpers.js | 7 +------ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/components/ui-components/AdvancedMultiSelect.js b/monkey/monkey_island/cc/ui/src/components/ui-components/AdvancedMultiSelect.js index 5c7c11345..bab944093 100644 --- a/monkey/monkey_island/cc/ui/src/components/ui-components/AdvancedMultiSelect.js +++ b/monkey/monkey_island/cc/ui/src/components/ui-components/AdvancedMultiSelect.js @@ -4,10 +4,10 @@ import {Button, Card, Form} from 'react-bootstrap'; import {cloneDeep} from 'lodash'; import {getComponentHeight} from './utils/HeightCalculator'; -import InfoPane from './InfoPane'; +import {getDefaultPaneParams, InfoPane} from './InfoPane'; import {MasterCheckbox, MasterCheckboxState} from './MasterCheckbox'; import ChildCheckbox from './ChildCheckbox'; -import {getFullDefinitionByKey, getDefaultPaneParams} from './JsonSchemaHelpers'; +import {getFullDefinitionByKey} from './JsonSchemaHelpers'; function AdvancedMultiSelectHeader(props) { const { diff --git a/monkey/monkey_island/cc/ui/src/components/ui-components/InfoPane.js b/monkey/monkey_island/cc/ui/src/components/ui-components/InfoPane.js index 5c963d87e..6e50ca66d 100644 --- a/monkey/monkey_island/cc/ui/src/components/ui-components/InfoPane.js +++ b/monkey/monkey_island/cc/ui/src/components/ui-components/InfoPane.js @@ -3,6 +3,12 @@ import React from 'react'; import {FontAwesomeIcon} from '@fortawesome/react-fontawesome'; import {faQuestionCircle} from '@fortawesome/free-solid-svg-icons'; +import {getObjectFromRegistryByRef} from './JsonSchemaHelpers'; + +function getDefaultPaneParams(refString, registry) { + let configSection = getObjectFromRegistryByRef(refString, registry); + return ({title: configSection.title, content: configSection.description}); +} function InfoPane(props) { return ( @@ -49,4 +55,4 @@ function getBody(props) { ) } -export default InfoPane +export {getDefaultPaneParams, InfoPane} diff --git a/monkey/monkey_island/cc/ui/src/components/ui-components/JsonSchemaHelpers.js b/monkey/monkey_island/cc/ui/src/components/ui-components/JsonSchemaHelpers.js index 06eed4aed..9a3d9c66b 100644 --- a/monkey/monkey_island/cc/ui/src/components/ui-components/JsonSchemaHelpers.js +++ b/monkey/monkey_island/cc/ui/src/components/ui-components/JsonSchemaHelpers.js @@ -16,9 +16,4 @@ function getObjectFromRegistryByRef(refString, registry) { return resolveObjectPath(refArray, registry); } -function getDefaultPaneParams(refString, registry) { - let configSection = getObjectFromRegistryByRef(refString, registry); - return ({title: configSection.title, content: configSection.description}); -} - -export {getFullDefinitionByKey, getDefaultPaneParams}; +export {getFullDefinitionByKey, getObjectFromRegistryByRef};