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

Support auto-refresh of filters with page refresh #366

Closed
jhiza opened this issue Apr 29, 2014 · 7 comments
Closed

Support auto-refresh of filters with page refresh #366

jhiza opened this issue Apr 29, 2014 · 7 comments

Comments

@jhiza
Copy link

jhiza commented Apr 29, 2014

By saving a template to elastic search and then examining the json stored there, I now can see how the filter lists work. Basically I'm trying to combine the scripted template capabilities (for using the same template with url parameters controlling the changing pieces) with the filtering capabilities.

The end goal is that:

  • a user clicks on a link that then renders a dynamic template
  • filter options are pre-populated (via the same way the app does it, filter module and the applyFilter(filter) function.
    BONUS:
  • if changing a filter parameter also updates the URL in the browser for the dynamically changed element.

It's a goal to not have elastic search as a part of this at all. If there is some code that I can put in my template.js file to dynamically retrieve a filter list, that would be great. I'm not a JS expert, hence my question.

current hack:
dashboard.services.filter = {
time: {
from: "now-" + (ARGS.from || timspan),
to: "now"
},
list: [
{
type: "filter",
name: "table_name",
query: "apps.database.[[table_name]].*",
includeAll: true,
current: {
text: tableName,
value: tableName
}
}

]
};

How to dynamically populate list elements via dashboard?

@jippi
Copy link
Contributor

jippi commented Apr 29, 2014

formatted code from above:

dashboard.services.filter = {
    time: {
        from: "now-" + (ARGS.from || timspan),
        to: "now"
    },
    list: [
        {
            type: "filter",
            name: "table_name",
            query: "apps.database.[[table_name]].*",
            includeAll: true,
            current: {
                text: tableName,
                value: tableName
            }
        }
    ]
}

@jhiza
Copy link
Author

jhiza commented Apr 30, 2014

Thanks for the reformat.

Basically I'd like to dynamically load the options section.

@torkelo torkelo changed the title Filter population for scripted dashboards Enable filter options reload on dashboard load May 2, 2014
@torkelo
Copy link
Member

torkelo commented May 2, 2014

changed title of issue to better reflect what is required. It is kind of tricky as all of the places when filters are applied to queries need to be async (as the first time will require the options be fetched from graphite). But should relatively easy.

@jhiza jhiza changed the title Enable filter options reload on dashboard load Enable dynamic loading of filter options in a dashboard May 2, 2014
@jhiza
Copy link
Author

jhiza commented May 2, 2014

Updated the title. ideally the query defined for the list type would be the value called.

Thanks!

@torkelo torkelo changed the title Enable dynamic loading of filter options in a dashboard Support auto-refresh of filters with page refresh Jun 22, 2014
@jhiza
Copy link
Author

jhiza commented Jul 11, 2014

Any plans for this feature soon?

@torkelo
Copy link
Member

torkelo commented Jul 11, 2014

Not within this month, maybe some time in august. On vacation now. Back in August, working full time on grafana!

@torkelo torkelo added this to the v1.8.0 milestone Aug 7, 2014
@torkelo
Copy link
Member

torkelo commented Sep 9, 2014

Seems to work ok in master.

{
        "type": "query",
        "name": "app",
        "query": "apps.*",
        "includeAll": true,
        "options": [],
        "current": {
          "text": "All",
          "value": "*"
        },
        "datasource": null,
        "allFormat": "wildcard",
        "refresh": true
      },

Notice the new refresh option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants