summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Klehr <mklehr@gmx.net>2013-03-27 12:02:19 +0100
committerMarcel Klehr <mklehr@gmx.net>2013-03-27 12:02:19 +0100
commitc4d9a71156c39d84350230e88ef9ebab148f1a2a (patch)
tree49c572fd6fd1c31cda0f081763c0a7ce1af1ad8e
parentd01a209cbf3377bc9c03719b00f2a3adbbb5b386 (diff)
downloadetherpad-lite-c4d9a71156c39d84350230e88ef9ebab148f1a2a.zip
/admin/plugins: Fix update check
-rw-r--r--src/node/hooks/express/adminplugins.js4
-rw-r--r--src/static/css/admin.css1
-rw-r--r--src/static/js/admin/plugins.js27
-rw-r--r--src/templates/admin/plugins.html8
4 files changed, 21 insertions, 19 deletions
diff --git a/src/node/hooks/express/adminplugins.js b/src/node/hooks/express/adminplugins.js
index 611a6b14..d8f19bba 100644
--- a/src/node/hooks/express/adminplugins.js
+++ b/src/node/hooks/express/adminplugins.js
@@ -35,9 +35,9 @@ exports.socketio = function (hook_name, args, cb) {
socket.emit("results:installed", {installed: installed});
});
- socket.on("getUpdatable", function() {
+ socket.on("checkUpdates", function() {
// Check plugins for updates
- installer.getAvailable(/*maxCacheAge:*/60*10, function(er, results) {
+ installer.getAvailablePlugins(/*maxCacheAge:*/60*10, function(er, results) {
if(er) {
console.warn(er);
socket.emit("results:updatable", {updatable: {}});
diff --git a/src/static/css/admin.css b/src/static/css/admin.css
index 31b16b9c..2260e27d 100644
--- a/src/static/css/admin.css
+++ b/src/static/css/admin.css
@@ -139,6 +139,7 @@ td, th {
#installed-plugins td>div {
position: relative;/* Allows us to position the loading indicator relative to this row */
display: inline-block; /*make this fill the whole cell*/
+ width:100%;
}
.messages td>* {
diff --git a/src/static/js/admin/plugins.js b/src/static/js/admin/plugins.js
index 3937e666..bc7a0208 100644
--- a/src/static/js/admin/plugins.js
+++ b/src/static/js/admin/plugins.js
@@ -46,7 +46,7 @@ $(document).ready(function () {
show: function(plugin, msg) {
$('.installed-results .'+plugin+' .progress').show()
$('.installed-results .'+plugin+' .progress .message').text(msg)
- $(window).scrollTop(0)
+ $(window).scrollTop($('.'+plugin).offset().top-100)
},
hide: function(plugin) {
$('.installed-results .'+plugin+' .progress').hide()
@@ -116,9 +116,13 @@ $(document).ready(function () {
$(".do-install, .do-update").unbind('click').click(function (e) {
var $row = $(e.target).closest("tr")
, plugin = $row.data('plugin');
- $row.remove().appendTo('#installed-plugins')
+ if($(this).hasClass('do-install')) {
+ $row.remove().appendTo('#installed-plugins')
+ installed.progress.show(plugin, 'Installing')
+ }else{
+ installed.progress.show(plugin, 'Updating')
+ }
socket.emit("install", plugin);
- installed.progress.show(plugin, 'Installing')
installed.messages.hide("nothing-installed")
});
@@ -200,20 +204,17 @@ $(document).ready(function () {
if(installed.list.length > 0) {
displayPluginList(installed.list, $("#installed-plugins"), $("#installed-plugin-template"));
+ socket.emit('checkUpdates');
}else {
installed.messages.show("nothing-installed")
}
});
socket.on('results:updatable', function(data) {
- $('#installed-plugins > tr').each(function(i, tr) {
- var pluginName = $(tr).find('.name').text()
-
- if (data.updatable.indexOf(pluginName) >= 0) {
- var actions = $(tr).find('.actions')
- actions.append('<input class="do-update" type="button" value="Update" />')
- actions.css('width', 200)
- }
+ data.updatable.forEach(function(pluginName) {
+ var $row = $('#installed-plugins > tr.'+pluginName)
+ , actions = $row.find('.actions')
+ actions.append('<input class="do-update" type="button" value="Update" />')
})
updateHandlers();
})
@@ -251,8 +252,8 @@ $(document).ready(function () {
socket.emit("getInstalled");
search('');
- // check for updates every 15mins
+ // check for updates every 5mins
setInterval(function() {
socket.emit('checkUpdates');
- }, 1000*60*15)
+ }, 1000*60*5)
});
diff --git a/src/templates/admin/plugins.html b/src/templates/admin/plugins.html
index 270fbfd7..1b69549c 100644
--- a/src/templates/admin/plugins.html
+++ b/src/templates/admin/plugins.html
@@ -46,8 +46,8 @@
<td class="name" data-label="Name"></td>
<td class="description" data-label="Description"></td>
<td class="version" data-label="Version"></td>
- <td class="actions">
- <div>
+ <td>
+ <div class="actions">
<input type="button" value="Uninstall" class="do-uninstall">
<div class="progress"><p><img src="../static/img/loading.gif"/></p><p><span class="message"></span></p></div>
</div>
@@ -86,8 +86,8 @@
<td class="name" data-label="Name"></td>
<td class="description" data-label="Description"></td>
<td class="version" data-label="Version"></td>
- <td class="actions">
- <div>
+ <td>
+ <div class="actions">
<input type="button" value="Install" class="do-install">
<div class="progress"><p><img src="../static/img/loading.gif"/></p><p><span class="message"></span></p></div>
</div>