Merge branch 'maintenance' of github.com:OctoPrint/OctoPrint into maintenance
This commit is contained in:
commit
74c6ae2f8a
6 files changed
+457
-52
No files matched your search
@@ -4,7 +4,6 @@ __author__ = "Gina Häußge <osd@foosel.net>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
|
||||
import copy
|
||||
import hashlib
|
||||
import logging
|
||||
@@ -28,7 +27,7 @@ from octoprint.server.util.flask import (
|
||||
no_firstrun_access,
|
||||
with_revalidation_checking,
|
||||
)
|
||||
from octoprint.util import dict_merge, get_formatted_size, to_unicode, yaml
|
||||
from octoprint.util import RepeatedTimer, dict_merge, get_formatted_size, to_unicode, yaml
|
||||
from octoprint.util.commandline import CommandlineError
|
||||
from octoprint.util.pip import create_pip_caller
|
||||
from octoprint.util.version import (
|
||||
@@ -61,7 +60,6 @@ class SoftwareUpdatePlugin(
|
||||
octoprint.plugin.WizardPlugin,
|
||||
octoprint.plugin.EventHandlerPlugin,
|
||||
):
|
||||
|
||||
COMMIT_TRACKING_TYPES = ("github_commit", "bitbucket_commit")
|
||||
CURRENT_TRACKING_TYPES = COMMIT_TRACKING_TYPES + ("etag", "lastmodified", "jsondata")
|
||||
RELEASE_TRACKING_TYPES = ("github_release",)
|
||||
@@ -99,6 +97,9 @@ class SoftwareUpdatePlugin(
|
||||
self._update_log_path = None
|
||||
self._update_log_dirty = False
|
||||
self._update_log_mutex = threading.RLock()
|
||||
self._queued_updates = {"targets": [], "force": True}
|
||||
self._queued_updates_abort_timer = None
|
||||
self._print_cancelled = False
|
||||
|
||||
self._environment_supported = True
|
||||
self._environment_versions = {}
|
||||
@@ -762,6 +763,8 @@ class SoftwareUpdatePlugin(
|
||||
|
||||
data["pip_enable_check"] = "pip" in checks
|
||||
|
||||
data["queued_updates"] = self._queued_updates.get("targets", [])
|
||||
|
||||
return data
|
||||
|
||||
def get_settings_restricted_paths(self):
|
||||
@@ -1284,10 +1287,6 @@ class SoftwareUpdatePlugin(
|
||||
description=message,
|
||||
)
|
||||
|
||||
if self._printer.is_printing() or self._printer.is_paused():
|
||||
# do not update while a print job is running
|
||||
flask.abort(409, description="Printer is currently printing or paused")
|
||||
|
||||
if not self._environment_supported:
|
||||
flask.abort(
|
||||
409,
|
||||
@@ -1316,9 +1315,64 @@ class SoftwareUpdatePlugin(
|
||||
|
||||
force = json_data.get("force", "false") in octoprint.settings.valid_boolean_trues
|
||||
|
||||
if self._printer.is_printing() or self._printer.is_paused():
|
||||
# do not update while a print job is running
|
||||
# store targets to be run later on print done event
|
||||
self._queued_updates["targets"] = list(
|
||||
set(self._queued_updates["targets"] + targets)
|
||||
)
|
||||
self._send_client_message(
|
||||
"queued_updates",
|
||||
{"targets": self._queued_updates["targets"]},
|
||||
)
|
||||
|
||||
return (
|
||||
flask.jsonify({"queued": self._queued_updates.get("targets", False)}),
|
||||
202,
|
||||
)
|
||||
|
||||
to_be_checked, checks = self.perform_updates(targets=targets, force=force)
|
||||
return flask.jsonify({"order": to_be_checked, "checks": checks})
|
||||
|
||||
@octoprint.plugin.BlueprintPlugin.route("/update/queued", methods=["POST"])
|
||||
@no_firstrun_access
|
||||
@Permissions.PLUGIN_SOFTWAREUPDATE_UPDATE.require(403)
|
||||
def cancel_queued(self):
|
||||
if "application/json" not in flask.request.headers["Content-Type"]:
|
||||
flask.abort(400, description="Expected content-type JSON")
|
||||
|
||||
json_data = flask.request.get_json(silent=True)
|
||||
if json_data is None:
|
||||
flask.abort(400, description="Invalid JSON")
|
||||
|
||||
command = json_data.get("command")
|
||||
if command == "cancel":
|
||||
targets = [x.strip() for x in json_data.get("targets", [])]
|
||||
|
||||
if targets:
|
||||
self._queued_updates["targets"] = [
|
||||
x for x in self._queued_updates["targets"] if x not in targets
|
||||
]
|
||||
else:
|
||||
self._queued_updates["targets"] = []
|
||||
|
||||
if not self._queued_updates["targets"] and self._queued_updates_abort_timer:
|
||||
self._queued_updates_abort_timer.cancel()
|
||||
self._queued_updates_abort_timer = None
|
||||
|
||||
self._send_client_message(
|
||||
"queued_updates",
|
||||
{"targets": self._queued_updates["targets"]},
|
||||
)
|
||||
|
||||
return (
|
||||
flask.jsonify({"queued": self._queued_updates["targets"]}),
|
||||
202,
|
||||
)
|
||||
|
||||
else:
|
||||
flask.abort(400, description="Expected a valid command")
|
||||
|
||||
@octoprint.plugin.BlueprintPlugin.route("/configure", methods=["POST"])
|
||||
@no_firstrun_access
|
||||
@Permissions.PLUGIN_SOFTWAREUPDATE_CONFIGURE.require(403)
|
||||
@@ -1475,7 +1529,33 @@ class SoftwareUpdatePlugin(
|
||||
def on_event(self, event, payload):
|
||||
from octoprint.events import Events
|
||||
|
||||
if (
|
||||
if event == Events.PRINT_STARTED:
|
||||
self._queued_updates_timer_stop()
|
||||
self._print_cancelled = False
|
||||
elif (
|
||||
event == Events.PRINT_DONE
|
||||
and self._settings.global_get(["webcam", "timelapse", "type"]) == "off"
|
||||
and len(self._queued_updates.get("targets", [])) > 0
|
||||
):
|
||||
self._queued_updates_timer_start()
|
||||
elif (
|
||||
event == Events.PRINT_FAILED
|
||||
and len(self._queued_updates.get("targets", [])) > 0
|
||||
):
|
||||
self._send_client_message(
|
||||
"queued_updates",
|
||||
{"print_failed": True, "targets": self._queued_updates["targets"]},
|
||||
)
|
||||
self._print_cancelled = True
|
||||
elif (
|
||||
event == Events.MOVIE_DONE
|
||||
and self._settings.global_get(["webcam", "timelapse", "type"]) != "off"
|
||||
and len(self._queued_updates.get("targets", [])) > 0
|
||||
and not (self._printer.is_printing() or self._printer.is_paused())
|
||||
and not self._print_cancelled
|
||||
):
|
||||
self._queued_updates_timer_start()
|
||||
elif (
|
||||
event != Events.CONNECTIVITY_CHANGED
|
||||
or not payload
|
||||
or not payload.get("new", False)
|
||||
@@ -1824,6 +1904,52 @@ class SoftwareUpdatePlugin(
|
||||
self._version_cache_dirty = True
|
||||
return information, update_available, update_possible, online, error
|
||||
|
||||
def _queued_updates_timer_start(self):
|
||||
if self._queued_updates_abort_timer is not None:
|
||||
return
|
||||
|
||||
self._logger.debug("Starting queued updates timer.")
|
||||
|
||||
self._timeout_value = 60
|
||||
self._queued_updates_abort_timer = RepeatedTimer(
|
||||
1, self._queued_updates_timer_task
|
||||
)
|
||||
self._queued_updates_abort_timer.start()
|
||||
|
||||
def _queued_updates_timer_stop(self):
|
||||
if self._queued_updates_abort_timer is not None:
|
||||
self._queued_updates_abort_timer.cancel()
|
||||
self._queued_updates_abort_timer = None
|
||||
self._send_client_message(
|
||||
"queued_updates",
|
||||
{
|
||||
"targets": self._queued_updates["targets"],
|
||||
"timeout_value": -1,
|
||||
},
|
||||
)
|
||||
|
||||
def _queued_updates_timer_task(self):
|
||||
if self._timeout_value is None:
|
||||
return
|
||||
|
||||
self._timeout_value -= 1
|
||||
if self._timeout_value <= 0:
|
||||
if self._queued_updates_abort_timer is not None:
|
||||
self._queued_updates_abort_timer.cancel()
|
||||
self._queued_updates_abort_timer = None
|
||||
self.perform_updates(
|
||||
targets=self._queued_updates["targets"],
|
||||
force=self._queued_updates["force"],
|
||||
)
|
||||
self._queued_updates = {"targets": [], "force": True}
|
||||
self._send_client_message(
|
||||
"queued_updates",
|
||||
{
|
||||
"targets": self._queued_updates["targets"],
|
||||
"timeout_value": self._timeout_value,
|
||||
},
|
||||
)
|
||||
|
||||
def perform_updates(self, force=False, **kwargs):
|
||||
"""
|
||||
Performs the updates for the given check_targets. Will update all possible targets by default.
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
this.updateUrl = url + "update";
|
||||
this.configureUrl = url + "configure";
|
||||
this.updatelogUrl = url + "updatelog";
|
||||
this.queuedURL = this.updateUrl + "/queued";
|
||||
};
|
||||
|
||||
OctoPrintSoftwareUpdateClient.prototype.checkEntries = function (
|
||||
@@ -72,6 +73,37 @@
|
||||
return this.base.postJson(this.updateUrl, data, opts);
|
||||
};
|
||||
|
||||
OctoPrintSoftwareUpdateClient.prototype.cancelQueued = function (targets, opts) {
|
||||
if (arguments.length === 1 && _.isObject(arguments[0])) {
|
||||
var params = arguments[0];
|
||||
targets = params.targets;
|
||||
}
|
||||
|
||||
targets = targets || [];
|
||||
if (typeof targets === "string") {
|
||||
targets = [targets];
|
||||
}
|
||||
|
||||
var data = {
|
||||
command: "cancel",
|
||||
targets: targets
|
||||
};
|
||||
return this.base.postJson(this.queuedURL, data, opts);
|
||||
};
|
||||
|
||||
OctoPrintSoftwareUpdateClient.prototype.cancelAllQueued = function (opts) {
|
||||
if (arguments.length === 1 && _.isObject(arguments[0])) {
|
||||
var params = arguments[0];
|
||||
opts = params.opts;
|
||||
}
|
||||
|
||||
var data = {
|
||||
command: "cancel"
|
||||
};
|
||||
|
||||
return this.base.postJson(this.queuedURL, data, opts);
|
||||
};
|
||||
|
||||
OctoPrintSoftwareUpdateClient.prototype.updateAll = function (force, opts) {
|
||||
if (arguments.length === 1 && _.isObject(arguments[0])) {
|
||||
var params = arguments[0];
|
||||
|
||||
@@ -1 +1 @@
|
||||
#settings_plugin_softwareupdate_updatelist{display:block;width:auto;overflow-x:hidden;padding-right:2px;margin-bottom:1em}div.swupdate-advanced{margin-bottom:5px}td.settings_plugin_softwareupdate_column_update{width:16px}td.settings_plugin_softwareupdate_column_update a{text-decoration:none;color:#000}td.settings_plugin_softwareupdate_column_information .line{display:block}td.settings_plugin_softwareupdate_column_information .settings_plugin_softwareupdate_release_channel{line-height:20px;height:20px;font-size:9px;margin-bottom:0;vertical-align:baseline}#settings_plugin_softwareupdate_updatelog_list .line{display:block}#settings_plugin_softwareupdate_updatelog_list td.settings_plugin_softwareupdate_column_datetime{width:150px}#settings_plugin_softwareupdate_workingdialog_output{font-size:.8em}#settings_plugin_softwareupdate_workingdialog_output .message{font-weight:bold}#settings_plugin_softwareupdate_workingdialog_output .separator{font-weight:bold;color:#666666}#settings_plugin_softwareupdate_workingdialog_output .stdout{color:#333333}#settings_plugin_softwareupdate_workingdialog_output .stderr{color:#990000}#settings_plugin_softwareupdate_workingdialog_output .call{color:#000099}#settings_plugin_softwareupdate_workingdialog_output .message_error{font-weight:bold;color:#990000}.softwareupdate_notification ul{margin:10px 0 10px 25px}.softwareupdate_notification ul .name{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block}
|
||||
#settings_plugin_softwareupdate_updatelist{display:block;width:auto;overflow-x:hidden;padding-right:2px;margin-bottom:1em}div.swupdate-advanced{margin-bottom:5px}td.settings_plugin_softwareupdate_column_update{width:16px}td.settings_plugin_softwareupdate_column_update a{text-decoration:none;color:#000}td.settings_plugin_softwareupdate_column_information .line{display:block}td.settings_plugin_softwareupdate_column_information .settings_plugin_softwareupdate_release_channel{line-height:20px;height:20px;font-size:9px;margin-bottom:0;vertical-align:baseline}#settings_plugin_softwareupdate_updatelog_list .line{display:block}#settings_plugin_softwareupdate_updatelog_list td.settings_plugin_softwareupdate_column_datetime{width:150px}#settings_plugin_softwareupdate_workingdialog_output{font-size:.8em}#settings_plugin_softwareupdate_workingdialog_output .message{font-weight:bold}#settings_plugin_softwareupdate_workingdialog_output .separator{font-weight:bold;color:#666666}#settings_plugin_softwareupdate_workingdialog_output .stdout{color:#333333}#settings_plugin_softwareupdate_workingdialog_output .stderr{color:#990000}#settings_plugin_softwareupdate_workingdialog_output .call{color:#000099}#settings_plugin_softwareupdate_workingdialog_output .message_error{font-weight:bold;color:#990000}.softwareupdate_notification ul{margin:10px 0 10px 25px}.softwareupdate_notification ul .name{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block}.progress-softwareupdate.progress{position:relative;display:flex;overflow:hidden;height:25px;font-size:12px}.progress-softwareupdate.progress .bar{display:flex;justify-content:center;align-items:center;width:100%;color:white;height:25px;font-size:12px}.progress-softwareupdate.progress .progress-text{position:absolute;display:flex;justify-content:center;align-items:center;left:0;right:0;top:0;bottom:0;background:white;transition:clip-path 1s linear;height:25px;font-size:12px}
|
||||
@@ -14,10 +14,12 @@ $(function () {
|
||||
self.popup = undefined;
|
||||
|
||||
self.updateInProgress = false;
|
||||
self.cancelInProgress = false;
|
||||
self.waitingForRestart = false;
|
||||
self.restartTimeout = undefined;
|
||||
|
||||
self.currentlyBeingUpdated = [];
|
||||
self.queuedUpdates = ko.observableArray([]);
|
||||
|
||||
self.working = ko.observable(false);
|
||||
self.workingTitle = ko.observable();
|
||||
@@ -76,7 +78,6 @@ $(function () {
|
||||
!self.updateInProgress &&
|
||||
self.environmentSupported() &&
|
||||
self.storageSufficient() &&
|
||||
!self.printerState.isPrinting() &&
|
||||
!self.throttled()
|
||||
);
|
||||
});
|
||||
@@ -91,6 +92,14 @@ $(function () {
|
||||
);
|
||||
});
|
||||
|
||||
self.enableCancelQueued = ko.pureComputed(function () {
|
||||
return self.queuedUpdates().length > 0;
|
||||
});
|
||||
|
||||
self.updateQueued = function (item) {
|
||||
return self.queuedUpdates().indexOf(item.key) > -1;
|
||||
};
|
||||
|
||||
self.enable_configSave = ko.pureComputed(function () {
|
||||
return (
|
||||
self.config_checkType() === "github_release" ||
|
||||
@@ -155,6 +164,16 @@ $(function () {
|
||||
});
|
||||
});
|
||||
|
||||
self.availableAndQueued = ko.pureComputed(function () {
|
||||
return _.filter(self.versions.items(), function (info) {
|
||||
return (
|
||||
info.updateAvailable &&
|
||||
info.updatePossible &&
|
||||
self.queuedUpdates.indexOf(info.key) > -1
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
self.throttled = ko.pureComputed(function () {
|
||||
return (
|
||||
self.piSupport &&
|
||||
@@ -252,6 +271,12 @@ $(function () {
|
||||
});
|
||||
};
|
||||
|
||||
self.onBeforeBinding = function () {
|
||||
self.queuedUpdates(
|
||||
self.settings.settings.plugins.softwareupdate.queued_updates()
|
||||
);
|
||||
};
|
||||
|
||||
self._copyConfig = function () {
|
||||
var availableCheckTypes = [
|
||||
{key: "github_release", name: gettext("Release")},
|
||||
@@ -706,7 +731,6 @@ $(function () {
|
||||
|
||||
self.performUpdate = function (force, items) {
|
||||
if (!self.updateAccess()) return;
|
||||
if (self.printerState.isPrinting()) return;
|
||||
|
||||
self.updateInProgress = true;
|
||||
|
||||
@@ -725,6 +749,29 @@ $(function () {
|
||||
OctoPrint.plugins.softwareupdate
|
||||
.update(items, force)
|
||||
.done(function (data) {
|
||||
if (data.hasOwnProperty("queued")) {
|
||||
self.queuedUpdates(data.queued);
|
||||
var message =
|
||||
"<p>" +
|
||||
gettext(
|
||||
"The install of the following plugin update(s) has been queued for after current print is finished or cancelled."
|
||||
) +
|
||||
'</p><p><div class="row-fluid"><ul><li>' +
|
||||
_.map(self.availableAndQueued(), function (info) {
|
||||
return info.displayName;
|
||||
}).join("</li><li>") +
|
||||
"</li></ul></div></p>";
|
||||
self._showPopup({
|
||||
title: gettext("Updates Queued"),
|
||||
text: message,
|
||||
type: "info",
|
||||
buttons: {
|
||||
sticker: false
|
||||
}
|
||||
});
|
||||
self.updateInProgress = false;
|
||||
return;
|
||||
}
|
||||
self.currentlyBeingUpdated = data.checks;
|
||||
self._markWorking(
|
||||
gettext("Updating..."),
|
||||
@@ -780,18 +827,6 @@ $(function () {
|
||||
items = self.availableAndPossibleAndEnabled();
|
||||
}
|
||||
|
||||
if (self.printerState.isPrinting()) {
|
||||
self._showPopup({
|
||||
title: gettext("Can't update while printing"),
|
||||
text: gettext(
|
||||
"A print job is currently in progress. Updating will be prevented until it is done."
|
||||
),
|
||||
type: "error"
|
||||
});
|
||||
self._updateClicked = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.throttled()) {
|
||||
self._showPopup({
|
||||
title: gettext("Can't update while throttled"),
|
||||
@@ -836,13 +871,13 @@ $(function () {
|
||||
"Be sure to read through any linked release notes, especially those for OctoPrint since they might contain important information you need to know <strong>before</strong> upgrading."
|
||||
) +
|
||||
"</p>" +
|
||||
"<p><strong>" +
|
||||
gettext("This action may disrupt any ongoing print jobs.") +
|
||||
"</strong></p>" +
|
||||
"<p>" +
|
||||
gettext("Updates will be queued if currently printing,") +
|
||||
" <strong>" +
|
||||
gettext(
|
||||
"Depending on your printer's controller and general setup, restarting OctoPrint may cause your printer to be reset."
|
||||
"however this action may disrupt any ongoing print if OctoPrint is not currently controlling it."
|
||||
) +
|
||||
"</strong>" +
|
||||
"</p>" +
|
||||
"<p>" +
|
||||
gettext("Are you sure you want to proceed?") +
|
||||
@@ -972,6 +1007,24 @@ $(function () {
|
||||
}
|
||||
};
|
||||
|
||||
self.cancelQueued = function (items) {
|
||||
self.cancelInProgress = true;
|
||||
OctoPrint.plugins.softwareupdate
|
||||
.cancelQueued({
|
||||
targets: _.map(items, function (info) {
|
||||
return info.key;
|
||||
})
|
||||
})
|
||||
.done(function (data) {
|
||||
self.queuedUpdates(data.queued);
|
||||
self.cancelInProgress = false;
|
||||
})
|
||||
.fail(function (response) {
|
||||
console.log(response);
|
||||
self.cancelInProgress = false;
|
||||
});
|
||||
};
|
||||
|
||||
self.onDataUpdaterPluginMessage = function (plugin, data) {
|
||||
if (plugin !== "softwareupdate") {
|
||||
return;
|
||||
@@ -1170,24 +1223,190 @@ $(function () {
|
||||
self.performCheck();
|
||||
break;
|
||||
}
|
||||
}
|
||||
case "queued_updates":
|
||||
{
|
||||
if (!self.updateAccess()) {
|
||||
return;
|
||||
}
|
||||
if (messageData.hasOwnProperty("targets")) {
|
||||
self.queuedUpdates(messageData.targets);
|
||||
var queuedUpdatesPopupOptions = {
|
||||
title: title,
|
||||
text: text,
|
||||
type: "notice",
|
||||
icon: false,
|
||||
hide: false,
|
||||
buttons: {
|
||||
closer: false,
|
||||
sticker: false
|
||||
},
|
||||
history: {
|
||||
history: false
|
||||
}
|
||||
};
|
||||
|
||||
if (options !== undefined) {
|
||||
self._showPopup(options);
|
||||
}
|
||||
};
|
||||
if (
|
||||
messageData.print_failed &&
|
||||
messageData.targets.length > 0
|
||||
) {
|
||||
queuedUpdatesPopupOptions.title = gettext(
|
||||
"Queued Updates Paused"
|
||||
);
|
||||
queuedUpdatesPopupOptions.text =
|
||||
'<div class="row-fluid"><ul><li>' +
|
||||
_.map(self.availableAndQueued(), function (info) {
|
||||
return info.displayName;
|
||||
}).join("</li><li>") +
|
||||
"</li></ul></div>";
|
||||
queuedUpdatesPopupOptions.confirm = {
|
||||
confirm: true,
|
||||
buttons: [
|
||||
{
|
||||
text: gettext("Continue Updates"),
|
||||
addClass: "btn-block btn-primary",
|
||||
promptTrigger: true,
|
||||
click: function (notice, value) {
|
||||
notice.remove();
|
||||
notice
|
||||
.get()
|
||||
.trigger("pnotify.continue", [
|
||||
notice,
|
||||
value
|
||||
]);
|
||||
}
|
||||
},
|
||||
{
|
||||
text: gettext("Cancel Updates"),
|
||||
addClass: "btn-block btn-danger",
|
||||
promptTrigger: true,
|
||||
click: function (notice, value) {
|
||||
notice.remove();
|
||||
notice
|
||||
.get()
|
||||
.trigger("pnotify.cancel", [
|
||||
notice,
|
||||
value
|
||||
]);
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
} else if (
|
||||
messageData.hasOwnProperty("timeout_value") &&
|
||||
messageData.timeout_value > 0 &&
|
||||
messageData.targets.length > 0
|
||||
) {
|
||||
var progress_percent = Math.floor(
|
||||
(messageData.timeout_value / 60) * 100
|
||||
);
|
||||
var progress_class =
|
||||
progress_percent < 25
|
||||
? "progress-danger"
|
||||
: progress_percent > 75
|
||||
? "progress-success"
|
||||
: "progress-warning";
|
||||
queuedUpdatesPopupOptions.title = gettext(
|
||||
"Starting Queued Updates"
|
||||
);
|
||||
queuedUpdatesPopupOptions.text =
|
||||
'<div class="row-fluid"><ul><li>' +
|
||||
_.map(self.availableAndQueued(), function (info) {
|
||||
return info.displayName;
|
||||
}).join("</li><li>") +
|
||||
'</li></ul></div><div class="progress progress-softwareupdate ' +
|
||||
progress_class +
|
||||
'"><div class="bar">' +
|
||||
gettext("Updating in ") +
|
||||
" " +
|
||||
messageData.timeout_value +
|
||||
" " +
|
||||
gettext("secs") +
|
||||
'</div><div class="progress-text" style="clip-path: inset(0 0 0 ' +
|
||||
progress_percent +
|
||||
"%);-webkit-clip-path: inset(0 0 0 " +
|
||||
progress_percent +
|
||||
'%);">' +
|
||||
gettext("Updating in ") +
|
||||
" " +
|
||||
messageData.timeout_value +
|
||||
" " +
|
||||
gettext("secs") +
|
||||
"</div></div>";
|
||||
queuedUpdatesPopupOptions.confirm = {
|
||||
confirm: true,
|
||||
buttons: [
|
||||
{
|
||||
text: gettext("Cancel Updates"),
|
||||
addClass: "btn-block btn-danger",
|
||||
promptTrigger: true,
|
||||
click: function (notice, value) {
|
||||
notice.remove();
|
||||
notice
|
||||
.get()
|
||||
.trigger("pnotify.cancel", [
|
||||
notice,
|
||||
value
|
||||
]);
|
||||
}
|
||||
},
|
||||
{
|
||||
text: "",
|
||||
addClass: "hidden"
|
||||
}
|
||||
]
|
||||
};
|
||||
} else {
|
||||
if (typeof self.queuedUpdatesPopup !== "undefined") {
|
||||
self.queuedUpdatesPopup.remove();
|
||||
self.queuedUpdatesPopup = undefined;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
self._forcedStdoutPatterns = [
|
||||
"You are using pip version .*?, however version .*? is available.",
|
||||
"You should consider upgrading via the '.*?' command.",
|
||||
"'.*?' does not exist -- can't clean it"
|
||||
];
|
||||
self._forcedStdoutLine = new RegExp(self._forcedStdoutPatterns.join("|"));
|
||||
self._preprocessLine = function (line) {
|
||||
if (line.stream === "stderr" && line.line.match(self._forcedStdoutLine)) {
|
||||
line.stream = "stdout";
|
||||
if (typeof self.queuedUpdatesPopup !== "undefined") {
|
||||
self.queuedUpdatesPopup.update(queuedUpdatesPopupOptions);
|
||||
} else {
|
||||
self.queuedUpdatesPopup = new PNotify(
|
||||
queuedUpdatesPopupOptions
|
||||
);
|
||||
self.queuedUpdatesPopup
|
||||
.get()
|
||||
.on("pnotify.cancel", function () {
|
||||
self.queuedUpdatesPopup = undefined;
|
||||
self.cancelQueued();
|
||||
});
|
||||
self.queuedUpdatesPopup
|
||||
.get()
|
||||
.on("pnotify.continue", function () {
|
||||
self.queuedUpdatesPopup = undefined;
|
||||
self.performUpdate(true, self.queuedUpdates());
|
||||
self._updateClicked = false;
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (typeof self.queuedUpdatesPopup !== "undefined") {
|
||||
self.queuedUpdatesPopup.remove();
|
||||
self.queuedUpdatesPopup = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (options !== undefined) {
|
||||
self._showPopup(options);
|
||||
}
|
||||
}
|
||||
return line;
|
||||
self._forcedStdoutPatterns = [
|
||||
"You are using pip version .*?, however version .*? is available.",
|
||||
"You should consider upgrading via the '.*?' command.",
|
||||
"'.*?' does not exist -- can't clean it"
|
||||
];
|
||||
self._forcedStdoutLine = new RegExp(self._forcedStdoutPatterns.join("|"));
|
||||
self._preprocessLine = function (line) {
|
||||
if (line.stream === "stderr" && line.line.match(self._forcedStdoutLine)) {
|
||||
line.stream = "stdout";
|
||||
}
|
||||
return line;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -85,3 +85,36 @@ td.settings_plugin_softwareupdate_column_information {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.progress-softwareupdate.progress {
|
||||
position: relative;
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
height: 25px;
|
||||
font-size: 12px;
|
||||
|
||||
.bar {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
color: white;
|
||||
height: 25px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.progress-text {
|
||||
position: absolute;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
background: white;
|
||||
transition: clip-path 1s linear;
|
||||
height: 25px;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
@@ -63,15 +63,6 @@
|
||||
Read more on this in <a href="https://faq.octoprint.org/pi-issues" target="_blank" rel="noopener noreferrer">the FAQ</a>.
|
||||
</p>
|
||||
{% endtrans %}</div>
|
||||
<div class="alert" data-bind="visible: printerState.isPrinting()">{% trans %}
|
||||
<p>
|
||||
<strong>OctoPrint is currently printing, updates are disabled.</strong>
|
||||
</p>
|
||||
<p>
|
||||
Running updates is not supported while printing in order to not risk any kind of disruption to the print job.
|
||||
Please let the print finish before trying to update.
|
||||
</p>
|
||||
{% endtrans %}</div>
|
||||
|
||||
<ul class="nav nav-pills">
|
||||
<li class="active">
|
||||
@@ -85,6 +76,9 @@
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="settings_plugin_softwareupdate_updates">
|
||||
<div class="pull-right">
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-primary" data-bind="click: function() { $root.cancelQueued(); }, enable: enableCancelQueued, css: {disabled: !enableCancelQueued}, visible: enableCancelQueued" title="{{ _('Cancel all queued updates') | edq }}" style="display: none;"><i class="fas fa-spinner fa-spin" data-bind="visible: cancelInProgress"></i> {{ _('Cancel Queued') }}</button>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-primary" data-bind="click: function() { $root.updateEnabled(); }, enable: enableUpdateEnabled, css: {disabled: !enableUpdateEnabled}" title="{{ _('Update all enabled') | edq }}"><i class="fas fa-spinner fa-spin" data-bind="visible: updateInProgress"></i> {{ _('Update all') }}</button>
|
||||
<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>
|
||||
@@ -113,7 +107,8 @@
|
||||
<span data-bind="visible: !compatible" class="muted"><i class="fas fa-power-off" title="{{ _('Not compatible') }}|edq"></i></span>
|
||||
</td>
|
||||
<td class="settings_plugin_softwareupdate_column_information">
|
||||
<a href="javascript:void(0)" data-bind="click: function() { $root.update(false, [$data]) }, visible: $root.enableUpdate() && updateAvailable && updatePossible" class="btn btn-primary pull-right">{{ _('Update') }}</a>
|
||||
<a href="javascript:void(0)" data-bind="click: function() { $root.update(false, [$data]) }, visible: $root.enableUpdate() && updateAvailable && updatePossible && !$root.updateQueued($data)" class="btn btn-primary pull-right">{{ _('Update') }}</a>
|
||||
<a href="javascript:void(0)" data-bind="click: function() { $root.cancelQueued([$data]) }, visible: $root.updateQueued($data)" class="btn btn-primary pull-right">{{ _('Cancel Queued') }}</a>
|
||||
<strong data-bind="text: displayName"></strong>: <span data-bind="text: displayVersion"></span> <span data-bind="invisible: updatePossible"><i class="fas fa-exclamation-triangle" data-bind="css: {'fa-unlink': !online && information && information.needs_online, 'fa-exclamation-triangle': !(!online && information && information.needs_online)}, attr: {title: $root.iconTitleForEntry($data)}"></i></span><br>
|
||||
<small data-bind="visible: compatible" class="muted">
|
||||
<span data-bind="visible: releaseChannels && releaseChannels.available" class="line">{{ _('Release Channel:') }} <select class="settings_plugin_softwareupdate_release_channel" data-bind="visible: releaseChannels && releaseChannels.available, value: releaseChannels.current, options: releaseChannels.available, optionsText: 'name', optionsValue: 'channel'"></select> <a href="https://faq.octoprint.org/using-release-channels" target="_blank"><i class="fas fa-question-circle"></i></a></span>
|
||||
|
||||
Reference in new issue
Block a user