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: Wrap value of multi variable in array when coming from URL #16992

Merged
merged 3 commits into from May 10, 2019

Conversation

aocenas
Copy link
Member

@aocenas aocenas commented May 10, 2019

Closes: #15942

When multiple choice option is selected it is wrapped in array even if only one option is selected. When refreshed and taken from URL though it is set as single string instead. This wraps the value in array for those cases to normalize the behaviour.

Copy link
Member

@torkelo torkelo left a comment

Choose a reason for hiding this comment

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

Looks great!

expect(setValueMock).toHaveBeenCalledWith({ text: 'none', value: 'none' });
});

it('sets text and value even if it does not match any option and it is array', async () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

@torkelo Sorry realised there was one more case that was kinda broken after you reviewed. This makes behaviour more consistent for custom values in URL as for single value it worked fine but for multiple custom values the text would be empty.

@aocenas aocenas merged commit cf39a26 into master May 10, 2019
@aocenas aocenas deleted the fix-variable-from-url branch May 10, 2019 20:20
ryantxu added a commit to ryantxu/grafana that referenced this pull request May 13, 2019
* grafana/master:
  chore: remove x character in explore
  Dashboard: show refresh button in kiosk mode (grafana#17032)
  Devenv: Updated gauge test dashboard
  Chore: reintroduce gosec (grafana#17021)
  Gauge: tweaks to background color and height usage (grafana#17019)
  Feature: provide multildap server configuration (grafana#16914)
  (feat/explore): Support for new LogQL filtering syntax (grafana#16674)
  fix(explore): Prevent double querying for Prometheus and Loki (grafana#17004)
  Chore: No implict any fixes (grafana#17020)
  move log package to /infra (grafana#17023)
  Chore: Lowered implicit anys limit to 5386
  Chore: Updated snapshot
  Select: Fixed isOpen issue
  Chore: Typescript no-implicit any fixes progress (grafana#17018)
  GraphPanel: show results for all SeriesData (grafana#16966)
  Fix: Wrap value of multi variable in array when coming from URL (grafana#16992)
ryantxu added a commit to ryantxu/grafana that referenced this pull request May 13, 2019
* grafana/master:
  chore: remove x character in explore
  Dashboard: show refresh button in kiosk mode (grafana#17032)
  Devenv: Updated gauge test dashboard
  Chore: reintroduce gosec (grafana#17021)
  Gauge: tweaks to background color and height usage (grafana#17019)
  Feature: provide multildap server configuration (grafana#16914)
  (feat/explore): Support for new LogQL filtering syntax (grafana#16674)
  fix(explore): Prevent double querying for Prometheus and Loki (grafana#17004)
  Chore: No implict any fixes (grafana#17020)
  move log package to /infra (grafana#17023)
  Chore: Lowered implicit anys limit to 5386
  Chore: Updated snapshot
  Select: Fixed isOpen issue
  Chore: Typescript no-implicit any fixes progress (grafana#17018)
  GraphPanel: show results for all SeriesData (grafana#16966)
  Fix: Wrap value of multi variable in array when coming from URL (grafana#16992)
ryantxu added a commit to NatelEnergy/grafana that referenced this pull request May 14, 2019
* grafana/master: (30 commits)
  chore: remove x character in explore
  Dashboard: show refresh button in kiosk mode (grafana#17032)
  Devenv: Updated gauge test dashboard
  Chore: reintroduce gosec (grafana#17021)
  Gauge: tweaks to background color and height usage (grafana#17019)
  Feature: provide multildap server configuration (grafana#16914)
  (feat/explore): Support for new LogQL filtering syntax (grafana#16674)
  fix(explore): Prevent double querying for Prometheus and Loki (grafana#17004)
  Chore: No implict any fixes (grafana#17020)
  move log package to /infra (grafana#17023)
  Chore: Lowered implicit anys limit to 5386
  Chore: Updated snapshot
  Select: Fixed isOpen issue
  Chore: Typescript no-implicit any fixes progress (grafana#17018)
  GraphPanel: show results for all SeriesData (grafana#16966)
  Fix: Wrap value of multi variable in array when coming from URL (grafana#16992)
  GettingStarted: add key and remove ng-class (grafana#17007)
  explore: add some extra time for angular query editors to update query (grafana#16955)
  Explore: Align Explore with Dashboards and Panels (grafana#16823)
  Explore: Fix empty result from datasource should render logs container (grafana#16999)
  ...
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.

Inconsistent behaviour of multi-value query variables
2 participants