Replace a few leftovers of isUser with new permissions, also fix a few permission checks
This commit is contained in:
1 parent
f53be57f0d
commit
1109bd35e7
14 files changed
+81
-52
No files matched your search
@@ -60,7 +60,7 @@ principals = Principal(app)
|
||||
import octoprint.access.permissions as permissions
|
||||
|
||||
# TODO deprecated, remove in future release
|
||||
admin_permission = util.variable_deprecated("admin_permission has been deprecated please use new Permissions.ADMIN instead", since="now")(
|
||||
admin_permission = util.variable_deprecated("admin_permission has been deprecated, please use new Permissions.ADMIN instead", since="now")(
|
||||
permissions.Permissions.ADMIN)
|
||||
#user_permission = util.variable_deprecated("user_permission has been deprecated and will be removed in a future version", since="now")(
|
||||
# permissions.Permissions.USER)
|
||||
|
||||
@@ -518,7 +518,7 @@ def _process_templates():
|
||||
# sidebar
|
||||
|
||||
templates["sidebar"]["entries"]= dict(
|
||||
connection=(gettext("Connection"), dict(template="sidebar/connection.jinja2", _div="connection", icon="signal", styles_wrapper=["display: none"], data_bind="visible: loginState.hasPermission(access.permissions.CONNECTION)", custom_bindings=False)),
|
||||
connection=(gettext("Connection"), dict(template="sidebar/connection.jinja2", _div="connection", icon="signal", styles_wrapper=["display: none"], data_bind="visible: loginState.hasPermission(access.permissions.CONNECTION)")),
|
||||
state=(gettext("State"), dict(template="sidebar/state.jinja2", _div="state", icon="info-sign", data_bind="visible: loginState.hasPermission(access.permissions.STATUS)")),
|
||||
files=(gettext("Files"), dict(template="sidebar/files.jinja2", _div="files", icon="list", classes_content=["overflow_visible"], template_header="sidebar/files_header.jinja2", data_bind="visible: loginState.hasPermission(access.permissions.DOWNLOAD)() || \
|
||||
loginState.hasPermission(access.permissions.UPLOAD)() || \
|
||||
|
||||
@@ -101,7 +101,7 @@ $(function() {
|
||||
self.isReady(data.flags.ready);
|
||||
self.isLoading(data.flags.loading);
|
||||
|
||||
if (self.loginState.isUser() && self.previousIsOperational != self.isOperational()) {
|
||||
if (self.loginState.hasPermission(self.access.permissions.CONNECTION)() && self.previousIsOperational != self.isOperational()) {
|
||||
// only open or close if the panel is visible (for admins) and
|
||||
// the state just changed to avoid thwarting manual open/close
|
||||
self.openOrCloseOnStateChange();
|
||||
|
||||
@@ -42,7 +42,7 @@ $(function() {
|
||||
self.keycontrolActive = ko.observable(false);
|
||||
self.keycontrolHelpActive = ko.observable(false);
|
||||
self.keycontrolPossible = ko.pureComputed(function () {
|
||||
return self.settings.feature_keyboardControl() && self.isOperational() && !self.isPrinting() && self.loginState.isUser() && !$.browser.mobile;
|
||||
return self.loginState.hasPermission(self.access.permissions.CONTROL)() && self.settings.feature_keyboardControl() && self.isOperational() && !self.isPrinting() && !$.browser.mobile;
|
||||
});
|
||||
self.showKeycontrols = ko.pureComputed(function () {
|
||||
return self.keycontrolActive() && self.keycontrolPossible();
|
||||
@@ -225,7 +225,7 @@ $(function() {
|
||||
if (data.hasOwnProperty("enabled")) {
|
||||
return data.enabled(data);
|
||||
} else {
|
||||
return self.isOperational() && self.loginState.isUser();
|
||||
return self.loginState.hasPermission(self.access.permissions.CONTROL)() && self.isOperational();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ $(function() {
|
||||
self.addFolderDialog = undefined;
|
||||
self.addFolderName = ko.observable(undefined);
|
||||
self.enableAddFolder = ko.pureComputed(function() {
|
||||
return self.loginState.isUser() && self.addFolderName() && self.addFolderName().trim() != "" && !self.addingFolder();
|
||||
return self.loginState.hasPermission(self.access.permissions.UPLOAD)() && self.addFolderName() && self.addFolderName().trim() != "" && !self.addingFolder();
|
||||
});
|
||||
|
||||
self.allItems = ko.observable(undefined);
|
||||
@@ -546,7 +546,7 @@ $(function() {
|
||||
} else {
|
||||
busy = _.contains(self.printerState.busyFiles(), data.origin + ":" + data.path);
|
||||
}
|
||||
return self.loginState.hasPermission(self.access.permissions.DELETE) && !busy;
|
||||
return self.loginState.hasPermission(self.access.permissions.DELETE)() && !busy;
|
||||
};
|
||||
|
||||
self.enableSelect = function(data) {
|
||||
@@ -560,7 +560,7 @@ $(function() {
|
||||
|
||||
|
||||
self.enableSlicing = function(data) {
|
||||
return self.loginState.hasPermission(self.access.permissions.SLICE) && self.slicing.enableSlicingDialog() && self.slicing.enableSlicingDialogForFile(data.name);
|
||||
return self.loginState.hasPermission(self.access.permissions.SLICE)() && self.slicing.enableSlicingDialog() && self.slicing.enableSlicingDialogForFile(data.name);
|
||||
};
|
||||
|
||||
self.enableAdditionalData = function(data) {
|
||||
@@ -830,13 +830,13 @@ $(function() {
|
||||
self.sdTarget = $("#drop_sd");
|
||||
|
||||
function evaluateDropzones() {
|
||||
var enableLocal = self.loginState.isUser();
|
||||
var enableLocal = self.loginState.hasPermission(self.access.permissions.UPLOAD)();
|
||||
var enableSd = enableLocal && CONFIG_SD_SUPPORT && self.printerState.isSdReady();
|
||||
|
||||
self._setDropzone("local", enableLocal);
|
||||
self._setDropzone("sdcard", enableSd);
|
||||
}
|
||||
self.loginState.isUser.subscribe(evaluateDropzones);
|
||||
self.loginState.currentUser.subscribe(evaluateDropzones);
|
||||
self.printerState.isSdReady.subscribe(evaluateDropzones);
|
||||
evaluateDropzones();
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ $(function() {
|
||||
var self = this;
|
||||
|
||||
self.loginState = parameters[0];
|
||||
self.access = parameters[1];
|
||||
|
||||
// initialize list helper
|
||||
self.listHelper = new ItemListHelper(
|
||||
@@ -36,6 +37,9 @@ $(function() {
|
||||
);
|
||||
|
||||
self.requestData = function() {
|
||||
if (!self.loginState.hasPermission(self.access.permissions.LOGS)())
|
||||
return;
|
||||
|
||||
OctoPrint.logs.list()
|
||||
.done(self.fromResponse);
|
||||
};
|
||||
@@ -49,6 +53,9 @@ $(function() {
|
||||
};
|
||||
|
||||
self.removeFile = function(filename) {
|
||||
if (!self.loginState.hasPermission(self.access.permissions.LOGS)())
|
||||
return;
|
||||
|
||||
OctoPrint.logs.delete(filename)
|
||||
.done(self.requestData);
|
||||
};
|
||||
@@ -60,7 +67,7 @@ $(function() {
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push([
|
||||
LogViewModel,
|
||||
["loginStateViewModel"],
|
||||
["loginStateViewModel", "accessViewModel"],
|
||||
"#logs"
|
||||
]);
|
||||
});
|
||||
@@ -3,6 +3,7 @@ $(function() {
|
||||
var self = this;
|
||||
|
||||
self.loginState = parameters[0];
|
||||
self.access = parameters[1];
|
||||
|
||||
self.timelapsePopup = undefined;
|
||||
|
||||
@@ -48,7 +49,7 @@ $(function() {
|
||||
return ("timed" == self.timelapseType());
|
||||
});
|
||||
self.saveButtonEnabled = ko.pureComputed(function() {
|
||||
return self.isDirty() && self.isOperational() && !self.isPrinting() && self.loginState.isUser();
|
||||
return self.loginState.hasPermission(self.access.permissions.TIMELAPSE_ADMIN)() && self.isDirty() && self.isOperational() && !self.isPrinting();
|
||||
});
|
||||
|
||||
self.isOperational.subscribe(function() {
|
||||
@@ -140,6 +141,9 @@ $(function() {
|
||||
);
|
||||
|
||||
self.requestData = function() {
|
||||
if (!self.loginState.hasPermission(self.access.permissions.TIMELAPSE_ADMIN)())
|
||||
return;
|
||||
|
||||
OctoPrint.timelapse.get(true)
|
||||
.done(self.fromResponse);
|
||||
};
|
||||
@@ -228,6 +232,9 @@ $(function() {
|
||||
};
|
||||
|
||||
self.removeFile = function(filename) {
|
||||
if (!self.loginState.hasPermission(self.access.permissions.TIMELAPSE_ADMIN)())
|
||||
return;
|
||||
|
||||
var perform = function() {
|
||||
OctoPrint.timelapse.delete(filename)
|
||||
.done(function() {
|
||||
@@ -241,6 +248,9 @@ $(function() {
|
||||
};
|
||||
|
||||
self.removeMarkedFiles = function() {
|
||||
if (!self.loginState.hasPermission(self.access.permissions.TIMELAPSE_ADMIN)())
|
||||
return;
|
||||
|
||||
var perform = function() {
|
||||
self._bulkRemove(self.markedForFileDeletion(), "files")
|
||||
.done(function() {
|
||||
@@ -265,6 +275,9 @@ $(function() {
|
||||
};
|
||||
|
||||
self.removeUnrendered = function(name) {
|
||||
if (!self.loginState.hasPermission(self.access.permissions.TIMELAPSE_ADMIN)())
|
||||
return;
|
||||
|
||||
var perform = function() {
|
||||
OctoPrint.timelapse.deleteUnrendered(name)
|
||||
.done(function() {
|
||||
@@ -278,6 +291,9 @@ $(function() {
|
||||
};
|
||||
|
||||
self.removeMarkedUnrendered = function() {
|
||||
if (!self.loginState.hasPermission(self.access.permissions.TIMELAPSE_ADMIN)())
|
||||
return;
|
||||
|
||||
var perform = function() {
|
||||
self._bulkRemove(self.markedForUnrenderedDeletion(), "unrendered")
|
||||
.done(function() {
|
||||
@@ -347,11 +363,17 @@ $(function() {
|
||||
};
|
||||
|
||||
self.renderUnrendered = function(name) {
|
||||
if (!self.loginState.hasPermission(self.access.permissions.TIMELAPSE_ADMIN)())
|
||||
return;
|
||||
|
||||
OctoPrint.timelapse.renderUnrendered(name)
|
||||
.done(self.requestData);
|
||||
};
|
||||
|
||||
self.save = function() {
|
||||
if (!self.loginState.hasPermission(self.access.permissions.TIMELAPSE_ADMIN)())
|
||||
return;
|
||||
|
||||
var payload = {
|
||||
"type": self.timelapseType(),
|
||||
"postRoll": self.timelapsePostRoll(),
|
||||
@@ -504,7 +526,7 @@ $(function() {
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push([
|
||||
TimelapseViewModel,
|
||||
["loginStateViewModel"],
|
||||
["loginStateViewModel", "accessViewModel"],
|
||||
"#timelapse"
|
||||
]);
|
||||
});
|
||||
@@ -21,7 +21,7 @@
|
||||
<td class="settings_logs_size" data-bind="text: formatSize(size)"></td>
|
||||
<td class="settings_logs_date" data-bind="text: formatDate(date)"></td>
|
||||
<td class="settings_logs_action">
|
||||
<a href="#" class="icon-trash" data-bind="click: function() { if ($root.loginState.isUser()) { $parent.removeFile($data.name); } else { return; } }, css: {disabled: !$root.loginState.isUser()}"></a> | <a href="#" class="icon-download" data-bind="attr: {href: refs.download}"></a>
|
||||
<a href="#" class="icon-trash" data-bind="click: $parent.removeFile($data.name)"></a> | <a href="#" class="icon-download" data-bind="attr: {href: refs.download}"></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div id="drop_overlay" data-bind="visible: loginState.isUser()">
|
||||
<div id="drop_overlay" data-bind="visible: loginState.hasPermission(access.permissions.UPLOAD)">
|
||||
<div id="drop_overlay_background"></div>
|
||||
<div id="drop_overlay_wrapper">
|
||||
{% if enableSdSupport %}
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
<div class="additionalInfo hide" data-bind="html: $root.getAdditionalData($data)"></div>
|
||||
<div class="btn-group action-buttons">
|
||||
<div class="btn btn-mini toggleAdditionalData" data-bind="click: function() { if ($root.enableAdditionalData($data)) { $root.toggleAdditionalData($data); } else { return; } }, css: { disabled: !$root.enableAdditionalData($data) }" title="{{ _('Additional data') }}"><i class="icon-chevron-down"></i></div>
|
||||
<a class="btn btn-mini" data-bind="attr: {href: $root.downloadLink($data)}, css: {disabled: !$root.downloadLink($data)}" title="{{ _('Download') }}"><i class="icon-download-alt"></i></a>
|
||||
<div class="btn btn-mini" data-bind="click: function(data, event) { if ($root.enableRemove($data)) { $root.removeFile($data, event); } else { return; } }, css: {disabled: !$root.enableRemove($data)}" title="{{ _('Remove') }}"><i class="icon-trash"></i></div>
|
||||
<div class="btn btn-mini" data-bind="click: function() { if ($root.enableSelect($data)) { $root.loadFile($data, false); } else { return; } }, css: {disabled: !$root.enableSelect($data)}" title="{{ _('Load') }}"><i class="icon-folder-open"></i></div>
|
||||
<div class="btn btn-mini" data-bind="click: function() { if ($root.enableSelectAndPrint($data)) { $root.loadFile($data, true); } else { return; } }, css: {disabled: !$root.enableSelectAndPrint($data)}" title="{{ _('Load and Print') }}"><i class="icon-print"></i></div>
|
||||
<a class="btn btn-mini" data-bind="visible: $root.loginState.hasPermission($root.access.permissions.DOWNLOAD), attr: {href: $root.downloadLink($data)}, css: {disabled: !$root.downloadLink($data)}" title="{{ _('Download') }}"><i class="icon-download-alt"></i></a>
|
||||
<div class="btn btn-mini" data-bind="visible: $root.loginState.hasPermission($root.access.permissions.DELETE), click: function(data, event) { if ($root.enableRemove($data)) { $root.removeFile($data, event); } else { return; } }, css: {disabled: !$root.enableRemove($data)}" title="{{ _('Remove') }}"><i class="icon-trash"></i></div>
|
||||
<div class="btn btn-mini" data-bind="visible: $root.loginState.hasPermission($root.access.permissions.SELECT), click: function() { if ($root.enableSelect($data)) { $root.loadFile($data, false); } else { return; } }, css: {disabled: !$root.enableSelect($data)}" title="{{ _('Load') }}"><i class="icon-folder-open"></i></div>
|
||||
<div class="btn btn-mini" data-bind="visible: $root.loginState.hasPermission($root.access.permissions.PRINT), click: function() { if ($root.enableSelectAndPrint($data)) { $root.loadFile($data, true); } else { return; } }, css: {disabled: !$root.enableSelectAndPrint($data)}" title="{{ _('Load and Print') }}"><i class="icon-print"></i></div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
<div class="uploaded">{{ _('Uploaded') }}: <span data-bind="text: formatTimeAgo(date)"></span></div>
|
||||
<div class="size">{{ _('Size') }}: <span data-bind="text: formatSize(size)"></span></div>
|
||||
<div class="btn-group action-buttons">
|
||||
<a class="btn btn-mini" data-bind="attr: {href: $root.downloadLink($data), css: {disabled: !$root.downloadLink($data)}}" title="{{ _('Download') }}"><i class="icon-download-alt"></i></a>
|
||||
<div class="btn btn-mini" data-bind="click: function(data, event) { if ($root.enableRemove($data)) { $root.removeFile($data, event); } else { return; } }, css: {disabled: !$root.enableRemove($data)}" title="{{ _('Remove') }}"><i class="icon-trash"></i></div>
|
||||
<div class="btn btn-mini" data-bind="click: function() { if ($root.enableSlicing($data)) { $root.sliceFile($data); } else { return; } }, css: {disabled: !$root.enableSlicing($data)}" title="{{ _('Slice') }}"><i class="icon-magic"></i></div>
|
||||
<a class="btn btn-mini" data-bind="visible: $root.loginState.hasPermission($root.access.permissions.DOWNLOAD), attr: {href: $root.downloadLink($data), css: {disabled: !$root.downloadLink($data)}}" title="{{ _('Download') }}"><i class="icon-download-alt"></i></a>
|
||||
<div class="btn btn-mini" data-bind="visible: $root.loginState.hasPermission($root.access.permissions.DELETE), click: function(data, event) { if ($root.enableRemove($data)) { $root.removeFile($data, event); } else { return; } }, css: {disabled: !$root.enableRemove($data)}" title="{{ _('Remove') }}"><i class="icon-trash"></i></div>
|
||||
<div class="btn btn-mini" data-bind="visible: $root.loginState.hasPermission($root.access.permissions.SLICE), click: function() { if ($root.enableSlicing($data)) { $root.sliceFile($data); } else { return; } }, css: {disabled: !$root.enableSlicing($data)}" title="{{ _('Slice') }}"><i class="icon-magic"></i></div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
@@ -40,36 +40,36 @@
|
||||
<div class="title clickable" data-bind="click: $root.changeFolder, style: { 'font-weight': $root.listHelper.isSelected($data) ? 'bold' : 'normal' }"><i class="icon-folder-open"></i> <span data-bind="text: name"></span></div>
|
||||
<div class="size">{{ _('Size') }}: <span data-bind="text: formatSize(size)"></span></div>
|
||||
<div class="btn-group action-buttons">
|
||||
<div class="btn btn-mini" data-bind="click: function(data, event) { if ($root.enableRemove($data)) { $root.removeFolder($data, event); } else { return; } }, css: {disabled: !$root.enableRemove($data)}" title="{{ _('Remove') }}"><i class="icon-trash"></i></div>
|
||||
<div class="btn btn-mini" data-bind="visible: $root.loginState.hasPermission($root.access.permissions.DELETE), click: function(data, event) { if ($root.enableRemove($data)) { $root.removeFolder($data, event); } else { return; } }, css: {disabled: !$root.enableRemove($data)}" title="{{ _('Remove') }}"><i class="icon-trash"></i></div>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
<div class="text-right muted" data-bind="attr: {title: diskusageString}, css: {'text-error': diskusageCritical}, style: {'font-weight': diskusageCritical() || diskusageWarning() ? 'bold' : 'normal'}">
|
||||
<small>{{ _('Free') }}: <span data-bind="text: freeSpaceString"></span> / {{ _('Total') }}: <span data-bind="text: totalSpaceString"></span> <i class="icon-exclamation-sign" data-bind="visible: diskusageWarning" style="display: none"></i></small>
|
||||
</div>
|
||||
<div style="display: none;" data-bind="visible: loginState.isUser">
|
||||
<div style="display: none;" data-bind="visible: loginState.hasPermission(access.permissions.UPLOAD)">
|
||||
<div class="row-fluid folder-button">
|
||||
<span class="btn addfolder-button span12" data-bind="click: function() { if ($root.loginState.isUser()) { $root.showAddFolderDialog(); } }, css: {disabled: !$root.loginState.isUser()}">
|
||||
<span class="btn addfolder-button span12" data-bind="click: $root.showAddFolderDialog">
|
||||
<i class="icon-folder-close"></i> {{ _('Create folder...') }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="row-fluid upload-buttons">
|
||||
{% if enableSdSupport %}
|
||||
<span class="btn btn-primary fileinput-button span6" data-bind="css: {disabled: !$root.loginState.isUser()}" style="margin-bottom: 10px">
|
||||
<span class="btn btn-primary fileinput-button span6" style="margin-bottom: 10px">
|
||||
<i class="icon-upload-alt icon-white"></i>
|
||||
<span>{{ _('Upload') }}</span>
|
||||
<input id="gcode_upload" accept="{{ ",".join(supportedExtensions) }}" type="file" name="file" class="fileinput-button" data-bind="enable: loginState.isUser()">
|
||||
<input id="gcode_upload" accept="{{ ",".join(supportedExtensions) }}" type="file" name="file" class="fileinput-button">
|
||||
</span>
|
||||
<span class="btn btn-primary fileinput-button span6" data-bind="css: {disabled: !$root.loginState.isUser() || !$root.isSdReady()}" style="margin-bottom: 10px">
|
||||
<span class="btn btn-primary fileinput-button span6" data-bind="css: {disabled: !$root.isSdReady()}" style="margin-bottom: 10px">
|
||||
<i class="icon-upload-alt icon-white"></i>
|
||||
<span>{{ _('Upload to SD') }}</span>
|
||||
<input id="gcode_upload_sd" accept="{{ ",".join(supportedExtensions) }}" type="file" name="file" class="fileinput-button" data-bind="enable: loginState.isUser() && isSdReady()">
|
||||
<input id="gcode_upload_sd" accept="{{ ",".join(supportedExtensions) }}" type="file" name="file" class="fileinput-button" data-bind="enable: isSdReady()">
|
||||
</span>
|
||||
{% else %}
|
||||
<span class="btn btn-primary fileinput-button span12" data-bind="css: {disabled: !$root.loginState.isUser()}" style="margin-bottom: 10px">
|
||||
<span class="btn btn-primary fileinput-button span12" style="margin-bottom: 10px">
|
||||
<i class="icon-upload-alt icon-white"></i>
|
||||
<span>{{ _('Upload') }}</span>
|
||||
<input id="gcode_upload" accept="{{ ",".join(supportedExtensions) }}" type="file" name="file" class="fileinput-button" data-bind="enable: loginState.isUser()">
|
||||
<input id="gcode_upload" accept="{{ ",".join(supportedExtensions) }}" type="file" name="file" class="fileinput-button">
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid print-control" style="display: none;" data-bind="visible: loginState.isUser">
|
||||
<button class="btn btn-primary span4" data-bind="click: print, enable: enablePrint, css: {'btn-danger': isPaused()}, attr: {title: titlePrintButton}" id="job_print"><i class="icon-white" data-bind="css: {'icon-print': !isPaused(), 'icon-undo': isPaused()}"></i> <span data-bind="text: (isPaused() ? '{{ _('Restart') }}' : '{{ _('Print') }}')">{{ _('Print') }}</span></button>
|
||||
<div class="row-fluid print-control">
|
||||
<button class="btn btn-primary span4" data-bind="visible: $root.loginState.hasPermission($root.access.permissions.PRINT), click: print, enable: enablePrint, css: {'btn-danger': isPaused()}, attr: {title: titlePrintButton}" id="job_print"><i class="icon-white" data-bind="css: {'icon-print': !isPaused(), 'icon-undo': isPaused()}"></i> <span data-bind="text: (isPaused() ? '{{ _('Restart') }}' : '{{ _('Print') }}')">{{ _('Print') }}</span></button>
|
||||
<button class="btn span4" id="job_pause" data-bind="click: function() { isPaused() ? onlyResume() : onlyPause(); }, enable: enablePause, css: {active: isPaused()}, attr: {title: titlePauseButton}"><i data-bind="css: {'icon-pause': !isPaused(), 'icon-play': isPaused()}"></i> <span data-bind="visible: !isPaused()">{{ _('Pause') }}</span><span data-bind="visible: isPaused()">{{ _('Resume') }}</span></button>
|
||||
<button class="btn span4" id="job_cancel" data-bind="click: cancel, enable: enableCancel" title="{{ _('Cancels the print job') }}"><i class="icon-stop"></i> {{ _('Cancel') }}</button>
|
||||
</div>
|
||||
@@ -5,7 +5,7 @@
|
||||
{% endif %}
|
||||
<div class="row-fluid">
|
||||
|
||||
<table class="table table-bordered table-hover" style="table-layout: fixed; width: 100%; margin-top: 20px">
|
||||
<table class="table table-bordered table-hover" style="table-layout: fixed; width: 100%; margin-top: 20px" data-bind="visible: loginState.hasPermission(access.permissions.CONTROL)">
|
||||
<tr>
|
||||
<th style="width: 18%"></th>
|
||||
<th style="width: 12%; text-align: right">{{ _('Actual') }}</th>
|
||||
@@ -23,11 +23,11 @@
|
||||
<td style="text-align: right; vertical-align: middle" data-bind="html: formatTemperature(actual())"></td>
|
||||
<td style="vertical-align: middle; overflow: visible">
|
||||
<div class="input-append">
|
||||
<input type="number" class="input-mini text-right tempInput" data-bind="attr: {placeholder: cleanTemperature(target()) }, value: newTarget, enable: $root.isOperational() && $root.loginState.isUser(), event: { keyup: function(d, e) {$root.handleEnter(e, 'target', $data);} }">
|
||||
<input type="number" class="input-mini text-right tempInput" data-bind="attr: {placeholder: cleanTemperature(target()) }, value: newTarget, enable: $root.isOperational, event: { keyup: function(d, e) {$root.handleEnter(e, 'target', $data);} }">
|
||||
<span class="add-on">°C</span>
|
||||
<div class="btn-group">
|
||||
<button type="submit" data-bind="click: $parent.setTarget, enable: $root.isOperational() && $root.loginState.isUser()" class="btn">{{ _('Set') }}</button>
|
||||
<button class="btn dropdown-toggle" data-toggle="dropdown" data-bind="enable: $root.isOperational() && $root.loginState.isUser()">
|
||||
<button type="submit" data-bind="click: $parent.setTarget, enable: $root.isOperational" class="btn">{{ _('Set') }}</button>
|
||||
<button class="btn dropdown-toggle" data-toggle="dropdown" data-bind="enable: $root.isOperational">
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
@@ -46,9 +46,9 @@
|
||||
</td>
|
||||
<td style="vertical-align: middle">
|
||||
<div class="input-append">
|
||||
<input type="number" min="-50" max="50" class="input-mini text-right tempInput" data-bind="attr: {placeholder: offset}, value: newOffset, enable: $root.isOperational() && $root.loginState.isUser(), event: { keyup: function(d, e) {$root.handleEnter(e, 'offset', $data);} }">
|
||||
<input type="number" min="-50" max="50" class="input-mini text-right tempInput" data-bind="attr: {placeholder: offset}, value: newOffset, enable: $root.isOperational, event: { keyup: function(d, e) {$root.handleEnter(e, 'offset', $data);} }">
|
||||
<span class="add-on">°C</span>
|
||||
<button type="submit" data-bind="click: $root.setOffset, enable: $root.isOperational() && $root.loginState.isUser()" class="btn">{{ _('Set') }}</button>
|
||||
<button type="submit" data-bind="click: $root.setOffset, enable: $root.isOperational" class="btn">{{ _('Set') }}</button>
|
||||
</div>
|
||||
</td>
|
||||
</script>
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="span6" id="terminal-sendpanel" style="display: none;" data-bind="visible: loginState.isUser">
|
||||
<div class="span6" id="terminal-sendpanel">
|
||||
<div class="input-append">
|
||||
<input type="text" id="terminal-command" data-bind="value: command, event: { keyup: function(d,e) { return handleKeyUp(e); }, keydown: function(d,e) { return handleKeyDown(e); } }, enable: isOperational() && loginState.isUser()">
|
||||
<button class="btn" type="button" id="terminal-send" data-bind="click: sendCommand, enable: isOperational() && loginState.isUser()">{{ _('Send') }}</button>
|
||||
<input type="text" id="terminal-command" data-bind="value: command, event: { keyup: function(d,e) { return handleKeyUp(e); }, keydown: function(d,e) { return handleKeyDown(e); } }, enable: isOperational">
|
||||
<button class="btn" type="button" id="terminal-send" data-bind="click: sendCommand, enable: isOperational()">{{ _('Send') }}</button>
|
||||
</div>
|
||||
<small class="muted">{{ _('Hint: Use the arrow up/down keys to recall commands sent previously') }}</small>
|
||||
</div>
|
||||
@@ -27,7 +27,7 @@
|
||||
<div><small><a href="#" class="muted" data-bind="toggleContent: { class: 'icon-caret-right icon-caret-down', container: '#term .hide' }"><i class="icon-caret-right"></i> {{ _('Advanced options') }}</a></small></div>
|
||||
<div class="hide">
|
||||
<p class="row-fluid">
|
||||
<button class="btn btn-primary btn-block" type="button" data-bind="click: fakeAck, enable: isOperational() && loginState.isUser()">{{ _("Fake Acknowledgement") }}</button>
|
||||
<button class="btn btn-primary btn-block" type="button" data-bind="click: fakeAck, enable: isOperational()">{{ _("Fake Acknowledgement") }}</button>
|
||||
<small class="muted">{{ _("If acknowledgements (\"ok\"s) sent by the firmware get lost due to issues with the serial communication to your printer, OctoPrint's communication with it can become stuck. If that happens, this can help. Please be advised that such occurences hint at general communication issues with your printer which will probably negatively influence your printing results and which you should therefore try to resolve!") }}</small>
|
||||
</p>
|
||||
<p class="row-fluid">
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<div style="display: none;" data-bind="visible: loginState.isUser">
|
||||
<div style="display: none;">
|
||||
<div class="alert" data-bind="visible: isPrinting()">
|
||||
{{ _('Take note that timelapse configuration is disabled while your printer is printing.') }}
|
||||
</div>
|
||||
<h1>{{ _('Timelapse Configuration') }}</h1>
|
||||
|
||||
<label for="webcam_timelapse_mode">{{ _('Timelapse Mode') }}</label>
|
||||
<select id="webcam_timelapse_mode" data-bind="value: timelapseType, enable: isOperational() && !isPrinting() && loginState.isUser()">
|
||||
<select id="webcam_timelapse_mode" data-bind="value: timelapseType, enable: isOperational() && !isPrinting()">
|
||||
<option value="off">{{ _('Off') }}</option>
|
||||
<option value="timed">{{ _('Timed') }}</option>
|
||||
<option value="zchange">{{ _('On Z Change') }}</option>
|
||||
@@ -16,25 +16,25 @@
|
||||
<div id="webcam_timelapse_timedsettings" data-bind="visible: intervalInputEnabled">
|
||||
<label for="webcam_timelapse_interval">{{ _('Interval between snapshots (in seconds)') }}</label>
|
||||
<div class="input-append">
|
||||
<input type="text" class="input-mini" id="webcam_timelapse_interval" data-bind="value: timelapseTimedInterval, valueUpdate: 'afterkeydown', enable: isOperational() && !isPrinting() && loginState.isUser()">
|
||||
<input type="text" class="input-mini" id="webcam_timelapse_interval" data-bind="value: timelapseTimedInterval, valueUpdate: 'afterkeydown', enable: isOperational() && !isPrinting()">
|
||||
<span class="add-on">{{ _('sec') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label for="webcam_timelapse_fps">{{ _('Timelapse frame rate (in frames per second)') }}</label>
|
||||
<div class="input-append">
|
||||
<input type="text" class="input-mini" id="webcam_timelapse_fps" data-bind="value: timelapseFps, valueUpdate: 'afterkeydown', enable: isOperational() && !isPrinting() && loginState.isUser() && timelapseTypeSelected()">
|
||||
<input type="text" class="input-mini" id="webcam_timelapse_fps" data-bind="value: timelapseFps, valueUpdate: 'afterkeydown', enable: isOperational() && !isPrinting() && timelapseTypeSelected()">
|
||||
<span class="add-on">{{ _('fps') }}</span>
|
||||
</div>
|
||||
|
||||
<label for="webcam_timelapse_postRoll">{{ _('Timelapse post roll (in rendered seconds)') }}</label>
|
||||
<div class="input-append">
|
||||
<input type="text" class="input-mini" id="webcam_timelapse_postRoll" data-bind="value: timelapsePostRoll, valueUpdate: 'afterkeydown', enable: isOperational() && !isPrinting() && loginState.isUser() && timelapseTypeSelected()">
|
||||
<input type="text" class="input-mini" id="webcam_timelapse_postRoll" data-bind="value: timelapsePostRoll, valueUpdate: 'afterkeydown', enable: isOperational() && !isPrinting() && timelapseTypeSelected()">
|
||||
<span class="add-on">{{ _('sec') }}</span>
|
||||
</div>
|
||||
<div id="webcam_timelapse_capturePostRoll" data-bind="visible: timelapseType() == 'timed'">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: timelapseCapturePostRoll, valueUpdate: 'afterkeydown', enable: isOperational() && !isPrinting() && loginState.isUser()"> {{ _('Capture post roll images') }}
|
||||
<input type="checkbox" data-bind="checked: timelapseCapturePostRoll, valueUpdate: 'afterkeydown', enable: isOperational() && !isPrinting()"> {{ _('Capture post roll images') }}
|
||||
<span class="help-block">{{ _('If this is unchecked, OctoPrint will simply repeat the last frame for the post roll instead of continuing to capture new frames.') }}</span>
|
||||
</label>
|
||||
</div>
|
||||
@@ -42,7 +42,7 @@
|
||||
<div id="webcam_timelapse_retractionsettings" data-bind="visible: timelapseType() == 'zchange'">
|
||||
<label for="webcam_timelapse_retractionZHop">{{ _('Retraction Z-Hop (in mm)') }}</label>
|
||||
<div class="input-append">
|
||||
<input type="text" class="input-mini" id="webcam_timelapse_retractionZHop" data-bind="value: timelapseRetractionZHop, valueUpdate: 'afterkeydown', enable: isOperational() && !isPrinting() && loginState.isUser()">
|
||||
<input type="text" class="input-mini" id="webcam_timelapse_retractionZHop" data-bind="value: timelapseRetractionZHop, valueUpdate: 'afterkeydown', enable: isOperational() && !isPrinting()">
|
||||
<span class="add-on">{{ _('mm') }}</span>
|
||||
</div>
|
||||
<span class="help-block">{{ _('Enter the retraction z-hop used in the firmware or the gcode file to trigger snapshots for the timelapse only if a real layer change happens. For this to work properly your retraction z-hop has to be different from your layerheight!') }}</span>
|
||||
@@ -99,7 +99,7 @@
|
||||
<td class="timelapse_files_checkbox"><input type="checkbox" data-bind="value: name, checked: $root.markedForFileDeletion"></td>
|
||||
<td class="timelapse_files_name" data-bind="text: name"></td>
|
||||
<td class="timelapse_files_size" data-bind="text: size"></td>
|
||||
<td class="timelapse_files_action"><a href="javascript:void(0)" class="icon-trash" data-bind="click: function() { if ($root.loginState.isUser()) { $parent.removeFile($data.name); } else { return; } }, css: {disabled: !$root.loginState.isUser()}"></a> | <a href="javascript:void(0)" class="icon-download" data-bind="attr: {href: url}"></a></td>
|
||||
<td class="timelapse_files_action"><a href="javascript:void(0)" class="icon-trash" data-bind="click: function() { $parent.removeFile($data.name); }"></a> | <a href="javascript:void(0)" class="icon-download" data-bind="attr: {href: url}"></a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -148,7 +148,7 @@
|
||||
<td class="timelapse_unrendered_size" data-bind="text: size"></td>
|
||||
<td class="timelapse_unrendered_action">
|
||||
<span data-bind="visible: processing"><i class="icon-refresh icon-spin"></i></span>
|
||||
<span data-bind="visible: !processing"><a href="javascript:void(0)" title="{{ _('Delete unrendered timelapse') }}" class="icon-trash" data-bind="click: function() { if ($root.loginState.isUser()) { $parent.removeUnrendered($data.name); } else { return; } }, css: {disabled: !$root.loginState.isUser()}"></a> | <a href="javascript:void(0)" title="{{ _('Render timelapse') }}" class="icon-facetime-video" data-bind="click: function() { if ($root.loginState.isUser() && !$root.isBusy()) { $parent.renderUnrendered($data.name); } else { return; } }, css: {disabled: !$root.loginState.isUser() || $root.isBusy()}"></a></span>
|
||||
<span data-bind="visible: !processing"><a href="javascript:void(0)" title="{{ _('Delete unrendered timelapse') }}" class="icon-trash" data-bind="click: function() { $parent.removeUnrendered($data.name); }"></a> | <a href="javascript:void(0)" title="{{ _('Render timelapse') }}" class="icon-facetime-video" data-bind="click: function() { if (!$root.isBusy()) { $parent.renderUnrendered($data.name); } else { return; } }, css: {disabled: $root.isBusy()}"></a></span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
Reference in new issue
Block a user