summaryrefslogtreecommitdiff
path: root/js/PrefHelpers.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-27 17:29:41 +0300
committerAndrew Dolgov <[email protected]>2021-02-27 17:29:41 +0300
commitde63e3799a28a51aa132c7c9e1dea44b2dfde800 (patch)
treeb461ddbc3ceb6bbf94362e3c1fa60d52a9a4d5db /js/PrefHelpers.js
parentcf5c7c4f2947cc949132df73bbbb0c2c49441fb0 (diff)
only show plugin update buttons when needed
Diffstat (limited to 'js/PrefHelpers.js')
-rw-r--r--js/PrefHelpers.js29
1 files changed, 28 insertions, 1 deletions
diff --git a/js/PrefHelpers.js b/js/PrefHelpers.js
index 125cc20d0..ff7766d8a 100644
--- a/js/PrefHelpers.js
+++ b/js/PrefHelpers.js
@@ -295,7 +295,34 @@ const Helpers = {
});
}
},
- updateLocal: function(name = null) {
+ checkForUpdate: function(name = null) {
+ Notify.progress("Checking for plugin updates...");
+
+ xhr.json("backend.php", {op: "pref-prefs", method: "checkForPluginUpdates", name: name}, (reply) => {
+ Notify.close();
+
+ if (reply) {
+ let plugins_with_updates = 0;
+
+ reply.forEach((p) => {
+ if (p.rv.o) {
+ const button = dijit.getEnclosingWidget(App.find(`*[data-update-btn-for-plugin="${p.plugin}"]`));
+
+ if (button) {
+ button.domNode.show();
+ ++plugins_with_updates;
+ }
+ }
+ });
+
+ if (plugins_with_updates > 0)
+ App.find(".update-all-plugins-btn").show();
+ } else {
+ Notify.error("Unable to check for plugin updates.");
+ }
+ });
+ },
+ update: function(name = null) {
const msg = name ? __("Update %p using git?").replace("%p", name) :
__("Update all local plugins using git?");