From 9b3fc0c65e249074fc0faafb7d333978c1c6359f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Sun, 3 Mar 2013 16:57:35 +0100 Subject: [PATCH] Set default instance name to empty string --- octoprint/settings.py | 2 +- octoprint/static/js/ui.js | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/octoprint/settings.py b/octoprint/settings.py index fe398eb..bbd846b 100644 --- a/octoprint/settings.py +++ b/octoprint/settings.py @@ -49,7 +49,7 @@ old_default_settings = { default_settings = old_default_settings.copy() default_settings.update({ "appearance": { - "name": "OctoPrint", + "name": "", "color": "white" }, "controls": [], diff --git a/octoprint/static/js/ui.js b/octoprint/static/js/ui.js index 16b7f74..dda2fa7 100644 --- a/octoprint/static/js/ui.js +++ b/octoprint/static/js/ui.js @@ -309,10 +309,8 @@ function TemperatureViewModel(settingsViewModel) { if (val == undefined || val == 0) return ""; // we don't want to display the minutes since the epoch if not connected yet ;) - // calculate current time in milliseconds in UTC - var now = new Date(); - var timezoneOffset = now.getTimezoneOffset() * 60 * 1000; - var timestampUtc = now.getTime() + timezoneOffset; + // current time in milliseconds in UTC + var timestampUtc = Date.now(); // calculate difference in milliseconds var diff = timestampUtc - val; @@ -804,10 +802,11 @@ function GcodeFilesViewModel() { } self.changeSorting = function(sorting) { - if (sorting != "name" && sorting != "upload") + if (sorting != "name" && sorting != "upload" && sorting != "size") return; self.currentSorting(sorting); + self.changePage(0); self._updateFiles(); } @@ -854,6 +853,13 @@ function GcodeFilesViewModel() { if (a["date"] < b["date"]) return 1; return 0; } + } else if (self.currentSorting() == "size") { + comparator = function(a, b) { + // sorts descending + if (a["bytes"] > b["bytes"]) return -1; + if (a["bytes"] < b["bytes"]) return 1; + return 0; + } } // work on all files