You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2014/07/31 23:43:01 UTC

[11/51] [abbrv] futon commit: updated refs/heads/import-master to 53a86dd

check if plugins are already installed& better install feedback


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

Branch: refs/heads/import-master
Commit: 4bfd2ff73e7c1463749802a328dd4a68ed514c2d
Parents: 3c7705f
Author: Jan Lehnardt <ja...@apache.org>
Authored: Thu Aug 1 18:56:07 2013 +0200
Committer: Jan Lehnardt <ja...@apache.org>
Committed: Thu Oct 3 16:08:36 2013 +0200

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


http://git-wip-us.apache.org/repos/asf/couchdb-futon/blob/4bfd2ff7/plugins.html
----------------------------------------------------------------------
diff --git a/plugins.html b/plugins.html
index 473531d..b42ed2e 100644
--- a/plugins.html
+++ b/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');