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

fix #7332 - saving vis with % in name causes error #7701

Merged
merged 7 commits into from
Aug 3, 2016

Conversation

ppisljar
Copy link
Member

@ppisljar ppisljar commented Jul 10, 2016

Fixes #7332

  • slugify_id.js utility was updated to replace % sign with -percentage-
  • tests for slugify_id utility were updated

I was looking for UI test of saving visualization but couldn't locate it .. can you please help me locate it ?

@Bargs
Copy link
Contributor

Bargs commented Jul 12, 2016

LGTM

You probably already found them, but I think these are the tests you were looking for https://github.com/elastic/kibana/blob/e7189e5349f91887e7eb1a0861e2613755075365/test/functional/apps/visualize/index.js

@Bargs Bargs assigned ppisljar and unassigned ppisljar and Bargs Jul 12, 2016
@ppisljar
Copy link
Member Author

would this be considerent sufficient test ?

  • i changed one of the tests where it saves and loads visualization to actually use a name with % inside ...
  • as opposed to adding a seperate test just for this (as saving and loading is already tested with each chart type i think this is more efficent and tells you enought about test-case if it fails

@Bargs
Copy link
Contributor

Bargs commented Jul 13, 2016

In theory I'm a fan of anything that speeds up the functional tests, but without an explicit test case I don't think future readers will understand what the % is for, and might remove it. Maybe you could add one test case for all special characters in slugify_id (like literally test creating a viz with the title /?&=%)?

@ppisljar
Copy link
Member Author

i added the test but need to fix #7733 first for them to pass

strings with special charracters are not found unless we add a space after it (searching for "test %*" wont work but searching for "test % *" will )
@ppisljar
Copy link
Member Author

strings with special charracters are not found unless we add a space after it (searching for "test %*" wont work but searching for "test % *" will )

i added a simple check if the last character in the query string is a special one additional space is appended before the asterisk *

let me know if this looks ok to you ?

@ppisljar ppisljar assigned Bargs and unassigned ppisljar Jul 15, 2016
@Bargs
Copy link
Contributor

Bargs commented Jul 15, 2016

strings with special charracters are not found unless we add a space after it (searching for "test %*" wont work but searching for "test % *" will )

I don't think this is quite the right solution. As far as I can tell, foo=* wouldn't match the title foo= because queries using * don't get analyzed, whereas the visualization title field is analyzed. What this means is, the title foo= would get stored under just foo in the inverted index, because the term is split into tokens on word dividers like = (based on the field's analyzer). A query with foo=* will try to find an exact match for foo=, which it won't find.

The reason why adding a space sort of works is that it's splitting the query string into two tokens: foo and *. That's my understanding at least, analyzed fields are complicated. So the downside to adding a space after special chars is that the list of special chars we need to handle is based on the field analyzer defined in the elasticsearch mapping, and we probably don't want to couple these things together.

Long story short, I think the correct solution here is to add the analyze_wildcard: true param to the query body. This will split a query like foo=* into the tokens we want and successfully match the title foo=. This solution would also match a title like foo=bar with a query string like foo=b, which neither the current code or the whitespace based solution would handle correctly.

// and trying to access the chart below with getXAxisLabels
// otherwise it hangs.
.then(function sleep() {
return PageObjects.common.sleep(2000);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there's really any reason to wait for the toast message, load the viz and wait for it if we're not running assertions on it. I think the only reason the test below does so is to set things up for the test that follows it.

@Bargs Bargs assigned ppisljar and unassigned Bargs Jul 15, 2016
return PageObjects.visualize.saveVisualization(vizNamewithSpecialChars)
.then(function (message) {
PageObjects.common.debug(`Saved viz message = ${message}`);
PageObjects.common.saveScreenshot('Visualize-area-chart-save-toast');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This screenshot uses an identical name to the one saved in the test below. Also, I don't think there's a need to save a screenshot at all here, right @LeeDr?

@Bargs
Copy link
Contributor

Bargs commented Jul 26, 2016

Looks like the name check in the new test is failing.

@Bargs Bargs removed their assignment Jul 26, 2016
@LeeDr
Copy link

LeeDr commented Jul 26, 2016

I agree that a screenshot is not necessary.

@ppisljar
Copy link
Member Author

test needs to wait for the toast message to dissappear, else it ruins the next test

@Bargs
Copy link
Contributor

Bargs commented Jul 27, 2016

LGTM. Make sure to get one more reviewer, maybe @LeeDr could take a look since this more tests than anything?

@Bargs Bargs removed their assignment Jul 27, 2016
@LeeDr
Copy link

LeeDr commented Aug 3, 2016

LGTM

@LeeDr LeeDr merged commit 4469e88 into elastic:master Aug 3, 2016
@ppisljar ppisljar deleted the fix/7332 branch August 4, 2016 05:54
airow pushed a commit to airow/kibana that referenced this pull request Feb 16, 2017
fix elastic#7332 - saving vis with % in name causes error

Former-commit-id: 4469e88
cee-chen added a commit that referenced this pull request May 3, 2024
`v94.1.0-backport.0` ⏩ `v94.2.1-backport.0`

_[Questions? Please see our Kibana upgrade
FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)_

---

##
[`v94.2.1-backport.0`](https://github.com/elastic/eui/releases/v94.2.1-backport.0)

**This is a backport release only intended for use by Kibana.**

- Reverted the `EuiFlexGroup`/`EuiFlexItem` `component` prop feature due
to Kibana typing issues

## [`v94.2.1`](https://github.com/elastic/eui/releases/v94.2.1)

**Bug fixes**

- Fixed an `EuiTabbedContent` edge case bug that occurred when updated
with a completely different set of `tabs`
([#7713](elastic/eui#7713))
- Fixed the `@storybook/test` dependency to be listed in
`devDependencies` and not `dependencies`
([#7719](elastic/eui#7719))

## [`v94.2.0`](https://github.com/elastic/eui/releases/v94.2.0)

- Updated `getDefaultEuiMarkdownPlugins()` to allow excluding the
following plugins in addition to `tooltip`:
([#7676](elastic/eui#7676))
  - `checkbox`
  - `linkValidator`
  - `lineBreaks`
  - `emoji`
- Updated `EuiSelectable`'s `isPreFiltered` prop to allow passing a
configuration object, which allows disabling search highlighting in
addition to search filtering
([#7683](elastic/eui#7683))
- Updated `EuiFlexGroup` and `EuiFlexItem` prop types to support passing
any valid React component type to the `component` prop and ensure proper
type checking of the extra props forwarded to the `component`.
([#7688](elastic/eui#7688))
- Updated `EuiSearchBar` to allow the `@` special character in query
string searches ([#7702](elastic/eui#7702))
- Added a new, optional `optionMatcher` prop to `EuiSelectable` and
`EuiComboBox` allowing passing a custom option matcher function to these
components and controlling option filtering for given search string
([#7709](elastic/eui#7709))

**Bug fixes**

- Fixed an `EuiPageTemplate` bug where prop updates would not cascade
down to child sections
([#7648](elastic/eui#7648))
- To cascade props down to the sidebar, `EuiPageTemplate` now explicitly
requires using the `EuiPageTemplate.Sidebar` rather than
`EuiPageSidebar`
- Fixed `EuiFieldNumber`'s typing to accept an icon configuration shape
([#7666](elastic/eui#7666))
- Fixed `EuiFieldText` and `EuiFieldNumber` to render the correct
paddings for icon shapes set to `side: 'right'`
([#7666](elastic/eui#7666))
- Fixed `EuiFieldText` and `EuiFieldNumber` to fully ignore
`icon`/`prepend`/`append` when `controlOnly` is set to true
([#7666](elastic/eui#7666))
- Fixed `EuiColorPicker`'s input not setting the correct right padding
for the number of icons displayed
([#7666](elastic/eui#7666))
- Visual fixes for `EuiRange`s with `showInput`:
([#7678](elastic/eui#7678))
  - Longer `append`/`prepend` labels no longer cause a background bug
  - Inputs can no longer overwhelm the actual range in width
- Fixed a visual text alignment regression in `EuiTableRowCell`s with
the `row` header scope
([#7681](elastic/eui#7681))
- Fixed `toolTipProps` type on `EuiSuperUpdateButton` to use
`Partial<EuiToolTipProps>`
([#7692](elastic/eui#7692))
- Fixes missing prop type for `popperProps` on `EuiDatePicker`
([#7694](elastic/eui#7694))
- Fixed a focus bug with `EuiDataGrid`s with `leadingControlColumns`
when moving columns to the left/right
([#7701](elastic/eui#7701))
([#7698](elastic/eui#7698))
- Fixed `EuiSuperDatePicker` to validate date string with respect of
locale on `EuiAbsoluteTab`.
([#7705](elastic/eui#7705))
- Fixed a visual bug with `EuiSuperDatePicker`'s absolute tab on small
mobile screens ([#7708](elastic/eui#7708))
- Fixed i18n of empty and loading state messages for the
`FieldValueSelectionFilter` component
([#7718](elastic/eui#7718))

**Dependency updates**

- Updated `@hello-pangea/dnd` to v16.6.0
([#7599](elastic/eui#7599))
- Updated `remark-rehype` to v8.1.0
([#7601](elastic/eui#7601))

**Accessibility**

- Improved `EuiBasicTable` and `EuiInMemoryTable`'s selection checkboxes
to have unique aria-labels per row
([#7672](elastic/eui#7672))
- Added `aria-valuetext` attributes to `EuiRange`s with tick labels for
improved screen reader UX
([#7675](elastic/eui#7675))
- Updated `EuiAccordion` to keep focus on accordion trigger instead of
moving to content on click/keypress
([#7696](elastic/eui#7696))
- Added `aria-disabled` attribute to `EuiHorizontalSteps` when status is
"disabled" ([#7699](elastic/eui#7699))

---------

Co-authored-by: Tomasz Kajtoch <[email protected]>
cee-chen added a commit that referenced this pull request May 8, 2024
`v93.6.0` ⏩ `v93.6.0-backport.0`

---

##
[`v93.6.0-backport.0`](https://github.com/elastic/eui/releases/v93.6.0-backport.0)

**This is a backport release only intended for use by Kibana.**

- Updated `EuiSearchBar` to allow the `@` special character in query
string searches ([#7702](elastic/eui#7702))

**Bug fixes**

- Fixed a focus bug with `EuiDataGrid`s with `leadingControlColumns`
when moving columns to the left/right
([#7701](elastic/eui#7701))
([#7698](elastic/eui#7698))

Co-authored-by: Kibana Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants