-
Notifications
You must be signed in to change notification settings - Fork 794
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '2698-plugin-selector-UI-schema' into develop
- Loading branch information
Showing
5 changed files
with
71 additions
and
146 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
...ey/monkey_island/cc/ui/src/components/configuration-components/PluginSelectorTemplate.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import {ObjectFieldTemplateProps} from '@rjsf/utils'; | ||
import React, {useState} from 'react'; | ||
import {Dropdown} from 'react-bootstrap'; | ||
|
||
const PluginSelector = (props) => { | ||
let selectOptions = []; | ||
for (const [name, plugin] of Object.entries(props.plugins)) { | ||
selectOptions.push( | ||
<Dropdown.Item onClick={() => props.onClick(name)} | ||
eventKey={`plugin['title']`}> | ||
{plugin['title']}</Dropdown.Item> | ||
)} | ||
|
||
return ( | ||
<Dropdown> | ||
<Dropdown.Toggle variant="success" id="dropdown-basic"> | ||
Select a plugin | ||
</Dropdown.Toggle> | ||
<Dropdown.Menu> | ||
{selectOptions} | ||
</Dropdown.Menu> | ||
</Dropdown> | ||
) | ||
} | ||
|
||
|
||
export default function PluginSelectorTemplate(props: ObjectFieldTemplateProps) { | ||
|
||
function getPluginDisplay(plugin, allPlugins){ | ||
let selectedPlugin = allPlugins.filter((pluginInArray) => pluginInArray.name == plugin) | ||
if(selectedPlugin.length === 1){ | ||
return <div className="property-wrapper">{selectedPlugin[0].content}</div> | ||
} | ||
} | ||
|
||
let [element, setElement] = useState(null); | ||
return ( | ||
<div> | ||
{props.title} | ||
{props.description} | ||
<PluginSelector plugins={{"TODO": {"title": "pass in actual schema"}}} | ||
onClick={(pluginName) => { | ||
setElement(pluginName) | ||
}}/> | ||
{getPluginDisplay(element, props.properties)} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
137 changes: 0 additions & 137 deletions
137
monkey/monkey_island/cc/ui/src/services/configuration/exploiterClasses.js
This file was deleted.
Oops, something went wrong.
10 changes: 4 additions & 6 deletions
10
monkey/monkey_island/cc/ui/src/services/configuration/propagation/exploitation.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters