[fix] File listing not working
This commit is contained in:
parent
0bb699ffe5
commit
136f47f318
|
@ -17,12 +17,9 @@ class KlipperLogAnalyzer():
|
|||
def analyze(self):
|
||||
data = self.parse_log(self.log_file, None)
|
||||
if not data:
|
||||
result = dict(error= "Couldn't parse \"{}\"".format(self.log_file))
|
||||
result = dict(error= "No relevant data available in \"{}\"".format(self.log_file))
|
||||
else:
|
||||
result = self.plot_mcu(data, self.MAXBANDWIDTH)
|
||||
#if options.frequency:
|
||||
# plot_frequency(data, outname, options.mcu)
|
||||
# return
|
||||
return result
|
||||
|
||||
def parse_log(self, logname, mcu):
|
||||
|
@ -119,14 +116,13 @@ class KlipperLogAnalyzer():
|
|||
else:
|
||||
hb = 100. * (self.MAXBUFFER - hb) / self.MAXBUFFER
|
||||
hostbuffers.append(hb)
|
||||
#times.append(datetime.datetime.utcfromtimestamp(st))
|
||||
times.append(st)
|
||||
bwdeltas.append(100. * (bw - lastbw) / (maxbw * timedelta))
|
||||
loads.append(100. * load / self.TASK_MAX)
|
||||
awake.append(100. * float(d.get('mcu_awake', 0.)) / self.STATS_INTERVAL)
|
||||
lasttime = st
|
||||
lastbw = bw
|
||||
|
||||
|
||||
result = dict(
|
||||
times= times,
|
||||
bwdeltas= bwdeltas,
|
||||
|
@ -151,4 +147,6 @@ class KlipperLogAnalyzer():
|
|||
val = d.get(key)
|
||||
if val not in (None, '0', '1'):
|
||||
times.append(st)
|
||||
values.append(float(val))
|
||||
values.append(float(val)/1000000.0)
|
||||
|
||||
return values
|
||||
|
|
|
@ -5,17 +5,19 @@ $(function() {
|
|||
self.settings = parameters[0];
|
||||
self.loginState = parameters[1];
|
||||
self.connectionState = parameters[2];
|
||||
|
||||
self.levelingViewModel = parameters[3];
|
||||
|
||||
self.shortStatus = ko.observable();
|
||||
self.logMessages = ko.observableArray();
|
||||
|
||||
|
||||
self.showLevelingDialog = function() {
|
||||
var dialog = $("#klipper_leveling_dialog");
|
||||
dialog.modal({
|
||||
show: 'true',
|
||||
backdrop: 'static',
|
||||
keyboard: false
|
||||
});
|
||||
});
|
||||
self.levelingViewModel.initView();
|
||||
}
|
||||
|
||||
self.showPidTuningDialog = function() {
|
||||
|
@ -89,7 +91,7 @@ $(function() {
|
|||
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: KlipperViewModel,
|
||||
dependencies: ["settingsViewModel", "loginStateViewModel", "connectionViewModel"],
|
||||
dependencies: ["settingsViewModel", "loginStateViewModel", "connectionViewModel", "klipperLevelingViewModel"],
|
||||
elements: ["#tab_plugin_klipper_main", "#sidebar_plugin_klipper", "#navbar_plugin_klipper"]
|
||||
});
|
||||
});
|
|
@ -2,11 +2,13 @@ $(function() {
|
|||
|
||||
function KlipperGraphViewModel(parameters) {
|
||||
var self = this;
|
||||
|
||||
self.loginState = parameters[0];
|
||||
|
||||
self.header = OctoPrint.getRequestHeaders({
|
||||
"content-type": "application/json",
|
||||
"cache-control": "no-cache"
|
||||
});
|
||||
|
||||
self.apiUrl = OctoPrint.getSimpleApiUrl("klipper");
|
||||
|
||||
self.availableLogFiles = ko.observableArray();
|
||||
|
@ -18,7 +20,7 @@ function KlipperGraphViewModel(parameters) {
|
|||
self.canvasContext;
|
||||
self.chart;
|
||||
self.spinnerDialog;
|
||||
|
||||
|
||||
self.onStartup = function() {
|
||||
self.canvas = $("#klipper_graph_canvas")[0]
|
||||
self.canvasContext = self.canvas.getContext("2d");
|
||||
|
@ -31,6 +33,13 @@ function KlipperGraphViewModel(parameters) {
|
|||
var myChart = new Chart(self.canvas, {
|
||||
type: "line"
|
||||
});
|
||||
|
||||
if(self.loginState.loggedIn()) {
|
||||
self.listLogFiles();
|
||||
}
|
||||
}
|
||||
|
||||
self.onUserLoggedIn = function(user) {
|
||||
self.listLogFiles();
|
||||
}
|
||||
|
||||
|
@ -147,15 +156,6 @@ function KlipperGraphViewModel(parameters) {
|
|||
data: response.awake
|
||||
});
|
||||
|
||||
// self.datasets.push(
|
||||
// {
|
||||
// label: "Frequency",
|
||||
// backgroundColor: "rgba(33, 64, 95, 0.5)",
|
||||
// borderColor: "rgb(33, 64, 95)",
|
||||
// yAxisID: 'y-axis-2',
|
||||
// data: response.frequency
|
||||
// });
|
||||
|
||||
self.chart = new Chart(self.canvas, {
|
||||
type: "line",
|
||||
data: {
|
||||
|
@ -193,14 +193,6 @@ function KlipperGraphViewModel(parameters) {
|
|||
position: 'left',
|
||||
id: 'y-axis-1'
|
||||
}
|
||||
// {
|
||||
// scaleLabel: {
|
||||
// display: true,
|
||||
// labelString: 'MHz'
|
||||
// },
|
||||
// position: 'right',
|
||||
// id: 'y-axis-2'
|
||||
// }
|
||||
]
|
||||
},
|
||||
legend: {
|
||||
|
@ -215,7 +207,7 @@ function KlipperGraphViewModel(parameters) {
|
|||
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: KlipperGraphViewModel,
|
||||
dependencies: [],
|
||||
dependencies: ["loginStateViewModel"],
|
||||
elements: ["#klipper_graph_dialog"]
|
||||
});
|
||||
});
|
||||
|
|
|
@ -3,14 +3,18 @@ $(function() {
|
|||
var self = this;
|
||||
self.settings = parameters[0];
|
||||
self.loginState = parameters[1];
|
||||
self.connectionState = parameters[2];
|
||||
|
||||
self.activePoint = ko.observable();
|
||||
self.activePoint = ko.observable(-1);
|
||||
self.pointCount = ko.observable();
|
||||
self.points = ko.observableArray();
|
||||
|
||||
self.onStartup = function() {
|
||||
self.activePoint(-1);
|
||||
self.initView = function() {
|
||||
self.points(self.settings.settings.plugins.klipper.probe.points());
|
||||
self.pointCount(
|
||||
self.points().length
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
self.startLeveling = function() {
|
||||
OctoPrint.control.sendGcode("G28")
|
||||
self.moveToPoint(0);
|
||||
|
@ -39,14 +43,14 @@ $(function() {
|
|||
|
||||
self.jumpToPoint = function(item) {
|
||||
self.moveToPoint(
|
||||
self.settings.settings.plugins.klipper.probe.points().indexOf(item)
|
||||
self.points().indexOf(item)
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
self.pointCount = function() {
|
||||
return self.settings.settings.plugins.klipper.probe.points().length;
|
||||
}
|
||||
|
||||
*/
|
||||
self.moveToPosition = function(x, y) {
|
||||
OctoPrint.control.sendGcode(
|
||||
"G1 Z" + (self.settings.settings.plugins.klipper.probe.height() * 1 +
|
||||
|
@ -64,7 +68,7 @@ $(function() {
|
|||
}
|
||||
|
||||
self.moveToPoint = function(index) {
|
||||
var point = self.settings.settings.plugins.klipper.probe.points()[index];
|
||||
var point = self.points()[index];
|
||||
|
||||
self.moveToPosition(point.x(), point.y());
|
||||
self.activePoint(index);
|
||||
|
@ -73,7 +77,7 @@ $(function() {
|
|||
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: KlipperLevelingViewModel,
|
||||
dependencies: ["settingsViewModel", "loginStateViewModel", "connectionViewModel"],
|
||||
dependencies: ["settingsViewModel", "loginStateViewModel"],
|
||||
elements: ["#klipper_leveling_dialog"]
|
||||
});
|
||||
});
|
|
@ -9,15 +9,15 @@
|
|||
<canvas id="klipper_graph_canvas"></canvas>
|
||||
</div>
|
||||
<span class="help-inline" style="display:block; position: absolute"><em>Click labels to hide/show dataset</em></span>
|
||||
<label class="checkbox fill-checkbox">
|
||||
<input type="checkbox" data-bind="checked: datasetFill, click: toggleDatasetFill" />{{ _('Fill Datasets') }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<form class="form-inline">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: datasetFill, click: toggleDatasetFill" />{{ _('filled datasets') }}
|
||||
</label>
|
||||
<span class="help-inline" text-align="left" data-bind="text: status"></span>
|
||||
<span text-align="left" data-bind="text: status" class="status-label"></span>
|
||||
<label class="control-label">
|
||||
{{ _('Select Log') }}
|
||||
{{ _('Select') }}
|
||||
<select data-bind="options: availableLogFiles, optionsText: 'name', optionsValue: 'file', value: logFile"></select>
|
||||
</label>
|
||||
<button class="btn" data-bind="click: listLogFiles" title="Reload file list"><i class="icon-refresh"></i></button>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
</div>
|
||||
<div class="span7"> </div>
|
||||
</div>
|
||||
<div data-bind="foreach: settings.settings.plugins.klipper.probe.points">
|
||||
<div data-bind="foreach: points">
|
||||
<div class="row-fluid">
|
||||
<div class="span1">
|
||||
<i class="fa fa-arrow-right pull-right" data-bind="visible: ($index()==$parent.activePoint())"></i>
|
||||
|
@ -41,11 +41,12 @@
|
|||
<div class="btn-group">
|
||||
<button class="btn" data-bind="click: startLeveling"><i class="icon-play"></i> {{ _('Start') }}</button>
|
||||
<button class="btn" data-bind="click: previousPoint, enable: (activePoint() > 0)"><i class="icon-chevron-left"></i> {{ _('Previous') }}</button>
|
||||
<button class="btn" data-bind="click: nextPoint, enable: (activePoint() < pointCount()-1)">{{ _('Next') }} <i class="icon-chevron-right"></i></button>
|
||||
<button class="btn" data-bind="click: nextPoint, enable: (activePoint() < (pointCount()-1))">{{ _('Next') }} <i class="icon-chevron-right"></i></button>
|
||||
<button class="btn" data-bind="click: stopLeveling" data-dismiss="modal"><i class="icon-stop"></i> {{ _('Stop') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="span2"></div>
|
||||
</div>
|
||||
</div>
|
||||
<span data-bind="text: pointCount"></span>
|
||||
</div>
|
Loading…
Reference in New Issue