You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2013/08/01 18:56:10 UTC

[2/2] git commit: updated refs/heads/1867-feature-plugins to b43465e

check if plugins are already installed& better install feedback


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

Branch: refs/heads/1867-feature-plugins
Commit: b43465e3e35b7515b4ed8b4a2165f98c8de5cd03
Parents: e0dce97
Author: Jan Lehnardt <ja...@apache.org>
Authored: Thu Aug 1 18:56:07 2013 +0200
Committer: Jan Lehnardt <ja...@apache.org>
Committed: Thu Aug 1 18:56:07 2013 +0200

----------------------------------------------------------------------
 share/www/plugins.html | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/b43465e3/share/www/plugins.html
----------------------------------------------------------------------
diff --git a/share/www/plugins.html b/share/www/plugins.html
index 473531d..b42ed2e 100644
--- a/share/www/plugins.html
+++ b/share/www/plugins.html
@@ -42,7 +42,7 @@ specific language governing permissions and limitations under the License.
           </ul>
         </p>
         <p>
-          <button href="#" class="install_plugin" data-url="http://people.apache.org/~jan" data-checksums='{"R15B03":"QVKzRsQGKhSdLkLTdHtgUYtr0wU="}' data-name="geocouch" data-version="couchdb1.2.x_v0.3.0-12-g4ea0bea">Install GeoCouch Now</button>
+          <button href="#" class="install-plugin" data-url="http://people.apache.org/~jan" data-checksums='{"R15B03":"QVKzRsQGKhSdLkLTdHtgUYtr0wU="}' data-name="geocouch" data-version="couchdb1.2.x_v0.3.0-12-g4ea0bea">Install GeoCouch Now</button>
         </p>
       </div>
       <div class="row">
@@ -56,13 +56,28 @@ specific language governing permissions and limitations under the License.
           </ul>
         </p>
         <p>
-          <button href="#" class="install_plugin" data-url="http://people.apache.org/~jan" data-checksums='{"R15B03":"2IvVuihCBAE4SIN3qgjofx23wJs="}' data-name="couchperuser" data-version="1.0.0">Install CouchPerUser Now</button>
+          <button href="#" class="install-plugin" data-url="http://people.apache.org/~jan" data-checksums='{"R15B03":"2IvVuihCBAE4SIN3qgjofx23wJs="}' data-name="couchperuser" data-version="1.0.0">Install CouchPerUser Now</button>
         </p>
       </div>
     </div>
   </div></body>
   <script>
-    $('.install_plugin').click(function(event) {
+    $('.install-plugin').each(function() {
+      var button = $(this);
+      var name = button.data('name');
+      var version = button.data('version');
+      $.get("/_config/plugins/" + name + "/", function(body, textStatus) {
+        body = JSON.parse(body);
+        if(body == version) {
+          button.html("Already Installed");
+        } else {
+          button.html("Other Version Installed: " + body);
+        }
+        button.attr("disabled", true);
+      });
+    });
+
+    $('.install-plugin').click(function(event) {
       var button = $(this);
       var plugin_spec = JSON.stringify({
         name: button.data('name'),
@@ -79,7 +94,12 @@ specific language governing permissions and limitations under the License.
         dataType: 'json', // expected from the server
         processData: false, // keep our precious JSON
         success: function(data, textStatus, jqXhr) {
-          button.html(textStatus);
+          if(textStatus == "success") {
+            button.html("Sucessfully Installed");
+            button.attr("disabled", true);
+          } else {
+            button.html(textStatus);
+          }
         },
         beforeSend: function(xhr) {
           xhr.setRequestHeader('Accept', 'application/json');