Antonio-Maranhao commented on a change in pull request #1133: update cluster 
module to redux
URL: https://github.com/apache/couchdb-fauxton/pull/1133#discussion_r223773963
 
 

 ##########
 File path: app/addons/cluster/api.js
 ##########
 @@ -10,29 +10,20 @@
 // License for the specific language governing permissions and limitations 
under
 // the License.
 
-import FauxtonAPI from "../../core/api";
 import Helpers from "../../helpers";
-
-var Cluster = FauxtonAPI.addon();
-
-Cluster.ClusterNodes = Backbone.Model.extend({
-  url: function () {
-    return Helpers.getServerUrl('/_membership');
-  },
-
-  parse: function (res) {
-    var list;
-
-    list = res.all_nodes.reduce(function (acc, node) {
-      var isInCluster = res.cluster_nodes.indexOf(node) !== -1;
-
-      acc.push({node: node, isInCluster: isInCluster});
-      return acc;
-    }, []);
-
-    res.nodes_mapped = list;
-    return res;
-  }
-});
-
-export default Cluster;
+import {get} from '../../core/ajax';
+
+export default () => {
+  return get(Helpers.getServerUrl('/_membership'))
+    .then(res => {
+      const list = res.all_nodes.reduce(function (acc, node) {
 
 Review comment:
   Can you please add some error handling here:
   ```
         if (!res.all_nodes) {
           const details = res.reason ? res.reason : '';
           throw new Error('Failed to load list of nodes.' + details);
         }
   ```

----------------------------------------------------------------
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