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

Upgrade EUI to 13.4.1 #43717

Closed
wants to merge 11 commits into from
Closed
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"@babel/register": "^7.5.5",
"@elastic/charts": "^10.0.1",
"@elastic/datemath": "5.0.2",
"@elastic/eui": "13.3.0",
"@elastic/eui": "13.4.1",
"@elastic/filesaver": "1.1.2",
"@elastic/good": "8.1.1-kibana2",
"@elastic/numeral": "2.3.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
EuiPopoverTitle,
EuiSpacer,
EuiSwitch,
EuiSwitchEvent,
} from '@elastic/eui';
import { FieldFilter, Filter } from '@kbn/es-query';
import { i18n } from '@kbn/i18n';
Expand Down Expand Up @@ -419,7 +420,7 @@ class FilterEditorUI extends Component<Props, State> {
this.setState({ selectedOperator, params });
};

private onCustomLabelSwitchChange = (event: React.ChangeEvent<HTMLInputElement>) => {
private onCustomLabelSwitchChange = (event: EuiSwitchEvent) => {
const useCustomLabel = event.target.checked;
const customLabel = event.target.checked ? '' : null;
this.setState({ useCustomLabel, customLabel });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ test('Can set title to an empty string', async () => {
);

const inputField = findTestSubject(component, 'customizePanelHideTitle');
inputField.simulate('change');
inputField.simulate('click');

findTestSubject(component, 'saveNewTitleButton').simulate('click');
expect(inputField.props().value).toBeUndefined();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ test('handleCheckboxOptionChange - multiselect', async () => {
component.update();

const checkbox = findTestSubject(component, 'listControlMultiselectInput');
checkbox.simulate('change', { target: { checked: true } });
checkbox.simulate('click');
sinon.assert.notCalled(handleFieldNameChange);
sinon.assert.notCalled(handleIndexPatternChange);
sinon.assert.notCalled(handleNumberOptionChange);
Expand All @@ -247,7 +247,9 @@ test('handleCheckboxOptionChange - multiselect', async () => {
expectedControlIndex,
expectedOptionName,
sinon.match((evt) => {
if (evt.target.checked === true) {
// Synthetic `evt.target.checked` does not get altered by EuiSwitch,
// but its aria attribute is correctly updated
if (evt.target.getAttribute('aria-checked') === 'true') {
return true;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,26 @@ describe('OptionsTab', () => {

it('should update updateFiltersOnChange', () => {
const component = mountWithIntl(<OptionsTab {...props} />);
const checkbox = component.find('[data-test-subj="inputControlEditorUpdateFiltersOnChangeCheckbox"] input[type="checkbox"]');
checkbox.simulate('change', { target: { checked: true } });
const checkbox = component.find('[data-test-subj="inputControlEditorUpdateFiltersOnChangeCheckbox"] button');
checkbox.simulate('click');

expect(props.setValue).toHaveBeenCalledTimes(1);
expect(props.setValue).toHaveBeenCalledWith('updateFiltersOnChange', true);
});

it('should update useTimeFilter', () => {
const component = mountWithIntl(<OptionsTab {...props} />);
const checkbox = component.find('[data-test-subj="inputControlEditorUseTimeFilterCheckbox"] input[type="checkbox"]');
checkbox.simulate('change', { target: { checked: true } });
const checkbox = component.find('[data-test-subj="inputControlEditorUseTimeFilterCheckbox"] button');
checkbox.simulate('click');

expect(props.setValue).toHaveBeenCalledTimes(1);
expect(props.setValue).toHaveBeenCalledWith('useTimeFilter', true);
});

it('should update pinFilters', () => {
const component = mountWithIntl(<OptionsTab {...props} />);
const checkbox = component.find('[data-test-subj="inputControlEditorPinFiltersCheckbox"] input[type="checkbox"]');
checkbox.simulate('change', { target: { checked: true } });
const checkbox = component.find('[data-test-subj="inputControlEditorPinFiltersCheckbox"] button');
checkbox.simulate('click');

expect(props.setValue).toHaveBeenCalledTimes(1);
expect(props.setValue).toHaveBeenCalledWith('pinFilters', true);
Expand Down
2 changes: 1 addition & 1 deletion src/legacy/ui/public/agg_types/controls/auto_precision.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { EuiSwitch, EuiFormRow } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { AggParamEditorProps } from 'ui/vis/editors/default';

function AutoPrecisionParamEditor({ value, setValue }: AggParamEditorProps<boolean>) {
function AutoPrecisionParamEditor({ value = false, setValue }: AggParamEditorProps<boolean>) {
const label = i18n.translate('common.ui.aggTypes.changePrecisionLabel', {
defaultMessage: 'Change precision on map zoom',
});
Expand Down
4 changes: 3 additions & 1 deletion src/legacy/ui/public/agg_types/controls/precision.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ function PrecisionParamEditor({ agg, value, setValue }: AggParamEditorProps<numb
min={1}
max={config.get('visualization:tileMap:maxPrecision')}
value={value}
onChange={ev => setValue(Number(ev.target.value))}
onChange={(ev: React.ChangeEvent<HTMLInputElement> | React.MouseEvent<HTMLButtonElement>) =>
setValue(Number(ev.currentTarget.value))
}
data-test-subj={`visEditorMapPrecision${agg.id}`}
showValue
/>
Expand Down
2 changes: 1 addition & 1 deletion src/legacy/ui/public/agg_types/controls/switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ interface SwitchParamEditorProps extends AggParamEditorProps<boolean> {
}

function SwitchParamEditor({
value,
value = false,
setValue,
dataTestSubj,
displayToolTip,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { EuiSwitch, EuiFormRow } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { AggParamEditorProps } from 'ui/vis/editors/default';

function UseGeocentroidParamEditor({ value, setValue }: AggParamEditorProps<boolean>) {
function UseGeocentroidParamEditor({ value = false, setValue }: AggParamEditorProps<boolean>) {
const label = i18n.translate('common.ui.aggTypes.placeMarkersOffGridLabel', {
defaultMessage: 'Place markers off grid (use geocentroid)',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
EuiOverlayMask,
EuiSpacer,
EuiSwitch,
EuiSwitchEvent,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import React, { Fragment } from 'react';
Expand Down Expand Up @@ -193,7 +194,7 @@ export class SavedObjectSaveModal extends React.Component<Props, State> {
});
};

private onCopyOnSaveChange = (event: React.ChangeEvent<HTMLInputElement>) => {
private onCopyOnSaveChange = (event: EuiSwitchEvent) => {
this.setState({
copyOnSave: event.target.checked,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ function RadiusRatioOptionControl({ editorStateParams, setValue }: AggControlPro
min={1}
max={100}
value={editorStateParams.radiusRatio || DEFAULT_VALUE}
onChange={e => setValue(editorStateParams, PARAM_NAME, parseFloat(e.target.value))}
onChange={(e: React.ChangeEvent<HTMLInputElement> | React.MouseEvent<HTMLButtonElement>) =>
setValue(editorStateParams, PARAM_NAME, parseFloat(e.currentTarget.value))
}
showRange
showValue
valueAppend="%"
Expand Down
8 changes: 5 additions & 3 deletions test/functional/page_objects/dashboard_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ export function DashboardPageProvider({ getService, getPageObjects }) {

async clickSave() {
log.debug('DashboardPage.clickSave');
await testSubjects.clickWhenNotDisabled('confirmSaveSavedObjectButton');
await testSubjects.click('confirmSaveSavedObjectButton');
}

async pressEnterKey() {
Expand Down Expand Up @@ -544,19 +544,21 @@ export function DashboardPageProvider({ getService, getPageObjects }) {
async setSaveAsNewCheckBox(checked) {
log.debug('saveAsNewCheckbox: ' + checked);
const saveAsNewCheckbox = await testSubjects.find('saveAsNewCheckbox');
const isAlreadyChecked = (await saveAsNewCheckbox.getAttribute('checked') === 'true');
const isAlreadyChecked = (await saveAsNewCheckbox.getAttribute('aria-checked') === 'true');
if (isAlreadyChecked !== checked) {
log.debug('Flipping save as new checkbox');
const saveAsNewCheckbox = await testSubjects.find('saveAsNewCheckbox');
await retry.try(() => saveAsNewCheckbox.click());
}
}

async setStoreTimeWithDashboard(checked) {
log.debug('Storing time with dashboard: ' + checked);
const storeTimeCheckbox = await testSubjects.find('storeTimeWithDashboard');
const isAlreadyChecked = (await storeTimeCheckbox.getAttribute('checked') === 'true');
const isAlreadyChecked = (await storeTimeCheckbox.getAttribute('aria-checked') === 'true');
if (isAlreadyChecked !== checked) {
log.debug('Flipping store time checkbox');
const storeTimeCheckbox = await testSubjects.find('storeTimeWithDashboard');
await retry.try(() => storeTimeCheckbox.click());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"license": "Apache-2.0",
"dependencies": {
"@elastic/eui": "13.3.0",
"@elastic/eui": "13.4.1",
"react": "^16.8.0",
"react-dom": "^16.8.0"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"license": "Apache-2.0",
"dependencies": {
"@elastic/eui": "13.3.0",
"@elastic/eui": "13.4.1",
"react": "^16.8.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"license": "Apache-2.0",
"dependencies": {
"@elastic/eui": "13.3.0",
"@elastic/eui": "13.4.1",
"react": "^16.8.0"
},
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"license": "Apache-2.0",
"dependencies": {
"@elastic/eui": "13.3.0",
"@elastic/eui": "13.4.1",
"react": "^16.8.0"
},
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"license": "Apache-2.0",
"dependencies": {
"@elastic/eui": "13.3.0",
"@elastic/eui": "13.4.1",
"react": "^16.8.0",
"react-dom": "^16.8.0"
}
Expand Down

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

Loading