kittoframework / kitto

Kitto is a framework for interactive dashboards written in Elixir
http://kitto.io/dashboards/sample
MIT License
955 stars 58 forks source link

Template ingestion error: undefined function template/0 #79

Closed mukulashokjoshi closed 7 years ago

mukulashokjoshi commented 7 years ago

Environment

Built with: Elixir 1.3.4 and OTP 18.3.4.4

* Node / NPM version (node -v) (npm -v):

node: v6.9.2 npm: 3.10.9

* Operating system:

ubuntu 16.10 Yakkety Yak


### Current behavior

I have followed all the steps, but it is possible that something was missed inadvertently due to which the sample template is not getting ingested into the layout. I have also checked the demo app and testing it resulted into the template correctly getting ingested. Any pointers will be helpful, as i not sure as to what i am doing wrong. The below is the debug trace:

[info] Starting assets watcher at: 127.0.0.1:8080 [info] Starting Kitto server, listening on ....:4003
[info] GET / [info] Sent 301 in 6ms [info] GET /dashboards/sample [error] Ranch listener Kitto.Router.HTTP had connection process started with :cowboy_protocol:start_link/4 at #PID<0.297.0> exit with reason: {{%CompileError{description : "undefined function template/0", file: "../dashboards/layout.html.eex", line: 16}, [{Kernel, :<>, 2, [file: 'expanding macro']}, {:elixir_compiler_0, :FILE, 1, [file: 'dashboards/layout.html.eex', line: 1]}, {Kernel, : <>, 2, [file: 'expanding macro']}, {:elixir_compiler_0, :FILE, 1, [file: 'dashboards/layout.html.eex', line: 1]}]}, {Kitto.Router, :call, [%Plug.Conn{adapter: {Plug.Adapters.Cowboy.Conn, :...}, assigns: %{}, before_send: [], body_params: %Plug.Conn.Unfetched{aspect: :body_params}, cookies: %Plug.Conn.Unfetched{aspect: :cookies}, halted: false, host: "...", method: "GET", owner: #PID<0.297.0>, params: %Plug.Conn.Unfetched{aspect: :params}, path_info: ["dashboards", "sample"], path_params: %{}, peer: {{, , , }, 58932}, port: 4003, private: %{}, query_params: %Plug.Conn.Unfetched{aspect: :query_params}, query_string: "", remote_ip: {, , , }, req_cookies: %Plug.Conn.Unfetched{aspect: :cookies}, req_headers: [{"host", "...:4003"}, {"connection", "keep-alive"}, {"upgrade-insecure-requests", "1"}, {"user- agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36"}, {"accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8"}, {"accept-encoding", "gzip, deflate, sdch"}, {"accept-language", "en-US,en;q=0.8"}, {"cookie", "_ga=GA1.1.216201135.1482994200"}], request_path: "/dashboards/sample", resp_body: nil, resp_cookies: %{}, resp_headers: [{"cache-control", "max-age=0, private, must-revalidate"}], scheme: :http, script_name: [], secret_key_base: nil, state: :unset, status: nil}, []]}}


### Expected behavior

The sample template should be ingested into the layout
zorbash commented 7 years ago

Hi @mukulashokjoshi it seems like you're using the latest Kitto but have generated a dashboard using an older installer.

See: https://github.com/kittoframework/kitto/wiki/Upgrading-Guide#layout about this issue.

What you have to do:

In /dashboards/layout.html.eex (which is the default layout) change <%= template %> to <%= @template %>.

Let me know if this did the trick.

mukulashokjoshi commented 7 years ago

@Zorbash thanks very much

Your suggestion worked and the template has been ingested successfully!

And yes was looking at the installer code and it showed an @ against the template, but i thought it must be getting replaced when generating the kitto app.

Will now start customising kitto!