diff options
author | Jan Lehnardt <jan@apache.org> | 2013-08-01 18:56:07 +0200 |
---|---|---|
committer | Jan Lehnardt <jan@apache.org> | 2013-08-02 21:17:05 +0200 |
commit | f0ed1b23b06c3470c2a5512abb6962a4cc07202e (patch) | |
tree | 648d05a426e9914fb3c4159f725d0ff76e045a4f | |
parent | afd7602e776ef86e8ae9d127d17143e32836b6a6 (diff) | |
download | couchdb-f0ed1b23b06c3470c2a5512abb6962a4cc07202e.tar.gz |
check if plugins are already installed& better install feedback
-rw-r--r-- | share/www/plugins.html | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/share/www/plugins.html b/share/www/plugins.html index 473531d97..b42ed2e4c 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'); |