From 31f2cbb64b198469a6f1bddba8e9f8c600161543 Mon Sep 17 00:00:00 2001 From: Teja Date: Sat, 4 Jul 2015 18:07:23 +0200 Subject: [PATCH] files search works again. wip --- src/octoprint/static/js/app/main.js | 273 ++++-------------- .../static/js/app/viewmodels/files.js | 267 ++--------------- 2 files changed, 86 insertions(+), 454 deletions(-) diff --git a/src/octoprint/static/js/app/main.js b/src/octoprint/static/js/app/main.js index 144d13b6..eb811813 100644 --- a/src/octoprint/static/js/app/main.js +++ b/src/octoprint/static/js/app/main.js @@ -65,176 +65,16 @@ $(function() { return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]; } }); -//<<<<<<< HEAD -// }); -// -// //~~ Initialize view models -// var loginStateViewModel = new LoginStateViewModel(); -// var printerProfilesViewModel = new PrinterProfilesViewModel(); -// var usersViewModel = new UsersViewModel(loginStateViewModel); -// var timelapseViewModel = new TimelapseViewModel(loginStateViewModel); -// -// var printerStateViewModel = new PrinterStateViewModel(loginStateViewModel, timelapseViewModel); -// var settingsViewModel = new SettingsViewModel(loginStateViewModel, usersViewModel, printerProfilesViewModel); -// var gcodeViewModel = new GcodeViewModel(loginStateViewModel, settingsViewModel); -// var connectionViewModel = new ConnectionViewModel(loginStateViewModel, settingsViewModel, printerProfilesViewModel); -// var appearanceViewModel = new AppearanceViewModel(settingsViewModel, printerStateViewModel); -// var temperatureViewModel = new TemperatureViewModel(loginStateViewModel, settingsViewModel); -// var terminalViewModel = new TerminalViewModel(loginStateViewModel, settingsViewModel); -// -// var slicingViewModel = new SlicingViewModel(loginStateViewModel, printerProfilesViewModel); -// var gcodeFilesViewModel = new GcodeFilesViewModel(printerStateViewModel, loginStateViewModel, slicingViewModel); -// var controlViewModel = new ControlViewModel(loginStateViewModel, settingsViewModel, printerStateViewModel); -// var navigationViewModel = new NavigationViewModel(loginStateViewModel, appearanceViewModel, settingsViewModel, usersViewModel); -// var logViewModel = new LogViewModel(loginStateViewModel); -// -// -// // the view model map is our basic look up table for dependencies that may be injected into other view models -// var viewModelMap = { -// loginStateViewModel: loginStateViewModel, -// printerProfilesViewModel: printerProfilesViewModel, -// usersViewModel: usersViewModel, -// settingsViewModel: settingsViewModel, -// connectionViewModel: connectionViewModel, -// timelapseViewModel: timelapseViewModel, -// printerStateViewModel: printerStateViewModel, -// appearanceViewModel: appearanceViewModel, -// temperatureViewModel: temperatureViewModel, -// controlViewModel: controlViewModel, -// terminalViewModel: terminalViewModel, -// gcodeFilesViewModel: gcodeFilesViewModel, -// gcodeViewModel: gcodeViewModel, -// navigationViewModel: navigationViewModel, -// logViewModel: logViewModel, -// slicingViewModel: slicingViewModel, -// }; -//======= - } -//>>>>>>> upstream/maintenance + } // helper to create a view model instance with injected constructor parameters from the view model map var _createViewModelInstance = function(viewModel, viewModelMap){ var viewModelClass = viewModel[0]; var viewModelParameters = viewModel[1]; -//<<<<<<< HEAD -// -// // now we'll try to resolve all of the view model's constructor parameters via our view model map -// var constructorParameters = _.map(viewModelParameters, function(parameter){ -// return viewModelMap[parameter] -// }); -// -// if (_.some(constructorParameters, function(parameter) { return parameter === undefined; })) { -// var _extractName = function(entry) { return entry[0]; }; -// var _onlyUnresolved = function(entry) { return entry[1] === undefined; }; -// var missingParameters = _.map(_.filter(_.zip(viewModelParameters, constructorParameters), _onlyUnresolved), _extractName); -// console.log("postponing", viewModel[0].name, "due to missing parameters:", missingParameters.join(", ")); -// return; -// } -// -// // if we came this far then we could resolve all constructor parameters, so let's construct that view model -// return new viewModelClass(constructorParameters); -// }; -// -// // helper for translating the name of a view model class into an identifier for the view model map -// var _getViewModelId = function(viewModel){ -// var name = viewModel[0].name; -// return name.substr(0, 1).toLowerCase() + name.substr(1); // FooBarViewModel => fooBarViewModel -// }; -// -// // instantiation loop, will make multiple passes over the list of unprocessed view models until all -// // view models have been successfully instantiated with all of their dependencies or no changes can be made -// // any more which means not all view models can be instantiated due to missing dependencies -// var unprocessedViewModels = ADDITIONAL_VIEWMODELS.slice(); -// var additionalViewModels = []; -// var pass = 1; -// while (unprocessedViewModels.length > 0) { -// console.log("View model dependency resolution, pass #" + pass++); -// var startLength = unprocessedViewModels.length; -// var postponed = []; -// -// // now try to instantiate every one of our as of yet unprocessed view model descriptors -// while (unprocessedViewModels.length > 0){ -// var viewModel = unprocessedViewModels.shift(); -// var viewModelId = _getViewModelId(viewModel); -// -// // make sure that we don't have to view models going by the same name -// if (_.has(viewModelMap, viewModelId)) { -// console.error("Duplicate class name while instantiating viewModel ", viewModelId); -// continue; -// } -// -// var viewModelInstance = _createViewModelInstance(viewModel, viewModelMap); -// -// // our view model couldn't yet be instantiated, so postpone it for a bit -// if (viewModelInstance === undefined) { -// postponed.push(viewModel); -// continue; -// } -// -// // we could resolve the depdendencies and the view model is not defined yet => add it, it's now fully processed -// var viewModelBindTarget = viewModel[2]; -// additionalViewModels.push([viewModelInstance, viewModelBindTarget]); -// viewModelMap[viewModelId] = viewModelInstance; -// } -// -// // anything that's now in the postponed list has to be readded to the unprocessedViewModels -// unprocessedViewModels = unprocessedViewModels.concat(postponed); -// -// // if we still have the same amount of items in our list of unprocessed view models it means that we -// // couldn't instantiate any more view models over a whole iteration, which in turn mean we can't resolve the -// // dependencies of remaining ones, so log that as an error and then quit the loop -// if (unprocessedViewModels.length == startLength) { -// console.error("Could not instantiate the following view models due to unresolvable dependencies:"); -// _.each(unprocessedViewModels, function(entry) { -// console.error(entry[0].name, "(missing:", _.filter(entry[1], function(id) { return !_.has(viewModelMap, id); }).join(", "), ")"); -// }); -// break; -// } -// } -// console.log("View model dependency resolution done"); -// -// var allViewModels = _.values(viewModelMap); -// var dataUpdater = new DataUpdater(allViewModels); -// -// -// //~~ Temperature -// -// $('#tabs a[data-toggle="tab"]').on('shown', function (e) { -// temperatureViewModel.updatePlot(); -// terminalViewModel.updateOutput(); -// }); -// -// //~~ File list -// -// $(".gcode_files").slimScroll({ -// height: "80vh", -// size: "5px", -// distance: "0", -// railVisible: true, -// alwaysVisible: true, -// scrollBy: "102px" -// }); -// -// //~~ Gcode upload -// -// function gcode_upload_done(e, data) { -// var filename = undefined; -// var location = undefined; -// if (data.result.files.hasOwnProperty("sdcard")) { -// filename = data.result.files.sdcard.name; -// location = "sdcard"; -// } else if (data.result.files.hasOwnProperty("local")) { -// filename = data.result.files.local.name; -// location = "local"; -// } -// gcodeFilesViewModel.requestData(filename, location); -//======= - - if (viewModelParameters != undefined) { + if (viewModelParameters != undefined) { if (!_.isArray(viewModelParameters)) { viewModelParameters = [viewModelParameters]; } -//>>>>>>> upstream/maintenance // now we'll try to resolve all of the view model's constructor parameters via our view model map var constructorParameters = _.map(viewModelParameters, function(parameter){ @@ -251,6 +91,40 @@ $(function() { log.debug("Postponing", viewModel[0].name, "due to missing parameters:", missingParameters); return; } + + // if we came this far then we could resolve all constructor parameters, so let's construct that view model + log.debug("Constructing", viewModel[0].name, "with parameters:", viewModelParameters); + return new viewModelClass(constructorParameters); + }; + + + + //~~ File list + $(".gcode_files").slimScroll({ + height: "80vh", + size: "5px", + distance: "0", + railVisible: true, + alwaysVisible: true, + scrollBy: "102px" + }); +// +// //~~ Gcode upload +// +// function gcode_upload_done(e, data) { +// var filename = undefined; +// var location = undefined; +// if (data.result.files.hasOwnProperty("sdcard")) { +// filename = data.result.files.sdcard.name; +// location = "sdcard"; +// } else if (data.result.files.hasOwnProperty("local")) { +// filename = data.result.files.local.name; +// location = "local"; +// } +// gcodeFilesViewModel.requestData(filename, location); +//======= + + //<<<<<<< HEAD // // if(data.result.files.hasOwnProperty("local")){ @@ -281,12 +155,6 @@ $(function() { // } //======= - // if we came this far then we could resolve all constructor parameters, so let's construct that view model - log.debug("Constructing", viewModel[0].name, "with parameters:", viewModelParameters); - return new viewModelClass(constructorParameters); - }; -//>>>>>>> upstream/maintenance - // map any additional view model bindings we might need to make var additionalBindings = {}; _.each(OCTOPRINT_ADDITIONAL_BINDINGS, function(bindings) { @@ -337,21 +205,12 @@ $(function() { var viewModelInstance = _createViewModelInstance(viewModel, viewModelMap); -//<<<<<<< HEAD -// if (printerStateViewModel.isSdReady() && loginStateViewModel.isUser()) { -// enable_sd_dropzone(); -// } else { -// disable_sd_dropzone(); -// } -// } -// -//======= // our view model couldn't yet be instantiated, so postpone it for a bit if (viewModelInstance === undefined) { postponed.push(viewModel); continue; } -//>>>>>>> upstream/maintenance + // we could resolve the depdendencies and the view model is not defined yet => add it, it's now fully processed var viewModelBindTargets = viewModel[2]; @@ -367,20 +226,8 @@ $(function() { allViewModels.push(viewModelInstance); viewModelMap[viewModelId] = viewModelInstance; } - -//<<<<<<< HEAD -// window.dropZoneTimeout = setTimeout(function () { -// window.dropZoneTimeout = null; -// dropOverlay.removeClass("in"); -// if (dropZoneLocal) dropZoneLocalBackground.removeClass("hover"); -// if (dropZoneSd) dropZoneSdBackground.removeClass("hover"); -// if (dropZone) dropZoneBackground.removeClass("hover"); -// }, 1000); -// }); -//======= // anything that's now in the postponed list has to be readded to the unprocessedViewModels unprocessedViewModels = unprocessedViewModels.concat(postponed); -//>>>>>>> upstream/maintenance // if we still have the same amount of items in our list of unprocessed view models it means that we // couldn't instantiate any more view models over a whole iteration, which in turn mean we can't resolve the @@ -398,6 +245,18 @@ $(function() { } log.info("... dependency resolution done"); +//<<<<<<< HEAD +// window.dropZoneTimeout = setTimeout(function () { +// window.dropZoneTimeout = null; +// dropOverlay.removeClass("in"); +// if (dropZoneLocal) dropZoneLocalBackground.removeClass("hover"); +// if (dropZoneSd) dropZoneSdBackground.removeClass("hover"); +// if (dropZone) dropZoneBackground.removeClass("hover"); +// }, 1000); +// }); +//======= +//>>>>>>> upstream/maintenance + var dataUpdater = new DataUpdater(allViewModels); //~~ Custom knockout.js bindings @@ -599,33 +458,18 @@ $(function() { e.stopPropagation(); }); + //<<<<<<< HEAD -// settingsViewModel.requestData(function() { -// ko.applyBindings(settingsViewModel, document.getElementById("settings_dialog")); -// -// ko.applyBindings(connectionViewModel, document.getElementById("connection")); -// ko.applyBindings(printerStateViewModel, document.getElementById("state")); -// ko.applyBindings(gcodeFilesViewModel, document.getElementById("files_accordion")); -// ko.applyBindings(controlViewModel, document.getElementById("control")); -// ko.applyBindings(controlViewModel, document.getElementById("focus")); -// ko.applyBindings(terminalViewModel, document.getElementById("term")); -// var gcode = document.getElementById("gcode"); -// if (gcode) { -// gcodeViewModel.initialize(); -// ko.applyBindings(gcodeViewModel, gcode); +// if (printerStateViewModel.isSdReady() && loginStateViewModel.isUser()) { +// enable_sd_dropzone(); +// } else { +// disable_sd_dropzone(); // } -// ko.applyBindings(navigationViewModel, document.getElementById("navbar")); -//// ko.applyBindings(appearanceViewModel, document.getElementsByTagName("head")[0]); -// ko.applyBindings(printerStateViewModel, document.getElementById("drop_overlay")); -// ko.applyBindings(logViewModel, document.getElementById("logs")); -// -//// var timelapseElement = document.getElementById("timelapse"); -//// if (timelapseElement) { -//// ko.applyBindings(timelapseViewModel, timelapseElement); -//// } -//// -//// ko.applyBindings(slicingViewModel, document.getElementById("slicing_configuration_dialog")); +// } +// //======= + + // prevent default action for drag-n-drop $(document).bind("drop dragover", function (e) { e.preventDefault(); @@ -647,7 +491,6 @@ $(function() { if (!Array.isArray(viewModelData) || viewModelData.length != 2) { return; } -//>>>>>>> upstream/maintenance var viewModel = viewModelData[0]; var targets = viewModelData[1]; diff --git a/src/octoprint/static/js/app/viewmodels/files.js b/src/octoprint/static/js/app/viewmodels/files.js index 2b10a8ea..e9024f56 100644 --- a/src/octoprint/static/js/app/viewmodels/files.js +++ b/src/octoprint/static/js/app/viewmodels/files.js @@ -1,44 +1,4 @@ -//<<<<<<< HEAD -//function GcodeFilesViewModel(printerStateViewModel, loginStateViewModel, slicingViewModel) { -// var self = this; -// -// self.printerState = printerStateViewModel; -// self.loginState = loginStateViewModel; -// self.slicing = slicingViewModel; -// self.conversion = undefined; -// self.workingArea = undefined; -// -// self.isErrorOrClosed = ko.observable(undefined); -// self.isOperational = ko.observable(undefined); -// self.isPrinting = ko.observable(undefined); -// self.isPaused = ko.observable(undefined); -// self.isError = ko.observable(undefined); -// self.isReady = ko.observable(undefined); -// self.isLoading = ko.observable(undefined); -// self.isSdReady = ko.observable(undefined); -// -// self.searchQuery = ko.observable(undefined); -// self.searchQuery.subscribe(function() { -// self.performSearch(); -// }); -// -// self.freeSpace = ko.observable(undefined); -// self.freeSpaceString = ko.computed(function() { -// if (!self.freeSpace()) -// return "-"; -// return formatSize(self.freeSpace()); -// }); -// -// // initialize list helper -// self.listHelper = new ItemListHelper( -// "gcodeFiles", -// { -// "name": function(a, b) { -// // sorts ascending -// if (a["name"].toLocaleLowerCase() < b["name"].toLocaleLowerCase()) return -1; -// if (a["name"].toLocaleLowerCase() > b["name"].toLocaleLowerCase()) return 1; -// return 0; -//======= + $(function() { function GcodeFilesViewModel(parameters) { var self = this; @@ -58,6 +18,7 @@ $(function() { self.searchQuery = ko.observable(undefined); self.searchQuery.subscribe(function() { + console.log("searhc update"); self.performSearch(); }); @@ -92,7 +53,6 @@ $(function() { if (a["bytes"] < b["bytes"]) return 1; return 0; } -//>>>>>>> upstream/maintenance }, { "printed": function(file) { @@ -117,7 +77,7 @@ $(function() { 0 ); - self.isLoadActionPossible = ko.computed(function() { + self.isLoadActionPossible = ko.computed(function() { return self.loginState.isUser() && !self.isPrinting() && !self.isPaused() && !self.isLoading(); }); @@ -138,7 +98,7 @@ $(function() { }); } }; - + self.fromCurrentData = function(data) { self._processStateData(data.state); }; @@ -176,7 +136,7 @@ $(function() { } }); }; - + self.fromResponse = function(response, filenameToFocus, locationToFocus) { var files = response.files; _.each(files, function(element, index, list) { @@ -200,73 +160,10 @@ $(function() { if (response.free) { self.freeSpace(response.free); } -//<<<<<<< HEAD -// }, -// "name", -// [], -// [["sd", "local"], ["machinecode", "model"]], -// 0 -// ); -// -// self.isLoadActionPossible = ko.computed(function() { -// return self.loginState.isUser() && !self.isPrinting() && !self.isPaused() && !self.isLoading(); -// }); -// -// self.isLoadAndPrintActionPossible = ko.computed(function() { -// return self.loginState.isUser() && self.isOperational() && self.isLoadActionPossible(); -// }); -// -// self.printerState.filename.subscribe(function(newValue) { -// self.highlightFilename(newValue); -// }); -// -// self.highlightFilename = function(filename) { -// if (filename == undefined) { -// self.listHelper.selectNone(); -// } else { -// self.listHelper.selectItem(function(item) { -// return item.name == filename; -// }); -// } -// }; -// -// self.fromCurrentData = function(data) { -// self._processStateData(data.state); -// }; -// -// self.fromHistoryData = function(data) { -// self._processStateData(data.state); -// }; -// -// self._processStateData = function(data) { -// self.isErrorOrClosed(data.flags.closedOrError); -// self.isOperational(data.flags.operational); -// self.isPaused(data.flags.paused); -// self.isPrinting(data.flags.printing); -// self.isError(data.flags.error); -// self.isReady(data.flags.ready); -// self.isLoading(data.flags.loading); -// self.isSdReady(data.flags.sdReady); -// }; -// -// self._otherRequestInProgress = false; -// self.requestData = function(filenameToFocus, locationToFocus) { -// if (self._otherRequestInProgress) return; -// -// self._otherRequestInProgress = true; -// $.ajax({ -// url: API_BASEURL + "files", -// method: "GET", -// dataType: "json", -// success: function(response) { -// -// self.fromResponse(response, filenameToFocus, locationToFocus); -// self._otherRequestInProgress = false; -// }, -// error: function(response) { -// console.error("ajax/json error", response); -// self._otherRequestInProgress = false; -//======= + + + + self.highlightFilename(self.printerState.filename()); }; @@ -328,7 +225,6 @@ $(function() { return data["refs"]["download"]; } else { return false; -//>>>>>>> upstream/maintenance } }; @@ -355,6 +251,7 @@ $(function() { return "files_template_" + data.type; } }; + self.getEntryId = function(data) { return "gcode_file_" + md5(data["origin"] + ":" + data["name"]); }; @@ -381,29 +278,20 @@ $(function() { self.enableSlicing = function(data) { return self.loginState.isUser() && self.slicing.enableSlicingDialog(); }; + // self.enableSlicing = function(data) { + // return self.loginState.isUser() && !(self.isPrinting() || self.isPaused()); + // }; + self.startGcodeWithSafetyWarning = function(gcodeFile){ + self.loadFile(gcodeFile, false); -//<<<<<<< HEAD -// $.ajax({ -// url: file.refs.resource, -// type: "POST", -// dataType: "json", -// contentType: "application/json; charset=UTF-8", -// data: JSON.stringify({command: "select", print: printAfterLoad}) -// }); -// }; -// -// self.startGcodeWithSafetyWarning = function(gcodeFile){ -// self.loadFile(gcodeFile, false); -// -// self.printerState.show_safety_glasses_warning(function(){ -// self.loadFile(gcodeFile, true); -// }); -// }; -//======= - self.enableAdditionalData = function(data) { + self.printerState.show_safety_glasses_warning(function(){ + self.loadFile(gcodeFile, true); + }); + }; + + self.enableAdditionalData = function(data) { return data["gcodeAnalysis"] || data["prints"] && data["prints"]["last"]; }; -//>>>>>>> upstream/maintenance self.toggleAdditionalData = function(data) { var entryElement = self.getEntryElement(data); @@ -440,7 +328,7 @@ $(function() { } return output; }; - + self.performSearch = function(e) { if (e !== undefined) { e.preventDefault(); @@ -468,6 +356,10 @@ $(function() { self.uploadButton.fileupload("disable"); }; + self.enableSVGConversion = function (data) { + return self.loginState.isUser() && !(self.isPrinting() || self.isPaused()); + }; + self.onStartup = function() { $(".accordion-toggle[data-target='#files']").click(function() { var files = $("#files"); @@ -503,112 +395,8 @@ $(function() { location = "local"; } self.requestData(filename, location); - -//<<<<<<< HEAD -// self._sendSdCommand = function(command) { -// $.ajax({ -// url: API_BASEURL + "printer/sd", -// type: "POST", -// dataType: "json", -// contentType: "application/json; charset=UTF-8", -// data: JSON.stringify({command: command}) -// }); -// }; -// -// self.downloadLink = function(data) { -// if (data["refs"] && data["refs"]["download"]) { -// return data["refs"]["download"]; -// } else { -// return false; -// } -// }; -// -// self.lastTimePrinted = function(data) { -// if (data["prints"] && data["prints"]["last"] && data["prints"]["last"]["date"]) { -// return data["prints"]["last"]["date"]; -// } else { -// return "-"; -// } -// }; -// -// self.getSuccessClass = function(data) { -// if (!data["prints"] || !data["prints"]["last"]) { -// return ""; -// } -// return data["prints"]["last"]["success"] ? "text-success" : "text-error"; -// }; -// -// self.templateFor = function(data) { -// var extension = data.name.split('.').pop().toLowerCase(); -// if (extension == "svg") { -// return "files_template_" + data.type + "_svg"; -// } else { -// return "files_template_" + data.type; -// } -// }; -// -// self.getEntryId = function(data) { -// return "gcode_file_" + md5(data["origin"] + ":" + data["name"]); -// }; -// -// self.getEntryElement = function(data) { -// var entryId = self.getEntryId(data); -// var entryElements = $("#" + entryId); -// if (entryElements && entryElements[0]) { -// return entryElements[0]; -// } else { -// return undefined; -// } -// }; -// -// self.enableRemove = function(data) { -// return self.loginState.isUser() && !_.contains(self.printerState.busyFiles(), data.origin + ":" + data.name); -// }; -// -// self.enableSelect = function(data, printAfterSelect) { -// var isLoadActionPossible = self.loginState.isUser() && self.isOperational() && !(self.isPrinting() || self.isPaused() || self.isLoading()); -// return isLoadActionPossible && !self.listHelper.isSelected(data); -// }; -// -// self.enableSlicing = function(data) { -// return self.loginState.isUser() && !(self.isPrinting() || self.isPaused()); -// }; -// -// self.enableSVGConversion = function(data) { -// return self.loginState.isUser() && !(self.isPrinting() || self.isPaused()); -// }; -// -// self.enableAdditionalData = function(data) { -// return data["gcodeAnalysis"] || data["prints"] && data["prints"]["last"]; -// }; -// -// self.toggleAdditionalData = function(data) { -// var entryElement = self.getEntryElement(data); -// if (!entryElement) return; -// -// var additionalInfo = $(".additionalInfo", entryElement); -// additionalInfo.slideToggle("fast", function() { -// $(".toggleAdditionalData i", entryElement).toggleClass("icon-chevron-down icon-chevron-up"); -// }); -// }; -// -// self.getAdditionalData = function(data) { -// var output = ""; -// if (data["gcodeAnalysis"]) { -// if (data["gcodeAnalysis"]["filament"] && typeof(data["gcodeAnalysis"]["filament"]) == "object") { -// var filament = data["gcodeAnalysis"]["filament"]; -// if (_.keys(filament).length == 1) { -// output += gettext("Filament") + ": " + formatFilament(data["gcodeAnalysis"]["filament"]["tool" + 0]) + "
"; -// } else if (_.keys(filament).length > 1) { -// for (var toolKey in filament) { -// if (!_.startsWith(toolKey, "tool") || !filament[toolKey] || !filament[toolKey].hasOwnProperty("length") || filament[toolKey]["length"] <= 0) continue; -// -// output += gettext("Filament") + " (" + gettext("Tool") + " " + toolKey.substr("tool".length) + "): " + formatFilament(filament[toolKey]) + "
"; -// } -//======= if (_.endsWith(filename.toLowerCase(), ".stl")) { self.slicing.show(location, filename); -//>>>>>>> upstream/maintenance } if (data.result.done) { @@ -618,6 +406,7 @@ $(function() { } } + function gcode_upload_fail(e, data) { var error = "

" + 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\".") + "

"; error += pnotifyAdditionalInfo("
" + data.jqXHR.responseText + "
"); @@ -826,6 +615,6 @@ $(function() { OCTOPRINT_VIEWMODELS.push([ GcodeFilesViewModel, ["printerStateViewModel", "loginStateViewModel", "slicingViewModel"], - "#files_wrapper" + ["#files_wrapper", "#files_search"] ]); });