🌈 style: Restyle PopUps; Editor Modal Position
- change title of PopUps - make sure position of editor modal is ok on first show
This commit is contained in:
parent
bcab95f77a
commit
ef6c846f56
|
@ -608,7 +608,7 @@ __plugin_settings_overlay__ = {
|
||||||
'actions': [{
|
'actions': [{
|
||||||
'action': 'octoklipper_restart',
|
'action': 'octoklipper_restart',
|
||||||
'command': 'sudo service klipper restart',
|
'command': 'sudo service klipper restart',
|
||||||
'name': 'Restart Klipper',
|
'name': gettext('Restart Klipper'),
|
||||||
'confirm': '<h3><center><b>' + gettext("You are about to restart Klipper!") + '<br>' + gettext("This will stop ongoing prints!") + '</b></center></h3><br>Command = "sudo service klipper restart"'
|
'confirm': '<h3><center><b>' + gettext("You are about to restart Klipper!") + '<br>' + gettext("This will stop ongoing prints!") + '</b></center></h3><br>Command = "sudo service klipper restart"'
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,7 +174,7 @@ def check_cfg(self, data):
|
||||||
"Error: Invalid Klipper config file:\n"
|
"Error: Invalid Klipper config file:\n"
|
||||||
+ "{}".format(str(error))
|
+ "{}".format(str(error))
|
||||||
)
|
)
|
||||||
util.send_message(self, "PopUp", "warning", "OctoKlipper: Invalid Config data\n",
|
util.send_message(self, "PopUp", "warning", "Invalid Config data\n",
|
||||||
"\n"
|
"\n"
|
||||||
+ str(error))
|
+ str(error))
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ def is_float_ok(self, dataToValidated):
|
||||||
self,
|
self,
|
||||||
"PopUp",
|
"PopUp",
|
||||||
"warning",
|
"warning",
|
||||||
"OctoKlipper: Invalid Config data\n",
|
"Invalid Config data\n",
|
||||||
"\n"
|
"\n"
|
||||||
+ "Invalid Value for <b>" + x + "</b> in Section: <b>" + y + "</b>\n"
|
+ "Invalid Value for <b>" + x + "</b> in Section: <b>" + y + "</b>\n"
|
||||||
+ "{}".format(str(error))
|
+ "{}".format(str(error))
|
||||||
|
|
|
@ -150,7 +150,6 @@ ul#klipper-settings {
|
||||||
}
|
}
|
||||||
|
|
||||||
div#klipper_backups_dialog {
|
div#klipper_backups_dialog {
|
||||||
min-height: 300px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: column;
|
flex-flow: column;
|
||||||
min-height: 400px;
|
min-height: 400px;
|
||||||
|
@ -255,10 +254,6 @@ div#settings_plugin_klipper div.tab-content div#conf.tab-pane div.control-group
|
||||||
margin: 5;
|
margin: 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
div#klipper_editor {
|
|
||||||
min-height: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 979px) {
|
@media (max-width: 979px) {
|
||||||
|
|
||||||
div#klipper_editor.modal {
|
div#klipper_editor.modal {
|
||||||
|
@ -267,13 +262,18 @@ div#klipper_editor {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
div#klipper_editor .modal-header {
|
#klipper_editor {
|
||||||
height: 6px;
|
|
||||||
|
display: flex;
|
||||||
|
flex-flow: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.octoprint-container.UICMainCont.container-fluid {
|
||||||
|
margin-top:0px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
div#klipper_editor .modal-body {
|
div#klipper_editor .modal-body {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
min-height: 250px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: column;
|
flex-flow: column;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,16 +37,36 @@ $(function () {
|
||||||
self.logMessages = ko.observableArray();
|
self.logMessages = ko.observableArray();
|
||||||
|
|
||||||
self.showPopUp = function (popupType, popupTitle, message) {
|
self.showPopUp = function (popupType, popupTitle, message) {
|
||||||
var title = popupType.toUpperCase() + ": " + popupTitle;
|
var title = "OctoKlipper: <br />" + popupTitle + "<br />";
|
||||||
|
var hide = false;
|
||||||
|
if (popupType == "success") {
|
||||||
|
hide = true
|
||||||
|
}
|
||||||
new PNotify({
|
new PNotify({
|
||||||
title: title,
|
title: title,
|
||||||
text: message,
|
text: message,
|
||||||
type: popupType,
|
type: popupType,
|
||||||
hide: false,
|
hide: hide,
|
||||||
icon: true
|
icon: true
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.onStartupComplete = function () {
|
||||||
|
var klipper_editor = $('#klipper_editor')
|
||||||
|
var modalOverflow = $(window).height() - 10 < klipper_editor.height();
|
||||||
|
|
||||||
|
klipper_editor.css('display', 'none');
|
||||||
|
if (modalOverflow) {
|
||||||
|
klipper_editor
|
||||||
|
.css('margin-top', 0)
|
||||||
|
.addClass('modal-overflow');
|
||||||
|
} else {
|
||||||
|
klipper_editor
|
||||||
|
.css('margin-top', 0 - klipper_editor.height() / 2)
|
||||||
|
.removeClass('modal-overflow');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
self.showEditorDialog = function () {
|
self.showEditorDialog = function () {
|
||||||
if (!self.hasRight("CONFIG")) return;
|
if (!self.hasRight("CONFIG")) return;
|
||||||
var editorDialog = $("#klipper_editor");
|
var editorDialog = $("#klipper_editor");
|
||||||
|
|
|
@ -42,6 +42,7 @@ $(function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
self.onStartupComplete = function () {
|
self.onStartupComplete = function () {
|
||||||
|
$('#klipper_backups_dialog').css('display', 'none');
|
||||||
if (self.loginState.loggedIn()) {
|
if (self.loginState.loggedIn()) {
|
||||||
self.listBakFiles();
|
self.listBakFiles();
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,16 +51,17 @@ $(function () {
|
||||||
.done(function (response) {
|
.done(function (response) {
|
||||||
var msg = ""
|
var msg = ""
|
||||||
if (response.is_syntax_ok == true) {
|
if (response.is_syntax_ok == true) {
|
||||||
msg = gettext('Syntax OK')
|
self.klipperViewModel.showPopUp("success", gettext("SyntaxCheck"), gettext("SyntaxCheck OK"));
|
||||||
} else {
|
} else {
|
||||||
msg = gettext('Syntax NOK')
|
msg = gettext('Syntax NOK')
|
||||||
|
showMessageDialog(
|
||||||
|
msg,
|
||||||
|
{
|
||||||
|
title: gettext("SyntaxCheck")
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
showMessageDialog(
|
|
||||||
msg,
|
|
||||||
{
|
|
||||||
title: gettext("SyntaxCheck")
|
|
||||||
}
|
|
||||||
)
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -73,16 +74,16 @@ $(function () {
|
||||||
.done(function (response) {
|
.done(function (response) {
|
||||||
var msg = ""
|
var msg = ""
|
||||||
if (response.saved === true) {
|
if (response.saved === true) {
|
||||||
msg = gettext('File saved.')
|
self.klipperViewModel.showPopUp("success", gettext("Save Config"), gettext("File saved."));
|
||||||
} else {
|
} else {
|
||||||
msg = gettext('File not saved.')
|
msg = gettext('File not saved!')
|
||||||
|
showMessageDialog(
|
||||||
|
msg,
|
||||||
|
{
|
||||||
|
title: gettext("Save Config")
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
showMessageDialog(
|
|
||||||
msg,
|
|
||||||
{
|
|
||||||
title: gettext("Save File")
|
|
||||||
}
|
|
||||||
)
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -147,6 +148,7 @@ $(function () {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
self.klipperViewModel.showPopUp("success", gettext("Reload Config"), gettext("File reloaded."));
|
||||||
if (editor) {
|
if (editor) {
|
||||||
editor.session.setValue(response.response.config);
|
editor.session.setValue(response.response.config);
|
||||||
editor.clearSelection();
|
editor.clearSelection();
|
||||||
|
|
Loading…
Reference in New Issue