mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[APM] Display ENVIRONMENT_ALL label instead of value (#133616)
* Fix ENVIRONMENT_ALL label * Add e2e test * Fix all option
This commit is contained in:
parent
6014b1ef74
commit
9d860432e8
3 changed files with 36 additions and 4 deletions
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export const ALL_OPTION_VALUE = 'ALL_OPTION_VALUE';
|
||||
|
||||
// human-readable label for service and environment. The "All" option should be translated.
|
||||
|
@ -24,3 +23,8 @@ export function getOptionLabel(value: string | undefined) {
|
|||
export function omitAllOption(value?: string) {
|
||||
return value === ALL_OPTION_VALUE ? undefined : value;
|
||||
}
|
||||
|
||||
export const ALL_OPTION = {
|
||||
value: ALL_OPTION_VALUE,
|
||||
label: getOptionLabel(ALL_OPTION_VALUE),
|
||||
};
|
||||
|
|
|
@ -101,4 +101,29 @@ describe('Agent configuration', () => {
|
|||
cy.wait('@serviceEnvironmentApi');
|
||||
cy.contains('production');
|
||||
});
|
||||
it('displays All label when selecting all option', () => {
|
||||
cy.intercept(
|
||||
'GET',
|
||||
'/api/apm/settings/agent-configuration/environments'
|
||||
).as('serviceEnvironmentApi');
|
||||
cy.contains('Create configuration').click();
|
||||
cy.get('[data-test-subj="serviceNameComboBox"]')
|
||||
.click()
|
||||
.type('All')
|
||||
.type('{enter}');
|
||||
cy.contains('All').realClick();
|
||||
cy.wait('@serviceEnvironmentApi');
|
||||
|
||||
cy.get('[data-test-subj="serviceEnviromentComboBox"]')
|
||||
.click({ force: true })
|
||||
.type('All');
|
||||
|
||||
cy.get('mark').contains('All').click();
|
||||
cy.contains('Next step').click();
|
||||
cy.contains('Service name All');
|
||||
cy.contains('Environment All');
|
||||
cy.contains('Edit').click();
|
||||
cy.wait('@serviceEnvironmentApi');
|
||||
cy.contains('All');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -9,7 +9,10 @@ import { EuiDescribedFormGroup, EuiFormRow } from '@elastic/eui';
|
|||
import React from 'react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { SuggestionsSelect } from '../../../../../shared/suggestions_select';
|
||||
import { ENVIRONMENT_ALL } from '../../../../../../../common/environment_filter_values';
|
||||
import {
|
||||
getOptionLabel,
|
||||
ALL_OPTION,
|
||||
} from '../../../../../../../common/agent_configuration/all_option';
|
||||
|
||||
interface Props {
|
||||
title: string;
|
||||
|
@ -40,8 +43,8 @@ export function FormRowSuggestionsSelect({
|
|||
>
|
||||
<EuiFormRow label={fieldLabel}>
|
||||
<SuggestionsSelect
|
||||
customOptions={allowAll ? [ENVIRONMENT_ALL] : undefined}
|
||||
defaultValue={value}
|
||||
customOptions={allowAll ? [ALL_OPTION] : undefined}
|
||||
defaultValue={value ? getOptionLabel(value) : undefined}
|
||||
fieldName={fieldName}
|
||||
onChange={onChange}
|
||||
isClearable={false}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue