diff --git a/src/legacy/core_plugins/kibana/public/discover/angular/doc.ts b/src/legacy/core_plugins/kibana/public/discover/angular/doc.ts index 79c7f6f65d9d2..af9556656afab 100644 --- a/src/legacy/core_plugins/kibana/public/discover/angular/doc.ts +++ b/src/legacy/core_plugins/kibana/public/discover/angular/doc.ts @@ -21,6 +21,11 @@ import { getAngularModule, wrapInI18nContext, getServices } from '../kibana_serv import { getRootBreadcrumbs } from '../helpers/breadcrumbs'; import html from './doc.html'; import { Doc } from '../components/doc/doc'; + +interface LazyScope extends ng.IScope { + [key: string]: any; +} + const { timefilter } = getServices(); const app = getAngularModule(); app.directive('discoverDoc', function(reactDirective: any) { @@ -44,7 +49,7 @@ app.config(($routeProvider: any) => { }) // the new route, es 7 deprecated types, es 8 removed them .when('/discover/doc/:indexPattern/:index', { - controller: ($scope: any, $route: any, es: any) => { + controller: ($scope: LazyScope, $route: any, es: any) => { timefilter.disableAutoRefreshSelector(); timefilter.disableTimeRangeSelector(); $scope.esClient = es; diff --git a/src/legacy/core_plugins/kibana/public/discover/angular/doc_table/components/table_row.ts b/src/legacy/core_plugins/kibana/public/discover/angular/doc_table/components/table_row.ts index 9e4c14157c0cc..883513173187a 100644 --- a/src/legacy/core_plugins/kibana/public/discover/angular/doc_table/components/table_row.ts +++ b/src/legacy/core_plugins/kibana/public/discover/angular/doc_table/components/table_row.ts @@ -66,7 +66,7 @@ export function createTableRowDirective( $el.empty(); // when we compile the details, we use this $scope - let $detailsScope: any; + let $detailsScope: LazyScope; // when we compile the toggle button in the summary, we use this $scope let $toggleScope; diff --git a/src/legacy/core_plugins/kibana/public/discover/angular/doc_table/doc_table.ts b/src/legacy/core_plugins/kibana/public/discover/angular/doc_table/doc_table.ts index 106657b4f0316..1be87bfa1f3b2 100644 --- a/src/legacy/core_plugins/kibana/public/discover/angular/doc_table/doc_table.ts +++ b/src/legacy/core_plugins/kibana/public/discover/angular/doc_table/doc_table.ts @@ -18,6 +18,7 @@ */ import _ from 'lodash'; +import { UiSettingsClient } from 'kibana/public'; import html from './doc_table.html'; import './infinite_scroll'; import './components/table_header'; @@ -28,8 +29,12 @@ import './lib/pager'; // @ts-ignore import { getLimitedSearchResultsMessage } from './doc_table_strings'; +interface LazyScope extends ng.IScope { + [key: string]: any; +} + export function createDocTableDirective( - config: any, + config: UiSettingsClient, getAppState: any, pagerFactory: any, $filter: any @@ -54,7 +59,7 @@ export function createDocTableDirective( onRemoveColumn: '=?', inspectorAdapters: '=?', }, - link: ($scope: any, $el: any) => { + link: ($scope: LazyScope, $el: JQuery) => { $scope.$watch('minimumVisibleRows', (minimumVisibleRows: number) => { $scope.limit = Math.max(minimumVisibleRows || 50, $scope.limit || 50); }); diff --git a/src/legacy/core_plugins/kibana/public/discover/angular/doc_table/infinite_scroll.ts b/src/legacy/core_plugins/kibana/public/discover/angular/doc_table/infinite_scroll.ts index bb5dca5094278..1a8ad372bbb8a 100644 --- a/src/legacy/core_plugins/kibana/public/discover/angular/doc_table/infinite_scroll.ts +++ b/src/legacy/core_plugins/kibana/public/discover/angular/doc_table/infinite_scroll.ts @@ -19,13 +19,17 @@ import $ from 'jquery'; +interface LazyScope extends ng.IScope { + [key: string]: any; +} + export function createInfiniteScrollDirective() { return { restrict: 'E', scope: { more: '=', }, - link: ($scope: any, $element: any) => { + link: ($scope: LazyScope, $element: JQuery) => { const $window = $(window); let checkTimer: any; @@ -34,7 +38,8 @@ export function createInfiniteScrollDirective() { const winHeight = Number($window.height()); const winBottom = Number(winHeight) + Number($window.scrollTop()); - const elTop = $element.offset().top; + const offset = $element.offset(); + const elTop = offset ? offset.top : 0; const remaining = elTop - winBottom; if (remaining <= winHeight * 0.5) { diff --git a/src/legacy/core_plugins/kibana/public/discover/embeddable/search_embeddable.ts b/src/legacy/core_plugins/kibana/public/discover/embeddable/search_embeddable.ts index e50a0c4b45704..62f4733acf3a0 100644 --- a/src/legacy/core_plugins/kibana/public/discover/embeddable/search_embeddable.ts +++ b/src/legacy/core_plugins/kibana/public/discover/embeddable/search_embeddable.ts @@ -281,7 +281,7 @@ export class SearchEmbeddable extends Embeddable }); const inspectorRequest = this.inspectorAdaptors.requests.start(title, { description }); inspectorRequest.stats(getRequestInspectorStats(searchSource)); - searchSource.getSearchRequestBody().then((body: any) => { + searchSource.getSearchRequestBody().then((body: Record) => { inspectorRequest.json(body); }); this.searchScope.isLoading = true;