-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Frontend React Components
⚠️ Warning: This is WIP - See this PR for details.
Here is the documentation of the most used components when creating a new partial. All components are defined in ScoutSuite/frontend/src/components. You can look at the "propTypes" of a component to understand when data it accepts.
It's a simple wrapper for one or multiple <PartialValue /> in the information section of a partial. If a partial doesn't have any tabs, you shouldn't wrap <PartialValue /> in <InformationsWrapper />.
Example
<InformationsWrapper>
{/* One or more partial values */}
</InformationsWrapper>Props
-
childrenOne or more<PartialValue />(required)
Creates a tab menu. The only valid childrens are one or more <TabPane />.
Example
<TabsMenu>
{/* One or more tab pane */}
<TabPane title="Tab 1"></TabPane>
<TabPane title="Tab 2"></TabPane>
</TabsMenu>Props
-
childrenOne or more<TabPane />(required)
Creates a tab menu. The only valid childrens are one or more <TabPane />.
Example
<TabPane
title="Tab 1"
disabled={someCondtion == isTrue}
>
{/* Tab content */}
</TabPane>Props
-
title: stringName of the tab (required) -
disabled: boolDisables a tab (usually when their is no content. -
childrenTab content (required)
Creates a tab menu. The only valid childrens are one or more <TabPane />.
Example
<PartialValue
label="Value Label"
valuePath="path.to.value"
errorPath="path.to.error"
renderValue={valueRenderingFunction}
value={customValue}
separator
inline
className="fancy-style"
tooltip
/>Props
-
label: stringLabel of the value (required) -
valuePath: stringPath to the value. For nested objects, usepath.to.value(required) -
value: stringOverwrites the value atvaluePath -
errorPath: string|array<string>Path or paths to the error. For nested objects, usepath.to.error -
separator: stringOverwrite the separator betweenlabeland the value. Default is:. -
renderValueIt takes a function to modify the rendering of the value. See Rendering Functions for more information and available functions. -
inline: boolIndicates to display the value inline -
className: stringAdds a className to the wrapper of the value -
tooltip: booleanAdds a tooltip around the value (only use when really needed) -
basePathOverwrite: stringOverwrite the base path to the value. This is used for Complex Partials
When some partial values are nested, for example the name value is located at networks.xyz.subnets.0.name, it can be useful to wrap multiple the some <PartialValue /> in a <PartialSection />.
Instead of writting:
<>
<PartialValue valuePath="networks.xyz.subnets.0.id" />
<PartialValue valuePath="networks.xyz.subnets.0.name" />
</>you can now write
<PartialSection path="networks.xyz.subnets.0">
<PartialValue valuePath="id" />
<PartialValue valuePath="name" />
</PartialSection>Example
<PartialSection
path="path.to.section"
>
{/* Nested <PartialValue /> */}
</PartialSection>Props
-
path: stringPath to object (required) -
childrenNested (required)
This component should be used when linking to another resource. If the name prop isn't defined, it will get it from the server by using the id.
Example
<ResourceLink
service="storage"
resource="buckets"
id="abc"
name="Bucket Name"
nameProps={{ renderData: (name) => valueOrNone(name) }}
/>Props
-
service: stringService for the resource (required) -
resource: stringResource type (required) -
id: stringId of the resource (required) -
name: stringOverwrites the name in the link -
nameProps: objectAdditional props for the<ResourceName />component.
Fetches a name for a resource based on it's ID.
Example
<ResourceName
service="storage"
resource="buckets"
id="abc"
renderData={(name) => valueOrNone(name)}
/>Props
-
service: stringService for the resource (required) -
resource: stringResource type (required) -
id: stringId of the resource (required) -
renderData: objectFunction to change how the name is rendered.
- Home
- Getting Started
- Setup
- Compliance
- Configuration and Usage
- Docker
- [v6] Upgrade to v6-alpha
- Advanced Usage
- Understanding the Architecture
- How to Contribute
- FAQ