Better "upload error" message with supported extensions

This commit is contained in:
Gina Häußge 2016-07-04 13:20:15 +02:00
parent be34f7309d
commit e453201c1a
2 changed files with 9 additions and 1 deletions

View file

@ -544,7 +544,14 @@ $(function() {
};
self._handleUploadFail = function(e, data) {
var error = "<p>" + gettext("Could not upload the file. Make sure that it is a GCODE file and has the extension \".gcode\" or \".gco\" or that it is an STL file with the extension \".stl\".") + "</p>";
var extensions = _.map(SUPPORTED_EXTENSIONS, function(extension) {
return extension.toLowerCase();
}).sort();
extensions = extensions.join(", ");
var error = "<p>"
+ _.sprintf(gettext("Could not upload the file. Make sure that it is a valid file with one of these extensions: %(extensions)s"),
{extensions: extensions})
+ "</p>";
error += pnotifyAdditionalInfo("<pre>" + data.jqXHR.responseText + "</pre>");
new PNotify({
title: "Upload failed",

View file

@ -29,6 +29,7 @@
var BRANCH = "{{ branch|e }}";
var LOCALE = "{{ g.locale|e }}";
var AVAILABLE_LOCALES = {{ locales|tojson }};
var SUPPORTED_EXTENSIONS = {{ supportedExtensions|tojson }};
var OCTOPRINT_VIEWMODELS = [];
var ADDITIONAL_VIEWMODELS = [];