fedora-infra / statscache

A daemon to build and keep fedmsg statistics
GNU Lesser General Public License v2.1
11 stars 9 forks source link

Dashboard not rendered properly at https://apps.stg.fedoraproject.org/statscache/web/dashboard #47

Closed rtnpro closed 9 years ago

rtnpro commented 9 years ago

Problem statement

Trying to load the dashboard at https://apps.stg.fedoraproject.org/statscache/web/dashboard throws the following errors on console:

GET https://apps.stg.fedoraproject.org/api/release-engineering-event-logs?limit=8 404 (Not Found)k.cors.a.crossDomain.send @ jquery-2.1.4.min.js:4n.extend.ajax @ jquery-2.1.4.min.js:4$.ajax.success @ dashboard:189j @ jquery-2.1.4.min.js:2k.fireWith @ jquery-2.1.4.min.js:2x @ jquery-2.1.4.min.js:4(anonymous function) @ jquery-2.1.4.min.js:4
dashboard:192 error: error
jquery-2.1.4.min.js:4 GET https://apps.stg.fedoraproject.org/api/volume-1m?limit=8 404 (Not Found)k.cors.a.crossDomain.send @ jquery-2.1.4.min.js:4n.extend.ajax @ jquery-2.1.4.min.js:4$.ajax.success @ dashboard:189j @ jquery-2.1.4.min.js:2k.fireWith @ jquery-2.1.4.min.js:2x @ jquery-2.1.4.min.js:4(anonymous function) @ jquery-2.1.4.min.js:4
dashboard:192 error: error
jquery-2.1.4.min.js:4 GET https://apps.stg.fedoraproject.org/api/volume-1s?limit=8 404 (Not Found)k.cors.a.crossDomain.send @ jquery-2.1.4.min.js:4n.extend.ajax @ jquery-2.1.4.min.js:4$.ajax.success @ dashboard:189j @ jquery-2.1.4.min.js:2k.fireWith @ jquery-2.1.4.min.js:2x @ jquery-2.1.4.min.js:4(anonymous function) @ jquery-2.1.4.min.js:4
dashboard:192 error: error
jquery-2.1.4.min.js:4 GET https://apps.stg.fedoraproject.org/api/volume-5s?limit=8 404 (Not Found)k.cors.a.crossDomain.send @ jquery-2.1.4.min.js:4n.extend.ajax @ jquery-2.1.4.min.js:4$.ajax.success @ dashboard:189j @ jquery-2.1.4.min.js:2k.fireWith @ jquery-2.1.4.min.js:2x @ jquery-2.1.4.min.js:4(anonymous function) @ jquery-2.1.4.min.js:4
jquery-2.1.4.min.js:4 GET https://apps.stg.fedoraproject.org/api/volume-by-category-1m?limit=8 404 (Not Found)k.cors.a.crossDomain.send @ jquery-2.1.4.min.js:4n.extend.ajax @ jquery-2.1.4.min.js:4$.ajax.success @ dashboard:189j @ jquery-2.1.4.min.js:2k.fireWith @ jquery-2.1.4.min.js:2x @ jquery-2.1.4.min.js:4(anonymous function) @ jquery-2.1.4.min.js:4
2dashboard:192 error: error
jquery-2.1.4.min.js:4 GET https://apps.stg.fedoraproject.org/api/volume-by-category-1s?limit=8 404 (Not Found)k.cors.a.crossDomain.send @ jquery-2.1.4.min.js:4n.extend.ajax @ jquery-2.1.4.min.js:4$.ajax.success @ dashboard:189j @ jquery-2.1.4.min.js:2k.fireWith @ jquery-2.1.4.min.js:2x @ jquery-2.1.4.min.js:4(anonymous function) @ jquery-2.1.4.min.js:4
jquery-2.1.4.min.js:4 GET https://apps.stg.fedoraproject.org/api/volume-by-category-5s?limit=8 404 (Not Found)k.cors.a.crossDomain.send @ jquery-2.1.4.min.js:4n.extend.ajax @ jquery-2.1.4.min.js:4$.ajax.success @ dashboard:189j @ jquery-2.1.4.min.js:2k.fireWith @ jquery-2.1.4.min.js:2x @ jquery-2.1.4.min.js:4(anonymous function) @ jquery-2.1.4.min.js:4
2dashboard:192 error: error

Reason

Generating URLS like: https://github.com/fedora-infra/statscache/blob/develop/statscache/templates/dashboard.html#L95 in javascript does not account for adding proper base path prefix for the URL, which is statscache in our case/

Solution

Using {{ url_for('<route name>') }} takes care of this issue.