Skip to content

Commit

Permalink
Add basic link from discover to the context app
Browse files Browse the repository at this point in the history
The doc viewer panel now contains a (hideous) link which displays the
context of the entry using the same column configuration. The location
and styling is hopefully subject to future improvement
  • Loading branch information
weltenwort committed Nov 23, 2016
1 parent 3227016 commit ef78a3c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/ui/public/doc_table/components/table_row.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import _ from 'lodash';
import $ from 'jquery';
import rison from 'rison-node';
import 'ui/highlight';
import 'ui/highlight/highlight_tags';
import 'ui/doc_viewer';
Expand All @@ -24,7 +25,7 @@ let MIN_LINE_LENGTH = 20;
* <tr ng-repeat="row in rows" kbn-table-row="row"></tr>
* ```
*/
module.directive('kbnTableRow', function ($compile) {
module.directive('kbnTableRow', function ($compile, $httpParamSerializer) {
let cellTemplate = _.template(noWhiteSpace(require('ui/doc_table/components/table_row/cell.html')));
let truncateByHeightTemplate = _.template(noWhiteSpace(require('ui/partials/truncate_by_height.html')));

Expand Down Expand Up @@ -87,6 +88,16 @@ module.directive('kbnTableRow', function ($compile) {
createSummaryRow($scope.row, $scope.row._id);
});

$scope.getContextAppHref = () => {
return `#/context/${$scope.indexPattern.id}/${$scope.row._type}/${$scope.row._id}?${
$httpParamSerializer({
_a: rison.encode({
columns: $scope.columns,
}),
})
}`;
};

// create a tr element that lists the value for each *column*
function createSummaryRow(row) {
let indexPattern = $scope.indexPattern;
Expand Down
5 changes: 4 additions & 1 deletion src/ui/public/doc_table/components/table_row/details.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
<a class="pull-right" ng-href="#/doc/{{indexPattern.id}}/{{row._index}}/{{row._type}}/?id={{row._id | uriescape}}">
<small>Link to /{{row._index}}/{{row._type}}/{{row._id | uriescape}}</small></i>
</a>
<a class="pull-right" ng-href="{{ getContextAppHref() }}">
<small>View surrounding entries</small></i>
</a>
<doc-viewer hit="row" filter="filter" columns="columns" index-pattern="indexPattern"></doc-viewer>
</td>
</td>

0 comments on commit ef78a3c

Please sign in to comment.