From ef78a3c856b6148764670213f1b332f61efeb907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20St=C3=BCrmer?= Date: Mon, 21 Nov 2016 16:12:38 +0100 Subject: [PATCH] Add basic link from discover to the context app 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 --- src/ui/public/doc_table/components/table_row.js | 13 ++++++++++++- .../doc_table/components/table_row/details.html | 5 ++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/ui/public/doc_table/components/table_row.js b/src/ui/public/doc_table/components/table_row.js index 530ddb996c3a98..f75ccb8e518eb2 100644 --- a/src/ui/public/doc_table/components/table_row.js +++ b/src/ui/public/doc_table/components/table_row.js @@ -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'; @@ -24,7 +25,7 @@ let MIN_LINE_LENGTH = 20; * * ``` */ -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'))); @@ -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; diff --git a/src/ui/public/doc_table/components/table_row/details.html b/src/ui/public/doc_table/components/table_row/details.html index d83d868dbefeb1..a5f968e0936666 100644 --- a/src/ui/public/doc_table/components/table_row/details.html +++ b/src/ui/public/doc_table/components/table_row/details.html @@ -2,5 +2,8 @@ Link to /{{row._index}}/{{row._type}}/{{row._id | uriescape}} + + View surrounding entries + - \ No newline at end of file +