Problems implementing models and connection to an API


#1

Hey everyone,

I have some trouble connecting my application to my API. The application is based on a dashboard theme (http://www.emberjsthemes.com/themes/view-theme.php?theme_id=1001).

The goal of my application is to provide a summary of device statistics and the current status. The is one page (/dashboard/overview), that shows a counter of active alerts, new devices connected, etc, a tabular log of device events, and a chart showing the current status of devices. The second page (/dashboard/device/id) is supposed to be device specific, but largely similar: the current status, and a log of events for this device only.

So far I have managed to change the theme to use static sites/items similar to the final design, which now need to be fed information dynamically. My API-resources are login protected, but logging in using Ember-Simple-Auth(-Tokens) is working already.

First issue: As this a dashboard, I want to display multiple metrics. As the information itself does not relate to each other, I have to make multiple requests for a single page. I have already discovered the RSVP.hash() function (via https://emberigniter.com/load-multiple-models-single-route/). However, I am still struggeling to implement it, due to the…

Second issue: Also due the nature of the application, some resources to not fit into the REST-way of naming things, e.g., /api/dashboard/alerts, /api/dashboard/history, etc… I dont’t think I can simply call findAll() or findRecord() on them. How can I access these resources using Ember Models? Changes to the resource paths are currently possible.

Third issue: The dashboard theme mentioned earlier provides a sidebar, showing a menu. I want to provide a link to each device in it (=> requires API calls for the current list). However, as the sidebar is implemented as a component and has no corresponding route, I don’t know how to implement it. I have read about services, which can provide data to all components. This seems to be a good solution, however I don’t know where to start with this.

I am extremely grateful for any help you can provide me. I will gladly post code execerpts, however I don’t know what to post at this point.

Cheers, Thomas