From 6b743c7728af254b029ca75827052eca335c44b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Barto=C5=A1?= <bartos@cesnet.cz> Date: Fri, 15 May 2020 10:29:51 +0200 Subject: [PATCH] TheHiveButton: added missing dependencies, minor improvements --- thehive_button/package.json | 4 +++- thehive_button/public/main.js | 36 +++++++++++++++++++---------------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/thehive_button/package.json b/thehive_button/package.json index 8542262..5dfa6de 100644 --- a/thehive_button/package.json +++ b/thehive_button/package.json @@ -12,7 +12,9 @@ "build": "plugin-helpers build" }, "dependencies": { - "request": "^2.88.0" + "request": "^2.88.0", + "@elastic/eui": "10.4.2", + "react": "^16.8.0" }, "devDependencies": { "@elastic/eslint-config-kibana": "link:../../packages/eslint-config-kibana", diff --git a/thehive_button/public/main.js b/thehive_button/public/main.js index 747846c..3631569 100644 --- a/thehive_button/public/main.js +++ b/thehive_button/public/main.js @@ -26,16 +26,17 @@ import { import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; -const optionsTemplate = ( +function optionsEditor({ stateParams, setValue }) { + return ( <EuiForm> <EuiFormRow label="Base URL of The Hive"> - <EuiFieldText value={editorState.params.url} /> + <EuiFieldText value={stateParams.url} /> </EuiFormRow> <EuiFormRow label="API key"> - <EuiFieldText value={editorState.params.apikey} /> + <EuiFieldText value={stateParams.apikey} /> </EuiFormRow> <EuiFormRow label="Username" helpText="Used as the owner of cases created from here"> - <EuiFieldText value={editorState.params.owner} /> + <EuiFieldText value={stateParams.owner} /> </EuiFormRow> </EuiForm> ); @@ -62,8 +63,8 @@ function TheHiveButtonVisProvider(Private) { owner: THEHIVE_OWNER, } }, - editor: 'default', -// editor: MyEditorController, +// editor: optionsEditor, + editor: 'default', editorConfig: { optionsTemplate: optionsTemplate, defaultSize: DefaultEditorSize.MEDIUM, @@ -95,22 +96,25 @@ function TheHiveButtonVisProvider(Private) { schema: 'metric', }, ], + editor: '<div class="hintbox"><i class="fa fa-danger text-info"></i> Some metric must be defined here, but it\'s setting is irrelevant. Just go to "Buckets" below and set up the field to get Observbles from.</div>' }, { group: 'buckets', name: 'group', title: 'Observables', - min: 1, - max: 1, + min: 0, + //max: 1, aggFilter: ['terms'], -// defaults: [ -// { -// type: 'terms', -// //schema: 'group', -// field: 'ip', -// size: 100, -// } -// ] + defaults: [ + { + type: 'terms', + schema: 'group', + field: 'ip', + size: 1000, + orderBy: 'alphabetical', + order: 'ascending', + } + ] }, ]), }, -- GitLab