aboutsummaryrefslogtreecommitdiff
path: root/javascript/app
diff options
context:
space:
mode:
Diffstat (limited to 'javascript/app')
-rw-r--r--javascript/app/components/identifier-info.js15
-rw-r--r--javascript/app/services/store.js16
-rw-r--r--javascript/app/utils/api-urls.js3
3 files changed, 31 insertions, 3 deletions
diff --git a/javascript/app/components/identifier-info.js b/javascript/app/components/identifier-info.js
index 537697a..bb859be 100644
--- a/javascript/app/components/identifier-info.js
+++ b/javascript/app/components/identifier-info.js
@@ -54,8 +54,19 @@ export default Ember.Component.extend({
Ember.run.next(this,() => {
if(currentIdentifier === this.get('identifierInfo')) {
this.set('downloadedDocumentation',definitionSite.documentation);
- }});
- });
+ }})
+ }).catch(() => {
+ this.get('store').loadHoogleDocs(packageId,
+ locationInfo.moduleName,
+ locationInfo.entity,
+ locationInfo.name)
+ .then((hoogleDocs) => {
+ Ember.run.next(this,() => {
+ if(currentIdentifier === this.get('identifierInfo')) {
+ this.set('downloadedDocumentation',hoogleDocs);
+ }});
+ });
+ });;
}
}
})
diff --git a/javascript/app/services/store.js b/javascript/app/services/store.js
index 8001061..650ddcf 100644
--- a/javascript/app/services/store.js
+++ b/javascript/app/services/store.js
@@ -53,6 +53,7 @@ export default Ember.Service.extend({
this.expressions = {};
this.references = {};
this.globalReferences = {};
+ this.hoogleDocs = {};
},
loadPackage(packageId) {
const packageInfo = this.packages[packageId];
@@ -144,11 +145,24 @@ export default Ember.Service.extend({
if(globalReferences) {
return new RSVP.Promise((resolve) => {resolve(globalReferences);});
} else {
- const url = urls.globalReferencesUrl(externalId);
+ const url = urls.globalReferencesUrl(externalId);
return Ember.$.getJSON(url).then((refs) => {
this.globalReferences[externalId] = refs;
return refs;
});
}
},
+ loadHoogleDocs(packageId,moduleName,entity,name) {
+ const id = packageId + "/" + moduleName + "/" + entity + "/" + name;
+ const hoogleDoc = this.hoogleDocs[id];
+ if(hoogleDoc) {
+ return new RSVP.Promise((resolve)=>{resolve(hoogleDoc);});
+ } else {
+ const url = urls.hoogleDocsUrl(packageId,moduleName,entity,name);
+ return Ember.$.getJSON(url).then((hoogleDoc) => {
+ this.hoogleDocs[id] = hoogleDoc;
+ return hoogleDoc;
+ });
+ }
+ }
});
diff --git a/javascript/app/utils/api-urls.js b/javascript/app/utils/api-urls.js
index d90c68a..7dce1c3 100644
--- a/javascript/app/utils/api-urls.js
+++ b/javascript/app/utils/api-urls.js
@@ -46,5 +46,8 @@ export const urls = {
},
globalIdentifiersUrl : function (query) {
return config.APP.apiUrlPrefix + "/globalIdentifiers/"+fixDots(encodeURIComponent(query));
+ },
+ hoogleDocsUrl : function (packageId,moduleName,entity,name) {
+ return config.APP.apiUrlPrefix + "/hoogleDocs/"+packageId+"/"+encodeURIComponent(moduleName)+"/"+entity+"/"+fixDots(encodeURIComponent(name));
}
}