diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 000000000..07d8c6d37
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,114 @@
+---
+name: 🐛 Report a bug
+about: Create a bug report to help improve OctoPrint
+---
+
+
+
+#### What were you doing?
+
+
+
+1. Go to '...'
+2. Click on '....'
+3. Scroll down to '....'
+4. See error
+
+
+
+#### What did you expect to happen?
+
+#### What happened instead?
+
+#### Did the same happen when running OctoPrint in safe mode?
+
+
+
+#### Version of OctoPrint
+
+
+
+#### Printer model & used firmware incl. version
+
+
+
+#### Browser and version of browser, operating system running browser
+
+
+
+#### System Info Bundle
+
+
+
+#### Link to contents of Javascript console in the browser
+
+
+
+#### Screenshot(s)/video(s) showing the problem:
+
+
+
+I have read the FAQ.
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
deleted file mode 100644
index fa873c9c1..000000000
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
+++ /dev/null
@@ -1,133 +0,0 @@
-name: 🐛 Report a bug
-description: Create a bug report to help improve OctoPrint
-body:
- - type: markdown
- attributes:
- value: >
- **Thank you for wanting to report a bug in OctoPrint!**
-
-
- If this is the first time you are doing this, please take a few moments to read
- through the [Contribution Guidelines](https://github.com/OctoPrint/OctoPrint/blob/master/CONTRIBUTING.md).
- Also check out [the FAQ](https://faq.octoprint.org) if your
- problem is maybe already covered there.
-
-
- You are about to report a bug in **OctoPrint**. Do not proceed if your issues
- occurs with OctoPi, any third party OctoPrint plugins, unofficial or outdated
- OctoPrint versions. If you are unsure of the difference between OctoPrint and
- OctoPi, [read this FAQ entry](https://faq.octoprint.org/octoprint-vs-octopi).
-
-
- Do also not seek support here ("I need help with ...", "I have a
- question ...", "Can someone walk me through ..."), that belongs into the
- [community forum at community.octoprint.org](https://community.octoprint.org) or on the [Discord server](https://discord.octoprint.org).
-
-
- And finally, make sure any bug you want to report is still present with the **current**
- OctoPrint version and that it does not vanish when you start OctoPrint
- in [safe mode](https://docs.octoprint.org/en/master/features/safemode.html) either.
-
-
- Thank you for your collaboration!
- - type: textarea
- attributes:
- label: The problem
- description: >-
- Describe the issue you are experiencing here. Tell us what you were trying to do
- step by step, and what happened that you did not expect.
-
- Provide a clear and concise description of what the problem is and include as many
- details as possible.
- placeholder: |
- 1. ...
- 2. ...
- 3. ...
- validations:
- required: true
- - type: dropdown
- attributes:
- label: Did the issue persist even in safe mode?
- description: >-
- Testing in safe mode is required to make sure the issue you are reporting is not
- caused by a third party plugin. Please see [here](https://docs.octoprint.org/en/master/features/safemode.html)
- on how to run OctoPrint in safe mode.
- options:
- - Yes, it did persist
- - No, it did not persist (it's an issue with one of your installed plugins, don't report here)
- - I cannot test this issue in safe mode (state why below)
- validations:
- required: true
- - type: input
- attributes:
- label: If you could not test in safe mode, please state why
- description: >-
- Issues caused by a third party plugin are a major cause of bugs reported here, so we really need to
- rule out that a plugin is at fault here. [Safe mode](https://docs.octoprint.org/en/master/features/safemode.html) is an easy way to do that. Only skip safe mode
- if your particular problem *absolutely requires* third party plugins to be enabled. "It would take
- too long" is **not** a reason to skip testing in safe mode, neither is "I do not know how to
- enable it" as you can find info on that [here](https://docs.octoprint.org/en/master/features/safemode.html).
-
- If you really *cannot* test in safe mode, leave a short explanation as to why.
- - type: markdown
- attributes:
- value: |
- ## Environment
- - type: input
- attributes:
- label: Version of OctoPrint
- description: Can be found in the lower left corner of the web interface.
- validations:
- required: true
- - type: input
- attributes:
- label: Operating system running OctoPrint
- description: >-
- OctoPi, Linux, Windows, MacOS, something else? With version please? OctoPi's
- version can be found in `/etc/octopi_version` or in the lower left corner of the
- web interface.
- validations:
- required: true
- - type: input
- attributes:
- label: Printer model & used firmware incl. version
- description: If applicable, always include if unsure
- - type: input
- attributes:
- label: Browser and version of browser, operating system running browser
- description: If applicable, always include if unsure
- - type: markdown
- attributes:
- value: |
- ## Logs and other files needed for analysis
- - type: markdown
- attributes:
- value: >-
- Please also be sure to upload the following files below:
-
- * `octoprint.log`: See [here](https://community.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299) if you don't know where to find that. Just attach down below as-is.
- * `serial.log` or the contents of your terminal tab, if applicable. Always
- include if unsure. **Please note that you need to enable `serial.log` first**,
- see [here](https://community.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299) if you don't know how to do or where to find it. Just attach down below as-is.
- * Your browser's JavaScript console, if you are reporting a problem with the
- user interface. See [here](https://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers) on where to find that.
- * If possible, screenshots or videos showing the problem, especially if you
- are reporting a problem with the user interface!
- * GCODE files with which to reproduce, if you are reporting an issue with
- GCODE file analysis or printing behaviour.
-
- Please be aware that unless at least `octoprint.log` is included, your bug report
- will not be processed.
- - type: checkboxes
- attributes:
- label: Checklist of files to include below
- options:
- - label: octoprint.log
- required: true
- - label: serial.log or contents of your terminal tab (always include in cases of issues with printer communication)
- - label: Contents of the JavaScript browser console (always include in cases of issues with the user interface)
- - label: Screenshots and/or videos showing the problem (always include in case of issues with the user interface)
- - label: GCODE file with which to reproduce (always include in case of issues with GCODE analysis or printing behaviour)
- - type: textarea
- attributes:
- label: Additional information & file uploads
diff --git a/.github/workflows/issue_automation.yml b/.github/workflows/issue_automation.yml
index fb59a7d97..0ba8b6f44 100644
--- a/.github/workflows/issue_automation.yml
+++ b/.github/workflows/issue_automation.yml
@@ -63,7 +63,7 @@ jobs:
})
}
- #- uses: OctoPrint/actions/issue-validation@main
- # if: github.event_name == 'issues' && (github.event.action == 'opened' || github.event.action == 'edited')
- # with:
- # repo-token: ${{ secrets.GITHUB_TOKEN }}
+ - uses: OctoPrint/actions/issue-validation@main
+ if: github.event_name == 'issues' && (github.event.action == 'opened' || github.event.action == 'edited')
+ with:
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
diff --git a/AUTHORS.md b/AUTHORS.md
index 1646b14e2..85ae55889 100644
--- a/AUTHORS.md
+++ b/AUTHORS.md
@@ -142,6 +142,7 @@ date of first contribution):
* [Scott Lahteine](https://github.com/thinkyhead)
* [Karthikeyan Singaravelan](https://github.com/tirkarthi)
* [Yvan Rodrigues](https://github.com/TwoRedCells)
+ * [Elton Law](https://github.com/eltonlaw)
* ["sparxooo"] (https://github.com/sparxooo)
OctoPrint started off as a fork of [Cura](https://github.com/daid/Cura) by
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 2097ccd8d..51c1e7d19 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -31,7 +31,7 @@ nothing but ticket management.
- **[Read the FAQ](https://faq.octoprint.org)**
- If you want to report a **bug**, [read "How to file a bug report" below](#how-to-file-a-bug-report)
- and *[use the provided form](https://github.com/OctoPrint/OctoPrint/issues/new?template=bug_report.yml)*.
+ and *[use the provided template](#what-should-i-include-in-a-ticket)*.
You do not need to do anything else with your ticket.
- If you want to post a **feature request** or a **documentation request**, add `[Request]`
to your issue's title (e.g. `[Request] Awesome new feature`). A question on how to run/change/setup
@@ -48,6 +48,15 @@ nothing but ticket management.
No matter what kind of ticket you create, never mix two or more "ticket reasons"
into one ticket: One ticket per bug, request, brainstorming thread please.
+> 👉 **Note**
+>
+> A bot is in place that monitors new tickets, automatically
+> categorizes them and checks new bug reports for usage of the provided template.
+> That bot will only bother you if you open a ticket that appears to be a bug (no
+> `[Request]` in the title) without the complete template, and it
+> will do that only to ensure that all information needed to solve the issue is
+> available for the maintainers to directly start tackling that problem.
+
## How to file a bug report
If you encounter an issue with OctoPrint, you are welcome to
@@ -109,7 +118,7 @@ following section *completely* and also follow the instructions in the
it is the same as your's, it actually behaves the same as your's. E.g. if someone gives steps
to reproduce his bug that looks like your's, reproduce the bug like that if possible,
and only add a "me too" if you actually can reproduce the same
- issue. Also **provide all information like logs, versions, different reproduction steps**
+ issue. Also **provide all information like Systeminfo Bundle, additional logs & versions, different reproduction steps**
and whatever was additionally requested over the course of the ticket
even if you "only" add to an existing ticket. The more information available regarding a bug, the higher
the chances of reproducing and solving it. But "me too" on an actually unrelated ticket
@@ -126,12 +135,128 @@ there.
First of all make sure your use **a descriptive title**. "It doesn't work"
and similar unspecific complaints are NOT descriptive titles.
-Always fill out the [reporting form](https://github.com/OctoPrint/OctoPrint/issues/new?template=bug_report.yml) **completely** and include as much
-information as possible.
+**Always use the following template, even if only adding a "me too" to an
+existing ticket**:
+
+```
+
+
+#### What were you doing?
+
+
+
+1. Go to '...'
+2. Click on '....'
+3. Scroll down to '....'
+4. See error
+
+
+
+#### What did you expect to happen?
+
+#### What happened instead?
+
+#### Did the same happen when running OctoPrint in safe mode?
+
+
+
+#### Version of OctoPrint
+
+
+
+#### Printer model & used firmware incl. version
+
+
+
+#### Browser and version of browser, operating system running browser
+
+
+
+#### System Info Bundle
+
+
+
+#### Link to contents of Javascript console in the browser
+
+
+
+#### Screenshot(s)/video(s) showing the problem:
+
+
+
+I have read the FAQ.
+```
Provide the same kind and amount of information also when you are just adding on to an
existing ticket!
+### Where can I find the System Info Bundle?
+
+Please refer to [this FAQ entry](https://community.octoprint.org/t/what-is-a-systeminfo-bundle-and-how-can-i-obtain-one/29887).
+
### Where can I find which version and branch I'm on?
Please refer to [this FAQ entry](https://community.octoprint.org/t/how-can-i-find-out-the-version-of-octoprint-or-octopi-i-am-running/204/1).
@@ -287,7 +412,8 @@ See [the corresponding chapter in the documentation](https://docs.octoprint.org/
* 2020-09-23: Move branch & versioning into development docs
* 2020-10-07: Introduce `pre-commit`
* 2021-02-04: Issue forms! \o/
- * 2020-03-04: Correct issue forms link
+ * 2021-03-04: Correct issue forms link
+ * 2021-04-27: Systeminfo Bundles! \o/
## Footnotes
* [1] - If you are wondering why, the problem is that anything that you add
diff --git a/SUPPORTERS.md b/SUPPORTERS.md
index 19999e43f..58b6bb381 100644
--- a/SUPPORTERS.md
+++ b/SUPPORTERS.md
@@ -78,4 +78,4 @@ thanks to everyone who contributed!
* Ulderico Cirello
* Ulrich Kempken
-and 2323 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel) or via [GitHub Sponsors](https://github.com/users/foosel/sponsorship)!
+and 2341 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel) or via [GitHub Sponsors](https://github.com/users/foosel/sponsorship)!
diff --git a/THIRDPARTYLICENSES.md b/THIRDPARTYLICENSES.md
index 80556b1cb..2708c1520 100644
--- a/THIRDPARTYLICENSES.md
+++ b/THIRDPARTYLICENSES.md
@@ -31,7 +31,6 @@
* [Moment.js](http://momentjs.com/): MIT
* [PNotify](http://sciactive.com/pnotify/): GPL, LGPL, MPL (triple licensed)
* [pusher.color.js](http://cache.preserve.io/5g18q0pw/index.html) (original link dead): MIT
- * [ResizeSensor.js](https://github.com/procurios/ResizeSensor): MIT
* [SockJS](https://github.com/sockjs/sockjs-client): MIT
* [sprintf-js](http://alexei.ro/): BSD
diff --git a/docs/api/files.rst b/docs/api/files.rst
index 0757bde41..73ca66ae3 100644
--- a/docs/api/files.rst
+++ b/docs/api/files.rst
@@ -585,6 +585,15 @@ Issue a file command
Requires the ``FILES_SELECT`` permission.
+ unselect
+ Unselects the currently selected file for printing.
+
+ Upon success, a status code of :http:statuscode:`204` and an empty body is returned. If no file is selected
+ or there already is an active print job, a :http:statuscode:`409` is returned. If path isn't ``current```
+ or the filename of the current selection, a :http:statuscode:`400` is returned
+
+ Requires the ``FILES_SELECT`` permission.
+
slice
Slices an STL file into GCODE. Note that this is an asynchronous operation that will take place in the background
after the response has been sent back to the client. Additional parameters are:
diff --git a/setup.py b/setup.py
index 02c1509e5..bc25b849f 100644
--- a/setup.py
+++ b/setup.py
@@ -279,9 +279,9 @@ def params():
project_urls = {
"Community Forum": "https://community.octoprint.org",
- "Bug Reports": "https://github.com/foosel/OctoPrint/issues",
- "Source": "https://github.com/foosel/OctoPrint",
- "Funding": "https://donate.octoprint.org",
+ "Bug Reports": "https://github.com/OctoPrint/OctoPrint/issues",
+ "Source": "https://github.com/OctoPrint/OctoPrint",
+ "Funding": "https://support.octoprint.org",
}
packages = setuptools.find_packages(where="src")
diff --git a/src/octoprint/plugins/errortracking/__init__.py b/src/octoprint/plugins/errortracking/__init__.py
index 637aefd95..cc8688013 100644
--- a/src/octoprint/plugins/errortracking/__init__.py
+++ b/src/octoprint/plugins/errortracking/__init__.py
@@ -21,10 +21,10 @@ from octoprint.util.version import (
)
SENTRY_URL_SERVER = (
- "https://6307d7f23ce040a29e080363a8aa1b1a@o118517.ingest.sentry.io/1373987"
+ "https://587d00b409ab4a3da3258c9adee29335@o118517.ingest.sentry.io/1373987"
)
SENTRY_URL_COREUI = (
- "https://e6c081baf17c4a82b871ed2a0cb09eba@o118517.ingest.sentry.io/1374096"
+ "https://722128c3b0ff45108bbfdfa566762c89@o118517.ingest.sentry.io/1374096"
)
SETTINGS_DEFAULTS = {
diff --git a/src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_tab.jinja2 b/src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_tab.jinja2
index 9c8ce4eb3..3451d5daf 100644
--- a/src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_tab.jinja2
+++ b/src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_tab.jinja2
@@ -17,10 +17,8 @@
diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py
index 66a02ff6e..93cafa498 100644
--- a/src/octoprint/server/__init__.py
+++ b/src/octoprint/server/__init__.py
@@ -2057,7 +2057,6 @@ class Server(object):
"js/lib/bootstrap-slider-knockout-binding.js",
"js/lib/loglevel.min.js",
"js/lib/sockjs.min.js",
- "js/lib/ResizeSensor.js",
"js/lib/hls.js",
"js/lib/less.js",
]
diff --git a/src/octoprint/server/api/files.py b/src/octoprint/server/api/files.py
index 456431ac4..6453ce070 100644
--- a/src/octoprint/server/api/files.py
+++ b/src/octoprint/server/api/files.py
@@ -794,6 +794,7 @@ def gcodeFileCommand(filename, target):
# valid file commands, dict mapping command name to mandatory parameters
valid_commands = {
"select": [],
+ "unselect": [],
"slice": [],
"analyse": [],
"copy": ["destination"],
@@ -842,6 +843,26 @@ def gcodeFileCommand(filename, target):
filenameToSelect = fileManager.path_on_disk(target, filename)
printer.select_file(filenameToSelect, sd, printAfterLoading, user)
+ elif command == "unselect":
+ with Permissions.FILES_SELECT.require(403):
+ if not printer.is_ready():
+ return make_response(
+ "Printer is already printing, cannot unselect current file", 409
+ )
+
+ _, currentFilename = _getCurrentFile()
+ if currentFilename is None:
+ return make_response(
+ "Cannot unselect current file when there is no file selected", 409
+ )
+
+ if filename != currentFilename and filename != "current":
+ return make_response(
+ "Only the currently selected file can be unselected", 400
+ )
+
+ printer.unselect_file()
+
elif command == "slice":
with Permissions.SLICE.require(403):
if not _verifyFileExists(target, filename):
diff --git a/src/octoprint/server/util/flask.py b/src/octoprint/server/util/flask.py
index b5aa8597d..4afa58051 100644
--- a/src/octoprint/server/util/flask.py
+++ b/src/octoprint/server/util/flask.py
@@ -1702,7 +1702,6 @@ def collect_core_assets(preferred_stylesheet="css"):
assets["js"] = [
"js/app/bindings/allowbindings.js",
"js/app/bindings/contextmenu.js",
- "js/app/bindings/copywidth.js",
"js/app/bindings/invisible.js",
"js/app/bindings/popover.js",
"js/app/bindings/qrcode.js",
diff --git a/src/octoprint/static/js/app/bindings/copywidth.js b/src/octoprint/static/js/app/bindings/copywidth.js
deleted file mode 100644
index fe00b025e..000000000
--- a/src/octoprint/static/js/app/bindings/copywidth.js
+++ /dev/null
@@ -1,48 +0,0 @@
-ko.bindingHandlers.copyWidth = {
- init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
- var node = ko.bindingHandlers.copyWidth._getReferenceNode(element, valueAccessor);
- ko.bindingHandlers.copyWidth._setWidth(node, element);
- ko.bindingHandlers.copyWidth._addResizeSensor(node, element);
- },
- update: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
- var node = ko.bindingHandlers.copyWidth._getReferenceNode(element, valueAccessor);
- ko.bindingHandlers.copyWidth._setWidth(node, element);
- ko.bindingHandlers.copyWidth._addResizeSensor(node, element);
- },
- _setWidth: function (node, element) {
- var width = node.width();
- if (!width) return;
- if ($(element).width() === width) return;
- element.style.width = width + "px";
- },
- _getReferenceNode: function (element, valueAccessor) {
- var value = ko.utils.unwrapObservable(valueAccessor());
- if (!value) return;
-
- var parts = value.split(" ");
- var node = $(element);
- while (parts.length > 0) {
- var part = parts.shift();
- if (part === ":parent") {
- node = node.parent();
- } else {
- var selector = part;
- if (parts.length > 0) {
- selector += " " + parts.join(" ");
- }
- node = $(selector, node);
- break;
- }
- }
- return node;
- },
- _addResizeSensor: function (node, element) {
- if (element.copyWidthSensor) {
- element.copyWidthSensor.detach();
- delete element.copyWidthSensor;
- }
- element.copyWidthSensor = new ResizeSensor(node, function () {
- ko.bindingHandlers.copyWidth._setWidth(node, element);
- });
- }
-};
diff --git a/src/octoprint/static/js/app/viewmodels/files.js b/src/octoprint/static/js/app/viewmodels/files.js
index 113a3d5ab..953816b4a 100644
--- a/src/octoprint/static/js/app/viewmodels/files.js
+++ b/src/octoprint/static/js/app/viewmodels/files.js
@@ -117,6 +117,7 @@ $(function () {
self.allItems = ko.observable(undefined);
self.currentPath = ko.observable("");
self.uploadProgressText = ko.observable();
+ self.uploadProgressPercentage = ko.observable();
// list style incl. persistence
var listStyleStorageKey = "gcodeFiles.currentListStyle";
@@ -1310,6 +1311,7 @@ $(function () {
self.uploadProgress.addClass("progress-striped").addClass("active");
self.uploadProgressBar.css("width", "100%");
if (payload.progressAvailable) {
+ self.uploadProgressPercentage(percentage);
self.uploadProgressText(
_.sprintf(gettext("Slicing ... (%(percentage)d%%)"), {percentage: 0})
);
@@ -1324,18 +1326,21 @@ $(function () {
percentage: Math.round(progress)
})
);
+ self.uploadProgressPercentage(Math.round(progress));
};
self.onEventSlicingCancelled = function (payload) {
self.uploadProgress.removeClass("progress-striped").removeClass("active");
self.uploadProgressBar.css("width", "0%");
self.uploadProgressText("");
+ self.uploadProgressPercentage(0);
};
self.onEventSlicingDone = function (payload) {
self.uploadProgress.removeClass("progress-striped").removeClass("active");
self.uploadProgressBar.css("width", "0%");
self.uploadProgressText("");
+ self.uploadProgressPercentage(0);
new PNotify({
title: gettext("Slicing done"),
@@ -1357,6 +1362,7 @@ $(function () {
self.uploadProgress.removeClass("progress-striped").removeClass("active");
self.uploadProgressBar.css("width", "0%");
self.uploadProgressText("");
+ self.uploadProgressPercentage(0);
var html = _.sprintf(
gettext("Could not slice %(stl)s to %(gcode)s: %(reason)s"),
@@ -1385,6 +1391,7 @@ $(function () {
self.onEventTransferStarted = function (payload) {
self.uploadProgress.addClass("progress-striped").addClass("active");
self.uploadProgressBar.css("width", "100%");
+ self.uploadProgressPercentage(100);
self.uploadProgressText(gettext("Streaming ..."));
};
@@ -1392,6 +1399,7 @@ $(function () {
self.uploadProgress.removeClass("progress-striped").removeClass("active");
self.uploadProgressBar.css("width", "0");
self.uploadProgressText("");
+ self.uploadProgressPercentage(0);
new PNotify({
title: gettext("Streaming done"),
@@ -1415,6 +1423,7 @@ $(function () {
self.uploadProgress.removeClass("progress-striped").removeClass("active");
self.uploadProgressBar.css("width", "0");
self.uploadProgressText("");
+ self.uploadProgressPercentage(0);
new PNotify({
title: gettext("Streaming failed"),
@@ -1473,6 +1482,7 @@ $(function () {
self._setProgressBar = function (percentage, text, active) {
self.uploadProgressBar.css("width", percentage + "%");
self.uploadProgressText(text);
+ self.uploadProgressPercentage(percentage);
if (active) {
self.uploadProgress.addClass("progress-striped active");
diff --git a/src/octoprint/static/js/lib/ResizeSensor.js b/src/octoprint/static/js/lib/ResizeSensor.js
deleted file mode 100644
index 9a25503bf..000000000
--- a/src/octoprint/static/js/lib/ResizeSensor.js
+++ /dev/null
@@ -1,373 +0,0 @@
-'use strict';
-
-/**
- * Copyright Marc J. Schmidt. See the LICENSE file at the top-level
- * directory of this distribution and at
- * https://github.com/marcj/css-element-queries/blob/master/LICENSE.
- */
-(function (root, factory) {
- if (typeof define === "function" && define.amd) {
- define(factory);
- } else if (typeof exports === "object") {
- module.exports = factory();
- } else {
- root.ResizeSensor = factory();
- }
-}(typeof window !== 'undefined' ? window : this, function () {
-
- // Make sure it does not throw in a SSR (Server Side Rendering) situation
- if (typeof window === "undefined") {
- return null;
- }
- // https://github.com/Semantic-Org/Semantic-UI/issues/3855
- // https://github.com/marcj/css-element-queries/issues/257
- var globalWindow = typeof window != 'undefined' && window.Math == Math
- ? window
- : typeof self != 'undefined' && self.Math == Math
- ? self
- : Function('return this')();
- // Only used for the dirty checking, so the event callback count is limited to max 1 call per fps per sensor.
- // In combination with the event based resize sensor this saves cpu time, because the sensor is too fast and
- // would generate too many unnecessary events.
- var requestAnimationFrame = globalWindow.requestAnimationFrame ||
- globalWindow.mozRequestAnimationFrame ||
- globalWindow.webkitRequestAnimationFrame ||
- function (fn) {
- return globalWindow.setTimeout(fn, 20);
- };
-
- var cancelAnimationFrame = globalWindow.cancelAnimationFrame ||
- globalWindow.mozCancelAnimationFrame ||
- globalWindow.webkitCancelAnimationFrame ||
- function (timer) {
- globalWindow.clearTimeout(timer);
- };
-
- /**
- * Iterate over each of the provided element(s).
- *
- * @param {HTMLElement|HTMLElement[]} elements
- * @param {Function} callback
- */
- function forEachElement(elements, callback){
- var elementsType = Object.prototype.toString.call(elements);
- var isCollectionTyped = ('[object Array]' === elementsType
- || ('[object NodeList]' === elementsType)
- || ('[object HTMLCollection]' === elementsType)
- || ('[object Object]' === elementsType)
- || ('undefined' !== typeof jQuery && elements instanceof jQuery) //jquery
- || ('undefined' !== typeof Elements && elements instanceof Elements) //mootools
- );
- var i = 0, j = elements.length;
- if (isCollectionTyped) {
- for (; i < j; i++) {
- callback(elements[i]);
- }
- } else {
- callback(elements);
- }
- }
-
- /**
- * Get element size
- * @param {HTMLElement} element
- * @returns {Object} {width, height}
- */
- function getElementSize(element) {
- if (!element.getBoundingClientRect) {
- return {
- width: element.offsetWidth,
- height: element.offsetHeight
- }
- }
-
- var rect = element.getBoundingClientRect();
- return {
- width: Math.round(rect.width),
- height: Math.round(rect.height)
- }
- }
-
- /**
- * Apply CSS styles to element.
- *
- * @param {HTMLElement} element
- * @param {Object} style
- */
- function setStyle(element, style) {
- Object.keys(style).forEach(function(key) {
- element.style[key] = style[key];
- });
- }
-
- /**
- * Class for dimension change detection.
- *
- * @param {Element|Element[]|Elements|jQuery} element
- * @param {Function} callback
- *
- * @constructor
- */
- var ResizeSensor = function(element, callback) {
- //Is used when checking in reset() only for invisible elements
- var lastAnimationFrameForInvisibleCheck = 0;
-
- /**
- *
- * @constructor
- */
- function EventQueue() {
- var q = [];
- this.add = function(ev) {
- q.push(ev);
- };
-
- var i, j;
- this.call = function(sizeInfo) {
- for (i = 0, j = q.length; i < j; i++) {
- q[i].call(this, sizeInfo);
- }
- };
-
- this.remove = function(ev) {
- var newQueue = [];
- for(i = 0, j = q.length; i < j; i++) {
- if(q[i] !== ev) newQueue.push(q[i]);
- }
- q = newQueue;
- };
-
- this.length = function() {
- return q.length;
- }
- }
-
- /**
- *
- * @param {HTMLElement} element
- * @param {Function} resized
- */
- function attachResizeEvent(element, resized) {
- if (!element) return;
- if (element.resizedAttached) {
- element.resizedAttached.add(resized);
- return;
- }
-
- element.resizedAttached = new EventQueue();
- element.resizedAttached.add(resized);
-
- element.resizeSensor = document.createElement('div');
- element.resizeSensor.dir = 'ltr';
- element.resizeSensor.className = 'resize-sensor';
-
- var style = {
- pointerEvents: 'none',
- position: 'absolute',
- left: '0px',
- top: '0px',
- right: '0px',
- bottom: '0px',
- overflow: 'hidden',
- zIndex: '-1',
- visibility: 'hidden',
- maxWidth: '100%'
- };
- var styleChild = {
- position: 'absolute',
- left: '0px',
- top: '0px',
- transition: '0s',
- };
-
- setStyle(element.resizeSensor, style);
-
- var expand = document.createElement('div');
- expand.className = 'resize-sensor-expand';
- setStyle(expand, style);
-
- var expandChild = document.createElement('div');
- setStyle(expandChild, styleChild);
- expand.appendChild(expandChild);
-
- var shrink = document.createElement('div');
- shrink.className = 'resize-sensor-shrink';
- setStyle(shrink, style);
-
- var shrinkChild = document.createElement('div');
- setStyle(shrinkChild, styleChild);
- setStyle(shrinkChild, { width: '200%', height: '200%' });
- shrink.appendChild(shrinkChild);
-
- element.resizeSensor.appendChild(expand);
- element.resizeSensor.appendChild(shrink);
- element.appendChild(element.resizeSensor);
-
- var computedStyle = window.getComputedStyle(element);
- var position = computedStyle ? computedStyle.getPropertyValue('position') : null;
- if ('absolute' !== position && 'relative' !== position && 'fixed' !== position && 'sticky' !== position) {
- element.style.position = 'relative';
- }
-
- var dirty = false;
-
- //last request animation frame id used in onscroll event
- var rafId = 0;
- var size = getElementSize(element);
- var lastWidth = 0;
- var lastHeight = 0;
- var initialHiddenCheck = true;
- lastAnimationFrameForInvisibleCheck = 0;
-
- var resetExpandShrink = function () {
- var width = element.offsetWidth;
- var height = element.offsetHeight;
-
- expandChild.style.width = (width + 10) + 'px';
- expandChild.style.height = (height + 10) + 'px';
-
- expand.scrollLeft = width + 10;
- expand.scrollTop = height + 10;
-
- shrink.scrollLeft = width + 10;
- shrink.scrollTop = height + 10;
- };
-
- var reset = function() {
- // Check if element is hidden
- if (initialHiddenCheck) {
- var invisible = element.offsetWidth === 0 && element.offsetHeight === 0;
- if (invisible) {
- // Check in next frame
- if (!lastAnimationFrameForInvisibleCheck){
- lastAnimationFrameForInvisibleCheck = requestAnimationFrame(function(){
- lastAnimationFrameForInvisibleCheck = 0;
- reset();
- });
- }
-
- return;
- } else {
- // Stop checking
- initialHiddenCheck = false;
- }
- }
-
- resetExpandShrink();
- };
- element.resizeSensor.resetSensor = reset;
-
- var onResized = function() {
- rafId = 0;
-
- if (!dirty) return;
-
- lastWidth = size.width;
- lastHeight = size.height;
-
- if (element.resizedAttached) {
- element.resizedAttached.call(size);
- }
- };
-
- var onScroll = function() {
- size = getElementSize(element);
- dirty = size.width !== lastWidth || size.height !== lastHeight;
-
- if (dirty && !rafId) {
- rafId = requestAnimationFrame(onResized);
- }
-
- reset();
- };
-
- var addEvent = function(el, name, cb) {
- if (el.attachEvent) {
- el.attachEvent('on' + name, cb);
- } else {
- el.addEventListener(name, cb);
- }
- };
-
- addEvent(expand, 'scroll', onScroll);
- addEvent(shrink, 'scroll', onScroll);
-
- // Fix for custom Elements and invisible elements
- lastAnimationFrameForInvisibleCheck = requestAnimationFrame(function(){
- lastAnimationFrameForInvisibleCheck = 0;
- reset();
- });
- }
-
- forEachElement(element, function(elem){
- attachResizeEvent(elem, callback);
- });
-
- this.detach = function(ev) {
- // clean up the unfinished animation frame to prevent a potential endless requestAnimationFrame of reset
- if (lastAnimationFrameForInvisibleCheck) {
- cancelAnimationFrame(lastAnimationFrameForInvisibleCheck);
- lastAnimationFrameForInvisibleCheck = 0;
- }
- ResizeSensor.detach(element, ev);
- };
-
- this.reset = function() {
- //To prevent invoking element.resizeSensor.resetSensor if it's undefined
- if (element.resizeSensor.resetSensor) {
- element.resizeSensor.resetSensor();
- }
- };
- };
-
- ResizeSensor.reset = function(element) {
- forEachElement(element, function(elem){
- //To prevent invoking element.resizeSensor.resetSensor if it's undefined
- if (element.resizeSensor.resetSensor) {
- elem.resizeSensor.resetSensor();
- }
- });
- };
-
- ResizeSensor.detach = function(element, ev) {
- forEachElement(element, function(elem){
- if (!elem) return;
- if(elem.resizedAttached && typeof ev === "function"){
- elem.resizedAttached.remove(ev);
- if(elem.resizedAttached.length()) return;
- }
- if (elem.resizeSensor) {
- if (elem.contains(elem.resizeSensor)) {
- elem.removeChild(elem.resizeSensor);
- }
- delete elem.resizeSensor;
- delete elem.resizedAttached;
- }
- });
- };
-
- if (typeof MutationObserver !== "undefined") {
- var observer = new MutationObserver(function (mutations) {
- for (var i in mutations) {
- if (mutations.hasOwnProperty(i)) {
- var items = mutations[i].addedNodes;
- for (var j = 0; j < items.length; j++) {
- if (items[j].resizeSensor) {
- ResizeSensor.reset(items[j]);
- }
- }
- }
- }
- });
-
- document.addEventListener("DOMContentLoaded", function (event) {
- observer.observe(document.body, {
- childList: true,
- subtree: true,
- });
- });
- }
-
- return ResizeSensor;
-
-}));
diff --git a/src/octoprint/static/less/octoprint.less b/src/octoprint/static/less/octoprint.less
index c10472c43..4ac09b40e 100644
--- a/src/octoprint/static/less/octoprint.less
+++ b/src/octoprint/static/less/octoprint.less
@@ -1475,55 +1475,29 @@ textarea.monospace {
font-family: monospace;
}
-// Progress bars with text
-//
-// .progress-text-front will also need to have the full width of the enclosing
-// progress wrapper applied (e.g. via copyWidth knockout binding)
+// Progress bars with text centered
-.progress-text,
.progress-text-centered {
position: relative;
-
- .progress-text-front,
- .progress-text-back {
- white-space: nowrap;
- }
-
- .progress-text-front {
- box-sizing: border-box;
- padding: 0 10px;
- width: 100%;
- display: block;
- }
-
- .progress-text-back {
- position: absolute;
- font-size: 12px;
- line-height: 20px;
- display: block;
- box-sizing: border-box;
- text-align: center;
- padding: 0 10px;
- }
-
.bar {
+ z-index: 1;
position: absolute;
overflow: hidden;
}
-}
-
-.progress-text-centered {
- .progress-text-front {
+ .progress-text-front,
+ .progress-text-back {
position: absolute;
+ top: 0;
+ z-index: 2;
+ text-align: center;
+ width: 100%;
+ box-sizing: border-box;
+ padding: 0 10px;
font-size: 12px;
line-height: 20px;
- display: block;
- text-align: center;
- color: #fff;
}
-
- .progress-text-back {
- width: 100%;
+ .progress-text-front {
+ color: #fff;
}
}
diff --git a/src/octoprint/templates/sidebar/files.jinja2 b/src/octoprint/templates/sidebar/files.jinja2
index f9de8327f..b7ee746cd 100644
--- a/src/octoprint/templates/sidebar/files.jinja2
+++ b/src/octoprint/templates/sidebar/files.jinja2
@@ -84,10 +84,8 @@
{% endif %}
{{ _('Hint: You can also drag and drop files on this page to upload them.') }}
diff --git a/src/octoprint/templates/sidebar/state.jinja2 b/src/octoprint/templates/sidebar/state.jinja2
index 5a58c43e5..99a17406f 100644
--- a/src/octoprint/templates/sidebar/state.jinja2
+++ b/src/octoprint/templates/sidebar/state.jinja2
@@ -21,10 +21,8 @@
diff --git a/src/octoprint/templates/tabs/timelapse.jinja2 b/src/octoprint/templates/tabs/timelapse.jinja2
index 6c9c2d677..ba2d6a3f9 100644
--- a/src/octoprint/templates/tabs/timelapse.jinja2
+++ b/src/octoprint/templates/tabs/timelapse.jinja2
@@ -104,10 +104,8 @@
{{ _('Timelapse Render Progress') }}
{{ _('Finished Timelapses') }}