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

Asynchronous templating #519

Open
aalpern opened this issue Sep 16, 2015 · 1 comment
Open

Asynchronous templating #519

aalpern opened this issue Sep 16, 2015 · 1 comment

Comments

@aalpern
Copy link
Member

aalpern commented Sep 16, 2015

Tessera currently uses handlebars for expanding templates in items such as the markdown item, and most importantly in queries. Internal to UA (to be released eventually) we integrate that with handlebars helper functions that call clusto to build graphite queries from role-based queries to clusto (to retrieve hostnames).

Because handlebars is synchronous, that means making synchronous HTTP calls, which is no fun (mitigated by in-browser caching, but still...).

Possible approaches to mitigate this:

  • Replace the template engine with one that supports both async rendering and async extensions. This also means re-writing portions of dashboard rendering using Promises (also not a bad thing). It also likely means some incompatibilities in the templates (see below), which is not ideal but probably acceptable.
  • Keep handlebars, but add an async data gathering phase, so we don't need to make async calls within template helpers. This is attractive from an MVC standpoint, but would really need a much more sophisticated editor (which is probably much more expensive to write, in terms of effort).

Async Template Engines

@aalpern
Copy link
Member Author

aalpern commented Dec 20, 2015

Oh, this is interesting - https://github.com/nknapp/promised-handlebars

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

1 participant