diff --git a/thehive_button/public/case_form.html b/thehive_button/public/case_form.html deleted file mode 100644 index fe45cbc2227b4f6538de205469e6c6c13cf6dcc7..0000000000000000000000000000000000000000 --- a/thehive_button/public/case_form.html +++ /dev/null @@ -1,11 +0,0 @@ -<form> -<label for="case-title">Title:</label><br> -<input type="text" name="case-title" style="width: 100%" value="" required="true"><br> -<br> -<label for="case-title">Description:</label><br> -<textarea name="case-descr" rows="10" style="width: 100%"> - --- -Created from Kibana -</textarea> -</form> \ No newline at end of file diff --git a/thehive_button/public/main.js b/thehive_button/public/main.js index 1361795e41978f2ae1d8e146cd57d2c65b220534..747846c3ca4c1562d48b14fa6bba6685829e07c7 100644 --- a/thehive_button/public/main.js +++ b/thehive_button/public/main.js @@ -1,5 +1,4 @@ //import './vis.less'; -//import optionsTemplate from './options_template.html'; import { THEHIVE_API_KEY, THEHIVE_URL, THEHIVE_OWNER } from './env'; //import { VisController } from './vis_controller'; import { TheHiveButtonVisComponent } from './vis_controller'; @@ -7,7 +6,40 @@ import { TheHiveButtonVisComponent } from './vis_controller'; import { VisFactoryProvider } from 'ui/vis/vis_factory'; import { VisTypesRegistryProvider } from 'ui/registry/vis_types'; import { Schemas } from 'ui/vis/editors/default/schemas'; -import { Status } from 'ui/vis/update_status'; +//import { Status } from 'ui/vis/update_status'; +import { DefaultEditorSize } from 'ui/vis/editor_size'; + +import optionsTemplate from './options_template.html'; + +/* +TODO: It would be better to compose options tab of EUI React elements, +but this probably needs at least kibana 7.4. +See this for example of a custom editor: + https://github.com/elastic/kibana/tree/master/src/plugins/vis_type_markdown/public + +import React from 'react'; +import { + EuiForm, + EuiFormRow, + EuiFieldText, +} from '@elastic/eui'; + +import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; + +const optionsTemplate = ( + <EuiForm> + <EuiFormRow label="Base URL of The Hive"> + <EuiFieldText value={editorState.params.url} /> + </EuiFormRow> + <EuiFormRow label="API key"> + <EuiFieldText value={editorState.params.apikey} /> + </EuiFormRow> + <EuiFormRow label="Username" helpText="Used as the owner of cases created from here"> + <EuiFieldText value={editorState.params.owner} /> + </EuiFormRow> + </EuiForm> +); +*/ function TheHiveButtonVisProvider(Private) { const VisFactory = Private(VisFactoryProvider); @@ -33,14 +65,9 @@ function TheHiveButtonVisProvider(Private) { editor: 'default', // editor: MyEditorController, editorConfig: { - /*collections: { - colorSchemas: [ - {id: "test1", label: "Test 1"}, - {id: "test2", label: "Test 2"}, - ], - },*/ - optionsTemplate: '<div>TEST</div>', -// optionsTemplate: '<thehivebutton-vis-params></thehivebutton-vis-params>', + optionsTemplate: optionsTemplate, + defaultSize: DefaultEditorSize.MEDIUM, + //enableAutoApply: true, schemas: new Schemas([ // TODO all this (metric and bucket "terms") could be pre-defind // (just a selection of fields to read Observables from would be nice) @@ -58,7 +85,7 @@ function TheHiveButtonVisProvider(Private) { { group: 'metrics', name: 'metric', - title: "Metric (not used)", + title: "Metric (not used, ignore this)", min: 1, max: 1, aggFilter: 'count', @@ -75,7 +102,7 @@ function TheHiveButtonVisProvider(Private) { title: 'Observables', min: 1, max: 1, - aggFilter: 'terms',//['!geohash_grid', '!geotile_grid', '!filter'], + aggFilter: ['terms'], // defaults: [ // { // type: 'terms', diff --git a/thehive_button/public/options_template.html b/thehive_button/public/options_template.html index 5ec603b3f1e531a18e2bcef0e60e0e54e177ea06..ef996577786150282c2ffb0d28652a3d1712842b 100644 --- a/thehive_button/public/options_template.html +++ b/thehive_button/public/options_template.html @@ -1,7 +1,8 @@ <div class="form-group"> - <p style="margin-bottom: 1em">The plugin is currently not configurable from here. Below are the predefined configuration values. They can be edited in "<tt><KIBANA_PATH>/plugins/thehive_button/public/env.js</tt>" on the backend.</p> - <label>The Hive API URL</label> - <input ng-model=vis.params.url class=form-control disabled=disabled /> - <label>The Hive API key</label> - <input ng-model=vis.params.apikey class=form-control disabled=disabled /> + <p><label>Base URL of The Hive</label> + <input ng-model="editorState.params.url" class=form-control /></p> + <p><label>API key</label> + <input ng-model="editorState.params.apikey" class=form-control /></p> + <p><label>User name to use as the owner of cases created from here</label> + <input ng-model="editorState.params.owner" class=form-control /></p> </div>