chg: [workflow:editor] Improved quick hashpath picker

feature/workflow-module/publish-event
Sami Mokaddem 2023-10-11 09:35:07 +02:00
parent 8e82260524
commit 438d1b8a43
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 17 additions and 3 deletions

View File

@ -252,6 +252,9 @@ $data_passed_to_if_module = [
"relationship_type": null,
"inherited": false
}
],
"enrichment": [
{}
]
}
],
@ -580,6 +583,9 @@ $data_passed_to_if_module = [
"relationship_type": null,
"inherited": false
}
],
"enrichment": [
{}
]
},
{

View File

@ -143,11 +143,18 @@ var iconBySeverity = {
'error': 'fa-exclamation-circle',
}
var severities = ['info', 'warning', 'error']
var haspathQuickPickMenu = [
var haspathQuickPickMenuElementSelector = [
{ 'name': 'All Attributes', 'path': 'Event._AttributeFlattened.{n}' },
{ 'name': 'All tags attached to all Attributes', 'path': 'Event._AttributeFlattened.{n}.Tag.{n}.name' },
{ 'name': 'All tags attached to the Event', 'path': 'Event.Tag.{n}.name' },
]
var haspathQuickPickMenuSubElementSelector = [
{ 'name': 'Attribute type', 'path': 'type' },
{ 'name': 'All tags', 'path': 'Tag.{n}.name' },
{ 'name': 'Warnings from warninglists', 'path': 'warnings.{n}.warninglist_category' },
{ 'name': 'Feed correlation', 'path': 'Feed.{n}.name' },
{ 'name': 'All enrichments', 'path': 'enrichment.{n}' },
]
var workflow_id = 0
var contentChanged = false
@ -1852,7 +1859,8 @@ function genInput(options, isTextArea, forNode = true) {
}
function genHashpathInput(options, forNode = true) {
function hashPathGenDropdownMenu() {
function hashPathGenDropdownMenu(hashpathOptions) {
var haspathQuickPickMenu = hashpathOptions.is_sub_selector ? haspathQuickPickMenuSubElementSelector : haspathQuickPickMenuElementSelector
var $divider = $('<li>').addClass('divider')
var $dropdownMenu = $('<ul>').addClass('dropdown-menu pull-right')
var $liPicker = $('<li>').append(
@ -1921,7 +1929,7 @@ function genHashpathInput(options, forNode = true) {
.attr('data-toggle', 'dropdown')
.text('Pick ')
.append($('<span>').addClass('caret'))
var $dropdownMenu = hashPathGenDropdownMenu()
var $dropdownMenu = hashPathGenDropdownMenu(options.hashpath ? options.hashpath : {})
$dropdownContainer.append($dropdownButton, $dropdownMenu)
$addonContainer.append($input, $dropdownContainer)
$container.append($label, $addonContainer)