Skip to content

Commit

Permalink
[frontend] possibility to select attributes in entity widgets (#6515)
Browse files Browse the repository at this point in the history
  • Loading branch information
Archidoit committed Mar 29, 2024
1 parent 618f3ed commit 9d6114c
Showing 1 changed file with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,7 @@ const WidgetConfig = ({ workspace, widget, onComplete, closeMenu }) => {
</FormControl>
)}
{dataSelection[i].perspective === 'entities'
&& getCurrentSelectedEntityTypes(i).length > 0
&& (
<FormControl
className={classes.formControl}
Expand All @@ -1090,7 +1091,7 @@ const WidgetConfig = ({ workspace, widget, onComplete, closeMenu }) => {
<QueryRenderer
query={stixCyberObservablesLinesAttributesQuery}
variables={{
elementType: getCurrentSelectedEntityTypes(i).length > 0 ? getCurrentSelectedEntityTypes(i) : ['Stix-Core-Object'],
elementType: getCurrentSelectedEntityTypes(i),
}}
render={({ props: resultProps }) => {
if (resultProps
Expand Down Expand Up @@ -1166,6 +1167,40 @@ const WidgetConfig = ({ workspace, widget, onComplete, closeMenu }) => {
/>
</FormControl>
)}
{dataSelection[i].perspective === 'entities'
&& getCurrentSelectedEntityTypes(i).length === 0 && (
<Select
fullWidth={true}
value={dataSelection[i].attribute ?? 'entity_type'}
onChange={(event) => handleChangeDataValidationParameter(
i,
'attribute',
event.target.value,
)
}
>
{[
{ value: 'entity_type' },
{ value: 'created-by.internal_id' },
{ value: 'object-label.internal_id' },
{ value: 'object-assignee.internal_id' },
{ value: 'object-marking.internal_id' },
{ value: 'kill-chain-phase.internal_id' },
{ value: 'x_opencti_workflow_id' },
].map((attribute) => (
<MenuItem
key={attribute.value}
value={attribute.value}
>
{t_i18n(
capitalizeFirstLetter(
attribute.value,
),
)}
</MenuItem>
))}
</Select>
)}
{dataSelection[i].perspective === 'audits' && (
<FormControl
className={classes.formControl}
Expand Down

0 comments on commit 9d6114c

Please sign in to comment.