Skip to content

Conversation

delta50
Copy link
Contributor

@delta50 delta50 commented Feb 25, 2021

What this PR does / why we need it:

Now it is possible to pass variables to the search tag input field of the dashlist config. This is useful when you have a generic dashboard and would like to use the templating feature for showing only the relevant dashboards in the list depending on a variable value.

Which issue(s) this PR fixes:

Fixes: #29028
Relates #18113 #18167

Special notes for your reviewer:
This is an updated version of this outdated PR #18167

@delta50 delta50 requested review from a team, thisisobate and torkelo and removed request for a team February 25, 2021 03:12
@CLAassistant
Copy link

CLAassistant commented Feb 25, 2021

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@dprokop dprokop left a comment

Choose a reason for hiding this comment

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

@delta50 thanks for the contribution. I've tested it and it seems like it works as expected.

Few things before we can merge this.

  1. Docs needs to be updated ( )
  2. Would be awesome if you could implement tests for this newly added feature
  3. Your co-committer needs to sign CLA agreement (andrew.riedel@deepintent.com - I assume it's you) :)

Additionally- since the change does not seem to be a big one - could you also add the variables interpolation to the search query input?

@dprokop dprokop added this to the 7.5.0 milestone Feb 25, 2021
@delta50 delta50 force-pushed the add-dashlist-vars branch from 959756d to 4cf782a Compare March 2, 2021 01:22
@delta50 delta50 requested a review from a team as a code owner March 2, 2021 01:22
@delta50 delta50 requested review from achatterjee-grafana, oddlittlebird and osg-grafana and removed request for a team March 2, 2021 01:22
@delta50
Copy link
Contributor Author

delta50 commented Mar 2, 2021

@dprokop I have added the variable interpolation to the query field, added documentation, and fixed the commit author.

I'm not sure where the tests for this would live, or what kind of tests you had in mind. Could you provide more info on what this would look like?

@delta50 delta50 force-pushed the add-dashlist-vars branch from 4cf782a to b4be2ce Compare March 2, 2021 01:27
@delta50 delta50 requested a review from dprokop March 2, 2021 03:26
Copy link
Contributor

@achatterjee-grafana achatterjee-grafana left a comment

Choose a reason for hiding this comment

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

Added some copy edit suggestions, code changes will need a review from engineers.

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
const params = {
limit: options.maxItems,
query: options.query,
query: /^\$.+/.test(options.query) ? replaceVars(options.query, {}, 'text') : options.query,
Copy link
Contributor

Choose a reason for hiding this comment

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

always pass it through replaceVars, there are multiple syntaxes so testing if the string contains variables is not needed

Copy link
Contributor Author

@delta50 delta50 Mar 4, 2021

Choose a reason for hiding this comment

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

This is done and the documentation has been updated.

@wbrowne wbrowne changed the title DashboardList: Enables templating on search tag input DashboardList: Enable templating on search tag input Mar 3, 2021
@torkelo torkelo removed this from the 7.5.0-beta1 milestone Mar 3, 2021
@delta50 delta50 requested a review from torkelo March 4, 2021 17:10
@oddlittlebird
Copy link
Contributor

This needs a milestone. Is it slated for 7.5?

@delta50
Copy link
Contributor Author

delta50 commented Mar 8, 2021

I would very much appreciate if this was able to go out in 7.5 as it is will help simplify our grafana setup significantly. If there is anything left to do let me know and I can knock it out ASAP.

Copy link
Contributor

@achatterjee-grafana achatterjee-grafana left a comment

Choose a reason for hiding this comment

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

One minor copy-edit suggestion. Otherwise doc content looks Ok.

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
@delta50
Copy link
Contributor Author

delta50 commented Mar 17, 2021

Hey @torkelo, is this good to go or are there more changes required?

@hugohaggmark
Copy link
Contributor

Hey @torkelo, is this good to go or are there more changes required?

Hi @delta50 I think you need to fix the build errors, seems to be prettier errors.

@grafanabot grafanabot added area/frontend type/docs Flags the technical writing team for documentation support; auto adds to org-wide docs project labels Mar 18, 2021
@delta50
Copy link
Contributor Author

delta50 commented Mar 18, 2021

Hey @torkelo, is this good to go or are there more changes required?

Hi @delta50 I think you need to fix the build errors, seems to be prettier errors.

This is fixed, my yarn setup was not correct, so I was assuming these errors were due to something outside my PR.

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
@torkelo torkelo merged commit 30e5afa into grafana:master Mar 18, 2021
@torkelo torkelo added this to the 8.0.0 milestone Mar 18, 2021
bergquist added a commit to bergquist/grafana that referenced this pull request Mar 19, 2021
* master: (168 commits)
  Fix loading timezone info on windows (grafana#32029)
  Remove datalink template suggestions for accessing specific fields when there are multiple dataframes. (grafana#32057)
  AlertingNG: Refactor notifier to support config reloads (grafana#32099)
  Chore: Replace Command dispatches by explicit calls (grafana#32131)
  MixedDataSource: Name is updated when data source variable changes (grafana#32090)
  Plugin: PanelRenderer and simplified QueryRunner to be used from plugins. (grafana#31901)
  DashboardList: Enable templating on search tag input (grafana#31460)
  release notes v7.3.10 and v7.4.5 (grafana#32135)
  Alerting: Add database table for persisting alerting configuration (grafana#32042)
  latest updated to 7.4.5 (grafana#32132)
  changelog v7.4.5 (grafana#32110)
  Chore: Tidy up Go deps (grafana#32127)
  Explore: Support full inspect drawer (grafana#32005)
  GraphNG: make sure dataset and config are in sync when initializing and re-initializing uPlot (grafana#32106)
  Login: Replace command dispatch by explicit call (grafana#32088)
  Loki: Label browser UI updates (grafana#31737)
  AlertingNG: Notification channel for emails (grafana#31768)
  Alerting: Enable Alert rule `severity` tag to override VictorOps Severity setting (grafana#29392)
  Docs: updates developer guide with useful resources for windows setup (grafana#32075)
  SQLStore: Close session in withDbSession (grafana#31775)
  ...
ryantxu pushed a commit to dejapong/grafana that referenced this pull request Mar 30, 2021
* Add variable interpolation for dashlist panel.

* Update docs/sources/panels/visualizations/dashboard-list-panel.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Fix variable interpolation for dashlist panel to work with all syntax.

* Update docs/sources/panels/visualizations/dashboard-list-panel.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Fix prettier issues.

* Fix prettier issues.

* Update docs/sources/panels/visualizations/dashboard-list-panel.md

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add to changelog area/frontend area/panel/dashboard-list pr/external This PR is from external contributor type/docs Flags the technical writing team for documentation support; auto adds to org-wide docs project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FeatureRequest] DashboardList: Add templating on search tag input

9 participants