Proposal for a browser-only ddoc user interface
Hi everyone, On marketing@ list we started a discussion which led to a proposal for a ddoc ui, in order to free early adopters to install and configure some couchapp deployment tool suitable for his own environment. @ermouth proposed to put his json-editor directly into a couchapp or better directly inside futon or fauxton. http://cloudwall.me/etc/json-editor.html What do you think about it? IMHO ermouth tool goes in the simplicity always win direction. It allows to create/modify a json(and so a ddoc) with intuitive ui and has support for attachments too, which should be all the pieces needed to create any kind of ddoc. I'm worried that maybe creating an alternative, even if easier-to-use editor for beginners, could limit flexibility for skilled devs. Explaining its use to app devs, would then only be a matter of creating concrete examples/tutorials, targeting different skill levels, explaining how and which ddoc fields to fill in for different type of couchapps. @ermouth: Which limitations you think your editor could have for ddoc creation? It's also true that I'm still idle to fauxton 1.6.1 version, I don't know what has changed since then. To be aware of it, is there a running online demo of the latest fauxton version? Best regards, -- Giovanni Lenzi www.smileupps.com Smileupps Cloud App Store
Re: Ideas for improving ddocs performance ??
One idea was already discussed on ML, IRC and pretty trivial: provide cache-friendly show/list functions with deterministic output. Mostly, could be solved by using stateless template engine like mustache on server side and side-effect less logic. The results could be cached on disk as like as views ones does and all show/list requests are turns into building and serving static content from disk. Another is to improve communication with query server, thought, it's less trivial than the former one. -- ,,,^..^,,, On Fri, May 8, 2015 at 6:48 PM, Giovanni Lenzi g.le...@smileupps.com wrote: Hi everyone, on the marketing@ list has emerged the need for improving ddocs performance. @ermouth said: Also couchapps generally have very poor perfomance – because json serialization/deserialization while transmitting data from map to _list and _show functions is slow. What do you think are ddocs performance bottlenecks and is there a way to fix them? -- Giovanni Lenzi www.smileupps.com Smileupps Cloud App Store
CouchDB secure even withouth a proxy
Hi everyone, I would like to write down some ideas I had, because there is high probability I'm going to forgot them soon :) This idea targets a secure use of CouchDB, even when you don't have a proxy in front of it. Given that: 1. the main security concern in the past was related to accessing couchdb root directly, which allowed access to _all_docs, _changes, _all_dbs or others global and db handlers 2. ddocs rewriting rules can be used fairly well to implement security, selectively preventing access to any kind of handler I am asking myself if, in the event the developer wants to access his instance through a vhost/url rewriting document, is it possible to prevent any request with a wrong header? Where wrong header could be translated both in host header not specified or specified header is not included in vhost configuration section Maybe a default vhost path variable (initially defaulting to / or empty) could be used as default url rewriting document path in case of wrong Host headers? Will this address the purpose above? Is it possible to implement? -- Giovanni Lenzi www.smileupps.com Smileupps Cloud App Store
[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 nadeeshaangunasin...@gmail.com Date: 2015-05-04T14:04:05Z Moved to a new folder commit 6d8ccdaf9f7392da2c80b9ddaf0ef54a1af9ceda Author: Nadeeshaan nadeeshaangunasin...@gmail.com Date: 2015-05-04T14:14:27Z Added the style reference commit 865d00e40df3b6278bc74c42c09a0e3d111de3c1 Author: Nadeeshaan nadeeshaangunasin...@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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
Ideas for improving ddocs performance ??
Hi everyone, on the marketing@ list has emerged the need for improving ddocs performance. @ermouth said: Also couchapps generally have very poor perfomance – because json serialization/deserialization while transmitting data from map to _list and _show functions is slow. What do you think are ddocs performance bottlenecks and is there a way to fix them? -- Giovanni Lenzi www.smileupps.com Smileupps Cloud App Store
Re: Proposal for a browser-only ddoc user interface
On Fri, May 8, 2015 at 6:36 PM, Giovanni Lenzi g.le...@smileupps.com wrote: It's also true that I'm still idle to fauxton 1.6.1 version, I don't know what has changed since then. To be aware of it, is there a running online demo of the latest fauxton version? try: npm install fauxton - a bit experimental for now, but will bring you latest fauxton. Also, you can build it from sources and push as couchapp or make static files and replace upstream version with them. -- ,,,^..^,,,
Implementing security at url rewriting level, to allow secure use of views withouth list
Hi everyone, I would like to write down some ideas I had, because there is high probability I'm going to forgot them soon :) This idea targets a way to implement server-side security by using views only, instead of view+list. If possible, It may open up a wide range of new possibilities for app devs. Given that views know nothing about userCtx, is it possible to enhance the _rewrite engine to create/overwrite a reserved dynamic variable, named :userCtxName with the value of userCtx.name? This variable could then be effectively used within the to or query rewriting rule attributes, as example, to perform read ACL at view level directly. More generally the question is: can _rewrite engine be improved to include userCtx concepts? Which could be the drawbacks? Ok, ideas finished. I won't bother you anymore. :) -- Giovanni Lenzi www.smileupps.com Smileupps Cloud App Store
[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub
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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-chttpd pull request: Escape database name on posts to _rep...
Github user kxepal commented on a diff in the pull request: https://github.com/apache/couchdb-chttpd/pull/35#discussion_r29967748 --- Diff: src/chttpd.erl --- @@ -315,9 +315,13 @@ replication_uri(Type, PostProps) - {Props} - couch_util:get_value(url, Props); Else - -Else +escape_dbname(Else) end. +escape_dbname(DbName) - +re:replace(DbName, /, %2f, [global, {return, binary}]). --- End diff -- Why not to use `chttpd:quote` 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-chttpd pull request: Escape database name on posts to _rep...
Github user kxepal commented on the pull request: https://github.com/apache/couchdb-chttpd/pull/35#issuecomment-100331205 It would be also good to have some test on this. Again, this issue was found by third party project. --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-chttpd pull request: Escape database name on posts to _rep...
GitHub user iilyak opened a pull request: https://github.com/apache/couchdb-chttpd/pull/35 Escape database name on posts to _replicate Currently we convert local references of source/target specified in JSON body into URLs. This commit escapes database name. So slashes in name could be used. COUCHDB-2666 You can merge this pull request into a Git repository by running: $ git pull https://github.com/iilyak/couchdb-chttpd 2666-dbname-escape-for-replication Alternatively you can review and apply these changes as the patch at: https://github.com/apache/couchdb-chttpd/pull/35.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 #35 commit 1f748170a1273a00faebdb912c94ad5120e98f59 Author: ILYA Khlopotov iil...@ca.ibm.com Date: 2015-05-08T18:41:10Z Escape database name on posts to _replicate Currently we convert local references of source/target specified in JSON body into URLs. This commit escapes database name. So slashes in name could be used. COUCHDB-2666 --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
Hey
http://travelteamlk.com/we/
Re: Configuration in CouchDB 2.0
Related: _config not being available on the front-cluster http interface is also confusing - I did not expect that when making the PR :( See https://issues.apache.org/jira/browse/COUCHDB-2683 We will remove the config tab from Fauxton but everyone will try curl if the tab is not in Fauxton anymore. On Thu, Apr 23, 2015 at 7:48 PM, Alexander Shorin kxe...@gmail.com wrote: On Thu, Apr 23, 2015 at 8:42 PM, Robert Kowalski r...@kowalski.gd wrote: In fact I am reporting this issue right now in this thread. I also reported it yesterday in the meeting and was asked to write to the ML. It is not really a bug, like a runtime exception that I am reporting. The errors I describe are originating from the misuse of _config and the resulting issues look like bugs to users and cause a lot of confusion. I was hope to get some stacktraces and logs from you about these errors (; The intention of my mail is to get feedback on atomic config changes (e.g. a token ring). At least for me this issue is a blocker for Couch 2.0 after my recent experiences where I had help a colleague. I'm not familiar with token-ring idea, but let's roll an implementation proposal, gather feedback, brainstorm it and make it real (: -- ,,,^..^,,,
Re: Configuration in CouchDB 2.0
On Sat, May 9, 2015 at 2:18 AM, Robert Kowalski r...@kowalski.gd wrote: Related: _config not being available on the front-cluster http interface is also confusing - I did not expect that when making the PR :( See https://issues.apache.org/jira/browse/COUCHDB-2683 We will remove the config tab from Fauxton but everyone will try curl if the tab is not in Fauxton anymore. This is a broken user experience ): There is no other way now as to explain every user that /_config isn't available anymore for cluster interface. We just need to fix that problem. I have it in my list to think and work on for this month. -- ,,,^..^,,,
[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub
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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub
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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub
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: #FF} +.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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub
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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub
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]; + } +} +
[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub
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]; + } +} +
[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub
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]; + } +} +
[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub
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]; + } +} +
[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub
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]; + } +} +
[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub
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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-fauxton pull request: Gsoc2015 moving to sub
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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---