Skip to content

Commit

Permalink
[User Experience App] Fix ux app env filter (elastic#105918) (elastic…
Browse files Browse the repository at this point in the history
…#106001)

Co-authored-by: Shahzad <[email protected]>
  • Loading branch information
kibanamachine and shahzad31 authored Jul 16, 2021
1 parent e333c67 commit b26051d
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function RumHome() {

const { isSmall, isXXL } = useBreakPoints();

const envStyle = isSmall ? {} : { maxWidth: 200 };
const envStyle = isSmall ? {} : { maxWidth: 500 };

return (
<CsmSharedContextProvider>
Expand Down Expand Up @@ -59,7 +59,7 @@ export function RumHome() {
function PageHeader() {
const { isSmall } = useBreakPoints();

const envStyle = isSmall ? {} : { maxWidth: 200 };
const envStyle = isSmall ? {} : { maxWidth: 400 };

return (
<div style={{ width: '100%' }}>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* 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; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { getEsFilter } from './get_es_filter';

describe('getEfFilters', function () {
it('should return environment in include filters', function () {
const result = getEsFilter({
browser: ['Chrome'],
environment: 'production',
});

expect(result).toEqual([
{ terms: { 'user_agent.name': ['Chrome'] } },
{ term: { 'service.environment': 'production' } },
]);
});

it('should not return environment in exclude filters', function () {
const result = getEsFilter(
{ browserExcluded: ['Chrome'], environment: 'production' },
true
);

expect(result).toEqual([{ terms: { 'user_agent.name': ['Chrome'] } }]);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,8 @@ export function getEsFilter(uiFilters: UxUIFilters, exclude?: boolean) {
};
}) as ESFilter[];

return [...mappedFilters, ...environmentQuery(uiFilters.environment)];
return [
...mappedFilters,
...(exclude ? [] : environmentQuery(uiFilters.environment)),
];
}

0 comments on commit b26051d

Please sign in to comment.