couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gar...@apache.org
Subject [2/3] git commit: updated refs/heads/1809-compact-and-clean to 6f9661e
Date Wed, 16 Oct 2013 13:27:05 GMT
started


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

Branch: refs/heads/1809-compact-and-clean
Commit: f6862f28eea99e0dc4cfbddbac3680b55c7da787
Parents: a61b47e
Author: Garren Smith <garren.smith@gmail.com>
Authored: Tue Oct 15 18:16:05 2013 +0200
Committer: Garren Smith <garren.smith@gmail.com>
Committed: Wed Oct 16 13:33:04 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/f6862f28/.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/f6862f28/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/f6862f28/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/f6862f28/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/f6862f28/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/f6862f28/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/f6862f28/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/f6862f28/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 6c39044..2272fdd 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -1595,13 +1595,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/f6862f28/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/f6862f28/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/f6862f28/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": {


Mime
View raw message