You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by nadeeshaan <gi...@git.apache.org> on 2015/05/08 18:23:45 UTC

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

GitHub user nadeeshaan opened a pull request:

    https://github.com/apache/couchdb-fauxton/pull/401

    Gsoc2015 moving to sub

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/nadeeshaan/couchdb-fauxton GSoC2015_Moving_to_sub

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/couchdb-fauxton/pull/401.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #401
    
----
commit d86c7ac9e7cec335698f9cfae722f623f2c86fbf
Author: Nadeeshaan <na...@gmail.com>
Date:   2015-05-04T14:04:05Z

    Moved to a new folder

commit 6d8ccdaf9f7392da2c80b9ddaf0ef54a1af9ceda
Author: Nadeeshaan <na...@gmail.com>
Date:   2015-05-04T14:14:27Z

    Added the style reference

commit 865d00e40df3b6278bc74c42c09a0e3d111de3c1
Author: Nadeeshaan <na...@gmail.com>
Date:   2015-05-07T16:20:39Z

    remove backbone view usage

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r29987270
  
    --- Diff: app/addons/documents/assets/less/documents.less ---
    @@ -18,6 +18,7 @@
     @import "changes.less";
     @import "sidenav.less";
     @import "index-results.less";
    +@import "revisionTree.less";
    --- End diff --
    
    Use hyphens instead of camelcase for LESS filenames; the queryOptions.less file in that folder is incorrect. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by nadeeshaan <gi...@git.apache.org>.
Github user nadeeshaan commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30625636
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,332 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +],
    +
    +function (app, FauxtonAPI, React, Stores) {
    +
    +  var store = Stores.revTreeStore;
    +  var lineObjs = [];
    +  var nodeObjs = [];
    +  var textObjs = [];
    +  var grid = 100;
    +  var scale = 7;
    +  var r = 15;
    +
    +  var LinesBox = React.createClass({
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map(function (element, i) {
    +              return <Line key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var CirclesBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map (function (element, i) {
    +              return <Circle key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var Circle = React.createClass({
    +
    +    render: function () {
    +      var cx = this.props.data.x;
    +      var cy = this.props.data.y;
    +      var radius = r;
    +      var classVal = this.props.data.class;
    +
    +      return (
    +        <circle cx={cx} cy={cy} r={radius} className={classVal}>{this.props.children}</circle>
    +      );
    +    }
    +  });
    +
    +  var Line = React.createClass({
    +
    +    render: function () {
    +      var x1 = this.props.data.x;
    +      var y1 = this.props.data.y;
    +      var x2 = this.props.data.nextX;
    +      var y2 = this.props.data.nextY;
    +
    +      return (
    +        <line x1={x1} y1={y1} x2={x2} y2={y2}>{this.props.children}</line>
    +      );
    +    }
    +  });
    +
    +  var TextsBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>{this.props.children}</g>
    +      );
    +    }
    +  });
    +
    +  var SVGComponent = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <svg height="500" width="500">{this.props.children}
    +        </svg>
    +      );
    +    }
    +  });
    +
    +  var Box = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <div className = "visualizeRevTree">
    +          {this.props.children}
    +        </div>
    +      );
    +    }
    +  });
    +
    +  var Text = React.createClass({
    +
    +    render: function () {
    +      var styleVals = {
    +        left: this.props.data.stLeft,
    +        top: this.props.data.stTop
    +      };
    +
    +      return (
    +          <div className = "box" style={styleVals} short={this.props.data.short} long={this.props.data.long}>
    +            <p>{this.props.data.short}</p>
    +            {this.props.children}
    +          </div>
    +      );
    +    }
    +  });
    +
    +  var draw = function (paths, deleted, winner, minUniq) {
    +    var maxX = grid;
    +    var maxY = grid;
    +    var levelCount = []; // numer of nodes on some level (pos)
    +    lineObjs.length = 0;
    +    nodeObjs.length = 0;
    +    textObjs.length = 0;
    +
    +    var map = {}; // map from rev to position
    +
    +    function drawPath(path) {
    +      for (var i = 0; i < path.length; i++) {
    +        var rev = path[i];
    +        var isLeaf = i === 0;
    +        var pos = +rev.split('-')[0];
    +
    +        if (!levelCount[pos]) {
    +          levelCount[pos] = 1;
    +        }
    +
    +        var x = levelCount[pos] * grid;
    +        var y = pos * grid;
    +
    +        if (!isLeaf) {
    +          var nextRev = path[i - 1];
    +          var nextX = map[nextRev][0];
    +          var nextY = map[nextRev][1];
    +
    +          if (map[rev]) {
    +            x = map[rev][0];
    +            y = map[rev][1];
    +          }
    +
    +          var lineObj = {
    +            "x" : x,
    +            "y" : y,
    +            "nextX" : nextX,
    +            "nextY" : nextY
    +          };
    +
    +          lineObjs.push(lineObj);
    +        }
    +
    +        if (map[rev]) {
    +          break;
    +        }
    +
    +        maxX = Math.max(x, maxX);
    +        maxY = Math.max(y, maxY);
    +        levelCount[pos]++;
    +
    +        node(x, y, rev, isLeaf, rev in deleted, rev === winner, minUniq);
    +        map[rev] = [x, y];
    +      }
    +    }
    +
    +    paths.forEach(drawPath);
    +  };
    +
    +  var minUniqueLength = function (arr) {
    +    function strCommon(a, b) {
    +
    +      if (a === b) {
    +        return a.length;
    +      }
    +
    +      var i = 0;
    +
    +      while (++i) {
    +        if (a[i - 1] !== b[i - 1]) return i;
    +      }
    +    }
    +
    +    var array = arr.slice(0);
    +    var com = 1;
    +    array.sort();
    +
    +    for (var i = 1; i < array.length; i++) {
    +      com = Math.max(com, strCommon(array[i], array[i - 1]));
    +    }
    +
    +    return com;
    +  };
    +
    +  function node(x, y, rev, isLeaf, isDeleted, isWinner, shortDescLen) {
    --- End diff --
    
    fixed


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r29987291
  
    --- Diff: app/addons/documents/assets/less/revisionTree.less ---
    @@ -0,0 +1,15 @@
    +.visualizeRevTree {position: relative}
    +.visualizeRevTree * {margin: 0; padding: 0; font-size: 10px}
    +.visualizeRevTree line{stroke: #000; stroke-width: .50}
    +.visualizeRevTree div{position: relative; }
    +.visualizeRevTree circle{stroke: #000; stroke-width: .10}
    +.visualizeRevTree circle.leaf{fill: #008000;}
    +.visualizeRevTree circle.winner{fill: #FF0000}
    +.visualizeRevTree circle.deleted{fill: #808080}
    +.visualizeRevTree circle{transition: .3s}
    +.visualizeRevTree circle.selected{stroke-width: .3}
    +.visualizeRevTree div.box{background: #ddd; border: 1px solid #bbb; border-radius: 7px; padding: 7px; position: absolute;}
    +.visualizeRevTree .editor {width: 220px}
    +.visualizeRevTree .editor dt{width: 100px; height: 15px; float: left;}
    +.visualizeRevTree .editor dd{width: 100px; height: 15px; float: left;}
    +.visualizeRevTree .editor input{width: 100%; height: 100%}
    --- End diff --
    
    Has the CSS been modified at all, or is it all from that external lib? Put any external libs into a `/external` subfolder of assets so it's clear what's ours and what's external.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30518078
  
    --- Diff: app/addons/documents/routes-rev-tree.js ---
    @@ -0,0 +1,48 @@
    +define([
    +  "app",
    +  "api",
    +  "addons/documents/resources",
    +  "addons/documents/views-rev-tree",
    +  "addons/documents/revisionTree/actions",
    +  "addons/documents/revisionTree/component.react"
    +
    +],
    +
    +function (app, FauxtonAPI, Resources, Views, RevisionTreeActions, AppComponent) {
    +  var  RevTreeRouteObject = FauxtonAPI.RouteObject.extend({
    +    layout: "one_pane",
    +
    +    crumbs: [
    +      {"name": "Revision Tree" , "link": "_revtree"}
    +    ],
    +
    +    routes: {
    +       "_revtree/:database/:doc/:winner": "revtreeRoute"
    --- End diff --
    
    `:database/:doc/_revtree/:winner` is probably better, because the revtree is a part of the doc which is part of the db


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30515864
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,332 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +],
    +
    +function (app, FauxtonAPI, React, Stores) {
    +
    +  var store = Stores.revTreeStore;
    +  var lineObjs = [];
    +  var nodeObjs = [];
    +  var textObjs = [];
    +  var grid = 100;
    +  var scale = 7;
    +  var r = 15;
    +
    +  var LinesBox = React.createClass({
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map(function (element, i) {
    +              return <Line key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var CirclesBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map (function (element, i) {
    --- End diff --
    
    `this.props.data.map(` (without the space for calling functions)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r29987436
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,330 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +  ], function(app,FauxtonAPI, React,Stores){
    +
    +    var store = Stores.revTreeStore;
    +
    +    var lineObjs = [];
    +    var nodeObjs = [];
    +    var textObjs = [];
    +
    +    var grid = 100;
    +    var scale = 7;
    +    var r = 15;
    +
    +    var LinesBox = React.createClass({
    +      render: function(){
    +        return (
    +          <g>
    +            {
    +              this.props.data.map(function (element, i) {
    +                return <Line key={i} data={element}/>;
    +              })
    +            }
    +          </g>
    +          );
    +      }
    +    });
    +
    +    var CirclesBox = React.createClass({
    +
    +      render: function(){
    +        return (
    +          <g>
    +            {
    +              this.props.data.map(function (element, i){
    +                return <Circle key={i} data={element}/>;
    +              })
    +            }
    +          </g>
    +          );
    +      }
    +    });
    +
    +    var Circle = React.createClass({
    +      render: function(){
    +        var cx = this.props.data.x;
    +        var cy = this.props.data.y;
    +        var radius = r;
    +        var classVal = this.props.data.class;
    +
    +        return (
    +          <circle cx={cx} cy={cy} r={radius} className={classVal}>{this.props.children}</circle>
    +          );
    +      }
    +    });
    +
    +    var Line = React.createClass({
    +      render: function(){
    +        var x1 = this.props.data.x;
    +        var y1 = this.props.data.y;
    +        var x2 = this.props.data.nextX;
    +        var y2 = this.props.data.nextY;
    +
    +        return (
    +          <line x1={x1} y1={y1} x2={x2} y2={y2}>{this.props.children}</line>
    +          );
    +      }
    +    });
    +
    +    var TextsBox = React.createClass({
    +      render: function(){
    +        return (
    +          <g>{this.props.children}</g>
    +          );
    +      }
    +    });
    +
    +    var SVGComponent = React.createClass({
    +      render: function() {
    +        return (
    +         <svg height="500" width="500">{this.props.children}
    +         </svg>
    +         );
    +      }
    +    });
    +
    +    var Box = React.createClass({
    +      render: function(){
    +        return (
    +          <div className = "visualizeRevTree">
    +            {this.props.children}
    +          </div>
    +          );
    +      }
    +    });
    +
    +    var Text = React.createClass({
    +      render: function(){
    +
    +        var styleVals = {
    +          left: this.props.data.stLeft,
    +          top: this.props.data.stTop
    +        };
    +
    +        return (
    +            <div className = "box" style={styleVals} short={this.props.data.short} long={this.props.data.long}>
    +              <p>{this.props.data.short}</p>
    +              {this.props.children}
    +            </div>
    +          );
    +      }
    +    });
    +
    +
    +    var draw = function(paths, deleted, winner, minUniq){
    +      var maxX = grid;
    +      var maxY = grid;
    +        var levelCount = []; // numer of nodes on some level (pos)
    +
    +        var map = {}; // map from rev to position
    +
    +        function drawPath(path) {
    +          for (var i = 0; i < path.length; i++) {
    +            var rev = path[i];
    +            var isLeaf = i === 0;
    +            var pos = +rev.split('-')[0];
    +
    +            if (!levelCount[pos]) {
    +              levelCount[pos] = 1;
    +            }
    +            var x = levelCount[pos] * grid;
    +            var y = pos * grid;
    +
    +            if (!isLeaf) {
    +              var nextRev = path[i-1];
    +              var nextX = map[nextRev][0];
    +              var nextY = map[nextRev][1];
    +
    +              if (map[rev]) {
    +                x = map[rev][0];
    +                y = map[rev][1];
    +              }
    +
    +              var lineObj = {
    +                "x" : x,
    +                "y" : y,
    +                "nextX" : nextX,
    +                "nextY" : nextY
    +              };
    +
    +              lineObjs.push(lineObj);
    +            }
    +            if (map[rev]) {
    +              break;
    +            }
    +            maxX = Math.max(x, maxX);
    +            maxY = Math.max(y, maxY);
    +            levelCount[pos]++;
    +
    +            node(x, y, rev, isLeaf, rev in deleted, rev === winner, minUniq);
    +            map[rev] = [x, y];
    +          }
    +        }
    +        paths.forEach(drawPath);
    +      };
    +
    +      var minUniqueLength = function(arr){
    +       function strCommon(a, b){
    +        if (a === b) return a.length;
    +        var i = 0;
    +        while(++i){
    +          if(a[i - 1] !== b[i - 1]) return i;
    +        }
    +      }
    +
    +      var array = arr.slice(0);
    +      var com = 1;
    +      array.sort();
    +      for (var i = 1; i < array.length; i++){
    +        com = Math.max(com, strCommon(array[i], array[i - 1]));
    +      }
    +      return com;
    +    };
    +
    +    function node(x, y, rev, isLeaf, isDeleted, isWinner, shortDescLen){
    +      circ(x, y, r, isLeaf, isDeleted, isWinner);
    +      var pos = rev.split('-')[0];
    +      var id = rev.split('-')[1];
    +      var opened = false;
    +
    +      var textObj = {
    +        "stLeft": (x-40) + "px",
    +        "stTop": (y-30) + "px",
    +        "short": pos + '-' + id.substr(0, shortDescLen),
    +        "long": pos + '-' + id
    +      };
    +
    +      textObjs.push(textObj);
    +    }
    +
    +    var circ = function(x, y, r, isLeaf, isDeleted, isWinner) {
    +
    +      var leafStat = "";
    +
    +      if (isLeaf) {
    +        leafStat = "leaf";
    +      }
    +      if (isWinner) {
    +        leafStat = "winner";
    +      }
    +      if (isDeleted) {
    +        leafStat = "deleted";
    +      }      
    --- End diff --
    
    Be nice to tidy this up a bit... but for now at least use `else if`'s


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by nadeeshaan <gi...@git.apache.org>.
Github user nadeeshaan commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30625714
  
    --- Diff: app/addons/documents/views-rev-tree.js ---
    @@ -0,0 +1,23 @@
    +define([
    +  "app",
    +  "api",
    +  "addons/documents/resources",
    +  "addons/documents/revisionTree/component.react"
    +],
    --- End diff --
    
    fixed


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by nadeeshaan <gi...@git.apache.org>.
Github user nadeeshaan commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30625678
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,332 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +],
    +
    +function (app, FauxtonAPI, React, Stores) {
    +
    +  var store = Stores.revTreeStore;
    +  var lineObjs = [];
    +  var nodeObjs = [];
    +  var textObjs = [];
    +  var grid = 100;
    +  var scale = 7;
    +  var r = 15;
    +
    +  var LinesBox = React.createClass({
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map(function (element, i) {
    +              return <Line key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var CirclesBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map (function (element, i) {
    +              return <Circle key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var Circle = React.createClass({
    +
    +    render: function () {
    +      var cx = this.props.data.x;
    +      var cy = this.props.data.y;
    +      var radius = r;
    +      var classVal = this.props.data.class;
    +
    +      return (
    +        <circle cx={cx} cy={cy} r={radius} className={classVal}>{this.props.children}</circle>
    +      );
    +    }
    +  });
    +
    +  var Line = React.createClass({
    +
    +    render: function () {
    +      var x1 = this.props.data.x;
    +      var y1 = this.props.data.y;
    +      var x2 = this.props.data.nextX;
    +      var y2 = this.props.data.nextY;
    +
    +      return (
    +        <line x1={x1} y1={y1} x2={x2} y2={y2}>{this.props.children}</line>
    +      );
    +    }
    +  });
    +
    +  var TextsBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>{this.props.children}</g>
    +      );
    +    }
    +  });
    +
    +  var SVGComponent = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <svg height="500" width="500">{this.props.children}
    +        </svg>
    +      );
    +    }
    +  });
    +
    +  var Box = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <div className = "visualizeRevTree">
    +          {this.props.children}
    +        </div>
    +      );
    +    }
    +  });
    +
    +  var Text = React.createClass({
    +
    +    render: function () {
    +      var styleVals = {
    +        left: this.props.data.stLeft,
    +        top: this.props.data.stTop
    +      };
    +
    +      return (
    +          <div className = "box" style={styleVals} short={this.props.data.short} long={this.props.data.long}>
    +            <p>{this.props.data.short}</p>
    +            {this.props.children}
    +          </div>
    +      );
    +    }
    +  });
    +
    +  var draw = function (paths, deleted, winner, minUniq) {
    +    var maxX = grid;
    +    var maxY = grid;
    +    var levelCount = []; // numer of nodes on some level (pos)
    +    lineObjs.length = 0;
    +    nodeObjs.length = 0;
    +    textObjs.length = 0;
    +
    +    var map = {}; // map from rev to position
    +
    +    function drawPath(path) {
    +      for (var i = 0; i < path.length; i++) {
    +        var rev = path[i];
    +        var isLeaf = i === 0;
    +        var pos = +rev.split('-')[0];
    +
    +        if (!levelCount[pos]) {
    +          levelCount[pos] = 1;
    +        }
    +
    +        var x = levelCount[pos] * grid;
    +        var y = pos * grid;
    +
    +        if (!isLeaf) {
    +          var nextRev = path[i - 1];
    +          var nextX = map[nextRev][0];
    +          var nextY = map[nextRev][1];
    +
    +          if (map[rev]) {
    +            x = map[rev][0];
    +            y = map[rev][1];
    +          }
    +
    +          var lineObj = {
    +            "x" : x,
    +            "y" : y,
    +            "nextX" : nextX,
    +            "nextY" : nextY
    +          };
    +
    +          lineObjs.push(lineObj);
    +        }
    +
    +        if (map[rev]) {
    +          break;
    +        }
    +
    +        maxX = Math.max(x, maxX);
    +        maxY = Math.max(y, maxY);
    +        levelCount[pos]++;
    +
    +        node(x, y, rev, isLeaf, rev in deleted, rev === winner, minUniq);
    +        map[rev] = [x, y];
    +      }
    +    }
    +
    +    paths.forEach(drawPath);
    +  };
    +
    +  var minUniqueLength = function (arr) {
    +    function strCommon(a, b) {
    +
    +      if (a === b) {
    +        return a.length;
    +      }
    +
    +      var i = 0;
    +
    +      while (++i) {
    +        if (a[i - 1] !== b[i - 1]) return i;
    +      }
    +    }
    +
    +    var array = arr.slice(0);
    +    var com = 1;
    +    array.sort();
    +
    +    for (var i = 1; i < array.length; i++) {
    +      com = Math.max(com, strCommon(array[i], array[i - 1]));
    +    }
    +
    +    return com;
    +  };
    +
    +  function node(x, y, rev, isLeaf, isDeleted, isWinner, shortDescLen) {
    +    circ(x, y, r, isLeaf, isDeleted, isWinner);
    +    var pos = rev.split('-')[0];
    +    var id = rev.split('-')[1];
    +    var opened = false;
    +
    +    var textObj = {
    +      "stLeft": (x - 40) + "px",
    +      "stTop": (y - 30) + "px",
    +      "short": pos + '-' + id.substr(0, shortDescLen),
    +      "long": pos + '-' + id
    +    };
    +
    +    textObjs.push(textObj);
    +  }
    +
    +  var circ = function (x, y, r, isLeaf, isDeleted, isWinner) {
    +
    +    var leafStat = "";
    +
    +    if (isLeaf) {
    +      leafStat = "leaf";
    +    }
    +    if (isWinner) {
    +      leafStat = "winner";
    +    }
    +    if (isDeleted) {
    +      leafStat = "deleted";
    +    }
    +
    +    var nodeObj = {
    +      "x" : x,
    +      "y" : y,
    +      "class" : leafStat
    +    };
    +
    +    nodeObjs.push(nodeObj);
    +  };
    +
    +  var App = React.createClass({
    +
    +    getInitialState: function () {
    +      return {
    +        lines: [],
    +        treeNodes: [],
    +        nodeTextObjs: []
    +      };
    +    },
    +
    +    componentDidMount: function () {
    +      var paths = [];
    +      var deleted = {};
    +      var treeDataOptions = store.getTreeOptions();
    --- End diff --
    
    Fixed the flux related Issue


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by nadeeshaan <gi...@git.apache.org>.
Github user nadeeshaan commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30625807
  
    --- Diff: app/addons/documents/routes-rev-tree.js ---
    @@ -0,0 +1,48 @@
    +define([
    +  "app",
    +  "api",
    +  "addons/documents/resources",
    +  "addons/documents/views-rev-tree",
    +  "addons/documents/revisionTree/actions",
    +  "addons/documents/revisionTree/component.react"
    +
    +],
    +
    +function (app, FauxtonAPI, Resources, Views, RevisionTreeActions, AppComponent) {
    +  var  RevTreeRouteObject = FauxtonAPI.RouteObject.extend({
    +    layout: "one_pane",
    +
    +    crumbs: [
    +      {"name": "Revision Tree" , "link": "_revtree"}
    +    ],
    +
    +    routes: {
    +       "_revtree/:database/:doc/:winner": "revtreeRoute"
    --- End diff --
    
    fixed


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by nadeeshaan <gi...@git.apache.org>.
Github user nadeeshaan commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30625559
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,332 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +],
    +
    +function (app, FauxtonAPI, React, Stores) {
    +
    +  var store = Stores.revTreeStore;
    +  var lineObjs = [];
    +  var nodeObjs = [];
    +  var textObjs = [];
    +  var grid = 100;
    +  var scale = 7;
    +  var r = 15;
    +
    +  var LinesBox = React.createClass({
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map(function (element, i) {
    +              return <Line key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var CirclesBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map (function (element, i) {
    --- End diff --
    
    fixed


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r29987515
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,330 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +  ], function(app,FauxtonAPI, React,Stores){
    +
    +    var store = Stores.revTreeStore;
    +
    +    var lineObjs = [];
    +    var nodeObjs = [];
    +    var textObjs = [];
    +
    +    var grid = 100;
    +    var scale = 7;
    +    var r = 15;
    +
    +    var LinesBox = React.createClass({
    +      render: function(){
    +        return (
    +          <g>
    +            {
    +              this.props.data.map(function (element, i) {
    +                return <Line key={i} data={element}/>;
    +              })
    +            }
    +          </g>
    +          );
    +      }
    +    });
    +
    +    var CirclesBox = React.createClass({
    +
    +      render: function(){
    +        return (
    +          <g>
    +            {
    +              this.props.data.map(function (element, i){
    +                return <Circle key={i} data={element}/>;
    +              })
    +            }
    +          </g>
    +          );
    +      }
    +    });
    +
    +    var Circle = React.createClass({
    +      render: function(){
    +        var cx = this.props.data.x;
    +        var cy = this.props.data.y;
    +        var radius = r;
    +        var classVal = this.props.data.class;
    +
    +        return (
    +          <circle cx={cx} cy={cy} r={radius} className={classVal}>{this.props.children}</circle>
    +          );
    +      }
    +    });
    +
    +    var Line = React.createClass({
    +      render: function(){
    +        var x1 = this.props.data.x;
    +        var y1 = this.props.data.y;
    +        var x2 = this.props.data.nextX;
    +        var y2 = this.props.data.nextY;
    +
    +        return (
    +          <line x1={x1} y1={y1} x2={x2} y2={y2}>{this.props.children}</line>
    +          );
    +      }
    +    });
    +
    +    var TextsBox = React.createClass({
    +      render: function(){
    +        return (
    +          <g>{this.props.children}</g>
    +          );
    +      }
    +    });
    +
    +    var SVGComponent = React.createClass({
    +      render: function() {
    +        return (
    +         <svg height="500" width="500">{this.props.children}
    +         </svg>
    +         );
    +      }
    +    });
    +
    +    var Box = React.createClass({
    +      render: function(){
    +        return (
    +          <div className = "visualizeRevTree">
    +            {this.props.children}
    +          </div>
    +          );
    +      }
    +    });
    +
    +    var Text = React.createClass({
    +      render: function(){
    +
    +        var styleVals = {
    +          left: this.props.data.stLeft,
    +          top: this.props.data.stTop
    +        };
    +
    +        return (
    +            <div className = "box" style={styleVals} short={this.props.data.short} long={this.props.data.long}>
    +              <p>{this.props.data.short}</p>
    +              {this.props.children}
    +            </div>
    +          );
    +      }
    +    });
    +
    +
    +    var draw = function(paths, deleted, winner, minUniq){
    +      var maxX = grid;
    +      var maxY = grid;
    +        var levelCount = []; // numer of nodes on some level (pos)
    +
    +        var map = {}; // map from rev to position
    +
    +        function drawPath(path) {
    +          for (var i = 0; i < path.length; i++) {
    +            var rev = path[i];
    +            var isLeaf = i === 0;
    +            var pos = +rev.split('-')[0];
    +
    +            if (!levelCount[pos]) {
    +              levelCount[pos] = 1;
    +            }
    +            var x = levelCount[pos] * grid;
    +            var y = pos * grid;
    +
    +            if (!isLeaf) {
    +              var nextRev = path[i-1];
    +              var nextX = map[nextRev][0];
    +              var nextY = map[nextRev][1];
    +
    +              if (map[rev]) {
    +                x = map[rev][0];
    +                y = map[rev][1];
    +              }
    +
    +              var lineObj = {
    +                "x" : x,
    +                "y" : y,
    +                "nextX" : nextX,
    +                "nextY" : nextY
    +              };
    +
    +              lineObjs.push(lineObj);
    +            }
    +            if (map[rev]) {
    +              break;
    +            }
    +            maxX = Math.max(x, maxX);
    +            maxY = Math.max(y, maxY);
    +            levelCount[pos]++;
    +
    +            node(x, y, rev, isLeaf, rev in deleted, rev === winner, minUniq);
    +            map[rev] = [x, y];
    +          }
    +        }
    +        paths.forEach(drawPath);
    +      };
    +
    +      var minUniqueLength = function(arr){
    +       function strCommon(a, b){
    +        if (a === b) return a.length;
    +        var i = 0;
    +        while(++i){
    +          if(a[i - 1] !== b[i - 1]) return i;
    +        }
    +      }
    +
    +      var array = arr.slice(0);
    +      var com = 1;
    +      array.sort();
    +      for (var i = 1; i < array.length; i++){
    +        com = Math.max(com, strCommon(array[i], array[i - 1]));
    +      }
    +      return com;
    +    };
    +
    +    function node(x, y, rev, isLeaf, isDeleted, isWinner, shortDescLen){
    +      circ(x, y, r, isLeaf, isDeleted, isWinner);
    +      var pos = rev.split('-')[0];
    +      var id = rev.split('-')[1];
    +      var opened = false;
    +
    +      var textObj = {
    +        "stLeft": (x-40) + "px",
    +        "stTop": (y-30) + "px",
    +        "short": pos + '-' + id.substr(0, shortDescLen),
    +        "long": pos + '-' + id
    +      };
    +
    +      textObjs.push(textObj);
    +    }
    +
    +    var circ = function(x, y, r, isLeaf, isDeleted, isWinner) {
    +
    +      var leafStat = "";
    +
    +      if (isLeaf) {
    +        leafStat = "leaf";
    +      }
    +      if (isWinner) {
    +        leafStat = "winner";
    +      }
    +      if (isDeleted) {
    +        leafStat = "deleted";
    +      }      
    +
    +      var nodeObj = {
    +        "x" : x,
    +        "y" : y,
    +        "class" : leafStat
    +      };
    +
    +      nodeObjs.push(nodeObj);
    +    };
    +
    +    var App = React.createClass({
    +      getInitialState: function() {
    +        return {
    +          lines: [],
    +          treeNodes: [],
    +          nodeTextObjs: []
    +        };
    +      },
    +
    +      componentDidMount: function() {
    +        var result = [];
    +        var paths = [];
    +        var deleted = {};
    +        var optionsVal = store.getTreeOptions();
    +        // var winner = this.props.data.winnerRev;
    +        var winner = optionsVal.winnerRev;
    +        // var url = '/'+this.props.data.db+'/'+this.props.data.docID;
    +        var url = '/'+optionsVal.db+'/'+optionsVal.docID;
    +        // var winner = this.props.data.;
    +        var minUniq = 0;
    +        $.get(app.host+url+'?open_revs=all&revs=true', function(rslt) {
    +          var data = rslt;
    +          if (this.isMounted()) {
    +            var x = data.split(/(\n|\r\n|\r)/);
    +
    +            for (var i = 0; i <x.length; i++) {
    +              if(String(x[i]).charAt(0) == "{"){
    +                  // console.log((JSON.parse(x[i])));
    +                  result.push(JSON.parse(x[i]));
    +                }
    +              }
    +
    +              // alert(result);
    +              var allRevs = [];
    +              paths = result.map(function(res) {
    +                // res = res.ok; // TODO: what about missing
    +                if (res._deleted) {
    +                  deleted[res._rev] = true;
    +                }
    +                var revs = res._revisions;
    +                revs.ids.forEach(function(id, i) {
    +                  var rev = (revs.start-i) + '-' + id;
    +                  if (allRevs.indexOf(rev) === -1) {
    +                    allRevs.push(rev);
    +                  }
    +                  i--;
    +                });
    +                return revs.ids.map(function(id, i) {
    +                  return (revs.start-i) + '-' + id;
    +                });
    +              });
    +
    +              minUniq = minUniqueLength(allRevs.map(function(rev) {
    +                return rev.split('-')[1];
    +              }));
    +
    +              // console.log(minUniq);
    +              draw(paths, deleted, winner, minUniq);     
    +              // alert(nodeObjs);
    +
    +
    +              this.setState({
    +                lines: lineObjs,
    +                treeNodes: nodeObjs,
    +                nodeTextObjs: textObjs
    +              });
    +            }
    +          }.bind(this));
    +      },
    +
    +      render: function(){
    +          return (
    +            <div>
    +            <Box>
    --- End diff --
    
    Check indentation again.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by nadeeshaan <gi...@git.apache.org>.
Github user nadeeshaan commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30625594
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,332 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +],
    +
    +function (app, FauxtonAPI, React, Stores) {
    +
    +  var store = Stores.revTreeStore;
    +  var lineObjs = [];
    +  var nodeObjs = [];
    +  var textObjs = [];
    +  var grid = 100;
    +  var scale = 7;
    +  var r = 15;
    +
    +  var LinesBox = React.createClass({
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map(function (element, i) {
    +              return <Line key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var CirclesBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map (function (element, i) {
    +              return <Circle key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var Circle = React.createClass({
    +
    +    render: function () {
    +      var cx = this.props.data.x;
    +      var cy = this.props.data.y;
    +      var radius = r;
    +      var classVal = this.props.data.class;
    +
    +      return (
    +        <circle cx={cx} cy={cy} r={radius} className={classVal}>{this.props.children}</circle>
    +      );
    +    }
    +  });
    +
    +  var Line = React.createClass({
    +
    +    render: function () {
    +      var x1 = this.props.data.x;
    +      var y1 = this.props.data.y;
    +      var x2 = this.props.data.nextX;
    +      var y2 = this.props.data.nextY;
    +
    +      return (
    +        <line x1={x1} y1={y1} x2={x2} y2={y2}>{this.props.children}</line>
    +      );
    +    }
    +  });
    +
    +  var TextsBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>{this.props.children}</g>
    +      );
    +    }
    +  });
    +
    +  var SVGComponent = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <svg height="500" width="500">{this.props.children}
    +        </svg>
    +      );
    +    }
    +  });
    +
    +  var Box = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <div className = "visualizeRevTree">
    +          {this.props.children}
    +        </div>
    +      );
    +    }
    +  });
    +
    +  var Text = React.createClass({
    +
    +    render: function () {
    +      var styleVals = {
    +        left: this.props.data.stLeft,
    +        top: this.props.data.stTop
    +      };
    +
    +      return (
    +          <div className = "box" style={styleVals} short={this.props.data.short} long={this.props.data.long}>
    --- End diff --
    
    fixed


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by nadeeshaan <gi...@git.apache.org>.
Github user nadeeshaan commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30625584
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,332 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +],
    +
    +function (app, FauxtonAPI, React, Stores) {
    +
    +  var store = Stores.revTreeStore;
    +  var lineObjs = [];
    +  var nodeObjs = [];
    +  var textObjs = [];
    +  var grid = 100;
    +  var scale = 7;
    +  var r = 15;
    +
    +  var LinesBox = React.createClass({
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map(function (element, i) {
    +              return <Line key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var CirclesBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map (function (element, i) {
    +              return <Circle key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var Circle = React.createClass({
    +
    +    render: function () {
    +      var cx = this.props.data.x;
    +      var cy = this.props.data.y;
    +      var radius = r;
    +      var classVal = this.props.data.class;
    +
    +      return (
    +        <circle cx={cx} cy={cy} r={radius} className={classVal}>{this.props.children}</circle>
    +      );
    +    }
    +  });
    +
    +  var Line = React.createClass({
    +
    +    render: function () {
    +      var x1 = this.props.data.x;
    +      var y1 = this.props.data.y;
    +      var x2 = this.props.data.nextX;
    +      var y2 = this.props.data.nextY;
    +
    +      return (
    +        <line x1={x1} y1={y1} x2={x2} y2={y2}>{this.props.children}</line>
    +      );
    +    }
    +  });
    +
    +  var TextsBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>{this.props.children}</g>
    +      );
    +    }
    +  });
    +
    +  var SVGComponent = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <svg height="500" width="500">{this.props.children}
    +        </svg>
    +      );
    +    }
    +  });
    +
    +  var Box = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <div className = "visualizeRevTree">
    --- End diff --
    
    fixed


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#issuecomment-100286573
  
    Wonderful, thanks @nadeeshaan! We'll look at this soon :D


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30516639
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,332 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +],
    +
    +function (app, FauxtonAPI, React, Stores) {
    +
    +  var store = Stores.revTreeStore;
    +  var lineObjs = [];
    +  var nodeObjs = [];
    +  var textObjs = [];
    +  var grid = 100;
    +  var scale = 7;
    +  var r = 15;
    +
    +  var LinesBox = React.createClass({
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map(function (element, i) {
    +              return <Line key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var CirclesBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map (function (element, i) {
    +              return <Circle key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var Circle = React.createClass({
    +
    +    render: function () {
    +      var cx = this.props.data.x;
    +      var cy = this.props.data.y;
    +      var radius = r;
    +      var classVal = this.props.data.class;
    +
    +      return (
    +        <circle cx={cx} cy={cy} r={radius} className={classVal}>{this.props.children}</circle>
    +      );
    +    }
    +  });
    +
    +  var Line = React.createClass({
    +
    +    render: function () {
    +      var x1 = this.props.data.x;
    +      var y1 = this.props.data.y;
    +      var x2 = this.props.data.nextX;
    +      var y2 = this.props.data.nextY;
    +
    +      return (
    +        <line x1={x1} y1={y1} x2={x2} y2={y2}>{this.props.children}</line>
    +      );
    +    }
    +  });
    +
    +  var TextsBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>{this.props.children}</g>
    +      );
    +    }
    +  });
    +
    +  var SVGComponent = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <svg height="500" width="500">{this.props.children}
    +        </svg>
    +      );
    +    }
    +  });
    +
    +  var Box = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <div className = "visualizeRevTree">
    +          {this.props.children}
    +        </div>
    +      );
    +    }
    +  });
    +
    +  var Text = React.createClass({
    +
    +    render: function () {
    +      var styleVals = {
    +        left: this.props.data.stLeft,
    +        top: this.props.data.stTop
    +      };
    +
    +      return (
    +          <div className = "box" style={styleVals} short={this.props.data.short} long={this.props.data.long}>
    +            <p>{this.props.data.short}</p>
    +            {this.props.children}
    +          </div>
    +      );
    +    }
    +  });
    +
    +  var draw = function (paths, deleted, winner, minUniq) {
    +    var maxX = grid;
    +    var maxY = grid;
    +    var levelCount = []; // numer of nodes on some level (pos)
    +    lineObjs.length = 0;
    +    nodeObjs.length = 0;
    +    textObjs.length = 0;
    --- End diff --
    
    for what is this used for?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30515793
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,332 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +],
    +
    +function (app, FauxtonAPI, React, Stores) {
    +
    +  var store = Stores.revTreeStore;
    +  var lineObjs = [];
    +  var nodeObjs = [];
    +  var textObjs = [];
    +  var grid = 100;
    +  var scale = 7;
    +  var r = 15;
    +
    +  var LinesBox = React.createClass({
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map(function (element, i) {
    +              return <Line key={i} data={element}/>;
    +            })
    --- End diff --
    
    missing semicolon


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by nadeeshaan <gi...@git.apache.org>.
Github user nadeeshaan commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30625794
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,332 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +],
    +
    +function (app, FauxtonAPI, React, Stores) {
    +
    +  var store = Stores.revTreeStore;
    +  var lineObjs = [];
    +  var nodeObjs = [];
    +  var textObjs = [];
    +  var grid = 100;
    +  var scale = 7;
    +  var r = 15;
    +
    +  var LinesBox = React.createClass({
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map(function (element, i) {
    +              return <Line key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var CirclesBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map (function (element, i) {
    +              return <Circle key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var Circle = React.createClass({
    +
    +    render: function () {
    +      var cx = this.props.data.x;
    +      var cy = this.props.data.y;
    +      var radius = r;
    +      var classVal = this.props.data.class;
    +
    +      return (
    +        <circle cx={cx} cy={cy} r={radius} className={classVal}>{this.props.children}</circle>
    +      );
    +    }
    +  });
    +
    +  var Line = React.createClass({
    +
    +    render: function () {
    +      var x1 = this.props.data.x;
    +      var y1 = this.props.data.y;
    +      var x2 = this.props.data.nextX;
    +      var y2 = this.props.data.nextY;
    +
    +      return (
    +        <line x1={x1} y1={y1} x2={x2} y2={y2}>{this.props.children}</line>
    +      );
    +    }
    +  });
    +
    +  var TextsBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>{this.props.children}</g>
    +      );
    +    }
    +  });
    +
    +  var SVGComponent = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <svg height="500" width="500">{this.props.children}
    +        </svg>
    +      );
    +    }
    +  });
    +
    +  var Box = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <div className = "visualizeRevTree">
    +          {this.props.children}
    +        </div>
    +      );
    +    }
    +  });
    +
    +  var Text = React.createClass({
    +
    +    render: function () {
    +      var styleVals = {
    +        left: this.props.data.stLeft,
    +        top: this.props.data.stTop
    +      };
    +
    +      return (
    +          <div className = "box" style={styleVals} short={this.props.data.short} long={this.props.data.long}>
    +            <p>{this.props.data.short}</p>
    +            {this.props.children}
    +          </div>
    +      );
    +    }
    +  });
    +
    +  var draw = function (paths, deleted, winner, minUniq) {
    +    var maxX = grid;
    +    var maxY = grid;
    +    var levelCount = []; // numer of nodes on some level (pos)
    +    lineObjs.length = 0;
    +    nodeObjs.length = 0;
    +    textObjs.length = 0;
    +
    +    var map = {}; // map from rev to position
    +
    +    function drawPath(path) {
    +      for (var i = 0; i < path.length; i++) {
    +        var rev = path[i];
    +        var isLeaf = i === 0;
    +        var pos = +rev.split('-')[0];
    +
    +        if (!levelCount[pos]) {
    +          levelCount[pos] = 1;
    +        }
    +
    +        var x = levelCount[pos] * grid;
    +        var y = pos * grid;
    +
    +        if (!isLeaf) {
    +          var nextRev = path[i - 1];
    +          var nextX = map[nextRev][0];
    +          var nextY = map[nextRev][1];
    +
    +          if (map[rev]) {
    +            x = map[rev][0];
    +            y = map[rev][1];
    +          }
    +
    +          var lineObj = {
    +            "x" : x,
    +            "y" : y,
    +            "nextX" : nextX,
    +            "nextY" : nextY
    +          };
    +
    +          lineObjs.push(lineObj);
    +        }
    +
    +        if (map[rev]) {
    +          break;
    +        }
    +
    +        maxX = Math.max(x, maxX);
    +        maxY = Math.max(y, maxY);
    +        levelCount[pos]++;
    +
    +        node(x, y, rev, isLeaf, rev in deleted, rev === winner, minUniq);
    +        map[rev] = [x, y];
    +      }
    +    }
    +
    +    paths.forEach(drawPath);
    +  };
    +
    +  var minUniqueLength = function (arr) {
    +    function strCommon(a, b) {
    +
    +      if (a === b) {
    +        return a.length;
    +      }
    +
    +      var i = 0;
    +
    +      while (++i) {
    +        if (a[i - 1] !== b[i - 1]) return i;
    +      }
    +    }
    +
    +    var array = arr.slice(0);
    +    var com = 1;
    +    array.sort();
    +
    +    for (var i = 1; i < array.length; i++) {
    +      com = Math.max(com, strCommon(array[i], array[i - 1]));
    +    }
    +
    +    return com;
    +  };
    +
    +  function node(x, y, rev, isLeaf, isDeleted, isWinner, shortDescLen) {
    +    circ(x, y, r, isLeaf, isDeleted, isWinner);
    +    var pos = rev.split('-')[0];
    +    var id = rev.split('-')[1];
    +    var opened = false;
    +
    +    var textObj = {
    +      "stLeft": (x - 40) + "px",
    +      "stTop": (y - 30) + "px",
    +      "short": pos + '-' + id.substr(0, shortDescLen),
    +      "long": pos + '-' + id
    +    };
    +
    +    textObjs.push(textObj);
    +  }
    +
    +  var circ = function (x, y, r, isLeaf, isDeleted, isWinner) {
    +
    +    var leafStat = "";
    +
    +    if (isLeaf) {
    +      leafStat = "leaf";
    +    }
    +    if (isWinner) {
    +      leafStat = "winner";
    +    }
    +    if (isDeleted) {
    +      leafStat = "deleted";
    +    }
    +
    +    var nodeObj = {
    +      "x" : x,
    +      "y" : y,
    +      "class" : leafStat
    +    };
    +
    +    nodeObjs.push(nodeObj);
    +  };
    +
    +  var App = React.createClass({
    +
    +    getInitialState: function () {
    +      return {
    +        lines: [],
    +        treeNodes: [],
    +        nodeTextObjs: []
    +      };
    +    },
    +
    +    componentDidMount: function () {
    +      var paths = [];
    +      var deleted = {};
    +      var treeDataOptions = store.getTreeOptions();
    +      var result = treeDataOptions.data;
    +      var winner = treeDataOptions.winner;
    +      console.log(result);
    +      console.log(winner);
    +      var minUniq = 0;
    +
    +      if (this.isMounted()) {
    +
    +        var allRevs = [];
    +
    +        paths = result.map(function (res) {
    +
    +        // TODO: what about missing
    +          if (res._deleted) {
    +            deleted[res._rev] = true;
    +          }
    +
    +          var revs = res._revisions;
    +
    +          revs.ids.forEach( function (id, i) {
    +
    +            var rev = (revs.start - i) + '-' + id;
    +
    +            if (allRevs.indexOf(rev) === -1) {
    +              allRevs.push(rev);
    +            }
    +
    +            i--;
    +          });
    +
    +          return revs.ids.map(function (id, i) {
    +            return (revs.start - i) + '-' + id;
    +          });
    +        });
    +
    +        minUniq = minUniqueLength(allRevs.map( function (rev) {
    --- End diff --
    
    fixed


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#issuecomment-104068413
  
    @nadeeshaan @michellephung @benkeen have you seen this revision tree? It's from the drupal project which syncs with pouch/couch
    
    https://youtu.be/Wijjsh6_Aq8?t=167
    
    (source https://twitter.com/janl/status/601063054533496834 )


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r29987299
  
    --- Diff: app/addons/documents/index-results/index-results.components.react.jsx ---
    @@ -53,9 +53,21 @@ function (app, FauxtonAPI, React, Stores, Actions, Components, Documents) {
             </a>);
         },
     
    +    //My Edit
    +
    +    getRevTreeUrlFragment: function (url) {
    +      return (
    +        <a href={url}>
    +          <i className="fonticon-sitemap"></i>
    +        </a>);
    +    },
    +
         getDocumentList: function () {
           return _.map(this.props.results, function (doc) {
    -
    +        
    +        var splitArr = (doc.url).split("/");
    --- End diff --
    
    First parentheses not needed here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30517810
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,332 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +],
    +
    +function (app, FauxtonAPI, React, Stores) {
    +
    +  var store = Stores.revTreeStore;
    +  var lineObjs = [];
    +  var nodeObjs = [];
    +  var textObjs = [];
    +  var grid = 100;
    +  var scale = 7;
    +  var r = 15;
    +
    +  var LinesBox = React.createClass({
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map(function (element, i) {
    +              return <Line key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var CirclesBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map (function (element, i) {
    +              return <Circle key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var Circle = React.createClass({
    +
    +    render: function () {
    +      var cx = this.props.data.x;
    +      var cy = this.props.data.y;
    +      var radius = r;
    +      var classVal = this.props.data.class;
    +
    +      return (
    +        <circle cx={cx} cy={cy} r={radius} className={classVal}>{this.props.children}</circle>
    +      );
    +    }
    +  });
    +
    +  var Line = React.createClass({
    +
    +    render: function () {
    +      var x1 = this.props.data.x;
    +      var y1 = this.props.data.y;
    +      var x2 = this.props.data.nextX;
    +      var y2 = this.props.data.nextY;
    +
    +      return (
    +        <line x1={x1} y1={y1} x2={x2} y2={y2}>{this.props.children}</line>
    +      );
    +    }
    +  });
    +
    +  var TextsBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>{this.props.children}</g>
    +      );
    +    }
    +  });
    +
    +  var SVGComponent = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <svg height="500" width="500">{this.props.children}
    +        </svg>
    +      );
    +    }
    +  });
    +
    +  var Box = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <div className = "visualizeRevTree">
    +          {this.props.children}
    +        </div>
    +      );
    +    }
    +  });
    +
    +  var Text = React.createClass({
    +
    +    render: function () {
    +      var styleVals = {
    +        left: this.props.data.stLeft,
    +        top: this.props.data.stTop
    +      };
    +
    +      return (
    +          <div className = "box" style={styleVals} short={this.props.data.short} long={this.props.data.long}>
    +            <p>{this.props.data.short}</p>
    +            {this.props.children}
    +          </div>
    +      );
    +    }
    +  });
    +
    +  var draw = function (paths, deleted, winner, minUniq) {
    +    var maxX = grid;
    +    var maxY = grid;
    +    var levelCount = []; // numer of nodes on some level (pos)
    +    lineObjs.length = 0;
    +    nodeObjs.length = 0;
    +    textObjs.length = 0;
    +
    +    var map = {}; // map from rev to position
    +
    +    function drawPath(path) {
    +      for (var i = 0; i < path.length; i++) {
    +        var rev = path[i];
    +        var isLeaf = i === 0;
    +        var pos = +rev.split('-')[0];
    +
    +        if (!levelCount[pos]) {
    +          levelCount[pos] = 1;
    +        }
    +
    +        var x = levelCount[pos] * grid;
    +        var y = pos * grid;
    +
    +        if (!isLeaf) {
    +          var nextRev = path[i - 1];
    +          var nextX = map[nextRev][0];
    +          var nextY = map[nextRev][1];
    +
    +          if (map[rev]) {
    +            x = map[rev][0];
    +            y = map[rev][1];
    +          }
    +
    +          var lineObj = {
    +            "x" : x,
    +            "y" : y,
    +            "nextX" : nextX,
    +            "nextY" : nextY
    +          };
    +
    +          lineObjs.push(lineObj);
    +        }
    +
    +        if (map[rev]) {
    +          break;
    +        }
    +
    +        maxX = Math.max(x, maxX);
    +        maxY = Math.max(y, maxY);
    +        levelCount[pos]++;
    +
    +        node(x, y, rev, isLeaf, rev in deleted, rev === winner, minUniq);
    +        map[rev] = [x, y];
    +      }
    +    }
    +
    +    paths.forEach(drawPath);
    +  };
    +
    +  var minUniqueLength = function (arr) {
    +    function strCommon(a, b) {
    +
    +      if (a === b) {
    +        return a.length;
    +      }
    +
    +      var i = 0;
    +
    +      while (++i) {
    +        if (a[i - 1] !== b[i - 1]) return i;
    +      }
    +    }
    +
    +    var array = arr.slice(0);
    +    var com = 1;
    +    array.sort();
    +
    +    for (var i = 1; i < array.length; i++) {
    +      com = Math.max(com, strCommon(array[i], array[i - 1]));
    +    }
    +
    +    return com;
    +  };
    +
    +  function node(x, y, rev, isLeaf, isDeleted, isWinner, shortDescLen) {
    +    circ(x, y, r, isLeaf, isDeleted, isWinner);
    +    var pos = rev.split('-')[0];
    +    var id = rev.split('-')[1];
    +    var opened = false;
    +
    +    var textObj = {
    +      "stLeft": (x - 40) + "px",
    +      "stTop": (y - 30) + "px",
    +      "short": pos + '-' + id.substr(0, shortDescLen),
    +      "long": pos + '-' + id
    +    };
    +
    +    textObjs.push(textObj);
    +  }
    +
    +  var circ = function (x, y, r, isLeaf, isDeleted, isWinner) {
    +
    +    var leafStat = "";
    +
    +    if (isLeaf) {
    +      leafStat = "leaf";
    +    }
    +    if (isWinner) {
    +      leafStat = "winner";
    +    }
    +    if (isDeleted) {
    +      leafStat = "deleted";
    +    }
    +
    +    var nodeObj = {
    +      "x" : x,
    +      "y" : y,
    +      "class" : leafStat
    +    };
    +
    +    nodeObjs.push(nodeObj);
    +  };
    +
    +  var App = React.createClass({
    +
    +    getInitialState: function () {
    +      return {
    +        lines: [],
    +        treeNodes: [],
    +        nodeTextObjs: []
    +      };
    +    },
    +
    +    componentDidMount: function () {
    +      var paths = [];
    +      var deleted = {};
    +      var treeDataOptions = store.getTreeOptions();
    +      var result = treeDataOptions.data;
    +      var winner = treeDataOptions.winner;
    +      console.log(result);
    +      console.log(winner);
    +      var minUniq = 0;
    +
    +      if (this.isMounted()) {
    +
    +        var allRevs = [];
    +
    +        paths = result.map(function (res) {
    +
    +        // TODO: what about missing
    +          if (res._deleted) {
    +            deleted[res._rev] = true;
    +          }
    +
    +          var revs = res._revisions;
    +
    +          revs.ids.forEach( function (id, i) {
    +
    +            var rev = (revs.start - i) + '-' + id;
    +
    +            if (allRevs.indexOf(rev) === -1) {
    +              allRevs.push(rev);
    +            }
    +
    +            i--;
    +          });
    +
    +          return revs.ids.map(function (id, i) {
    +            return (revs.start - i) + '-' + id;
    +          });
    +        });
    +
    +        minUniq = minUniqueLength(allRevs.map( function (rev) {
    --- End diff --
    
    `map( function (rev) {` -> `map(function (rev) {`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#issuecomment-104231944
  
    @nadeeshaan is don't see the changes, have you really pushed the branch?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30517251
  
    --- Diff: app/addons/documents/views-rev-tree.js ---
    @@ -0,0 +1,23 @@
    +define([
    +  "app",
    +  "api",
    +  "addons/documents/resources",
    +  "addons/documents/revisionTree/component.react"
    +],
    --- End diff --
    
    we can delete this?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#issuecomment-100404620
  
    This is a great start @nadeeshaan - clearly you understand a fair chunk of the code and how it works already, which is fantastic. I just provided a few initial remarks above. No doubt we'll all iterate on this and provide more feedback over time.
    
    Plus I'll give some thought to the UI. Improving the navigation and overall clarity of the revision page is pretty important, I think - even for an initial version.
    
    Anyway, awesome work! 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30515433
  
    --- Diff: app/addons/documents/assets/less/revisionTree.less ---
    @@ -0,0 +1,15 @@
    +.visualizeRevTree {position: relative}
    +.visualizeRevTree * {margin: 0; padding: 0; font-size: 10px}
    --- End diff --
    
    i think we can delete that file now


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30517537
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,332 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +],
    +
    +function (app, FauxtonAPI, React, Stores) {
    +
    +  var store = Stores.revTreeStore;
    +  var lineObjs = [];
    +  var nodeObjs = [];
    +  var textObjs = [];
    +  var grid = 100;
    +  var scale = 7;
    +  var r = 15;
    +
    +  var LinesBox = React.createClass({
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map(function (element, i) {
    +              return <Line key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var CirclesBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map (function (element, i) {
    +              return <Circle key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var Circle = React.createClass({
    +
    +    render: function () {
    +      var cx = this.props.data.x;
    +      var cy = this.props.data.y;
    +      var radius = r;
    --- End diff --
    
    this should get passed using props, too


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r29987385
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,330 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +  ], function(app,FauxtonAPI, React,Stores){
    +
    +    var store = Stores.revTreeStore;
    +
    +    var lineObjs = [];
    +    var nodeObjs = [];
    +    var textObjs = [];
    +
    +    var grid = 100;
    +    var scale = 7;
    +    var r = 15;
    +
    +    var LinesBox = React.createClass({
    +      render: function(){
    +        return (
    +          <g>
    +            {
    +              this.props.data.map(function (element, i) {
    +                return <Line key={i} data={element}/>;
    +              })
    +            }
    +          </g>
    +          );
    +      }
    +    });
    +
    +    var CirclesBox = React.createClass({
    +
    +      render: function(){
    +        return (
    +          <g>
    +            {
    +              this.props.data.map(function (element, i){
    +                return <Circle key={i} data={element}/>;
    +              })
    +            }
    +          </g>
    +          );
    +      }
    +    });
    +
    +    var Circle = React.createClass({
    +      render: function(){
    +        var cx = this.props.data.x;
    +        var cy = this.props.data.y;
    +        var radius = r;
    +        var classVal = this.props.data.class;
    +
    +        return (
    +          <circle cx={cx} cy={cy} r={radius} className={classVal}>{this.props.children}</circle>
    +          );
    +      }
    +    });
    +
    +    var Line = React.createClass({
    +      render: function(){
    +        var x1 = this.props.data.x;
    +        var y1 = this.props.data.y;
    +        var x2 = this.props.data.nextX;
    +        var y2 = this.props.data.nextY;
    +
    +        return (
    +          <line x1={x1} y1={y1} x2={x2} y2={y2}>{this.props.children}</line>
    +          );
    +      }
    +    });
    +
    +    var TextsBox = React.createClass({
    +      render: function(){
    +        return (
    +          <g>{this.props.children}</g>
    +          );
    +      }
    +    });
    +
    +    var SVGComponent = React.createClass({
    +      render: function() {
    +        return (
    +         <svg height="500" width="500">{this.props.children}
    +         </svg>
    +         );
    +      }
    +    });
    +
    +    var Box = React.createClass({
    +      render: function(){
    +        return (
    +          <div className = "visualizeRevTree">
    +            {this.props.children}
    +          </div>
    +          );
    +      }
    +    });
    +
    +    var Text = React.createClass({
    +      render: function(){
    +
    +        var styleVals = {
    +          left: this.props.data.stLeft,
    +          top: this.props.data.stTop
    +        };
    +
    +        return (
    +            <div className = "box" style={styleVals} short={this.props.data.short} long={this.props.data.long}>
    +              <p>{this.props.data.short}</p>
    +              {this.props.children}
    +            </div>
    +          );
    +      }
    +    });
    +
    +
    +    var draw = function(paths, deleted, winner, minUniq){
    +      var maxX = grid;
    +      var maxY = grid;
    +        var levelCount = []; // numer of nodes on some level (pos)
    +
    +        var map = {}; // map from rev to position
    +
    +        function drawPath(path) {
    +          for (var i = 0; i < path.length; i++) {
    --- End diff --
    
    We avoid for-loops and either use one of the underscore methods (_.each, _.map, etc.) or more recently have moved to using forEach: http://kangax.github.io/compat-table/es5/#Array.prototype.forEach


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by nadeeshaan <gi...@git.apache.org>.
Github user nadeeshaan commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30625763
  
    --- Diff: app/addons/documents/routes-rev-tree.js ---
    @@ -0,0 +1,48 @@
    +define([
    +  "app",
    +  "api",
    +  "addons/documents/resources",
    +  "addons/documents/views-rev-tree",
    +  "addons/documents/revisionTree/actions",
    +  "addons/documents/revisionTree/component.react"
    +
    +],
    +
    +function (app, FauxtonAPI, Resources, Views, RevisionTreeActions, AppComponent) {
    +  var  RevTreeRouteObject = FauxtonAPI.RouteObject.extend({
    +    layout: "one_pane",
    +
    +    crumbs: [
    +      {"name": "Revision Tree" , "link": "_revtree"}
    +    ],
    +
    +    routes: {
    +       "_revtree/:database/:doc/:winner": "revtreeRoute"
    +    },
    +
    +    roles: ["_admin"],
    +
    +    apiUrl:'revtree',
    +
    +    initialize: function () {
    +        //put common views used on all your routes here (eg:  sidebars )
    +    },
    +
    +    revtreeRoute: function (database, docId, winner) {
    +      var treeDataUrl = app.host + '/' + database + '/' + docId + '?open_revs=all&revs=true';
    +
    +      var revTreeData = new Resources.RevTreeDataModel(treeDataUrl);
    +
    +      RevisionTreeActions.newRevisionTree(revTreeData, winner);
    +      this.setComponent("#dashboard-content", AppComponent.App);
    +
    +      // this.setView("#dashboard-content", new Resources.WRAP.Wrapper({params: parameters}));
    --- End diff --
    
    fixed


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r29987484
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,330 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +  ], function(app,FauxtonAPI, React,Stores){
    +
    +    var store = Stores.revTreeStore;
    +
    +    var lineObjs = [];
    +    var nodeObjs = [];
    +    var textObjs = [];
    +
    +    var grid = 100;
    +    var scale = 7;
    +    var r = 15;
    +
    +    var LinesBox = React.createClass({
    +      render: function(){
    +        return (
    +          <g>
    +            {
    +              this.props.data.map(function (element, i) {
    +                return <Line key={i} data={element}/>;
    +              })
    +            }
    +          </g>
    +          );
    +      }
    +    });
    +
    +    var CirclesBox = React.createClass({
    +
    +      render: function(){
    +        return (
    +          <g>
    +            {
    +              this.props.data.map(function (element, i){
    +                return <Circle key={i} data={element}/>;
    +              })
    +            }
    +          </g>
    +          );
    +      }
    +    });
    +
    +    var Circle = React.createClass({
    +      render: function(){
    +        var cx = this.props.data.x;
    +        var cy = this.props.data.y;
    +        var radius = r;
    +        var classVal = this.props.data.class;
    +
    +        return (
    +          <circle cx={cx} cy={cy} r={radius} className={classVal}>{this.props.children}</circle>
    +          );
    +      }
    +    });
    +
    +    var Line = React.createClass({
    +      render: function(){
    +        var x1 = this.props.data.x;
    +        var y1 = this.props.data.y;
    +        var x2 = this.props.data.nextX;
    +        var y2 = this.props.data.nextY;
    +
    +        return (
    +          <line x1={x1} y1={y1} x2={x2} y2={y2}>{this.props.children}</line>
    +          );
    +      }
    +    });
    +
    +    var TextsBox = React.createClass({
    +      render: function(){
    +        return (
    +          <g>{this.props.children}</g>
    +          );
    +      }
    +    });
    +
    +    var SVGComponent = React.createClass({
    +      render: function() {
    +        return (
    +         <svg height="500" width="500">{this.props.children}
    +         </svg>
    +         );
    +      }
    +    });
    +
    +    var Box = React.createClass({
    +      render: function(){
    +        return (
    +          <div className = "visualizeRevTree">
    +            {this.props.children}
    +          </div>
    +          );
    +      }
    +    });
    +
    +    var Text = React.createClass({
    +      render: function(){
    +
    +        var styleVals = {
    +          left: this.props.data.stLeft,
    +          top: this.props.data.stTop
    +        };
    +
    +        return (
    +            <div className = "box" style={styleVals} short={this.props.data.short} long={this.props.data.long}>
    +              <p>{this.props.data.short}</p>
    +              {this.props.children}
    +            </div>
    +          );
    +      }
    +    });
    +
    +
    +    var draw = function(paths, deleted, winner, minUniq){
    +      var maxX = grid;
    +      var maxY = grid;
    +        var levelCount = []; // numer of nodes on some level (pos)
    +
    +        var map = {}; // map from rev to position
    +
    +        function drawPath(path) {
    +          for (var i = 0; i < path.length; i++) {
    +            var rev = path[i];
    +            var isLeaf = i === 0;
    +            var pos = +rev.split('-')[0];
    +
    +            if (!levelCount[pos]) {
    +              levelCount[pos] = 1;
    +            }
    +            var x = levelCount[pos] * grid;
    +            var y = pos * grid;
    +
    +            if (!isLeaf) {
    +              var nextRev = path[i-1];
    +              var nextX = map[nextRev][0];
    +              var nextY = map[nextRev][1];
    +
    +              if (map[rev]) {
    +                x = map[rev][0];
    +                y = map[rev][1];
    +              }
    +
    +              var lineObj = {
    +                "x" : x,
    +                "y" : y,
    +                "nextX" : nextX,
    +                "nextY" : nextY
    +              };
    +
    +              lineObjs.push(lineObj);
    +            }
    +            if (map[rev]) {
    +              break;
    +            }
    +            maxX = Math.max(x, maxX);
    +            maxY = Math.max(y, maxY);
    +            levelCount[pos]++;
    +
    +            node(x, y, rev, isLeaf, rev in deleted, rev === winner, minUniq);
    +            map[rev] = [x, y];
    +          }
    +        }
    +        paths.forEach(drawPath);
    +      };
    +
    +      var minUniqueLength = function(arr){
    +       function strCommon(a, b){
    +        if (a === b) return a.length;
    +        var i = 0;
    +        while(++i){
    +          if(a[i - 1] !== b[i - 1]) return i;
    +        }
    +      }
    +
    +      var array = arr.slice(0);
    +      var com = 1;
    +      array.sort();
    +      for (var i = 1; i < array.length; i++){
    +        com = Math.max(com, strCommon(array[i], array[i - 1]));
    +      }
    +      return com;
    +    };
    +
    +    function node(x, y, rev, isLeaf, isDeleted, isWinner, shortDescLen){
    +      circ(x, y, r, isLeaf, isDeleted, isWinner);
    +      var pos = rev.split('-')[0];
    +      var id = rev.split('-')[1];
    +      var opened = false;
    +
    +      var textObj = {
    +        "stLeft": (x-40) + "px",
    +        "stTop": (y-30) + "px",
    +        "short": pos + '-' + id.substr(0, shortDescLen),
    +        "long": pos + '-' + id
    +      };
    +
    +      textObjs.push(textObj);
    +    }
    +
    +    var circ = function(x, y, r, isLeaf, isDeleted, isWinner) {
    +
    +      var leafStat = "";
    +
    +      if (isLeaf) {
    +        leafStat = "leaf";
    +      }
    +      if (isWinner) {
    +        leafStat = "winner";
    +      }
    +      if (isDeleted) {
    +        leafStat = "deleted";
    +      }      
    +
    +      var nodeObj = {
    +        "x" : x,
    +        "y" : y,
    +        "class" : leafStat
    +      };
    +
    +      nodeObjs.push(nodeObj);
    +    };
    +
    +    var App = React.createClass({
    +      getInitialState: function() {
    +        return {
    +          lines: [],
    +          treeNodes: [],
    +          nodeTextObjs: []
    +        };
    +      },
    +
    +      componentDidMount: function() {
    +        var result = [];
    +        var paths = [];
    +        var deleted = {};
    +        var optionsVal = store.getTreeOptions();
    +        // var winner = this.props.data.winnerRev;
    +        var winner = optionsVal.winnerRev;
    +        // var url = '/'+this.props.data.db+'/'+this.props.data.docID;
    +        var url = '/'+optionsVal.db+'/'+optionsVal.docID;
    +        // var winner = this.props.data.;
    +        var minUniq = 0;
    +        $.get(app.host+url+'?open_revs=all&revs=true', function(rslt) {
    +          var data = rslt;
    +          if (this.isMounted()) {
    --- End diff --
    
    There's an awful lot of nesting going on here, which makes the code rather complicated to read. See if you can simplify it a bit, e.g. by not wrapping the whole thing in this `if` but returning/ending earlier if the opposite is true.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30517283
  
    --- Diff: app/addons/documents/routes-rev-tree.js ---
    @@ -0,0 +1,48 @@
    +define([
    +  "app",
    +  "api",
    +  "addons/documents/resources",
    +  "addons/documents/views-rev-tree",
    +  "addons/documents/revisionTree/actions",
    +  "addons/documents/revisionTree/component.react"
    +
    +],
    +
    +function (app, FauxtonAPI, Resources, Views, RevisionTreeActions, AppComponent) {
    +  var  RevTreeRouteObject = FauxtonAPI.RouteObject.extend({
    +    layout: "one_pane",
    +
    +    crumbs: [
    +      {"name": "Revision Tree" , "link": "_revtree"}
    +    ],
    +
    +    routes: {
    +       "_revtree/:database/:doc/:winner": "revtreeRoute"
    +    },
    +
    +    roles: ["_admin"],
    +
    +    apiUrl:'revtree',
    +
    +    initialize: function () {
    +        //put common views used on all your routes here (eg:  sidebars )
    +    },
    +
    +    revtreeRoute: function (database, docId, winner) {
    +      var treeDataUrl = app.host + '/' + database + '/' + docId + '?open_revs=all&revs=true';
    +
    +      var revTreeData = new Resources.RevTreeDataModel(treeDataUrl);
    +
    +      RevisionTreeActions.newRevisionTree(revTreeData, winner);
    +      this.setComponent("#dashboard-content", AppComponent.App);
    +
    +      // this.setView("#dashboard-content", new Resources.WRAP.Wrapper({params: parameters}));
    --- End diff --
    
    we can delete this?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by nadeeshaan <gi...@git.apache.org>.
Github user nadeeshaan commented on the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#issuecomment-104122658
  
    @robertkowalski  I added the changes. Going to start writing tests


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30516127
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,332 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +],
    +
    +function (app, FauxtonAPI, React, Stores) {
    +
    +  var store = Stores.revTreeStore;
    +  var lineObjs = [];
    +  var nodeObjs = [];
    +  var textObjs = [];
    +  var grid = 100;
    +  var scale = 7;
    +  var r = 15;
    +
    +  var LinesBox = React.createClass({
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map(function (element, i) {
    +              return <Line key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var CirclesBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map (function (element, i) {
    +              return <Circle key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var Circle = React.createClass({
    +
    +    render: function () {
    +      var cx = this.props.data.x;
    +      var cy = this.props.data.y;
    +      var radius = r;
    +      var classVal = this.props.data.class;
    +
    +      return (
    +        <circle cx={cx} cy={cy} r={radius} className={classVal}>{this.props.children}</circle>
    +      );
    +    }
    +  });
    +
    +  var Line = React.createClass({
    +
    +    render: function () {
    +      var x1 = this.props.data.x;
    +      var y1 = this.props.data.y;
    +      var x2 = this.props.data.nextX;
    +      var y2 = this.props.data.nextY;
    +
    +      return (
    +        <line x1={x1} y1={y1} x2={x2} y2={y2}>{this.props.children}</line>
    +      );
    +    }
    +  });
    +
    +  var TextsBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>{this.props.children}</g>
    +      );
    +    }
    +  });
    +
    +  var SVGComponent = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <svg height="500" width="500">{this.props.children}
    +        </svg>
    +      );
    +    }
    +  });
    +
    +  var Box = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <div className = "visualizeRevTree">
    +          {this.props.children}
    +        </div>
    +      );
    +    }
    +  });
    +
    +  var Text = React.createClass({
    +
    +    render: function () {
    +      var styleVals = {
    +        left: this.props.data.stLeft,
    +        top: this.props.data.stTop
    +      };
    +
    +      return (
    +          <div className = "box" style={styleVals} short={this.props.data.short} long={this.props.data.long}>
    +            <p>{this.props.data.short}</p>
    +            {this.props.children}
    +          </div>
    +      );
    +    }
    +  });
    +
    +  var draw = function (paths, deleted, winner, minUniq) {
    +    var maxX = grid;
    +    var maxY = grid;
    +    var levelCount = []; // numer of nodes on some level (pos)
    +    lineObjs.length = 0;
    +    nodeObjs.length = 0;
    +    textObjs.length = 0;
    +
    +    var map = {}; // map from rev to position
    +
    +    function drawPath(path) {
    +      for (var i = 0; i < path.length; i++) {
    +        var rev = path[i];
    +        var isLeaf = i === 0;
    +        var pos = +rev.split('-')[0];
    +
    +        if (!levelCount[pos]) {
    +          levelCount[pos] = 1;
    +        }
    +
    +        var x = levelCount[pos] * grid;
    +        var y = pos * grid;
    +
    +        if (!isLeaf) {
    +          var nextRev = path[i - 1];
    +          var nextX = map[nextRev][0];
    +          var nextY = map[nextRev][1];
    +
    +          if (map[rev]) {
    +            x = map[rev][0];
    +            y = map[rev][1];
    +          }
    +
    +          var lineObj = {
    +            "x" : x,
    +            "y" : y,
    +            "nextX" : nextX,
    +            "nextY" : nextY
    +          };
    +
    +          lineObjs.push(lineObj);
    +        }
    +
    +        if (map[rev]) {
    +          break;
    +        }
    +
    +        maxX = Math.max(x, maxX);
    +        maxY = Math.max(y, maxY);
    +        levelCount[pos]++;
    +
    +        node(x, y, rev, isLeaf, rev in deleted, rev === winner, minUniq);
    +        map[rev] = [x, y];
    +      }
    +    }
    +
    +    paths.forEach(drawPath);
    +  };
    +
    +  var minUniqueLength = function (arr) {
    +    function strCommon(a, b) {
    +
    +      if (a === b) {
    +        return a.length;
    +      }
    +
    +      var i = 0;
    +
    +      while (++i) {
    +        if (a[i - 1] !== b[i - 1]) return i;
    +      }
    +    }
    +
    +    var array = arr.slice(0);
    +    var com = 1;
    +    array.sort();
    +
    +    for (var i = 1; i < array.length; i++) {
    +      com = Math.max(com, strCommon(array[i], array[i - 1]));
    +    }
    +
    +    return com;
    +  };
    +
    +  function node(x, y, rev, isLeaf, isDeleted, isWinner, shortDescLen) {
    --- End diff --
    
    space missing after `node`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30515944
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,332 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +],
    +
    +function (app, FauxtonAPI, React, Stores) {
    +
    +  var store = Stores.revTreeStore;
    +  var lineObjs = [];
    +  var nodeObjs = [];
    +  var textObjs = [];
    +  var grid = 100;
    +  var scale = 7;
    +  var r = 15;
    +
    +  var LinesBox = React.createClass({
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map(function (element, i) {
    +              return <Line key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var CirclesBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map (function (element, i) {
    +              return <Circle key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var Circle = React.createClass({
    +
    +    render: function () {
    +      var cx = this.props.data.x;
    +      var cy = this.props.data.y;
    +      var radius = r;
    +      var classVal = this.props.data.class;
    +
    +      return (
    +        <circle cx={cx} cy={cy} r={radius} className={classVal}>{this.props.children}</circle>
    +      );
    +    }
    +  });
    +
    +  var Line = React.createClass({
    +
    +    render: function () {
    +      var x1 = this.props.data.x;
    +      var y1 = this.props.data.y;
    +      var x2 = this.props.data.nextX;
    +      var y2 = this.props.data.nextY;
    +
    +      return (
    +        <line x1={x1} y1={y1} x2={x2} y2={y2}>{this.props.children}</line>
    +      );
    +    }
    +  });
    +
    +  var TextsBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>{this.props.children}</g>
    +      );
    +    }
    +  });
    +
    +  var SVGComponent = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <svg height="500" width="500">{this.props.children}
    +        </svg>
    +      );
    +    }
    +  });
    +
    +  var Box = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <div className = "visualizeRevTree">
    --- End diff --
    
    `className="visualizeRevTree"` (without space)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by michellephung <gi...@git.apache.org>.
Github user michellephung commented on the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#issuecomment-104068748
  
    @robertkowalski nice!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r29987511
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,330 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +  ], function(app,FauxtonAPI, React,Stores){
    +
    +    var store = Stores.revTreeStore;
    +
    +    var lineObjs = [];
    +    var nodeObjs = [];
    +    var textObjs = [];
    +
    +    var grid = 100;
    +    var scale = 7;
    +    var r = 15;
    +
    +    var LinesBox = React.createClass({
    +      render: function(){
    +        return (
    +          <g>
    +            {
    +              this.props.data.map(function (element, i) {
    +                return <Line key={i} data={element}/>;
    +              })
    +            }
    +          </g>
    +          );
    +      }
    +    });
    +
    +    var CirclesBox = React.createClass({
    +
    +      render: function(){
    +        return (
    +          <g>
    +            {
    +              this.props.data.map(function (element, i){
    +                return <Circle key={i} data={element}/>;
    +              })
    +            }
    +          </g>
    +          );
    +      }
    +    });
    +
    +    var Circle = React.createClass({
    +      render: function(){
    +        var cx = this.props.data.x;
    +        var cy = this.props.data.y;
    +        var radius = r;
    +        var classVal = this.props.data.class;
    +
    +        return (
    +          <circle cx={cx} cy={cy} r={radius} className={classVal}>{this.props.children}</circle>
    +          );
    +      }
    +    });
    +
    +    var Line = React.createClass({
    +      render: function(){
    +        var x1 = this.props.data.x;
    +        var y1 = this.props.data.y;
    +        var x2 = this.props.data.nextX;
    +        var y2 = this.props.data.nextY;
    +
    +        return (
    +          <line x1={x1} y1={y1} x2={x2} y2={y2}>{this.props.children}</line>
    +          );
    +      }
    +    });
    +
    +    var TextsBox = React.createClass({
    +      render: function(){
    +        return (
    +          <g>{this.props.children}</g>
    +          );
    +      }
    +    });
    +
    +    var SVGComponent = React.createClass({
    +      render: function() {
    +        return (
    +         <svg height="500" width="500">{this.props.children}
    +         </svg>
    +         );
    +      }
    +    });
    +
    +    var Box = React.createClass({
    +      render: function(){
    +        return (
    +          <div className = "visualizeRevTree">
    +            {this.props.children}
    +          </div>
    +          );
    +      }
    +    });
    +
    +    var Text = React.createClass({
    +      render: function(){
    +
    +        var styleVals = {
    +          left: this.props.data.stLeft,
    +          top: this.props.data.stTop
    +        };
    +
    +        return (
    +            <div className = "box" style={styleVals} short={this.props.data.short} long={this.props.data.long}>
    +              <p>{this.props.data.short}</p>
    +              {this.props.children}
    +            </div>
    +          );
    +      }
    +    });
    +
    +
    +    var draw = function(paths, deleted, winner, minUniq){
    +      var maxX = grid;
    +      var maxY = grid;
    +        var levelCount = []; // numer of nodes on some level (pos)
    +
    +        var map = {}; // map from rev to position
    +
    +        function drawPath(path) {
    +          for (var i = 0; i < path.length; i++) {
    +            var rev = path[i];
    +            var isLeaf = i === 0;
    +            var pos = +rev.split('-')[0];
    +
    +            if (!levelCount[pos]) {
    +              levelCount[pos] = 1;
    +            }
    +            var x = levelCount[pos] * grid;
    +            var y = pos * grid;
    +
    +            if (!isLeaf) {
    +              var nextRev = path[i-1];
    +              var nextX = map[nextRev][0];
    +              var nextY = map[nextRev][1];
    +
    +              if (map[rev]) {
    +                x = map[rev][0];
    +                y = map[rev][1];
    +              }
    +
    +              var lineObj = {
    +                "x" : x,
    +                "y" : y,
    +                "nextX" : nextX,
    +                "nextY" : nextY
    +              };
    +
    +              lineObjs.push(lineObj);
    +            }
    +            if (map[rev]) {
    +              break;
    +            }
    +            maxX = Math.max(x, maxX);
    +            maxY = Math.max(y, maxY);
    +            levelCount[pos]++;
    +
    +            node(x, y, rev, isLeaf, rev in deleted, rev === winner, minUniq);
    +            map[rev] = [x, y];
    +          }
    +        }
    +        paths.forEach(drawPath);
    +      };
    +
    +      var minUniqueLength = function(arr){
    +       function strCommon(a, b){
    +        if (a === b) return a.length;
    +        var i = 0;
    +        while(++i){
    +          if(a[i - 1] !== b[i - 1]) return i;
    +        }
    +      }
    +
    +      var array = arr.slice(0);
    +      var com = 1;
    +      array.sort();
    +      for (var i = 1; i < array.length; i++){
    +        com = Math.max(com, strCommon(array[i], array[i - 1]));
    +      }
    +      return com;
    +    };
    +
    +    function node(x, y, rev, isLeaf, isDeleted, isWinner, shortDescLen){
    +      circ(x, y, r, isLeaf, isDeleted, isWinner);
    +      var pos = rev.split('-')[0];
    +      var id = rev.split('-')[1];
    +      var opened = false;
    +
    +      var textObj = {
    +        "stLeft": (x-40) + "px",
    +        "stTop": (y-30) + "px",
    +        "short": pos + '-' + id.substr(0, shortDescLen),
    +        "long": pos + '-' + id
    +      };
    +
    +      textObjs.push(textObj);
    +    }
    +
    +    var circ = function(x, y, r, isLeaf, isDeleted, isWinner) {
    +
    +      var leafStat = "";
    +
    +      if (isLeaf) {
    +        leafStat = "leaf";
    +      }
    +      if (isWinner) {
    +        leafStat = "winner";
    +      }
    +      if (isDeleted) {
    +        leafStat = "deleted";
    +      }      
    +
    +      var nodeObj = {
    +        "x" : x,
    +        "y" : y,
    +        "class" : leafStat
    +      };
    +
    +      nodeObjs.push(nodeObj);
    +    };
    +
    +    var App = React.createClass({
    +      getInitialState: function() {
    +        return {
    +          lines: [],
    +          treeNodes: [],
    +          nodeTextObjs: []
    +        };
    +      },
    +
    +      componentDidMount: function() {
    +        var result = [];
    +        var paths = [];
    +        var deleted = {};
    +        var optionsVal = store.getTreeOptions();
    +        // var winner = this.props.data.winnerRev;
    +        var winner = optionsVal.winnerRev;
    +        // var url = '/'+this.props.data.db+'/'+this.props.data.docID;
    +        var url = '/'+optionsVal.db+'/'+optionsVal.docID;
    +        // var winner = this.props.data.;
    +        var minUniq = 0;
    +        $.get(app.host+url+'?open_revs=all&revs=true', function(rslt) {
    +          var data = rslt;
    +          if (this.isMounted()) {
    +            var x = data.split(/(\n|\r\n|\r)/);
    +
    +            for (var i = 0; i <x.length; i++) {
    +              if(String(x[i]).charAt(0) == "{"){
    --- End diff --
    
    Once we get down to the nitty gritty, we'll want to get all the code style consistent with the rest of the codebase, like here: space after the if, triple equals, not double (we always try to use strict equality). But I won't bore you with picking out all the instance in the code - just read over the style doc and get to it whenever you refactor. No rush!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by michellephung <gi...@git.apache.org>.
Github user michellephung commented on the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#issuecomment-104748483
  
    no worries @nadeeshaan :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by nadeeshaan <gi...@git.apache.org>.
Github user nadeeshaan commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30625617
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,332 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +],
    +
    +function (app, FauxtonAPI, React, Stores) {
    +
    +  var store = Stores.revTreeStore;
    +  var lineObjs = [];
    +  var nodeObjs = [];
    +  var textObjs = [];
    +  var grid = 100;
    +  var scale = 7;
    +  var r = 15;
    +
    +  var LinesBox = React.createClass({
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map(function (element, i) {
    +              return <Line key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var CirclesBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map (function (element, i) {
    +              return <Circle key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var Circle = React.createClass({
    +
    +    render: function () {
    +      var cx = this.props.data.x;
    +      var cy = this.props.data.y;
    +      var radius = r;
    +      var classVal = this.props.data.class;
    +
    +      return (
    +        <circle cx={cx} cy={cy} r={radius} className={classVal}>{this.props.children}</circle>
    +      );
    +    }
    +  });
    +
    +  var Line = React.createClass({
    +
    +    render: function () {
    +      var x1 = this.props.data.x;
    +      var y1 = this.props.data.y;
    +      var x2 = this.props.data.nextX;
    +      var y2 = this.props.data.nextY;
    +
    +      return (
    +        <line x1={x1} y1={y1} x2={x2} y2={y2}>{this.props.children}</line>
    +      );
    +    }
    +  });
    +
    +  var TextsBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>{this.props.children}</g>
    +      );
    +    }
    +  });
    +
    +  var SVGComponent = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <svg height="500" width="500">{this.props.children}
    +        </svg>
    +      );
    +    }
    +  });
    +
    +  var Box = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <div className = "visualizeRevTree">
    +          {this.props.children}
    +        </div>
    +      );
    +    }
    +  });
    +
    +  var Text = React.createClass({
    +
    +    render: function () {
    +      var styleVals = {
    +        left: this.props.data.stLeft,
    +        top: this.props.data.stTop
    +      };
    +
    +      return (
    +          <div className = "box" style={styleVals} short={this.props.data.short} long={this.props.data.long}>
    +            <p>{this.props.data.short}</p>
    +            {this.props.children}
    +          </div>
    +      );
    +    }
    +  });
    +
    +  var draw = function (paths, deleted, winner, minUniq) {
    +    var maxX = grid;
    +    var maxY = grid;
    +    var levelCount = []; // numer of nodes on some level (pos)
    +    lineObjs.length = 0;
    +    nodeObjs.length = 0;
    +    textObjs.length = 0;
    +
    +    var map = {}; // map from rev to position
    +
    +    function drawPath(path) {
    --- End diff --
    
    fixed


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by nadeeshaan <gi...@git.apache.org>.
Github user nadeeshaan closed the pull request at:

    https://github.com/apache/couchdb-fauxton/pull/401


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#issuecomment-104232649
  
    please join irc if you have questions


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30516010
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,332 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +],
    +
    +function (app, FauxtonAPI, React, Stores) {
    +
    +  var store = Stores.revTreeStore;
    +  var lineObjs = [];
    +  var nodeObjs = [];
    +  var textObjs = [];
    +  var grid = 100;
    +  var scale = 7;
    +  var r = 15;
    +
    +  var LinesBox = React.createClass({
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map(function (element, i) {
    +              return <Line key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var CirclesBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map (function (element, i) {
    +              return <Circle key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var Circle = React.createClass({
    +
    +    render: function () {
    +      var cx = this.props.data.x;
    +      var cy = this.props.data.y;
    +      var radius = r;
    +      var classVal = this.props.data.class;
    +
    +      return (
    +        <circle cx={cx} cy={cy} r={radius} className={classVal}>{this.props.children}</circle>
    +      );
    +    }
    +  });
    +
    +  var Line = React.createClass({
    +
    +    render: function () {
    +      var x1 = this.props.data.x;
    +      var y1 = this.props.data.y;
    +      var x2 = this.props.data.nextX;
    +      var y2 = this.props.data.nextY;
    +
    +      return (
    +        <line x1={x1} y1={y1} x2={x2} y2={y2}>{this.props.children}</line>
    +      );
    +    }
    +  });
    +
    +  var TextsBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>{this.props.children}</g>
    +      );
    +    }
    +  });
    +
    +  var SVGComponent = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <svg height="500" width="500">{this.props.children}
    +        </svg>
    +      );
    +    }
    +  });
    +
    +  var Box = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <div className = "visualizeRevTree">
    +          {this.props.children}
    +        </div>
    +      );
    +    }
    +  });
    +
    +  var Text = React.createClass({
    +
    +    render: function () {
    +      var styleVals = {
    +        left: this.props.data.stLeft,
    +        top: this.props.data.stTop
    +      };
    +
    +      return (
    +          <div className = "box" style={styleVals} short={this.props.data.short} long={this.props.data.long}>
    --- End diff --
    
    ` = ` without space, like the others in this line


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30517934
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,332 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +],
    +
    +function (app, FauxtonAPI, React, Stores) {
    +
    +  var store = Stores.revTreeStore;
    +  var lineObjs = [];
    +  var nodeObjs = [];
    +  var textObjs = [];
    +  var grid = 100;
    +  var scale = 7;
    +  var r = 15;
    +
    +  var LinesBox = React.createClass({
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map(function (element, i) {
    +              return <Line key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var CirclesBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map (function (element, i) {
    +              return <Circle key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var Circle = React.createClass({
    +
    +    render: function () {
    +      var cx = this.props.data.x;
    +      var cy = this.props.data.y;
    +      var radius = r;
    +      var classVal = this.props.data.class;
    +
    +      return (
    +        <circle cx={cx} cy={cy} r={radius} className={classVal}>{this.props.children}</circle>
    +      );
    +    }
    +  });
    +
    +  var Line = React.createClass({
    +
    +    render: function () {
    +      var x1 = this.props.data.x;
    +      var y1 = this.props.data.y;
    +      var x2 = this.props.data.nextX;
    +      var y2 = this.props.data.nextY;
    +
    +      return (
    +        <line x1={x1} y1={y1} x2={x2} y2={y2}>{this.props.children}</line>
    +      );
    +    }
    +  });
    +
    +  var TextsBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>{this.props.children}</g>
    +      );
    +    }
    +  });
    +
    +  var SVGComponent = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <svg height="500" width="500">{this.props.children}
    +        </svg>
    +      );
    +    }
    +  });
    +
    +  var Box = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <div className = "visualizeRevTree">
    +          {this.props.children}
    +        </div>
    +      );
    +    }
    +  });
    +
    +  var Text = React.createClass({
    +
    +    render: function () {
    +      var styleVals = {
    +        left: this.props.data.stLeft,
    +        top: this.props.data.stTop
    +      };
    +
    +      return (
    +          <div className = "box" style={styleVals} short={this.props.data.short} long={this.props.data.long}>
    +            <p>{this.props.data.short}</p>
    +            {this.props.children}
    +          </div>
    +      );
    +    }
    +  });
    +
    +  var draw = function (paths, deleted, winner, minUniq) {
    +    var maxX = grid;
    +    var maxY = grid;
    +    var levelCount = []; // numer of nodes on some level (pos)
    +    lineObjs.length = 0;
    +    nodeObjs.length = 0;
    +    textObjs.length = 0;
    +
    +    var map = {}; // map from rev to position
    +
    +    function drawPath(path) {
    +      for (var i = 0; i < path.length; i++) {
    +        var rev = path[i];
    +        var isLeaf = i === 0;
    +        var pos = +rev.split('-')[0];
    +
    +        if (!levelCount[pos]) {
    +          levelCount[pos] = 1;
    +        }
    +
    +        var x = levelCount[pos] * grid;
    +        var y = pos * grid;
    +
    +        if (!isLeaf) {
    +          var nextRev = path[i - 1];
    +          var nextX = map[nextRev][0];
    +          var nextY = map[nextRev][1];
    +
    +          if (map[rev]) {
    +            x = map[rev][0];
    +            y = map[rev][1];
    +          }
    +
    +          var lineObj = {
    +            "x" : x,
    +            "y" : y,
    +            "nextX" : nextX,
    +            "nextY" : nextY
    +          };
    +
    +          lineObjs.push(lineObj);
    +        }
    +
    +        if (map[rev]) {
    +          break;
    +        }
    +
    +        maxX = Math.max(x, maxX);
    +        maxY = Math.max(y, maxY);
    +        levelCount[pos]++;
    +
    +        node(x, y, rev, isLeaf, rev in deleted, rev === winner, minUniq);
    +        map[rev] = [x, y];
    +      }
    +    }
    +
    +    paths.forEach(drawPath);
    +  };
    +
    +  var minUniqueLength = function (arr) {
    +    function strCommon(a, b) {
    +
    +      if (a === b) {
    +        return a.length;
    +      }
    +
    +      var i = 0;
    +
    +      while (++i) {
    +        if (a[i - 1] !== b[i - 1]) return i;
    +      }
    +    }
    +
    +    var array = arr.slice(0);
    +    var com = 1;
    +    array.sort();
    +
    +    for (var i = 1; i < array.length; i++) {
    +      com = Math.max(com, strCommon(array[i], array[i - 1]));
    +    }
    +
    +    return com;
    +  };
    +
    +  function node(x, y, rev, isLeaf, isDeleted, isWinner, shortDescLen) {
    +    circ(x, y, r, isLeaf, isDeleted, isWinner);
    +    var pos = rev.split('-')[0];
    +    var id = rev.split('-')[1];
    +    var opened = false;
    +
    +    var textObj = {
    +      "stLeft": (x - 40) + "px",
    +      "stTop": (y - 30) + "px",
    +      "short": pos + '-' + id.substr(0, shortDescLen),
    +      "long": pos + '-' + id
    +    };
    +
    +    textObjs.push(textObj);
    +  }
    +
    +  var circ = function (x, y, r, isLeaf, isDeleted, isWinner) {
    +
    +    var leafStat = "";
    +
    +    if (isLeaf) {
    +      leafStat = "leaf";
    +    }
    +    if (isWinner) {
    +      leafStat = "winner";
    +    }
    +    if (isDeleted) {
    +      leafStat = "deleted";
    +    }
    +
    +    var nodeObj = {
    +      "x" : x,
    +      "y" : y,
    +      "class" : leafStat
    +    };
    +
    +    nodeObjs.push(nodeObj);
    +  };
    +
    +  var App = React.createClass({
    +
    +    getInitialState: function () {
    +      return {
    +        lines: [],
    +        treeNodes: [],
    +        nodeTextObjs: []
    +      };
    +    },
    +
    +    componentDidMount: function () {
    +      var paths = [];
    +      var deleted = {};
    +      var treeDataOptions = store.getTreeOptions();
    --- End diff --
    
    after you moved the code to render, please add tests for this react file, too


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by nadeeshaan <gi...@git.apache.org>.
Github user nadeeshaan commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30625538
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,332 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +],
    +
    +function (app, FauxtonAPI, React, Stores) {
    +
    +  var store = Stores.revTreeStore;
    +  var lineObjs = [];
    +  var nodeObjs = [];
    +  var textObjs = [];
    +  var grid = 100;
    +  var scale = 7;
    +  var r = 15;
    +
    +  var LinesBox = React.createClass({
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map(function (element, i) {
    +              return <Line key={i} data={element}/>;
    +            })
    --- End diff --
    
    adding semicolon gives an error --- "Unexpected Token ;"


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30515760
  
    --- Diff: app/addons/documents/revisionTree/actions.js ---
    @@ -0,0 +1,26 @@
    +define([
    +  'app',
    +  'api',
    +  'addons/documents/revisionTree/actiontypes',
    +  'addons/documents/revisionTree/stores'
    +],
    +
    +function (app, FauxtonAPI, ActionTypes, Stores) {
    +
    +  var revTreeStore = Stores.revTreeStore;
    +
    +  return {
    +    newRevisionTree: function (revTreeDataModel, winner) {
    +      revTreeDataModel.toJSON();
    --- End diff --
    
    i think you don't need that


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#issuecomment-104071746
  
    @nadeeshaan have you pushed your changes?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30792351
  
    --- Diff: app/addons/documents/views-rev-tree.js ---
    @@ -0,0 +1,23 @@
    +define([
    +  "app",
    +  "api",
    +  "addons/documents/resources",
    +  "addons/documents/revisionTree/component.react"
    +],
    --- End diff --
    
    sorry, but the file is still there


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by nadeeshaan <gi...@git.apache.org>.
Github user nadeeshaan commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30625400
  
    --- Diff: app/addons/documents/revisionTree/actions.js ---
    @@ -0,0 +1,26 @@
    +define([
    +  'app',
    +  'api',
    +  'addons/documents/revisionTree/actiontypes',
    +  'addons/documents/revisionTree/stores'
    +],
    +
    +function (app, FauxtonAPI, ActionTypes, Stores) {
    +
    +  var revTreeStore = Stores.revTreeStore;
    +
    +  return {
    +    newRevisionTree: function (revTreeDataModel, winner) {
    +      revTreeDataModel.toJSON();
    --- End diff --
    
    fixed


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30515729
  
    --- Diff: app/addons/documents/resources.js ---
    @@ -434,5 +434,43 @@ function (app, FauxtonAPI, Documents, PagingCollection) {
         }, menuLinks);
       };
     
    +  Documents.RevTreeDataModel = Backbone.Model.extend({
    +    initialize: function (url) {
    +      this.url = url;
    +      console.log("inside initialize");
    +    },
    +    url: function () {
    +      return this.url;
    +    },
    +
    +    sync: function (method, model, options) {
    +      console.log("inside Sync-----" + this.url);
    +      var params = {
    +        error: options.error,
    +        success: options.success,
    +        url: this.url,
    +        type: 'GET',
    +        dataType: 'text',
    +        async: false
    +      };
    +
    +      return $.ajax(params);
    +    },
    +    parse: function (response) {
    +
    +      var parsedResult = [];
    +      var splitResponse = response.split(/(\n|\r\n|\r)/);
    +
    +      for (var i = 0; i < splitResponse.length; i++) {
    +        if (String(splitResponse[i]).charAt(0) == "{") {
    +          parsedResult.push(JSON.parse(splitResponse[i]));
    +        }
    +      }
    +      console.log(parsedResult);
    +
    +      return {content: parsedResult};
    --- End diff --
    
    this code needs some tests, example test: https://github.com/apache/couchdb-fauxton/blob/master/app/addons/documents/tests/resourcesSpec.js#L45-72


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30516082
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,332 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +],
    +
    +function (app, FauxtonAPI, React, Stores) {
    +
    +  var store = Stores.revTreeStore;
    +  var lineObjs = [];
    +  var nodeObjs = [];
    +  var textObjs = [];
    +  var grid = 100;
    +  var scale = 7;
    +  var r = 15;
    +
    +  var LinesBox = React.createClass({
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map(function (element, i) {
    +              return <Line key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var CirclesBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map (function (element, i) {
    +              return <Circle key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var Circle = React.createClass({
    +
    +    render: function () {
    +      var cx = this.props.data.x;
    +      var cy = this.props.data.y;
    +      var radius = r;
    +      var classVal = this.props.data.class;
    +
    +      return (
    +        <circle cx={cx} cy={cy} r={radius} className={classVal}>{this.props.children}</circle>
    +      );
    +    }
    +  });
    +
    +  var Line = React.createClass({
    +
    +    render: function () {
    +      var x1 = this.props.data.x;
    +      var y1 = this.props.data.y;
    +      var x2 = this.props.data.nextX;
    +      var y2 = this.props.data.nextY;
    +
    +      return (
    +        <line x1={x1} y1={y1} x2={x2} y2={y2}>{this.props.children}</line>
    +      );
    +    }
    +  });
    +
    +  var TextsBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>{this.props.children}</g>
    +      );
    +    }
    +  });
    +
    +  var SVGComponent = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <svg height="500" width="500">{this.props.children}
    +        </svg>
    +      );
    +    }
    +  });
    +
    +  var Box = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <div className = "visualizeRevTree">
    +          {this.props.children}
    +        </div>
    +      );
    +    }
    +  });
    +
    +  var Text = React.createClass({
    +
    +    render: function () {
    +      var styleVals = {
    +        left: this.props.data.stLeft,
    +        top: this.props.data.stTop
    +      };
    +
    +      return (
    +          <div className = "box" style={styleVals} short={this.props.data.short} long={this.props.data.long}>
    +            <p>{this.props.data.short}</p>
    +            {this.props.children}
    +          </div>
    +      );
    +    }
    +  });
    +
    +  var draw = function (paths, deleted, winner, minUniq) {
    +    var maxX = grid;
    +    var maxY = grid;
    +    var levelCount = []; // numer of nodes on some level (pos)
    +    lineObjs.length = 0;
    +    nodeObjs.length = 0;
    +    textObjs.length = 0;
    +
    +    var map = {}; // map from rev to position
    +
    +    function drawPath(path) {
    --- End diff --
    
    `drawPath (` (space missing)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by nadeeshaan <gi...@git.apache.org>.
Github user nadeeshaan commented on the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#issuecomment-104746546
  
    @robertkowalski , @michellephung , @benkeen  
    In this branch by mistakenly I have done some alterations while merging with the master. But I have my backup branch with same changes here https://github.com/nadeeshaan/couchdb-fauxton/tree/GSOC_2015_RevisionTreeVisualization. 
    So I will add a new PR from that branch and close this PR if you guys are ok with it. 
    Sorry for the troubles
    :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r29987362
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,330 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +  ], function(app,FauxtonAPI, React,Stores){
    +
    +    var store = Stores.revTreeStore;
    +
    +    var lineObjs = [];
    +    var nodeObjs = [];
    +    var textObjs = [];
    +
    +    var grid = 100;
    +    var scale = 7;
    +    var r = 15;
    +
    +    var LinesBox = React.createClass({
    +      render: function(){
    +        return (
    +          <g>
    +            {
    +              this.props.data.map(function (element, i) {
    +                return <Line key={i} data={element}/>;
    +              })
    +            }
    +          </g>
    +          );
    +      }
    +    });
    +
    +    var CirclesBox = React.createClass({
    +
    +      render: function(){
    +        return (
    +          <g>
    +            {
    +              this.props.data.map(function (element, i){
    +                return <Circle key={i} data={element}/>;
    +              })
    +            }
    +          </g>
    +          );
    +      }
    +    });
    +
    +    var Circle = React.createClass({
    +      render: function(){
    +        var cx = this.props.data.x;
    +        var cy = this.props.data.y;
    +        var radius = r;
    +        var classVal = this.props.data.class;
    +
    +        return (
    +          <circle cx={cx} cy={cy} r={radius} className={classVal}>{this.props.children}</circle>
    +          );
    +      }
    +    });
    +
    +    var Line = React.createClass({
    +      render: function(){
    +        var x1 = this.props.data.x;
    +        var y1 = this.props.data.y;
    +        var x2 = this.props.data.nextX;
    +        var y2 = this.props.data.nextY;
    +
    +        return (
    +          <line x1={x1} y1={y1} x2={x2} y2={y2}>{this.props.children}</line>
    +          );
    +      }
    +    });
    +
    +    var TextsBox = React.createClass({
    +      render: function(){
    +        return (
    +          <g>{this.props.children}</g>
    +          );
    +      }
    +    });
    +
    +    var SVGComponent = React.createClass({
    +      render: function() {
    +        return (
    +         <svg height="500" width="500">{this.props.children}
    +         </svg>
    +         );
    +      }
    +    });
    +
    +    var Box = React.createClass({
    +      render: function(){
    +        return (
    +          <div className = "visualizeRevTree">
    +            {this.props.children}
    +          </div>
    +          );
    +      }
    +    });
    +
    +    var Text = React.createClass({
    +      render: function(){
    +
    +        var styleVals = {
    +          left: this.props.data.stLeft,
    +          top: this.props.data.stTop
    +        };
    +
    +        return (
    +            <div className = "box" style={styleVals} short={this.props.data.short} long={this.props.data.long}>
    +              <p>{this.props.data.short}</p>
    +              {this.props.children}
    +            </div>
    +          );
    +      }
    +    });
    +
    +
    +    var draw = function(paths, deleted, winner, minUniq){
    +      var maxX = grid;
    +      var maxY = grid;
    +        var levelCount = []; // numer of nodes on some level (pos)
    --- End diff --
    
    Watch for consistent indentation here. Ooh - btw, check out the JS/HTML/CSS style guide, of you haven't already: https://github.com/apache/couchdb-fauxton/blob/master/styleguide.md


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#issuecomment-100840740
  
    testsuite is red
    
    in order to fix run  `npm test` and fix the issues


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30516588
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,332 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +],
    +
    +function (app, FauxtonAPI, React, Stores) {
    +
    +  var store = Stores.revTreeStore;
    +  var lineObjs = [];
    +  var nodeObjs = [];
    +  var textObjs = [];
    +  var grid = 100;
    +  var scale = 7;
    +  var r = 15;
    +
    +  var LinesBox = React.createClass({
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map(function (element, i) {
    +              return <Line key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var CirclesBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map (function (element, i) {
    +              return <Circle key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var Circle = React.createClass({
    +
    +    render: function () {
    +      var cx = this.props.data.x;
    +      var cy = this.props.data.y;
    +      var radius = r;
    +      var classVal = this.props.data.class;
    +
    +      return (
    +        <circle cx={cx} cy={cy} r={radius} className={classVal}>{this.props.children}</circle>
    +      );
    +    }
    +  });
    +
    +  var Line = React.createClass({
    +
    +    render: function () {
    +      var x1 = this.props.data.x;
    +      var y1 = this.props.data.y;
    +      var x2 = this.props.data.nextX;
    +      var y2 = this.props.data.nextY;
    +
    +      return (
    +        <line x1={x1} y1={y1} x2={x2} y2={y2}>{this.props.children}</line>
    +      );
    +    }
    +  });
    +
    +  var TextsBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>{this.props.children}</g>
    +      );
    +    }
    +  });
    +
    +  var SVGComponent = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <svg height="500" width="500">{this.props.children}
    +        </svg>
    +      );
    +    }
    +  });
    +
    +  var Box = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <div className = "visualizeRevTree">
    +          {this.props.children}
    +        </div>
    +      );
    +    }
    +  });
    +
    +  var Text = React.createClass({
    +
    +    render: function () {
    +      var styleVals = {
    +        left: this.props.data.stLeft,
    +        top: this.props.data.stTop
    +      };
    +
    +      return (
    +          <div className = "box" style={styleVals} short={this.props.data.short} long={this.props.data.long}>
    +            <p>{this.props.data.short}</p>
    +            {this.props.children}
    +          </div>
    +      );
    +    }
    +  });
    +
    +  var draw = function (paths, deleted, winner, minUniq) {
    +    var maxX = grid;
    +    var maxY = grid;
    +    var levelCount = []; // numer of nodes on some level (pos)
    +    lineObjs.length = 0;
    +    nodeObjs.length = 0;
    +    textObjs.length = 0;
    +
    +    var map = {}; // map from rev to position
    +
    +    function drawPath(path) {
    +      for (var i = 0; i < path.length; i++) {
    +        var rev = path[i];
    +        var isLeaf = i === 0;
    +        var pos = +rev.split('-')[0];
    +
    +        if (!levelCount[pos]) {
    +          levelCount[pos] = 1;
    +        }
    +
    +        var x = levelCount[pos] * grid;
    +        var y = pos * grid;
    +
    +        if (!isLeaf) {
    +          var nextRev = path[i - 1];
    +          var nextX = map[nextRev][0];
    +          var nextY = map[nextRev][1];
    +
    +          if (map[rev]) {
    +            x = map[rev][0];
    +            y = map[rev][1];
    +          }
    +
    +          var lineObj = {
    +            "x" : x,
    +            "y" : y,
    +            "nextX" : nextX,
    +            "nextY" : nextY
    +          };
    +
    +          lineObjs.push(lineObj);
    +        }
    +
    +        if (map[rev]) {
    +          break;
    +        }
    +
    +        maxX = Math.max(x, maxX);
    +        maxY = Math.max(y, maxY);
    +        levelCount[pos]++;
    +
    +        node(x, y, rev, isLeaf, rev in deleted, rev === winner, minUniq);
    +        map[rev] = [x, y];
    +      }
    +    }
    +
    +    paths.forEach(drawPath);
    +  };
    +
    +  var minUniqueLength = function (arr) {
    +    function strCommon(a, b) {
    +
    +      if (a === b) {
    +        return a.length;
    +      }
    +
    +      var i = 0;
    +
    +      while (++i) {
    +        if (a[i - 1] !== b[i - 1]) return i;
    +      }
    +    }
    +
    +    var array = arr.slice(0);
    +    var com = 1;
    +    array.sort();
    +
    +    for (var i = 1; i < array.length; i++) {
    +      com = Math.max(com, strCommon(array[i], array[i - 1]));
    +    }
    +
    +    return com;
    +  };
    +
    +  function node(x, y, rev, isLeaf, isDeleted, isWinner, shortDescLen) {
    +    circ(x, y, r, isLeaf, isDeleted, isWinner);
    +    var pos = rev.split('-')[0];
    +    var id = rev.split('-')[1];
    +    var opened = false;
    +
    +    var textObj = {
    +      "stLeft": (x - 40) + "px",
    +      "stTop": (y - 30) + "px",
    +      "short": pos + '-' + id.substr(0, shortDescLen),
    +      "long": pos + '-' + id
    +    };
    +
    +    textObjs.push(textObj);
    +  }
    +
    +  var circ = function (x, y, r, isLeaf, isDeleted, isWinner) {
    +
    +    var leafStat = "";
    +
    +    if (isLeaf) {
    +      leafStat = "leaf";
    +    }
    +    if (isWinner) {
    +      leafStat = "winner";
    +    }
    +    if (isDeleted) {
    +      leafStat = "deleted";
    +    }
    +
    +    var nodeObj = {
    +      "x" : x,
    +      "y" : y,
    +      "class" : leafStat
    +    };
    +
    +    nodeObjs.push(nodeObj);
    +  };
    +
    +  var App = React.createClass({
    +
    +    getInitialState: function () {
    +      return {
    +        lines: [],
    +        treeNodes: [],
    +        nodeTextObjs: []
    +      };
    +    },
    +
    +    componentDidMount: function () {
    +      var paths = [];
    +      var deleted = {};
    +      var treeDataOptions = store.getTreeOptions();
    --- End diff --
    
    with flux you should get them using `getInitialState ` - example: https://github.com/apache/couchdb-fauxton/blob/master/app/addons/databases/components.react.jsx#L29-L38
    
    you can then access it in render using `this.state` - example: https://github.com/apache/couchdb-fauxton/blob/master/app/addons/databases/components.react.jsx#L53
    
    the construction of the elements should also happen in render


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r29987429
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,330 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +  ], function(app,FauxtonAPI, React,Stores){
    +
    +    var store = Stores.revTreeStore;
    +
    +    var lineObjs = [];
    +    var nodeObjs = [];
    +    var textObjs = [];
    +
    +    var grid = 100;
    +    var scale = 7;
    +    var r = 15;
    +
    +    var LinesBox = React.createClass({
    +      render: function(){
    +        return (
    +          <g>
    +            {
    +              this.props.data.map(function (element, i) {
    +                return <Line key={i} data={element}/>;
    +              })
    +            }
    +          </g>
    +          );
    +      }
    +    });
    +
    +    var CirclesBox = React.createClass({
    +
    +      render: function(){
    +        return (
    +          <g>
    +            {
    +              this.props.data.map(function (element, i){
    +                return <Circle key={i} data={element}/>;
    +              })
    +            }
    +          </g>
    +          );
    +      }
    +    });
    +
    +    var Circle = React.createClass({
    +      render: function(){
    +        var cx = this.props.data.x;
    +        var cy = this.props.data.y;
    +        var radius = r;
    +        var classVal = this.props.data.class;
    +
    +        return (
    +          <circle cx={cx} cy={cy} r={radius} className={classVal}>{this.props.children}</circle>
    +          );
    +      }
    +    });
    +
    +    var Line = React.createClass({
    +      render: function(){
    +        var x1 = this.props.data.x;
    +        var y1 = this.props.data.y;
    +        var x2 = this.props.data.nextX;
    +        var y2 = this.props.data.nextY;
    +
    +        return (
    +          <line x1={x1} y1={y1} x2={x2} y2={y2}>{this.props.children}</line>
    +          );
    +      }
    +    });
    +
    +    var TextsBox = React.createClass({
    +      render: function(){
    +        return (
    +          <g>{this.props.children}</g>
    +          );
    +      }
    +    });
    +
    +    var SVGComponent = React.createClass({
    +      render: function() {
    +        return (
    +         <svg height="500" width="500">{this.props.children}
    +         </svg>
    +         );
    +      }
    +    });
    +
    +    var Box = React.createClass({
    +      render: function(){
    +        return (
    +          <div className = "visualizeRevTree">
    +            {this.props.children}
    +          </div>
    +          );
    +      }
    +    });
    +
    +    var Text = React.createClass({
    +      render: function(){
    +
    +        var styleVals = {
    +          left: this.props.data.stLeft,
    +          top: this.props.data.stTop
    +        };
    +
    +        return (
    +            <div className = "box" style={styleVals} short={this.props.data.short} long={this.props.data.long}>
    +              <p>{this.props.data.short}</p>
    +              {this.props.children}
    +            </div>
    +          );
    +      }
    +    });
    +
    +
    +    var draw = function(paths, deleted, winner, minUniq){
    +      var maxX = grid;
    +      var maxY = grid;
    +        var levelCount = []; // numer of nodes on some level (pos)
    +
    +        var map = {}; // map from rev to position
    +
    +        function drawPath(path) {
    +          for (var i = 0; i < path.length; i++) {
    +            var rev = path[i];
    +            var isLeaf = i === 0;
    +            var pos = +rev.split('-')[0];
    +
    +            if (!levelCount[pos]) {
    +              levelCount[pos] = 1;
    +            }
    +            var x = levelCount[pos] * grid;
    +            var y = pos * grid;
    +
    +            if (!isLeaf) {
    +              var nextRev = path[i-1];
    +              var nextX = map[nextRev][0];
    +              var nextY = map[nextRev][1];
    +
    +              if (map[rev]) {
    +                x = map[rev][0];
    +                y = map[rev][1];
    +              }
    +
    +              var lineObj = {
    +                "x" : x,
    +                "y" : y,
    +                "nextX" : nextX,
    +                "nextY" : nextY
    +              };
    +
    +              lineObjs.push(lineObj);
    +            }
    +            if (map[rev]) {
    +              break;
    +            }
    +            maxX = Math.max(x, maxX);
    +            maxY = Math.max(y, maxY);
    +            levelCount[pos]++;
    +
    +            node(x, y, rev, isLeaf, rev in deleted, rev === winner, minUniq);
    +            map[rev] = [x, y];
    +          }
    +        }
    +        paths.forEach(drawPath);
    +      };
    +
    +      var minUniqueLength = function(arr){
    +       function strCommon(a, b){
    +        if (a === b) return a.length;
    +        var i = 0;
    +        while(++i){
    +          if(a[i - 1] !== b[i - 1]) return i;
    +        }
    +      }
    +
    +      var array = arr.slice(0);
    +      var com = 1;
    +      array.sort();
    +      for (var i = 1; i < array.length; i++){
    +        com = Math.max(com, strCommon(array[i], array[i - 1]));
    +      }
    +      return com;
    +    };
    +
    +    function node(x, y, rev, isLeaf, isDeleted, isWinner, shortDescLen){
    +      circ(x, y, r, isLeaf, isDeleted, isWinner);
    +      var pos = rev.split('-')[0];
    +      var id = rev.split('-')[1];
    +      var opened = false;
    +
    +      var textObj = {
    +        "stLeft": (x-40) + "px",
    +        "stTop": (y-30) + "px",
    +        "short": pos + '-' + id.substr(0, shortDescLen),
    +        "long": pos + '-' + id
    +      };
    +
    +      textObjs.push(textObj);
    +    }
    +
    +    var circ = function(x, y, r, isLeaf, isDeleted, isWinner) {
    +
    +      var leafStat = "";
    +
    +      if (isLeaf) {
    +        leafStat = "leaf";
    +      }
    +      if (isWinner) {
    +        leafStat = "winner";
    +      }
    +      if (isDeleted) {
    +        leafStat = "deleted";
    +      }      
    +
    +      var nodeObj = {
    +        "x" : x,
    +        "y" : y,
    +        "class" : leafStat
    +      };
    +
    +      nodeObjs.push(nodeObj);
    +    };
    +
    +    var App = React.createClass({
    +      getInitialState: function() {
    +        return {
    +          lines: [],
    +          treeNodes: [],
    +          nodeTextObjs: []
    +        };
    +      },
    +
    +      componentDidMount: function() {
    +        var result = [];
    +        var paths = [];
    +        var deleted = {};
    +        var optionsVal = store.getTreeOptions();
    +        // var winner = this.props.data.winnerRev;
    +        var winner = optionsVal.winnerRev;
    +        // var url = '/'+this.props.data.db+'/'+this.props.data.docID;
    +        var url = '/'+optionsVal.db+'/'+optionsVal.docID;
    +        // var winner = this.props.data.;
    +        var minUniq = 0;
    +        $.get(app.host+url+'?open_revs=all&revs=true', function(rslt) {
    --- End diff --
    
    As discussed in the last meeting, all Ajax requests are handled via Backbone models/collections. Drop me or one or us a line if you get stuck on it - there's plenty of examples in the code (in varying degrees of complexity!)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by nadeeshaan <gi...@git.apache.org>.
Github user nadeeshaan commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30625782
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,332 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +],
    +
    +function (app, FauxtonAPI, React, Stores) {
    +
    +  var store = Stores.revTreeStore;
    +  var lineObjs = [];
    +  var nodeObjs = [];
    +  var textObjs = [];
    +  var grid = 100;
    +  var scale = 7;
    +  var r = 15;
    +
    +  var LinesBox = React.createClass({
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map(function (element, i) {
    +              return <Line key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var CirclesBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map (function (element, i) {
    +              return <Circle key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var Circle = React.createClass({
    +
    +    render: function () {
    +      var cx = this.props.data.x;
    +      var cy = this.props.data.y;
    +      var radius = r;
    --- End diff --
    
    fixed


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#issuecomment-104416541
  
    Hi Nadeeshan, I was in a meeting - sorry - you got some merge issues.
    
    I can help you tomorrow, just join IRC



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#discussion_r30515805
  
    --- Diff: app/addons/documents/revisionTree/component.react.jsx ---
    @@ -0,0 +1,332 @@
    +define([
    +  "app",
    +  "api",
    +  "react",
    +  'addons/documents/revisionTree/stores',
    +  'addons/documents/revisionTree/actions',
    +],
    +
    +function (app, FauxtonAPI, React, Stores) {
    +
    +  var store = Stores.revTreeStore;
    +  var lineObjs = [];
    +  var nodeObjs = [];
    +  var textObjs = [];
    +  var grid = 100;
    +  var scale = 7;
    +  var r = 15;
    +
    +  var LinesBox = React.createClass({
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map(function (element, i) {
    +              return <Line key={i} data={element}/>;
    +            })
    +          }
    +        </g>
    +      );
    +    }
    +  });
    +
    +  var CirclesBox = React.createClass({
    +
    +    render: function () {
    +      return (
    +        <g>
    +          {
    +            this.props.data.map (function (element, i) {
    +              return <Circle key={i} data={element}/>;
    +            })
    --- End diff --
    
    missing semicolon


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub

Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on the pull request:

    https://github.com/apache/couchdb-fauxton/pull/401#issuecomment-104231722
  
    cool! you also have to rebase against master and solve the conflict
    
    ping us on irc if you have questions regarding that


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---