|
|
@ -358,7 +358,7 @@ const Helpers = {
|
|
|
|
|
|
|
|
|
|
|
|
// only user-enabled actually counts in the checkbox when saving because system plugin checkboxes are disabled (see below)
|
|
|
|
// only user-enabled actually counts in the checkbox when saving because system plugin checkboxes are disabled (see below)
|
|
|
|
container.innerHTML += `
|
|
|
|
container.innerHTML += `
|
|
|
|
<li data-row-value="${App.escapeHtml(plugin.name)}" data-plugin-name="${App.escapeHtml(plugin.name)}" title="${plugin.is_system ? __("System plugins are enabled using global configuration.") : ""}">
|
|
|
|
<li data-row-value="${App.escapeHtml(plugin.name)}" data-plugin-local="${plugin.is_local}" data-plugin-name="${App.escapeHtml(plugin.name)}" title="${plugin.is_system ? __("System plugins are enabled using global configuration.") : ""}">
|
|
|
|
<label class="checkbox ${plugin.is_system ? "system text-info" : ""}">
|
|
|
|
<label class="checkbox ${plugin.is_system ? "system text-info" : ""}">
|
|
|
|
${App.FormFields.checkbox_tag("plugins[]", plugin.user_enabled || plugin.system_enabled, plugin.name,
|
|
|
|
${App.FormFields.checkbox_tag("plugins[]", plugin.user_enabled || plugin.system_enabled, plugin.name,
|
|
|
|
{disabled: plugin.is_system})}</div>
|
|
|
|
{disabled: plugin.is_system})}</div>
|
|
|
@ -604,6 +604,7 @@ const Helpers = {
|
|
|
|
title: __("Update plugins"),
|
|
|
|
title: __("Update plugins"),
|
|
|
|
need_refresh: false,
|
|
|
|
need_refresh: false,
|
|
|
|
plugins_to_update: [],
|
|
|
|
plugins_to_update: [],
|
|
|
|
|
|
|
|
plugins_to_check: [],
|
|
|
|
onHide: function() {
|
|
|
|
onHide: function() {
|
|
|
|
if (this.need_refresh) {
|
|
|
|
if (this.need_refresh) {
|
|
|
|
Helpers.Prefs.refresh();
|
|
|
|
Helpers.Prefs.refresh();
|
|
|
@ -634,10 +635,10 @@ const Helpers = {
|
|
|
|
`
|
|
|
|
`
|
|
|
|
<li>
|
|
|
|
<li>
|
|
|
|
<h3>${p.plugin}</h3>
|
|
|
|
<h3>${p.plugin}</h3>
|
|
|
|
${p.rv.e ? `<pre class="small text-error pre-wrap">${p.rv.e}</pre>` : ''}
|
|
|
|
${p.rv.stderr ? `<pre class="small text-error pre-wrap">${p.rv.stderr}</pre>` : ''}
|
|
|
|
${p.rv.o ? `<pre class="small text-success pre-wrap">${p.rv.o}</pre>` : ''}
|
|
|
|
${p.rv.stdout ? `<pre class="small text-success pre-wrap">${p.rv.stdout}</pre>` : ''}
|
|
|
|
<div class="small">
|
|
|
|
<div class="small">
|
|
|
|
${p.rv.s ? App.FormFields.icon("error_outline") + " " + __("Exited with RC: %d").replace("%d", p.rv.s) :
|
|
|
|
${p.rv.git_status ? App.FormFields.icon("error_outline") + " " + __("Exited with RC: %d").replace("%d", p.rv.git_status) :
|
|
|
|
App.FormFields.icon("check") + " " + __("Update done.")}
|
|
|
|
App.FormFields.icon("check") + " " + __("Update done.")}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</li>
|
|
|
@ -648,67 +649,94 @@ const Helpers = {
|
|
|
|
dijit.getEnclosingWidget(dialog.domNode.querySelector(".update-btn")).attr('disabled', !enable_update_btn);
|
|
|
|
dijit.getEnclosingWidget(dialog.domNode.querySelector(".update-btn")).attr('disabled', !enable_update_btn);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
content: `
|
|
|
|
checkNextPlugin: function() {
|
|
|
|
<ul class="panel panel-scrollable plugin-updater-list update-results">
|
|
|
|
const name = dialog.plugins_to_check.shift();
|
|
|
|
<li class='text-center'>${__("Looking for changes...")}</li>
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<footer>
|
|
|
|
if (name) {
|
|
|
|
${App.FormFields.button_tag(App.FormFields.icon("update") + " " + __("Update"), "", {disabled: true, class: "update-btn alt-primary", onclick: "App.dialogOf(this).performUpdate()"})}
|
|
|
|
this.checkUpdates(name);
|
|
|
|
${App.FormFields.cancel_dialog_tag(__("Close"))}
|
|
|
|
} else {
|
|
|
|
</footer>
|
|
|
|
const num_updated = dialog.plugins_to_update.length;
|
|
|
|
`,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const tmph = dojo.connect(dialog, 'onShow', function () {
|
|
|
|
if (num_updated > 0)
|
|
|
|
dojo.disconnect(tmph);
|
|
|
|
dialog.attr('title',
|
|
|
|
|
|
|
|
App.l10n.ngettext('Updates pending for %d plugin', 'Updates pending for %d plugins', num_updated)
|
|
|
|
|
|
|
|
.replace("%d", num_updated));
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
dialog.attr('title', __("No updates available"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dijit.getEnclosingWidget(dialog.domNode.querySelector(".update-btn"))
|
|
|
|
|
|
|
|
.attr('disabled', num_updated == 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
checkUpdates: function(name) {
|
|
|
|
|
|
|
|
console.log('checkUpdates', name);
|
|
|
|
|
|
|
|
|
|
|
|
xhr.json("backend.php", {op: "pref-prefs", method: "checkForPluginUpdates", name: name}, (reply) => {
|
|
|
|
|
|
|
|
const container = dialog.domNode.querySelector(".update-results");
|
|
|
|
const container = dialog.domNode.querySelector(".update-results");
|
|
|
|
let enable_update_btn = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!reply) {
|
|
|
|
dialog.attr('title', __("Checking: %s").replace("%s", name));
|
|
|
|
container.innerHTML = `<li class='text-center text-error'>${__("Operation failed: check event log.")}</li>`;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
container.innerHTML = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dialog.plugins_to_update = [];
|
|
|
|
//container.innerHTML = `<li class='text-center'>${__("Checking: %s...").replace("%s", name)}</li>`;
|
|
|
|
|
|
|
|
|
|
|
|
reply.forEach((p) => {
|
|
|
|
xhr.json("backend.php", {op: "pref-prefs", method: "checkForPluginUpdates", name: name}, (reply) => {
|
|
|
|
if (p.rv.s == 0) {
|
|
|
|
|
|
|
|
enable_update_btn = true;
|
|
|
|
|
|
|
|
dialog.plugins_to_update.push(p.plugin);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const update_button = dijit.getEnclosingWidget(
|
|
|
|
if (!reply) {
|
|
|
|
App.find(`*[data-update-btn-for-plugin="${p.plugin}"]`));
|
|
|
|
container.innerHTML += `<li class='text-error'>${__("%s: Operation failed: check event log.").replace("%s", name)}</li>`;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
if (update_button)
|
|
|
|
reply.forEach((p) => {
|
|
|
|
update_button.domNode.show();
|
|
|
|
if (p.rv.need_update) {
|
|
|
|
|
|
|
|
dialog.plugins_to_update.push(p.plugin);
|
|
|
|
|
|
|
|
|
|
|
|
container.innerHTML +=
|
|
|
|
const update_button = dijit.getEnclosingWidget(
|
|
|
|
`
|
|
|
|
App.find(`*[data-update-btn-for-plugin="${p.plugin}"]`));
|
|
|
|
<li><h3>${p.plugin}</h3>
|
|
|
|
|
|
|
|
${p.rv.e ? `<pre class="small text-error pre-wrap">${p.rv.e}</pre>` : ''}
|
|
|
|
|
|
|
|
${p.rv.o ? `<pre class="small text-success pre-wrap">${p.rv.o}</pre>` : ''}
|
|
|
|
|
|
|
|
<div class="small">
|
|
|
|
|
|
|
|
${p.rv.s ? App.FormFields.icon("error_outline") + " " + __("Exited with RC: %d").replace("%d", p.rv.s) :
|
|
|
|
|
|
|
|
App.FormFields.icon("check") + " " + __("Ready to update")}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
|
|
|
|
`
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!enable_update_btn) {
|
|
|
|
if (update_button)
|
|
|
|
container.innerHTML = `<li class='text-center text-info'>${name ? __("Plugin %s is up-to-date").replace("%s", name) :
|
|
|
|
update_button.domNode.show();
|
|
|
|
__("All local plugins are up-to-date.")}</li>`;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (p.rv.need_update || p.rv.git_status != 0) {
|
|
|
|
|
|
|
|
container.innerHTML +=
|
|
|
|
|
|
|
|
`
|
|
|
|
|
|
|
|
<li><h3>${p.plugin}</h3>
|
|
|
|
|
|
|
|
${p.rv.stderr ? `<pre class="small text-error pre-wrap">${p.rv.stderr}</pre>` : ''}
|
|
|
|
|
|
|
|
${p.rv.stdout ? `<pre class="small text-success pre-wrap">${p.rv.stdout}</pre>` : ''}
|
|
|
|
|
|
|
|
<div class="small">
|
|
|
|
|
|
|
|
${p.rv.git_status ? App.FormFields.icon("error_outline") + " " + __("Exited with RC: %d").replace("%d", p.rv.git_status) :
|
|
|
|
|
|
|
|
App.FormFields.icon("check") + " " + __("Ready to update")}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
|
|
|
|
`
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
dialog.checkNextPlugin();
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dijit.getEnclosingWidget(dialog.domNode.querySelector(".update-btn")).attr('disabled', !enable_update_btn);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
content: `
|
|
|
|
|
|
|
|
<ul class="panel panel-scrollable plugin-updater-list update-results">
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<footer>
|
|
|
|
|
|
|
|
${App.FormFields.button_tag(App.FormFields.icon("update") + " " + __("Update"), "", {disabled: true, class: "update-btn alt-primary", onclick: "App.dialogOf(this).performUpdate()"})}
|
|
|
|
|
|
|
|
${App.FormFields.cancel_dialog_tag(__("Close"))}
|
|
|
|
|
|
|
|
</footer>
|
|
|
|
|
|
|
|
`,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const tmph = dojo.connect(dialog, 'onShow', function () {
|
|
|
|
|
|
|
|
dojo.disconnect(tmph);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dialog.plugins_to_update = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (name) {
|
|
|
|
|
|
|
|
dialog.checkUpdates(name);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
dialog.plugins_to_check = [...document.querySelectorAll('*[data-plugin-name][data-plugin-local=true]')].map((p) => p.getAttribute('data-plugin-name'));
|
|
|
|
|
|
|
|
dialog.checkNextPlugin();
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
dialog.show();
|
|
|
|
dialog.show();
|
|
|
|