summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-27 13:05:02 +0300
committerAndrew Dolgov <[email protected]>2021-02-27 13:05:02 +0300
commitdfff2cef7b29e2275bd1cf9ac59d3e50f09b7bc5 (patch)
tree967719142c2e105e765039fc79661f4fc1efe898 /js
parent5edcbf2e9bfa79ea87a6e420a4c17e8b02997716 (diff)
add basic updater for stuff in plugins.local
Diffstat (limited to 'js')
-rw-r--r--js/PrefHelpers.js64
1 files changed, 58 insertions, 6 deletions
diff --git a/js/PrefHelpers.js b/js/PrefHelpers.js
index 62f6d91b1..125cc20d0 100644
--- a/js/PrefHelpers.js
+++ b/js/PrefHelpers.js
@@ -278,20 +278,72 @@ const Helpers = {
});
}
},
+ refresh: function() {
+ xhr.post("backend.php", { op: "pref-prefs" }, (reply) => {
+ dijit.byId('prefsTab').attr('content', reply);
+ Notify.close();
+ });
+ },
+ },
+ Plugins: {
clearPluginData: function(name) {
if (confirm(__("Clear stored data for this plugin?"))) {
Notify.progress("Loading, please wait...");
- xhr.post("backend.php", {op: "pref-prefs", method: "clearplugindata", name: name}, () => {
+ xhr.post("backend.php", {op: "pref-prefs", method: "clearPluginData", name: name}, () => {
Helpers.Prefs.refresh();
});
}
},
- refresh: function() {
- xhr.post("backend.php", { op: "pref-prefs" }, (reply) => {
- dijit.byId('prefsTab').attr('content', reply);
- Notify.close();
- });
+ updateLocal: function(name = null) {
+ const msg = name ? __("Update %p using git?").replace("%p", name) :
+ __("Update all local plugins using git?");
+
+ if (confirm(msg)) {
+
+ const dialog = new fox.SingleUseDialog({
+ title: __("Plugin Updater"),
+ content: `
+ <ul class="panel panel-scrollable update-results">
+ <li>${__("Loading, please wait...")}</li>
+ </ul>
+
+ <footer class="text-center">
+ ${App.FormFields.submit_tag(__("Close this window"))}
+ </footer>
+ `,
+ });
+
+ const tmph = dojo.connect(dialog, 'onShow', function () {
+ dojo.disconnect(tmph);
+
+ xhr.json("backend.php", {op: "pref-prefs", method: "updateLocalPlugins", name: name}, (reply) => {
+ const container = dialog.domNode.querySelector(".update-results");
+
+ if (!reply) {
+ container.innerHTML = __("Operation failed: check event log.");
+ } else {
+ container.innerHTML = "";
+
+ reply.forEach((p) => {
+ container.innerHTML +=
+ `
+ <li><h3 style="margin-top: 0">${p.plugin}</h3>
+ ${p.rv.e ? `<pre class="small text-error">${p.rv.e}</pre>` : ''}
+ ${p.rv.o ? `<pre class="small text-success">${p.rv.o}</pre>` : ''}
+ <p class="small">
+ ${p.rv.s ? __("Exited with RC: %d").replace("%d", p.rv.s) : __("OK")}
+ </p>
+ </li>
+ `
+ });
+ }
+ });
+
+ });
+
+ dialog.show();
+ }
},
},
OPML: {