-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[APM] Integrate Alert Search bar in alert tab #149610
Changes from all commits
d2a6594
ea7c2c5
670f085
2ff6cf6
ac5ce29
aac41ce
4bf78b2
042aeb4
9b1027a
ce3b2ce
1e899e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
*/ | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
import { escapeKuery } from '@kbn/es-query'; | ||
import { SERVICE_ENVIRONMENT } from './es_fields/apm'; | ||
import { Environment } from './environment_rt'; | ||
|
||
|
@@ -43,18 +44,30 @@ export const ENVIRONMENT_NOT_DEFINED = { | |
label: getEnvironmentLabel(ENVIRONMENT_NOT_DEFINED_VALUE), | ||
}; | ||
|
||
export function getEnvironmentEsField(environment: string) { | ||
if ( | ||
function isEnvironmentDefined(environment: string) { | ||
return ( | ||
!environment || | ||
environment === ENVIRONMENT_NOT_DEFINED_VALUE || | ||
environment === ENVIRONMENT_ALL_VALUE | ||
) { | ||
); | ||
} | ||
|
||
export function getEnvironmentEsField(environment: string) { | ||
if (isEnvironmentDefined(environment)) { | ||
return {}; | ||
} | ||
|
||
return { [SERVICE_ENVIRONMENT]: environment }; | ||
} | ||
|
||
export function getEnvironmentKuery(environment: string) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't you use this function instead? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I could use it like this:
so I thought it might be cleaner to have the function |
||
if (isEnvironmentDefined(environment)) { | ||
return null; | ||
} | ||
|
||
return `${[SERVICE_ENVIRONMENT]}: ${escapeKuery(environment)} `; | ||
} | ||
|
||
// returns the environment url param that should be used | ||
// based on the requested environment. If the requested | ||
// environment is different from the URL parameter, we'll | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* 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 url from 'url'; | ||
import { synthtrace } from '../../../../synthtrace'; | ||
import { opbeans } from '../../../fixtures/synthtrace/opbeans'; | ||
|
||
const start = '2021-10-10T00:00:00.000Z'; | ||
const end = '2021-10-10T00:15:00.000Z'; | ||
|
||
const serviceOverviewHref = url.format({ | ||
pathname: '/app/apm/services/opbeans-java/alerts', | ||
query: { rangeFrom: start, rangeTo: end }, | ||
}); | ||
|
||
describe('Errors table', () => { | ||
before(() => { | ||
synthtrace.index( | ||
opbeans({ | ||
from: new Date(start).getTime(), | ||
to: new Date(end).getTime(), | ||
}) | ||
); | ||
}); | ||
|
||
after(() => { | ||
synthtrace.clean(); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.loginAsViewerUser(); | ||
}); | ||
|
||
it('Alerts table with the search bar is populated', () => { | ||
cy.visitKibana(serviceOverviewHref); | ||
cy.contains('opbeans-java'); | ||
cy.contains('All'); | ||
cy.contains('Active'); | ||
cy.contains('Recovered'); | ||
cy.getByTestSubj('globalQueryBar').should('exist'); | ||
}); | ||
}); |
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kpatticha Shouldn't this be called
isEnvironmentUndefined
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah! I fixed it and forgot to push 😢
thanks for catching this!, will fix it in a follow-up PR