Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] [User Experience App] Fix ux app env filter (#105918) #106001

Merged
merged 1 commit into from
Jul 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)),
];
}