You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2013/10/23 17:48:38 UTC

[2/4] git commit: updated refs/heads/master to 308b993

started


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/8e297c88
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/8e297c88
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/8e297c88

Branch: refs/heads/master
Commit: 8e297c88d400922f86ef33cfb0bec1b18e9d6c40
Parents: 90b6db9
Author: Garren Smith <ga...@gmail.com>
Authored: Tue Oct 15 18:16:05 2013 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Wed Oct 23 17:48:09 2013 +0200

----------------------------------------------------------------------
 .gitignore                                      |  1 +
 src/fauxton/app/addons/compaction/base.js       | 29 +++++++++
 src/fauxton/app/addons/compaction/resources.js  | 21 +++++++
 src/fauxton/app/addons/compaction/routes.js     | 62 ++++++++++++++++++++
 .../app/addons/compaction/templates/layout.html | 27 +++++++++
 src/fauxton/app/addons/compaction/views.js      | 40 +++++++++++++
 src/fauxton/app/api.js                          | 23 ++++++++
 src/fauxton/app/modules/documents/views.js      |  6 +-
 .../app/templates/documents/sidebar.html        |  3 +
 src/fauxton/app/templates/documents/tabs.html   | 21 -------
 src/fauxton/settings.json.default               |  3 +-
 11 files changed, 213 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/8e297c88/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 95cf2f3..2d6a17b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -101,6 +101,7 @@ src/fauxton/app/addons/*
 !src/fauxton/app/addons/exampleAuth
 !src/fauxton/app/addons/permissions
 !src/fauxton/app/addons/verifyinstall
+!src/fauxton/app/addons/compaction
 src/fauxton/settings.json*
 !src/fauxton/settings.json.default
 src/ibrowse/ibrowse.app

http://git-wip-us.apache.org/repos/asf/couchdb/blob/8e297c88/src/fauxton/app/addons/compaction/base.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/compaction/base.js b/src/fauxton/app/addons/compaction/base.js
new file mode 100644
index 0000000..8d93016
--- /dev/null
+++ b/src/fauxton/app/addons/compaction/base.js
@@ -0,0 +1,29 @@
+// 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/compaction/routes"
+],
+
+function(app, FauxtonAPI, Compaction) {
+  Compaction.initialize = function() {
+    FauxtonAPI.registerExtension('docLinks', {
+      title: "Compact & Clean", 
+      url: "compact", 
+      icon: "icon-cogs"
+    });
+  };
+
+  return Compaction;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/8e297c88/src/fauxton/app/addons/compaction/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/compaction/resources.js b/src/fauxton/app/addons/compaction/resources.js
new file mode 100644
index 0000000..d0180ef
--- /dev/null
+++ b/src/fauxton/app/addons/compaction/resources.js
@@ -0,0 +1,21 @@
+// 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"
+],
+
+function (app, FauxtonAPI) {
+  var Compaction = FauxtonAPI.addon();
+  return Compaction;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/8e297c88/src/fauxton/app/addons/compaction/routes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/compaction/routes.js b/src/fauxton/app/addons/compaction/routes.js
new file mode 100644
index 0000000..e04d386
--- /dev/null
+++ b/src/fauxton/app/addons/compaction/routes.js
@@ -0,0 +1,62 @@
+// 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",
+
+       // Modules
+       "addons/compaction/views",
+       "modules/databases/resources"
+],
+
+function(app, FauxtonAPI, Compaction, Databases) {
+
+  var  CompactionRouteObject = FauxtonAPI.RouteObject.extend({
+    layout: "one_pane",
+
+    crumbs: [
+      {"name": "Compact & Clean", "link": "compact"}
+    ],
+
+    routes: {
+      "database/:database/compact": "compaction"
+    },
+
+    initialize: function(route, masterLayout, options) {
+      var databaseName = options[0];
+
+      this.database = this.database || new Databases.Model({id: databaseName});
+    },
+
+    compaction: function () {
+      this.setView('#dashboard-content', new Compaction.Layout({model: this.database}));
+    },
+
+    establish: function () {
+      return this.database.fetch();
+    }
+
+    /*apiUrl: function() {
+      return [this.compactions.url(), this.compactions.documentation];
+    },*/
+
+  });
+
+  Compaction.RouteObjects = [CompactionRouteObject];
+
+  return Compaction;
+
+});
+
+

http://git-wip-us.apache.org/repos/asf/couchdb/blob/8e297c88/src/fauxton/app/addons/compaction/templates/layout.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/compaction/templates/layout.html b/src/fauxton/app/addons/compaction/templates/layout.html
new file mode 100644
index 0000000..56bcbc2
--- /dev/null
+++ b/src/fauxton/app/addons/compaction/templates/layout.html
@@ -0,0 +1,27 @@
+<!--
+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.
+-->
+
+<table class="table table-striped table-bordered">
+  <tbody>
+  <tr> 
+    <td>
+      <h3> Compact Database </h3>
+      <p>Compacting a database removes deleted documents and previous revisions. It is an irreversible operation and may take a while to complete for large databases.</p>
+      <button id="compact-db" class="btn btn-large btn-primary"> Run </button>
+    </td>
+  </tr>
+  </tbody>
+
+</table>
+

http://git-wip-us.apache.org/repos/asf/couchdb/blob/8e297c88/src/fauxton/app/addons/compaction/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/compaction/views.js b/src/fauxton/app/addons/compaction/views.js
new file mode 100644
index 0000000..67afd5e
--- /dev/null
+++ b/src/fauxton/app/addons/compaction/views.js
@@ -0,0 +1,40 @@
+// 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",
+
+       // Modules
+       "addons/compaction/resources"
+],
+function (app, FauxtonAPI, Compaction) {
+
+  Compaction.Layout = FauxtonAPI.View.extend({
+    template: 'addons/compaction/templates/layout',
+
+    events: {
+      "click compact-db": "compactDB"
+    },
+
+    compactDB: function (event) {
+      event.preventDefault();
+    }
+
+
+  });
+
+
+
+  return Compaction;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/8e297c88/src/fauxton/app/api.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/api.js b/src/fauxton/app/api.js
index d9f66fe..96d4586 100644
--- a/src/fauxton/app/api.js
+++ b/src/fauxton/app/api.js
@@ -452,6 +452,29 @@ function(app, Fauxton) {
 
   });
 
+  var extensions = _.extend({}, Backbone.Events);
+  // Can look at a remove function later.
+  FauxtonAPI.registerExtension = function (name, view) {
+    if (!extensions[name]) {
+      extensions[name] = [];
+    }
+
+    extensions.trigger('add:' + name, view);
+    extensions[name].push(view);
+  };
+
+  FauxtonAPI.getExtensions = function (name) {
+    var views = extensions[name];
+
+    if (!views) {
+      views = [];
+    }
+
+    return views;
+  };
+
+  FauxtonAPI.extensions = extensions;
+
   app.fauxtonAPI = FauxtonAPI;
   return app.fauxtonAPI;
 });

http://git-wip-us.apache.org/repos/asf/couchdb/blob/8e297c88/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 283f7b9..eaec296 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -1634,13 +1634,17 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, Codemirror, JSHint, re
     },
 
     serialize: function() {
+      var docLinks = FauxtonAPI.getExtensions('docLinks');
+      console.log(docLinks);
       return {
         changes_url: '#' + this.database.url('changes'),
         permissions_url: '#' + this.database.url('app') + '/permissions',
         db_url: '#' + this.database.url('index') + '?limit=100',
         index: [1,2,3],
         view: [1,2],
-        database: this.collection.database
+        database: this.collection.database,
+        database_url: '#' + this.database.url('app'), 
+        docLinks: docLinks
       };
     },
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/8e297c88/src/fauxton/app/templates/documents/sidebar.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/documents/sidebar.html b/src/fauxton/app/templates/documents/sidebar.html
index eb01942..881309f 100644
--- a/src/fauxton/app/templates/documents/sidebar.html
+++ b/src/fauxton/app/templates/documents/sidebar.html
@@ -25,6 +25,9 @@ the License.
           <li><a class="icon-file" href="<%= db_url %>">Docs</a></li>
           <li><a class="icon-lock" href="<%= permissions_url %>">Permissions</a></li>
           <li><a class="icon-forward" href="<%= changes_url %>">Changes</a></li>
+          <% _.each(docLinks, function (link) { %>
+          <li><a class="<%= link.icon %>" href="<%= database_url + '/' + link.url %>"><%= link.title %></a></li>
+          <% }); %>
         </ul>
       </div>
     </div>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/8e297c88/src/fauxton/app/templates/documents/tabs.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/documents/tabs.html b/src/fauxton/app/templates/documents/tabs.html
index 57e6cb1..f8b0c4b 100644
--- a/src/fauxton/app/templates/documents/tabs.html
+++ b/src/fauxton/app/templates/documents/tabs.html
@@ -14,26 +14,5 @@ the License.
 
 <ul class="nav nav-tabs">
   <li class="active"><a href="<%= db_url %>">Docs</a></li>
-  <!-- TODO::REENABLE
-  <li><a href="#">Permissions</a></li>
-  <li><a href="#">Stats</a></li>
-  -->
   <li id="changes"><a  href="<%= changes_url %>">Changes</a></li>
-  <!-- TODO::REENABLE
-  <div id="search" class="navbar-search span4 nav pull-right input-prepend" style="height:20px;"></div>
-  <!-- TODO: put this styling into less --//>
-  <ul class="nav pull-right" style="margin:5px 10px 0px 10px;">
-    <li>
-      <div class="btn-group">
-        <a class="btn btn-small dropdown-toggle" data-toggle="dropdown" href="#">
-          <i class="icon icon-cog"></i> Database actions <span class="caret"></span>
-        </a>
-        <ul class="dropdown-menu">
-          <li><a class=""><i class="icon-repeat"></i> Replicate database</a></li>
-          <li><a id="delete-database" class=""><i class="icon-trash"></i> Delete database</a></li>
-        </ul>
-      </div>
-    </li>
-  </ul>
-  -->
 </ul>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/8e297c88/src/fauxton/settings.json.default
----------------------------------------------------------------------
diff --git a/src/fauxton/settings.json.default b/src/fauxton/settings.json.default
index ce45e26..54cc0ce 100644
--- a/src/fauxton/settings.json.default
+++ b/src/fauxton/settings.json.default
@@ -8,8 +8,9 @@
   { "name": "plugins" },
   { "name": "contribute" },
   { "name": "permissions" },
-  { "name": "auth" },
   { "name": "verifyinstall" }
+  { "name": "compaction" },
+  { "name": "auth" }
   ],
     "template": {
       "development": {