garrensmith commented on a change in pull request #962: add Mango index 
examples dropdown
URL: https://github.com/apache/couchdb-fauxton/pull/962#discussion_r134191786
 
 

 ##########
 File path: app/addons/documents/mango/mango.stores.js
 ##########
 @@ -118,22 +107,54 @@ Stores.MangoStore = FauxtonAPI.Store.extend({
   },
 
   getDefaultHistory: function () {
-    return [this.createHistoryEntry(defaultQueryFindCode)];
+    return [this.createSelectItem(defaultQueryFindCode)];
   },
 
   getHistory: function () {
     return app.utils.localStorageGet(this.getHistoryKey()) || 
this.getDefaultHistory();
   },
 
+  addQueryIndexTemplate: function (value, label) {
+    const templateItem = this.createSelectItem(value);
+    templateItem.label = label || templateItem.label;
+
+    var existing = this.queryIndexTemplates.find(i => i.value === 
templateItem.value);
+    if (!existing) {
+      this.queryIndexTemplates.push(templateItem);
+    }
+  },
+
+  getQueryIndexTemplates: function () {
+    if (!this.queryIndexTemplates.length) {
+      this.addQueryIndexTemplate({
+        "index": {
+          "fields": ["foo"]
 
 Review comment:
   Could you move these two static templates to a constants file. 
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to