You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by de...@apache.org on 2013/09/09 15:19:11 UTC
[01/10] git commit: updated refs/heads/1807-Replication to 38970f1
Updated Branches:
refs/heads/1807-Replication 80a5e6efc -> 38970f1d1 (forced update)
Fixes Active Tasks text size and bottom scrollbar issue with windowResize
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/555c061e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/555c061e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/555c061e
Branch: refs/heads/1807-Replication
Commit: 555c061e3c9882d5618bb7c2f60f7491073ab965
Parents: 473847d
Author: suelockwood <de...@gmail.com>
Authored: Thu Sep 5 14:26:48 2013 -0400
Committer: suelockwood <de...@gmail.com>
Committed: Thu Sep 5 14:26:48 2013 -0400
----------------------------------------------------------------------
src/fauxton/app/addons/activetasks/assets/less/activetasks.less | 2 +-
src/fauxton/app/resizeColumns.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/555c061e/src/fauxton/app/addons/activetasks/assets/less/activetasks.less
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/activetasks/assets/less/activetasks.less b/src/fauxton/app/addons/activetasks/assets/less/activetasks.less
index 5ba394f..695799d 100644
--- a/src/fauxton/app/addons/activetasks/assets/less/activetasks.less
+++ b/src/fauxton/app/addons/activetasks/assets/less/activetasks.less
@@ -2,5 +2,5 @@
cursor: pointer;
}
table.active-tasks{
- font-size: 12px;
+ font-size: 16px;
}
http://git-wip-us.apache.org/repos/asf/couchdb/blob/555c061e/src/fauxton/app/resizeColumns.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/resizeColumns.js b/src/fauxton/app/resizeColumns.js
index 687b9d3..9cf7115 100644
--- a/src/fauxton/app/resizeColumns.js
+++ b/src/fauxton/app/resizeColumns.js
@@ -30,7 +30,7 @@ function(mixins) {
Resize.prototype = {
getPrimaryNavWidth: function(){
- var primaryNavWidth = $('body').hasClass('closeMenu')? 66:220;
+ var primaryNavWidth = $('body').hasClass('closeMenu')? 64:224;
return primaryNavWidth;
},
getPanelWidth: function(){
[10/10] git commit: updated refs/heads/1807-Replication to 38970f1
Posted by de...@apache.org.
fixing CSS overrides on the form
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/38970f1d
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/38970f1d
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/38970f1d
Branch: refs/heads/1807-Replication
Commit: 38970f1d108ca545776b03f375c7c2da33cab402
Parents: 15ac934
Author: suelockwood <de...@gmail.com>
Authored: Thu Sep 5 09:55:41 2013 -0400
Committer: suelockwood <de...@gmail.com>
Committed: Fri Sep 6 14:20:11 2013 -0400
----------------------------------------------------------------------
src/fauxton/app/addons/replication/assets/less/replication.less | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/38970f1d/src/fauxton/app/addons/replication/assets/less/replication.less
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/replication/assets/less/replication.less b/src/fauxton/app/addons/replication/assets/less/replication.less
index dafc086..ec3b718 100644
--- a/src/fauxton/app/addons/replication/assets/less/replication.less
+++ b/src/fauxton/app/addons/replication/assets/less/replication.less
@@ -9,8 +9,10 @@
@secondarySidebar: #E4DFDC;
-#replication {
+form#replication {
position: relative;
+ max-width: none;
+ width: auto;
.form_set{
width: 350px;
[09/10] git commit: updated refs/heads/1807-Replication to 38970f1
Posted by de...@apache.org.
Fixed Create target. Change swap to icon, added tooltips, made inputs wider.
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/15ac934f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/15ac934f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/15ac934f
Branch: refs/heads/1807-Replication
Commit: 15ac934fabbaa81f57c6bd6a3c54b96d9632f4a0
Parents: 3a6777e
Author: suelockwood <de...@gmail.com>
Authored: Mon Aug 26 12:32:37 2013 -0400
Committer: suelockwood <de...@gmail.com>
Committed: Fri Sep 6 14:20:11 2013 -0400
----------------------------------------------------------------------
.../replication/assets/less/replication.less | 82 +++++---------------
.../app/addons/replication/templates/form.html | 9 ++-
src/fauxton/app/addons/replication/views.js | 16 ++--
3 files changed, 39 insertions(+), 68 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/15ac934f/src/fauxton/app/addons/replication/assets/less/replication.less
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/replication/assets/less/replication.less b/src/fauxton/app/addons/replication/assets/less/replication.less
index fe544ea..dafc086 100644
--- a/src/fauxton/app/addons/replication/assets/less/replication.less
+++ b/src/fauxton/app/addons/replication/assets/less/replication.less
@@ -13,26 +13,27 @@
position: relative;
.form_set{
- width: 300px;
+ width: 350px;
display: inline-block;
border: 1px solid @greyBrown;
- padding: 10px;
+ padding: 15px 10px 0;
margin-bottom: 20px;
&.middle{
- width: 200px;
+ width: 100px;
border: none;
position: relative;
height: 100px;
margin: 0;
}
input, select {
- margin: 0 0 16px 35px;
+ margin: 0 0 16px 5px;
height: 40px;
+ width: 318px;
}
.btn-group{
- margin: 0 0 16px 35px;
+ margin: 0 0 16px 5px;
.btn {
- padding: 10px 30px;
+ padding: 10px 57px;
}
}
&.local{
@@ -101,11 +102,9 @@
min-width: 130px;
padding-left: 0px;
}
- input[type=text],
input[type=radio],
- input[type=checkbox],
- select {
-
+ input[type=checkbox]{
+ margin: 0 0 2px 0;
}
}
@@ -113,7 +112,7 @@
z-index: 0;
position: absolute;
top: 20px;
- left: 63px;
+ left: 15px;
&:after {
width: 70px;
@@ -129,56 +128,17 @@
}
}
.swap {
- z-index: 30;
- cursor: pointer;
- position: absolute;
- font-size: 12px;
- width: 27px;
- height: 12px;
- display: block;
- border-top: 3px solid @greyBrown;
- border-bottom: 3px solid @greyBrown;
- top: 50px;
- left: 84px;
- &:hover {
- border-color: #2C2C2C;
- &:before {
- bottom: -8px;
- right: 23px;
- position: absolute;
- border-right: 7px solid #2C2C2C;
- border-top: 7px solid rgba(44, 44, 44, 0);
- border-bottom: 7px solid rgba(44, 44, 44, 0);
- content: "";
- }
- &:after {
- top: -8px;
- left: 23px;
- position: absolute;
- border-left: 7px solid #2C2C2C;
- border-top: 7px solid rgba(44, 44, 44, 0);
- border-bottom: 7px solid rgba(44, 44, 44, 0);
- content: "";
- }
- }
- &:before {
- bottom: -8px;
- right: 23px;
- position: absolute;
- border-right: 7px solid @greyBrown;
- border-top: 7px solid rgba(44, 44, 44, 0);
- border-bottom: 7px solid rgba(44, 44, 44, 0);
- content: "";
-
- }
- &:after {
- top: -8px;
- left: 23px;
- position: absolute;
- border-left: 7px solid @greyBrown;
- border-top: 7px solid rgba(44, 44, 44, 0);
- border-bottom: 7px solid rgba(44, 44, 44, 0);
- content: "";
+ text-decoration: none;
+ z-index: 30;
+ cursor: pointer;
+ position: absolute;
+ font-size: 40px;
+ width: 27px;
+ height: 12px;
+ top: 31px;
+ left: 30px;
+ &:hover {
+ color: @greyBrown;
}
}
http://git-wip-us.apache.org/repos/asf/couchdb/blob/15ac934f/src/fauxton/app/addons/replication/templates/form.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/replication/templates/form.html b/src/fauxton/app/addons/replication/templates/form.html
index 2a70889..eeb3081 100644
--- a/src/fauxton/app/addons/replication/templates/form.html
+++ b/src/fauxton/app/addons/replication/templates/form.html
@@ -33,7 +33,9 @@ the License.
<div class="form_set middle">
<span class="circle "></span>
- <span class="swap">
+ <a href="#" title="Switch Target and Source" class="swap">
+ <span class="fonticon-swap-arrows"></span>
+ </a>
</span>
</div>
@@ -58,6 +60,11 @@ the License.
<input type="checkbox" name="continuous" value="true" id="continuous">
Continuous
</label>
+
+ <label for="createTarget">
+ <input type="checkbox" name="create_target" value="true" id="createTarget">
+ Create Target <i class="icon-question-sign " rel="tooltip" title="Create the target database"></i>
+ </label>
</div>
<button class="btn btn-success btn-large save" type="submit">Replicate</button>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/15ac934f/src/fauxton/app/addons/replication/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/replication/views.js b/src/fauxton/app/addons/replication/views.js
index ea87432..b2b8728 100644
--- a/src/fauxton/app/addons/replication/views.js
+++ b/src/fauxton/app/addons/replication/views.js
@@ -120,6 +120,14 @@ function(app, FauxtonAPI, replication) {
error = true;
}
}
+
+ if (this.$('input#to_name').is(':visible')){
+ var alreadyExists = this.collection.where({"name":this.$('input#to_name').val()});
+ if (alreadyExists.length === 0){
+ error = true;
+ }
+ }
+
return error;
},
serialize: function(){
@@ -166,21 +174,17 @@ function(app, FauxtonAPI, replication) {
var formJSON = {};
_.map(this.$(e.currentTarget).serializeArray(), function(formData){
if(formData.value !== ''){
- formJSON[formData.name] = (formData.value ==="true"? true: formData.value.replace(/\s/g, ''));
+ formJSON[formData.name] = (formData.value ==="true"? true: formData.value.replace(/\s/g, '').toLowerCase());
}
});
- var alreadyExists = this.collection.where({"name":$('input#to_name').val()});
-
- if (alreadyExists.length === 0){
- formJSON.create_target = true;
- }
console.log($(e.currentTarget).serializeArray(), formJSON);
this.updateButtonText(true);
this.startReplication(formJSON);
},
swapFields: function(e){
+ e.preventDefault();
//WALL O' VARIABLES
var $fromSelect = this.$('#from_name'),
$toSelect = this.$('#to_name'),
[07/10] git commit: updated refs/heads/1807-Replication to 38970f1
Posted by de...@apache.org.
Replication addon sans tests
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/a2a56978
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/a2a56978
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/a2a56978
Branch: refs/heads/1807-Replication
Commit: a2a56978b7e23c9921231a4ce4a1fa4baf7679b9
Parents: 0bc81f9
Author: suelockwood <de...@gmail.com>
Authored: Thu Aug 22 15:26:20 2013 -0400
Committer: suelockwood <de...@gmail.com>
Committed: Fri Sep 6 14:20:10 2013 -0400
----------------------------------------------------------------------
.gitignore | 1 +
.../replication/assets/less/replication.less | 129 +++++++++
src/fauxton/app/addons/replication/base.js | 24 ++
src/fauxton/app/addons/replication/resources.js | 70 +++++
src/fauxton/app/addons/replication/route.js | 47 +++
.../app/addons/replication/templates/form.html | 76 +++++
.../addons/replication/templates/progress.html | 22 ++
.../addons/replication/tests/replicationSpec.js | 28 ++
src/fauxton/app/addons/replication/views.js | 290 +++++++++++++++++++
src/fauxton/settings.json.default | 1 +
10 files changed, 688 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/a2a56978/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index a022b14..a4798c9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -91,6 +91,7 @@ src/fauxton/app/addons/*
!src/fauxton/app/addons/config
!src/fauxton/app/addons/logs
!src/fauxton/app/addons/stats
+!src/fauxton/app/addons/replication
!src/fauxton/app/addons/contribute
!src/fauxton/app/addons/auth
!src/fauxton/app/addons/exampleAuth
http://git-wip-us.apache.org/repos/asf/couchdb/blob/a2a56978/src/fauxton/app/addons/replication/assets/less/replication.less
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/replication/assets/less/replication.less b/src/fauxton/app/addons/replication/assets/less/replication.less
new file mode 100644
index 0000000..bcfdb56
--- /dev/null
+++ b/src/fauxton/app/addons/replication/assets/less/replication.less
@@ -0,0 +1,129 @@
+#replication {
+ position: relative;
+
+ .options {
+ position: relative;
+ &:after{
+ content: '';
+ display: block;
+ position: absolute;
+ right: -16px;
+ top: 9px;
+ width: 0;
+ height: 0;
+ border-left: 5px solid transparent;
+ border-right: 5px solid transparent;
+ border-bottom: 5px solid black;
+ border-top: none;
+ }
+ &.off {
+ &:after{
+ content: '';
+ display: block;
+ position: absolute;
+ right: -16px;
+ top: 9px;
+ width: 0;
+ height: 0;
+ border-left: 5px solid transparent;
+ border-right: 5px solid transparent;
+ border-bottom: none;
+ border-top: 5px solid black;
+ }
+ }
+ }
+ .control-group{
+ label{
+ float: left;
+ min-height: 30px;
+ vertical-align: top;
+ padding-right: 5px;
+ min-width: 130px;
+ }
+ input[type=text],
+ input[type=radio],
+ input[type=checkbox],
+ select {
+ margin-top: -2px;
+ }
+ }
+
+
+ .swap {
+ cursor: pointer;
+ position: absolute;
+ font-size: 12px;
+ width: 27px;
+ height: 12px;
+ display: block;
+ border-top: 3px solid #8E9292;
+ border-bottom: 3px solid #8E9292;
+ top: 20%;
+ left: 42%;
+ &:hover {
+ border-color: #2C2C2C;
+ &:before {
+ bottom: -8px;
+ right: 23px;
+ position: absolute;
+ border-right: 7px solid #2C2C2C;
+ border-top: 7px solid rgba(44, 44, 44, 0);
+ border-bottom: 7px solid rgba(44, 44, 44, 0);
+ content: "";
+ }
+ &:after {
+ top: -8px;
+ left: 23px;
+ position: absolute;
+ border-left: 7px solid #2C2C2C;
+ border-top: 7px solid rgba(44, 44, 44, 0);
+ border-bottom: 7px solid rgba(44, 44, 44, 0);
+ content: "";
+ }
+ }
+ &:before {
+ bottom: -8px;
+ right: 23px;
+ position: absolute;
+ border-right: 7px solid #8E9292;
+ border-top: 7px solid rgba(44, 44, 44, 0);
+ border-bottom: 7px solid rgba(44, 44, 44, 0);
+ content: "";
+
+ }
+ &:after {
+ top: -8px;
+ left: 23px;
+ position: absolute;
+ border-left: 7px solid #8E9292;
+ border-top: 7px solid rgba(44, 44, 44, 0);
+ border-bottom: 7px solid rgba(44, 44, 44, 0);
+ content: "";
+ }
+ }
+
+}
+#replicationStatus{
+ &.showHeader{
+ li.header{
+ display: block;
+ }
+ }
+ li.header{
+ display: none;
+ }
+ ul{
+ margin: 0;
+ li{
+ .progress,
+ p{
+ margin: 0px;
+ vertical-align: bottom;
+ }
+ padding: 10px 0 ;
+ margin: 0;
+ list-style: none;
+ border-bottom: 1px solid #e3e3e3;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/couchdb/blob/a2a56978/src/fauxton/app/addons/replication/base.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/replication/base.js b/src/fauxton/app/addons/replication/base.js
new file mode 100644
index 0000000..93965c1
--- /dev/null
+++ b/src/fauxton/app/addons/replication/base.js
@@ -0,0 +1,24 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+define([
+ "app",
+ "api",
+ "addons/replication/route"
+],
+
+function(app, FauxtonAPI, replication) {
+ replication.initialize = function() {
+ FauxtonAPI.addHeaderLink({title: "Replication", href: "#/replication", icon: "fonticon-replicate",});
+ };
+ return replication;
+});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/a2a56978/src/fauxton/app/addons/replication/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/replication/resources.js b/src/fauxton/app/addons/replication/resources.js
new file mode 100644
index 0000000..67b474a
--- /dev/null
+++ b/src/fauxton/app/addons/replication/resources.js
@@ -0,0 +1,70 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+define([
+ "app",
+ "api",
+ 'addons/activetasks/resources'
+],
+
+function (app, FauxtonAPI, ActiveTasks) {
+ var Replication = {};
+
+ //these are probably dupes from the database modules. I'm going to keep them seperate for now.
+ Replication.DBModel = Backbone.Model.extend({
+ label: function () {
+ //for autocomplete
+ return this.get("name");
+ }
+ });
+
+ Replication.DBList = Backbone.Collection.extend({
+ model: Replication.DBModel,
+ url: function() {
+ return app.host + "/_all_dbs";
+ },
+ parse: function(resp) {
+ // TODO: pagination!
+ return _.map(resp, function(database) {
+ return {
+ id: database,
+ name: database
+ };
+ });
+ }
+ });
+
+ Replication.Task = Backbone.Model.extend({});
+
+ Replication.Tasks = Backbone.Collection.extend({
+ model: Replication.Task,
+ url: function () {
+ return app.host + '/_active_tasks';
+ },
+ parse: function(resp){
+ //only want replication tasks to return
+ return _.map(resp, function(task){
+ if (task.type === "replication"){
+ return task;
+ }
+ });
+ }
+ });
+
+ Replication.Replicate = Backbone.Model.extend({
+ url: function(){
+ return app.host + "/_replicate";
+ }
+ });
+
+ return Replication;
+});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/a2a56978/src/fauxton/app/addons/replication/route.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/replication/route.js b/src/fauxton/app/addons/replication/route.js
new file mode 100644
index 0000000..4002203
--- /dev/null
+++ b/src/fauxton/app/addons/replication/route.js
@@ -0,0 +1,47 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+define([
+ "app",
+ "api",
+ "addons/replication/resources",
+ "addons/replication/views"
+],
+function(app, FauxtonAPI, Replication, Views) {
+ var RepRouteObject = FauxtonAPI.RouteObject.extend({
+ layout: "one_pane",
+ roles: ["_admin"],
+ routes: {
+ "replication": "defaultView"
+ },
+ selectedHeader: "Replication",
+ apiUrl: function() {
+ return app.host+"/_replication";
+ },
+ crumbs: [
+ {"name": "Replicate changes from: ", "link": "replication"}
+ ],
+ defaultView: function(){
+ this.databases = new Replication.DBList({});
+ this.tasks = new Replication.Tasks({id: "ReplicationTasks"}); //replace with with a call to active tasks when that is merged in
+ this.setView("#dashboard-content", new Views.ReplicationForm({
+ collection: this.databases,
+ status: this.tasks
+ }));
+ }
+ });
+
+
+ Replication.RouteObjects = [RepRouteObject];
+
+ return Replication;
+});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/a2a56978/src/fauxton/app/addons/replication/templates/form.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/replication/templates/form.html b/src/fauxton/app/addons/replication/templates/form.html
new file mode 100644
index 0000000..c1711b5
--- /dev/null
+++ b/src/fauxton/app/addons/replication/templates/form.html
@@ -0,0 +1,76 @@
+<!--
+Licensed under the Apache License, Version 2.0 (the "License"); you may not
+use this file except in compliance with the License. You may obtain a copy of
+the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+License for the specific language governing permissions and limitations under
+the License.
+-->
+
+<form id="replication" class="form-horizontal">
+ <div class="row">
+ <div class="span5 from form_set">
+ <div class="control-group from_local">
+ <label for="from_local">
+ <input type="radio" id="from_local" name="from_type" value="local" checked="" class="setType">
+ Local database:
+ </label>
+ <select id="from_name" name="source">
+ <% _.each( databases, function( db, i ){ %>
+ <option value="<%=db.name%>"><%=db.name%></option>
+ <% }); %>
+ </select>
+ </div>
+
+ <div class="control-group from_to_remote">
+ <label for="from_to_remote">
+ <input type="radio" id="from_to_remote" name="from_type" value="remote" class="setType">
+ Remote database:
+ </label>
+ <input type="text" id="from_url" name="source" size="30" value="http://" disabled="true">
+ </div>
+ </div>
+
+
+ <div class="span2">
+ <span class="swap">
+ </span>
+ </div>
+
+ <div class="to form_set span5">
+ <div class="to_local control-group">
+ <label for="to_local">
+ <input type="radio" id="to_local" name="to_type" value="local" checked="" class="setType">
+ Local database:
+ </label>
+ <input type="text" id="to_name" name="target" size="30">
+ </div>
+
+ <div class="to_remote control-group">
+ <label for="to_remote">
+ <input type="radio" id="to_remote" name="to_type" value="remote" class="setType">
+ Remote database:
+ </label>
+ <input type="text" id="to_url" name="target" size="30" value="http://" disabled="true">
+ </div>
+ </div>
+ </div>
+
+ <div class="actions">
+ <div class="control-group">
+ <label for="continuous">
+ <input type="checkbox" name="continuous" value="continuous" id="continuous">
+ Continuous
+ </label>
+ </div>
+
+ <button class="btn btn-success btn-large save" type="submit">Replicate</button>
+ </div>
+</form>
+
+<div id="replicationStatus"></div>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/a2a56978/src/fauxton/app/addons/replication/templates/progress.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/replication/templates/progress.html b/src/fauxton/app/addons/replication/templates/progress.html
new file mode 100644
index 0000000..d93db68
--- /dev/null
+++ b/src/fauxton/app/addons/replication/templates/progress.html
@@ -0,0 +1,22 @@
+<!--
+Licensed under the Apache License, Version 2.0 (the "License"); you may not
+use this file except in compliance with the License. You may obtain a copy of
+the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+License for the specific language governing permissions and limitations under
+the License.
+-->
+<p class="span6">Replicating <%=source%> to <%=target%>. Please wait... :)</p>
+
+<div class="span5 progress progress-striped active">
+ <div class="bar" style="width: <%=progress || 0%>%;"><%=progress || "0"%>%</div>
+</div>
+
+<span class="span1">
+ <button class="cancel btn btn-danger btn-large delete" data-source="<%=source%>" data-rep-id="<%=repid%>" data-continuous="<%=continuous%>" data-target="<%=target%>">Cancel</a>
+</span>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/a2a56978/src/fauxton/app/addons/replication/tests/replicationSpec.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/replication/tests/replicationSpec.js b/src/fauxton/app/addons/replication/tests/replicationSpec.js
new file mode 100644
index 0000000..788b082
--- /dev/null
+++ b/src/fauxton/app/addons/replication/tests/replicationSpec.js
@@ -0,0 +1,28 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+define([
+ 'addons/replication/base',
+ 'chai'
+], function (Replication, chai) {
+ var expect = chai.expect;
+
+ describe('Replication Addon', function(){
+
+ describe('Replication DBList Collection', function () {
+ var rep;
+
+ beforeEach(function () {
+ rep = new rep.DBList(["foo","bar","baz","bo"]);
+ });
+ });
+ });
+});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/a2a56978/src/fauxton/app/addons/replication/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/replication/views.js b/src/fauxton/app/addons/replication/views.js
new file mode 100644
index 0000000..30c642f
--- /dev/null
+++ b/src/fauxton/app/addons/replication/views.js
@@ -0,0 +1,290 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+define([
+ "app",
+ "api",
+ "addons/replication/resources"
+],
+function(app, FauxtonAPI, replication) {
+ var View = {},
+ Events ={},
+ pollingInfo ={
+ rate: 5,
+ intervalId: null
+ };
+
+ _.extend(Events, Backbone.Events);
+
+// NOTES: http://wiki.apache.org/couchdb/Replication
+
+// Replication form view is huge
+// -----------------------------------
+// afterRender: autocomplete on the target input field
+// beforeRender: add the status table
+// disableFields: disable non active fields on submit
+// enableFields: enable field when radio btns are clicked
+// establish: get the DB list for autocomplete
+// formValidation: make sure fields aren't empty
+// showProgress: make a call to active_tasks model and show only replication types. Poll every 5 seconds. (make this it's own view)
+// startReplication: saves to the model, starts replication
+// submit: form submit handler
+// swapFields: change to and from target
+// toggleAdvancedOptions: toggle advanced
+
+ View.ReplicationForm = FauxtonAPI.View.extend({
+ template: "addons/replication/templates/form",
+ events: {
+ "submit #replication": "submit",
+ "click input[type=radio]": "enableFields",
+ "click .swap": "swapFields",
+ "click .options": "toggleAdvancedOptions"
+ },
+ initialize: function(){
+ this.status = this.options.status;
+ this.newRepModel = new replication.Replicate({});
+ },
+ afterRender: function(){
+ var dbLimit = 30;
+ var ajaxReq;
+ //re-using what we have on DB search
+ this.$el.find("input#to_name").typeahead({
+ source: function(query, process) {
+ var url = [
+ app.host,
+ "/_all_dbs?startkey=%22",
+ query,
+ "%22&endkey=%22",
+ query,
+ "\u9999%22&limit=",
+ dbLimit
+ ].join('');
+ if (ajaxReq) ajaxReq.abort();
+ ajaxReq = $.ajax({
+ url: url,
+ dataType: 'json',
+ success: function(data) {
+ process(data);
+ }
+ });
+ }
+ });
+
+ },
+
+ beforeRender: function(){
+ this.insertView("#replicationStatus", new View.ReplicationList({
+ collection: this.status
+ }));
+ },
+ cleanup: function(){
+ clearInterval(pollingInfo.intervalId);
+ },
+ disableFields: function(){
+ this.$('input[type=radio]').attr('disabled',true);
+ this.$('.advancedOptions:hidden').find('input').attr('disabled',true);
+ },
+
+ enableFields: function(e){
+ var $currentTarget = this.$(e.currentTarget);
+ $currentTarget.parents(".form_set").find('input[type="text"], select').attr('disabled','true').addClass('disabled');
+ $currentTarget.parents('.control-group').find('input[type="text"], select').removeAttr('disabled').removeClass('disabled');
+ },
+ establish: function(){
+ return [ this.collection.fetch(), this.status.fetch()];
+ },
+
+ formValidation: function(){
+ var $remote = this.$el.find("[value='remote']:checked").parents('.control-group').find('input[type=text]'),
+ error = false;
+ for(var i=0; i<$remote.length; i++){
+ if ($remote[i].value =="http://" || $remote[i].value ==" "){
+ error = true;
+ }
+ }
+ return error;
+ },
+ serialize: function(){
+ return {
+ databases: this.collection.toJSON()
+ };
+ },
+ startReplication: function(json){
+ var that = this;
+ this.newRepModel.save(json,{
+ success: function(resp){
+ var notification = FauxtonAPI.addNotification({
+ msg: "Replication from "+resp.get('source')+" to "+ resp.get('target')+" has begun.",
+ type: "success",
+ clear: true
+ });
+ that.updateButtonText(false);
+ Events.trigger('update:tasks');
+ },
+ error: function(model, xhr, options){
+ var errorMessage = JSON.parse(xhr.responseText);
+ var notification = FauxtonAPI.addNotification({
+ msg: errorMessage.reason,
+ type: "error",
+ clear: true
+ });
+ that.updateButtonText(false);
+ }
+ });
+ },
+ updateButtonText: function(wait){
+ var $button = this.$('#replication button[type=submit]');
+ if(wait){
+ $button.text('Starting replication...').attr('disabled', true);
+ } else {
+ $button.text('Replication').attr('disabled', false);
+ }
+ },
+ submit: function(e){
+ e.preventDefault();
+ this.disableFields(); //disable fields not relevant to submitting
+
+ var formJSON = {};
+ _.map(this.$(e.currentTarget).serializeArray(), function(formData){
+ if(formData.value !== ''){
+ formJSON[formData.name] = formData.value;
+ }
+ });
+
+ var alreadyExists = this.collection.where({"name":$('input#to_name').val()});
+
+ if (alreadyExists.length === 0){
+ formJSON.create_target = true;
+ }
+ console.log($(e.currentTarget).serializeArray(), formJSON);
+ this.updateButtonText(true);
+ this.startReplication(formJSON);
+ },
+ swapFields: function(e){
+ //WALL O' VARIABLES
+ var $fromSelect = this.$('#from_name'),
+ $toSelect = this.$('#to_name'),
+ $toInput = this.$('#to_url'),
+ $fromInput = this.$('#from_url'),
+ fromSelectVal = $fromSelect.val(),
+ fromInputVal = $fromInput.val(),
+ toSelectVal = $toSelect.val(),
+ toInputVal = $toInput.val();
+
+ $fromSelect.val(toSelectVal);
+ $toSelect.val(fromSelectVal);
+
+ $fromInput.val(toInputVal);
+ $toInput.val(fromInputVal);
+ }
+ });
+
+
+View.ReplicationList = FauxtonAPI.View.extend({
+ tagName: "ul",
+ initialize: function(){
+ Events.bind('update:tasks', this.establish, this);
+ this.listenTo(this.collection, "reset", this.render);
+ this.$el.prepend("<li class='header'><h2>Active Replication Tasks</h2></li>");
+ },
+ establish: function(){
+ return [this.collection.fetch({reset: true})];
+ },
+ setPolling: function(){
+ var that = this;
+ this.cleanup();
+ pollingInfo.intervalId = setInterval(function() {
+ that.establish();
+ }, pollingInfo.rate*1000);
+ },
+ cleanup: function(){
+ clearInterval(pollingInfo.intervalId);
+ },
+ beforeRender: function(){
+ var that = this;
+ this.collection.forEach(function(item) {
+ this.insertView(new View.replicationItem({
+ model: item
+ }));
+ }, this);
+ },
+ showHeader: function(){
+ if (this.collection.length > 0){
+ this.$el.parent().addClass('showHeader');
+ } else {
+ this.$el.parent().removeClass('showHeader');
+ }
+ },
+ afterRender: function(){
+ this.showHeader();
+ this.setPolling();
+ }
+});
+
+ //make this a table row item.
+ View.replicationItem = FauxtonAPI.View.extend({
+ tagName: "li",
+ className: "row",
+ template: "addons/replication/templates/progress",
+ events: {
+ "click .cancel": "cancelReplication"
+ },
+ initialize: function(){
+ this.newRepModel = new replication.Replicate({});
+ },
+ establish: function(){
+ return [this.model.fetch()];
+ },
+ cancelReplication: function(e){
+ //need to pass "cancel": true with source & target
+ var $currentTarget = $(e.currentTarget),
+ repID = $currentTarget.attr('data-rep-id');
+ this.newRepModel.save({
+ "replication_id": repID,
+ "cancel": true
+ },
+ {
+ success: function(model, xhr, options){
+ var notification = FauxtonAPI.addNotification({
+ msg: "Replication stopped.",
+ type: "success",
+ clear: true
+ });
+ },
+ error: function(model, xhr, options){
+ var errorMessage = JSON.parse(xhr.responseText);
+ var notification = FauxtonAPI.addNotification({
+ msg: errorMessage.reason,
+ type: "error",
+ clear: true
+ });
+ }
+ });
+ },
+ afterRender: function(){
+ if (this.model.get('continuous')){
+ this.$el.addClass('continuous');
+ }
+ },
+ serialize: function(){
+ return {
+ progress: this.model.get('progress'),
+ target: this.model.get('target'),
+ source: this.model.get('source'),
+ continuous: this.model.get('continuous'),
+ repid: this.model.get('replication_id')
+ };
+ }
+ });
+
+ return View;
+});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/a2a56978/src/fauxton/settings.json.default
----------------------------------------------------------------------
diff --git a/src/fauxton/settings.json.default b/src/fauxton/settings.json.default
index 2b7fe89..81cb4cb 100644
--- a/src/fauxton/settings.json.default
+++ b/src/fauxton/settings.json.default
@@ -4,6 +4,7 @@
{ "name": "config" },
{ "name": "logs" },
{ "name": "stats" },
+ { "name": "replication" },
{ "name": "contribute" },
{ "name": "auth" }
],
[04/10] git commit: updated refs/heads/1807-Replication to 38970f1
Posted by de...@apache.org.
Fixing cases of resize collumns to use the generic selectors
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/4eb2a38f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/4eb2a38f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/4eb2a38f
Branch: refs/heads/1807-Replication
Commit: 4eb2a38f28859bdfef8c7dd97a6456db708b48d7
Parents: 98dfd62
Author: suelockwood <de...@gmail.com>
Authored: Fri Sep 6 10:51:15 2013 -0400
Committer: suelockwood <de...@gmail.com>
Committed: Fri Sep 6 10:51:15 2013 -0400
----------------------------------------------------------------------
src/fauxton/app/modules/documents/views.js | 5 -----
src/fauxton/app/modules/fauxton/base.js | 4 +---
src/fauxton/app/templates/documents/view_editor.html | 2 +-
src/fauxton/app/templates/layouts/with_tabs_sidebar.html | 2 +-
4 files changed, 3 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/4eb2a38f/src/fauxton/app/modules/documents/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/documents/views.js b/src/fauxton/app/modules/documents/views.js
index 8f9af49..6b63c15 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -1192,11 +1192,6 @@ function(app, FauxtonAPI, Documents, pouchdb, Codemirror, JSHint, resizeColumns)
afterRender: function() {
- //resizeAnimation
- app.resizeColumns = new resizeColumns({
- selectorElements: '#dashboard-content, #dashboard-upper-menu, #db-views-tabs-nav'
- });
- app.resizeColumns.onResizeHandler();
var that = this,
mapFun = this.$("#map-function"),
http://git-wip-us.apache.org/repos/asf/couchdb/blob/4eb2a38f/src/fauxton/app/modules/fauxton/base.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/fauxton/base.js b/src/fauxton/app/modules/fauxton/base.js
index 0b11849..8fa40fa 100644
--- a/src/fauxton/app/modules/fauxton/base.js
+++ b/src/fauxton/app/modules/fauxton/base.js
@@ -22,9 +22,7 @@ function(app, Backbone, resizeColumns) {
//resizeAnimation
- app.resizeColumns = new resizeColumns({
- selectorElements: '#dashboard-content, #dashboard-upper-menu'
- });
+ app.resizeColumns = new resizeColumns({});
app.resizeColumns.onResizeHandler();
var Fauxton = app.module();
http://git-wip-us.apache.org/repos/asf/couchdb/blob/4eb2a38f/src/fauxton/app/templates/documents/view_editor.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/documents/view_editor.html b/src/fauxton/app/templates/documents/view_editor.html
index 9aaa503..13b92b1 100644
--- a/src/fauxton/app/templates/documents/view_editor.html
+++ b/src/fauxton/app/templates/documents/view_editor.html
@@ -12,7 +12,7 @@ License for the specific language governing permissions and limitations under
the License.
-->
<div class="row">
- <ul class="nav nav-tabs" id="db-views-tabs-nav">
+ <ul class="nav nav-tabs window-resizeable" id="db-views-tabs-nav">
<li class="active"> <a class="fonticon-wrench fonticon" data-toggle="tab" href="#index"><% if (newView) { %>Create Index <% } else { %>Edit Index <% } %></a></li>
<li><a class="fonticon-plus fonticon" href="#query" data-toggle="tab">Advanced Options</a></li>
<li><a href="#metadata" data-toggle="tab">Design Doc Metadata</a></li>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/4eb2a38f/src/fauxton/app/templates/layouts/with_tabs_sidebar.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/layouts/with_tabs_sidebar.html b/src/fauxton/app/templates/layouts/with_tabs_sidebar.html
index 69d723b..d4efc8d 100644
--- a/src/fauxton/app/templates/layouts/with_tabs_sidebar.html
+++ b/src/fauxton/app/templates/layouts/with_tabs_sidebar.html
@@ -29,7 +29,7 @@ the License.
<section id="dashboard-content" class="list pull-right window-resizeable">
<div class="inner">
- <div id="dashboard-upper-menu"></div>
+ <div id="dashboard-upper-menu" class="window-resizeable"></div>
<div id="dashboard-upper-content"></div>
<div id="dashboard-lower-content"></div>
[02/10] git commit: updated refs/heads/1807-Replication to 38970f1
Posted by de...@apache.org.
Fixing PrettyPrint issue on _changes
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/04716fc7
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/04716fc7
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/04716fc7
Branch: refs/heads/1807-Replication
Commit: 04716fc7e2c43ff7decf63facd69e07fc9ae476c
Parents: 555c061
Author: suelockwood <de...@gmail.com>
Authored: Thu Sep 5 15:21:43 2013 -0400
Committer: suelockwood <de...@gmail.com>
Committed: Thu Sep 5 15:21:43 2013 -0400
----------------------------------------------------------------------
src/fauxton/app/templates/documents/changes.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/04716fc7/src/fauxton/app/templates/documents/changes.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/documents/changes.html b/src/fauxton/app/templates/documents/changes.html
index e528a1c..5a29644 100644
--- a/src/fauxton/app/templates/documents/changes.html
+++ b/src/fauxton/app/templates/documents/changes.html
@@ -29,7 +29,7 @@ the License.
<td> <a href="#<%= database.url('app') %>/<%= change.id %>"><%= change.id %></a> </td>
<% } %>
<td>
- <pre class="prettyprint"> <%= JSON.stringify({changes: change.changes, doc: change.doc}, null, " ") %> </pre>
+ <pre class="prettyprint"> <%- JSON.stringify({changes: change.changes, doc: change.doc}, null, " ") %> </pre>
</td>
<td><%= change.deleted ? "true" : "false" %></td>
</tr>
[06/10] git commit: updated refs/heads/1807-Replication to 38970f1
Posted by de...@apache.org.
Fix order of action buttons in the editor
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/0bc81f93
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/0bc81f93
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/0bc81f93
Branch: refs/heads/1807-Replication
Commit: 0bc81f93430153b678d4484371263de8b504b0a6
Parents: 8c8e5a4
Author: suelockwood <de...@gmail.com>
Authored: Fri Sep 6 14:19:39 2013 -0400
Committer: suelockwood <de...@gmail.com>
Committed: Fri Sep 6 14:19:39 2013 -0400
----------------------------------------------------------------------
src/fauxton/app/modules/documents/views.js | 127 +++++++++----------
src/fauxton/app/templates/documents/doc.html | 15 ++-
.../documents/doc_field_editor_tabs.html | 15 +--
src/fauxton/assets/less/database.less | 9 ++
4 files changed, 85 insertions(+), 81 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0bc81f93/src/fauxton/app/modules/documents/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/documents/views.js b/src/fauxton/app/modules/documents/views.js
index 805116e..83e1e8f 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -298,71 +298,7 @@ function(app, FauxtonAPI, Documents, pouchdb, Codemirror, JSHint, resizeColumns)
},
events: {
- "click button.delete": "destroy",
- "click button.duplicate": "duplicate",
- "click button.upload": "upload"
- },
-
- destroy: function(event) {
- if (this.model.isNewDoc()) {
- FauxtonAPI.addNotification({
- msg: 'This document has not been saved yet.',
- type: 'warning'
- });
- return;
- }
-
- if (!window.confirm("Are you sure you want to delete this doc?")) {
- return false;
- }
-
- var database = this.model.database;
-
- this.model.destroy().then(function(resp) {
- FauxtonAPI.addNotification({
- msg: "Succesfully destroyed your doc"
- });
- FauxtonAPI.navigate(database.url("index"));
- }, function(resp) {
- FauxtonAPI.addNotification({
- msg: "Failed to destroy your doc!",
- type: "error"
- });
- });
- },
-
- beforeRender: function () {
- this.uploadModal = this.setView('#upload-modal', new Views.UploadModal({model: this.model}));
- this.uploadModal.render();
-
- this.duplicateModal = this.setView('#duplicate-modal', new Views.DuplicateDocModal({model: this.model}));
- this.duplicateModal.render();
- },
-
- upload: function (event) {
- event.preventDefault();
- if (this.model.isNewDoc()) {
- FauxtonAPI.addNotification({
- msg: 'Please save the document before uploading an attachment.',
- type: 'warning'
- });
- return;
- }
- this.uploadModal.showModal();
- },
-
- duplicate: function(event) {
- if (this.model.isNewDoc()) {
- FauxtonAPI.addNotification({
- msg: 'Please save the document before duplicating it.',
- type: 'warning'
- });
- return;
- }
- event.preventDefault();
- this.duplicateModal.showModal();
},
-
updateSelected: function (selected) {
this.selected = selected;
this.$('.active').removeClass('active');
@@ -590,13 +526,74 @@ function(app, FauxtonAPI, Documents, pouchdb, Codemirror, JSHint, resizeColumns)
Views.Doc = FauxtonAPI.View.extend({
template: "templates/documents/doc",
events: {
- "click button.save-doc": "saveDoc"
+ "click button.save-doc": "saveDoc",
+ "click button.delete": "destroy",
+ "click button.duplicate": "duplicate",
+ "click button.upload": "upload"
},
disableLoader: true,
initialize: function (options) {
this.database = options.database;
},
+ destroy: function(event) {
+ if (this.model.isNewDoc()) {
+ FauxtonAPI.addNotification({
+ msg: 'This document has not been saved yet.',
+ type: 'warning'
+ });
+ return;
+ }
+
+ if (!window.confirm("Are you sure you want to delete this doc?")) {
+ return false;
+ }
+
+ var database = this.model.database;
+
+ this.model.destroy().then(function(resp) {
+ FauxtonAPI.addNotification({
+ msg: "Succesfully destroyed your doc"
+ });
+ FauxtonAPI.navigate(database.url("index"));
+ }, function(resp) {
+ FauxtonAPI.addNotification({
+ msg: "Failed to destroy your doc!",
+ type: "error"
+ });
+ });
+ },
+ beforeRender: function () {
+ this.uploadModal = this.setView('#upload-modal', new Views.UploadModal({model: this.model}));
+ this.uploadModal.render();
+
+ this.duplicateModal = this.setView('#duplicate-modal', new Views.DuplicateDocModal({model: this.model}));
+ this.duplicateModal.render();
+ },
+
+ upload: function (event) {
+ event.preventDefault();
+ if (this.model.isNewDoc()) {
+ FauxtonAPI.addNotification({
+ msg: 'Please save the document before uploading an attachment.',
+ type: 'warning'
+ });
+ return;
+ }
+ this.uploadModal.showModal();
+ },
+
+ duplicate: function(event) {
+ if (this.model.isNewDoc()) {
+ FauxtonAPI.addNotification({
+ msg: 'Please save the document before duplicating it.',
+ type: 'warning'
+ });
+ return;
+ }
+ event.preventDefault();
+ this.duplicateModal.showModal();
+ },
updateValues: function() {
var notification;
if (this.model.changedAttributes()) {
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0bc81f93/src/fauxton/app/templates/documents/doc.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/documents/doc.html b/src/fauxton/app/templates/documents/doc.html
index d6577af..6d4c8e5 100644
--- a/src/fauxton/app/templates/documents/doc.html
+++ b/src/fauxton/app/templates/documents/doc.html
@@ -14,8 +14,9 @@ the License.
<div id="doc">
<div class="errors-container"></div>
+
+<div class="btn-group" style="margin-bottom: 15px">
<% if (attachments) { %>
- <div class="btn-group pull-right" style="margin-bottom: 15px">
<a class="btn dropdown-toggle btn" data-toggle="dropdown" href="#">
View Attachments
<span class="caret"></span>
@@ -29,8 +30,16 @@ the License.
</li>
<% }) %>
</ul>
- </div>
- <% } %>
+
+ <% } %>
+ <button class="btn btn-small upload"><i class="icon-circle-arrow-up"></i> Upload Attachment</button>
+ <button class="btn btn-small duplicate"><i class="icon-repeat"></i> Duplicate document</button>
+ <button class="btn btn-small delete"><i class="icon-trash"></i> Delete document</button>
+ </ul>
+
+<div id="upload-modal"> </div>
+<div id="duplicate-modal"> </div>
+</div>
<textarea class="doc-code"><%- JSON.stringify(doc.attributes, null, " ") %></textarea>
<br />
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0bc81f93/src/fauxton/app/templates/documents/doc_field_editor_tabs.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/documents/doc_field_editor_tabs.html b/src/fauxton/app/templates/documents/doc_field_editor_tabs.html
index 29c6d8b..af34b71 100644
--- a/src/fauxton/app/templates/documents/doc_field_editor_tabs.html
+++ b/src/fauxton/app/templates/documents/doc_field_editor_tabs.html
@@ -14,17 +14,6 @@ the License.
<ul class="nav nav-tabs">
<!--<li id="field_editor" class="<%= isSelectedClass('field_editor') %>"><a href="#<%= doc.url('app') %>/field_editor">Doc fields</a></li>-->
- <li id="code_editor" class="<%= isSelectedClass('code_editor') %>"><a href="#<%= doc.url('app') %>/code_editor"><i class="icon-pencil"></i> Code editor</a></li>
- <ul class="nav pull-right" style="margin:5px 10px 0px 10px;">
- <li>
- <div class="btn-group">
- <button class="btn btn-small upload"><i class="icon-circle-arrow-up"></i> Upload Attachment</button>
- <button class="btn btn-small duplicate"><i class="icon-repeat"></i> Duplicate document</button>
- <button class="btn btn-small delete"><i class="icon-trash"></i> Delete document</button>
- </div>
- </li>
- </ul>
+ <li id="code_editor" class="<%= isSelectedClass('code_editor') %>"><a href="#<%= doc.url('app') %>/code_editor"><i class="icon-pencil"> </i> Code editor</a>
+ </li>
</ul>
-
-<div id="upload-modal"> </div>
-<div id="duplicate-modal"> </div>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0bc81f93/src/fauxton/assets/less/database.less
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/less/database.less b/src/fauxton/assets/less/database.less
index 3854bcd..e1862d9 100644
--- a/src/fauxton/assets/less/database.less
+++ b/src/fauxton/assets/less/database.less
@@ -191,3 +191,12 @@ table.active-tasks{
}
}
+
+#doc {
+ .dropdown-menu{
+ width: auto;
+ }
+}
+#tabs {
+ height: 40px;
+}
[03/10] git commit: updated refs/heads/1807-Replication to 38970f1
Posted by de...@apache.org.
More Json Pretty print fixes. Css fixes for documents. Make code editor height size of page.
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/98dfd62b
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/98dfd62b
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/98dfd62b
Branch: refs/heads/1807-Replication
Commit: 98dfd62b0b29077f175c01fe6abb5ca9dcb7ecda
Parents: 04716fc
Author: suelockwood <de...@gmail.com>
Authored: Thu Sep 5 16:39:23 2013 -0400
Committer: suelockwood <de...@gmail.com>
Committed: Fri Sep 6 10:45:14 2013 -0400
----------------------------------------------------------------------
src/fauxton/app/modules/documents/views.js | 1 +
src/fauxton/app/templates/documents/index_row_tabular.html | 4 ++--
src/fauxton/assets/less/fauxton.less | 3 ++-
3 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/98dfd62b/src/fauxton/app/modules/documents/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/documents/views.js b/src/fauxton/app/modules/documents/views.js
index d43f06c..8f9af49 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -725,6 +725,7 @@ function(app, FauxtonAPI, Documents, pouchdb, Codemirror, JSHint, resizeColumns)
"Ctrl-/": "undo"
}
});
+ setTimeout(function(){that.editor.setSize(null,$('#dashboard').outerHeight()-250);},200);
}
});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/98dfd62b/src/fauxton/app/templates/documents/index_row_tabular.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/documents/index_row_tabular.html b/src/fauxton/app/templates/documents/index_row_tabular.html
index f211f9e..f5f68fa 100644
--- a/src/fauxton/app/templates/documents/index_row_tabular.html
+++ b/src/fauxton/app/templates/documents/index_row_tabular.html
@@ -15,11 +15,11 @@ the License.
<td class="select"><input type="checkbox"></td>
<td>
<div>
- <pre class="prettyprint"><%= JSON.stringify(doc.get("key")) %></pre>
+ <pre class="prettyprint"><%- JSON.stringify(doc.get("key")) %></pre>
</div>
</td>
<td>
<div>
- <pre class="prettyprint"><%= JSON.stringify(doc.get("value")) %></pre>
+ <pre class="prettyprint"><%- JSON.stringify(doc.get("value")) %></pre>
</div>
</td>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/98dfd62b/src/fauxton/assets/less/fauxton.less
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/less/fauxton.less b/src/fauxton/assets/less/fauxton.less
index 02fcef6..185113e 100644
--- a/src/fauxton/assets/less/fauxton.less
+++ b/src/fauxton/assets/less/fauxton.less
@@ -371,7 +371,8 @@ a:hover{
/*dashboard content can be in multiple templates*/
#dashboard-content{
- &.row-fluid{
+ &.row-fluid,
+ &.window-resizeable{
/*remove gutter without rewriting variable*/
margin-left: 0px;
}
[05/10] git commit: updated refs/heads/1807-Replication to 38970f1
Posted by de...@apache.org.
Check if codemirror has already been added and remove
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/8c8e5a46
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/8c8e5a46
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/8c8e5a46
Branch: refs/heads/1807-Replication
Commit: 8c8e5a4671377563be6dcc942c976f9ae602c76a
Parents: 4eb2a38
Author: suelockwood <de...@gmail.com>
Authored: Fri Sep 6 11:56:42 2013 -0400
Committer: suelockwood <de...@gmail.com>
Committed: Fri Sep 6 11:56:42 2013 -0400
----------------------------------------------------------------------
src/fauxton/app/modules/documents/views.js | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/8c8e5a46/src/fauxton/app/modules/documents/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/documents/views.js b/src/fauxton/app/modules/documents/views.js
index 6b63c15..805116e 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -707,6 +707,9 @@ function(app, FauxtonAPI, Documents, pouchdb, Codemirror, JSHint, resizeColumns)
afterRender: function() {
this.model.on("sync", this.updateValues, this);
var that = this;
+ if ($('.CodeMirror').length > 0){
+ $('.CodeMirror').remove();
+ }
this.editor = Codemirror.fromTextArea(this.$el.find("textarea.doc-code").get()[0], {
mode: "application/json",
json: false,
[08/10] git commit: updated refs/heads/1807-Replication to 38970f1
Posted by de...@apache.org.
Fixed continuous, scrubbed whitepaces from db names, updated layout
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/3a6777e4
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/3a6777e4
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/3a6777e4
Branch: refs/heads/1807-Replication
Commit: 3a6777e421aebc86ebce31a8f4fb4a75e7daa186
Parents: a2a5697
Author: suelockwood <de...@gmail.com>
Authored: Fri Aug 23 16:53:33 2013 -0400
Committer: suelockwood <de...@gmail.com>
Committed: Fri Sep 6 14:20:10 2013 -0400
----------------------------------------------------------------------
.../replication/assets/less/replication.less | 102 +++++++++++++++++--
.../app/addons/replication/templates/form.html | 53 ++++------
.../addons/replication/templates/progress.html | 4 +-
src/fauxton/app/addons/replication/views.js | 35 ++++---
4 files changed, 140 insertions(+), 54 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/3a6777e4/src/fauxton/app/addons/replication/assets/less/replication.less
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/replication/assets/less/replication.less b/src/fauxton/app/addons/replication/assets/less/replication.less
index bcfdb56..fe544ea 100644
--- a/src/fauxton/app/addons/replication/assets/less/replication.less
+++ b/src/fauxton/app/addons/replication/assets/less/replication.less
@@ -1,6 +1,66 @@
+/**/
+
+@brown: #3A2C2B;
+@red: #E33F3B;
+@darkRed: #AF2D24;
+@linkRed: #DA4F49;
+@greyBrown: #A59D9D;
+@fontGrey: #808080;
+@secondarySidebar: #E4DFDC;
+
+
#replication {
position: relative;
+ .form_set{
+ width: 300px;
+ display: inline-block;
+ border: 1px solid @greyBrown;
+ padding: 10px;
+ margin-bottom: 20px;
+ &.middle{
+ width: 200px;
+ border: none;
+ position: relative;
+ height: 100px;
+ margin: 0;
+ }
+ input, select {
+ margin: 0 0 16px 35px;
+ height: 40px;
+ }
+ .btn-group{
+ margin: 0 0 16px 35px;
+ .btn {
+ padding: 10px 30px;
+ }
+ }
+ &.local{
+ .local_option{
+ display: block;
+ }
+ .remote_option{
+ display: none;
+ }
+ .local-btn{
+ background-color: @red;
+ color: #fff;
+ }
+ .remote-btn{
+ background-color: #f5f5f5;
+ color: @fontGrey;
+ }
+ }
+ .local_option{
+ display: none;
+ }
+ .remote-btn{
+ background-color: @red;
+ color: #fff;
+ }
+ }
+
+
.options {
position: relative;
&:after{
@@ -39,27 +99,47 @@
vertical-align: top;
padding-right: 5px;
min-width: 130px;
+ padding-left: 0px;
}
input[type=text],
input[type=radio],
input[type=checkbox],
select {
- margin-top: -2px;
+
}
}
+ .circle{
+ z-index: 0;
+ position: absolute;
+ top: 20px;
+ left: 63px;
+ &:after {
+ width: 70px;
+ height: 70px;
+ content: '';
+ display: block;
+ position: relative;
+ margin: 0 auto;
+ border: 1px solid @greyBrown;
+ -webkit-border-radius: 40px;
+ -moz-border-radius: 40px;
+ border-radius:40px;
+ }
+ }
.swap {
+ z-index: 30;
cursor: pointer;
position: absolute;
font-size: 12px;
width: 27px;
height: 12px;
display: block;
- border-top: 3px solid #8E9292;
- border-bottom: 3px solid #8E9292;
- top: 20%;
- left: 42%;
+ border-top: 3px solid @greyBrown;
+ border-bottom: 3px solid @greyBrown;
+ top: 50px;
+ left: 84px;
&:hover {
border-color: #2C2C2C;
&:before {
@@ -85,7 +165,7 @@
bottom: -8px;
right: 23px;
position: absolute;
- border-right: 7px solid #8E9292;
+ border-right: 7px solid @greyBrown;
border-top: 7px solid rgba(44, 44, 44, 0);
border-bottom: 7px solid rgba(44, 44, 44, 0);
content: "";
@@ -95,7 +175,7 @@
top: -8px;
left: 23px;
position: absolute;
- border-left: 7px solid #8E9292;
+ border-left: 7px solid @greyBrown;
border-top: 7px solid rgba(44, 44, 44, 0);
border-bottom: 7px solid rgba(44, 44, 44, 0);
content: "";
@@ -107,6 +187,10 @@
&.showHeader{
li.header{
display: block;
+ border: none;
+ }
+ ul {
+ border:1px solid @greyBrown;
}
}
li.header{
@@ -120,10 +204,10 @@
margin: 0px;
vertical-align: bottom;
}
- padding: 10px 0 ;
+ padding: 10px 10px;
margin: 0;
list-style: none;
- border-bottom: 1px solid #e3e3e3;
+ border-top: 1px solid @greyBrown;
}
}
}
http://git-wip-us.apache.org/repos/asf/couchdb/blob/3a6777e4/src/fauxton/app/addons/replication/templates/form.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/replication/templates/form.html b/src/fauxton/app/addons/replication/templates/form.html
index c1711b5..2a70889 100644
--- a/src/fauxton/app/addons/replication/templates/form.html
+++ b/src/fauxton/app/addons/replication/templates/form.html
@@ -13,58 +13,49 @@ the License.
-->
<form id="replication" class="form-horizontal">
- <div class="row">
- <div class="span5 from form_set">
- <div class="control-group from_local">
- <label for="from_local">
- <input type="radio" id="from_local" name="from_type" value="local" checked="" class="setType">
- Local database:
- </label>
+ <div class="from form_set local">
+ <div class="btn-group">
+ <button class="btn local-btn" type="button" value="local">Local</button>
+ <button class="btn remote-btn" type="button" value="remote">Remote</button>
+ </div>
+
+ <div class="from_local local_option">
<select id="from_name" name="source">
<% _.each( databases, function( db, i ){ %>
<option value="<%=db.name%>"><%=db.name%></option>
<% }); %>
</select>
</div>
-
- <div class="control-group from_to_remote">
- <label for="from_to_remote">
- <input type="radio" id="from_to_remote" name="from_type" value="remote" class="setType">
- Remote database:
- </label>
- <input type="text" id="from_url" name="source" size="30" value="http://" disabled="true">
+ <div class="from_to_remote remote_option">
+ <input type="text" id="from_url" name="source" size="30" value="http://">
</div>
</div>
-
- <div class="span2">
+ <div class="form_set middle">
+ <span class="circle "></span>
<span class="swap">
</span>
</div>
- <div class="to form_set span5">
- <div class="to_local control-group">
- <label for="to_local">
- <input type="radio" id="to_local" name="to_type" value="local" checked="" class="setType">
- Local database:
- </label>
- <input type="text" id="to_name" name="target" size="30">
+ <div class="to form_set local">
+ <div class="btn-group">
+ <button class="btn local-btn" type="button" value="local">Local</button>
+ <button class="btn remote-btn" type="button" value="remote">Remote</button>
+ </div>
+ <div class="to_local local_option">
+ <input type="text" id="to_name" name="target" size="30" placeholder="database name">
</div>
- <div class="to_remote control-group">
- <label for="to_remote">
- <input type="radio" id="to_remote" name="to_type" value="remote" class="setType">
- Remote database:
- </label>
- <input type="text" id="to_url" name="target" size="30" value="http://" disabled="true">
+ <div class="to_remote remote_option">
+ <input type="text" id="to_url" name="target" size="30" value="http://">
</div>
</div>
- </div>
+
<div class="actions">
<div class="control-group">
<label for="continuous">
- <input type="checkbox" name="continuous" value="continuous" id="continuous">
+ <input type="checkbox" name="continuous" value="true" id="continuous">
Continuous
</label>
</div>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/3a6777e4/src/fauxton/app/addons/replication/templates/progress.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/replication/templates/progress.html b/src/fauxton/app/addons/replication/templates/progress.html
index d93db68..02c47f2 100644
--- a/src/fauxton/app/addons/replication/templates/progress.html
+++ b/src/fauxton/app/addons/replication/templates/progress.html
@@ -11,9 +11,9 @@ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
-->
-<p class="span6">Replicating <%=source%> to <%=target%>. Please wait... :)</p>
+<p class="span6">Replicating <strong><%=source%></strong> to <strong><%=target%></strong></p>
-<div class="span5 progress progress-striped active">
+<div class="span4 progress progress-striped active">
<div class="bar" style="width: <%=progress || 0%>%;"><%=progress || "0"%>%</div>
</div>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/3a6777e4/src/fauxton/app/addons/replication/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/replication/views.js b/src/fauxton/app/addons/replication/views.js
index 30c642f..ea87432 100644
--- a/src/fauxton/app/addons/replication/views.js
+++ b/src/fauxton/app/addons/replication/views.js
@@ -45,7 +45,7 @@ function(app, FauxtonAPI, replication) {
template: "addons/replication/templates/form",
events: {
"submit #replication": "submit",
- "click input[type=radio]": "enableFields",
+ "click .btn-group .btn": "showFields",
"click .swap": "swapFields",
"click .options": "toggleAdvancedOptions"
},
@@ -89,22 +89,31 @@ function(app, FauxtonAPI, replication) {
cleanup: function(){
clearInterval(pollingInfo.intervalId);
},
- disableFields: function(){
- this.$('input[type=radio]').attr('disabled',true);
- this.$('.advancedOptions:hidden').find('input').attr('disabled',true);
+
+ disableFields: function(disable){
+ if(disable){
+ this.$el.find('input:hidden','select:hidden').attr('disabled',true);
+ }else{
+ this.$el.find('input','select').attr('disabled',false);
+ }
},
- enableFields: function(e){
- var $currentTarget = this.$(e.currentTarget);
- $currentTarget.parents(".form_set").find('input[type="text"], select').attr('disabled','true').addClass('disabled');
- $currentTarget.parents('.control-group').find('input[type="text"], select').removeAttr('disabled').removeClass('disabled');
+ showFields: function(e){
+ var $currentTarget = $(e.currentTarget),
+ targetVal = $currentTarget.val();
+
+ if (targetVal === "local"){
+ $currentTarget.parents('.form_set').addClass('local');
+ }else{
+ $currentTarget.parents('.form_set').removeClass('local');
+ }
},
establish: function(){
return [ this.collection.fetch(), this.status.fetch()];
},
formValidation: function(){
- var $remote = this.$el.find("[value='remote']:checked").parents('.control-group').find('input[type=text]'),
+ var $remote = this.$el.find('input:visible'),
error = false;
for(var i=0; i<$remote.length; i++){
if ($remote[i].value =="http://" || $remote[i].value ==" "){
@@ -140,6 +149,7 @@ function(app, FauxtonAPI, replication) {
that.updateButtonText(false);
}
});
+ this.disableFields(false);
},
updateButtonText: function(wait){
var $button = this.$('#replication button[type=submit]');
@@ -151,12 +161,13 @@ function(app, FauxtonAPI, replication) {
},
submit: function(e){
e.preventDefault();
- this.disableFields(); //disable fields not relevant to submitting
+ this.disableFields(true); //disable fields not relevant to submitting
var formJSON = {};
_.map(this.$(e.currentTarget).serializeArray(), function(formData){
if(formData.value !== ''){
- formJSON[formData.name] = formData.value;
+ formJSON[formData.name] = (formData.value ==="true"? true: formData.value.replace(/\s/g, ''));
+
}
});
@@ -194,7 +205,7 @@ View.ReplicationList = FauxtonAPI.View.extend({
initialize: function(){
Events.bind('update:tasks', this.establish, this);
this.listenTo(this.collection, "reset", this.render);
- this.$el.prepend("<li class='header'><h2>Active Replication Tasks</h2></li>");
+ this.$el.prepend("<li class='header'><h4>Active Replication Tasks</h4></li>");
},
establish: function(){
return [this.collection.fetch({reset: true})];