Skip to content

Commit

Permalink
add custom row expansion to reveal raw events
Browse files Browse the repository at this point in the history
  • Loading branch information
northben committed Feb 14, 2020
1 parent 6abd00d commit 0a79972
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
40 changes: 40 additions & 0 deletions amelia/appserver/static/custom_table_row_expansion.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
require([
'splunkjs/mvc/tableview',
'splunkjs/mvc/eventsviewerview',
'splunkjs/mvc/searchmanager',
'splunkjs/mvc',
'underscore',
'splunkjs/mvc/simplexml/ready!'
],function(TableView, EventsViewerView, SearchManager, mvc, _) {
var EventSearchBasedRowExpansionRenderer = TableView.BaseRowExpansionRenderer.extend({
initialize: function(args) {
this._searchManager = new SearchManager({
id: 'details-search-manager',
preview: false
});
this._chartView = new EventsViewerView({
managerid: 'details-search-manager',
type: "raw",
'raw.drilldown': "none"
});
},
canRender: function(rowData) {
return true;
},
render: function($container, rowData) {
var sourcetypeCell = _(rowData.cells).find(function (cell) {
return cell.field === 'sourcetype';
});

var indexCell = _(rowData.cells).find(function (cell) {
return cell.field === 'index';
});
this._searchManager.set({ search: `index=${indexCell.value} sourcetype=${sourcetypeCell.value} | dedup punct`});
$container.append(this._chartView.render().el);
}
});
var tableElement = mvc.Components.getInstance("table1");
tableElement.getVisualization(function(tableView) {
tableView.addRowExpansionRenderer(new EventSearchBasedRowExpansionRenderer());
});
});
2 changes: 1 addition & 1 deletion amelia/default/data/ui/views/data_dictionary_explorer.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<form script="table_icons_inline.js">
<form script="table_icons_inline.js,custom_table_row_expansion.js">
<description>
Display customizable metadata about Splunk indexes and sourcetypes.
</description>
Expand Down

0 comments on commit 0a79972

Please sign in to comment.