Skip to content

Commit

Permalink
Merge branch 'master' into sm-react-license-page
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Sep 7, 2021
2 parents f4c61b2 + d7b9389 commit 3e330e5
Show file tree
Hide file tree
Showing 137 changed files with 1,961 additions and 1,230 deletions.
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pageLoadAssetSize:
indexPatternManagement: 28222
indexPatternEditor: 25000
infra: 184320
fleet: 465774
fleet: 250000
ingestPipelines: 58003
inputControlVis: 172675
inspector: 148711
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ kibana_vars=(
enterpriseSearch.host
externalUrl.policy
i18n.locale
interactiveSetup.enabled
interactiveSetup.connectionCheck.interval
interpreter.enableInVisualize
kibana.autocompleteTerminateAfter
kibana.autocompleteTimeout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ COPY --from=builder --chown=1000:0 /usr/share/kibana /usr/share/kibana
WORKDIR /usr/share/kibana
RUN ln -s /usr/share/kibana /opt/kibana

{{! Please notify @elastic/kibana-security if you want to remove or change this environment variable. }}
ENV ELASTIC_CONTAINER true
ENV PATH=/usr/share/kibana/bin:$PATH

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ COPY --from=prep_files --chown=1000:0 /usr/share/kibana /usr/share/kibana
WORKDIR /usr/share/kibana
RUN ln -s /usr/share/kibana /opt/kibana

{{! Please notify @elastic/kibana-security if you want to remove or change this environment variable. }}
ENV ELASTIC_CONTAINER true
ENV PATH=/usr/share/kibana/bin:$PATH

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import dedent from 'dedent';

import { TemplateContext } from '../template_context';

// IMPORTANT: Please notify @elastic/kibana-security if you're changing any of the Docker specific
// configuration defaults. We rely on these defaults in the interactive setup mode.
function generator({ imageFlavor }: TemplateContext) {
return dedent(`
#
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/apm_oss/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import { schema, TypeOf } from '@kbn/config-schema';
import { ConfigDeprecationProvider, PluginInitializerContext } from '../../../core/server';
import { APMOSSPlugin } from './plugin';

const deprecations: ConfigDeprecationProvider = ({ unused }) => [unused('fleetMode')];
const deprecations: ConfigDeprecationProvider = ({ unused }) => [
unused('fleetMode'),
unused('indexPattern'),
];

export const config = {
schema: schema.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { debounce } from 'lodash';
import { EuiButtonEmpty } from '@elastic/eui';
import { DocTableProps, DocTableRenderProps, DocTableWrapper } from './doc_table_wrapper';
import { SkipBottomButton } from '../skip_bottom_button';
import { shouldLoadNextDocPatch } from './lib/should_load_next_doc_patch';

const FOOTER_PADDING = { padding: 0 };

Expand All @@ -35,12 +36,7 @@ const DocTableInfiniteContent = (props: DocTableRenderProps) => {
const scheduleCheck = debounce(() => {
const isMobileView = document.getElementsByClassName('dscSidebar__mobile').length > 0;
const usedScrollDiv = isMobileView ? scrollMobileElem : scrollDiv;

const scrollusedHeight = usedScrollDiv.scrollHeight;
const scrollTop = Math.abs(usedScrollDiv.scrollTop);
const clientHeight = usedScrollDiv.clientHeight;

if (scrollTop + clientHeight === scrollusedHeight) {
if (shouldLoadNextDocPatch(usedScrollDiv)) {
setLimit((prevLimit) => prevLimit + 50);
}
}, 50);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { shouldLoadNextDocPatch } from './should_load_next_doc_patch';

describe('shouldLoadNextDocPatch', () => {
test('next patch should not be loaded', () => {
const scrollingDomEl = {
scrollHeight: 500,
scrollTop: 100,
clientHeight: 100,
} as HTMLElement;

expect(shouldLoadNextDocPatch(scrollingDomEl)).toBeFalsy();
});

test('next patch should be loaded', () => {
const scrollingDomEl = {
scrollHeight: 500,
scrollTop: 350,
clientHeight: 100,
} as HTMLElement;

expect(shouldLoadNextDocPatch(scrollingDomEl)).toBeTruthy();
});

test("next patch should be loaded even there's a decimal scroll height", () => {
const scrollingDomEl = {
scrollHeight: 500,
scrollTop: 350.34234234,
clientHeight: 100,
} as HTMLElement;

expect(shouldLoadNextDocPatch(scrollingDomEl)).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

// use a buffer to start rendering more documents before the user completely scrolles down
const verticalScrollBuffer = 100;

/**
* Helper function to determine if the next patch of 50 documents should be loaded
*/
export function shouldLoadNextDocPatch(domEl: HTMLElement) {
// the height of the scrolling div, including content not visible on the screen due to overflow.
const scrollHeight = domEl.scrollHeight;
// the number of pixels that the div is is scrolled vertically
const scrollTop = domEl.scrollTop;
// the inner height of the scrolling div, excluding content that's visible on the screen
const clientHeight = domEl.clientHeight;

const consumedHeight = scrollTop + clientHeight;
const remainingHeight = scrollHeight - consumedHeight;
return remainingHeight < verticalScrollBuffer;
}
Loading

0 comments on commit 3e330e5

Please sign in to comment.