Skip to content

Commit 553c206

Browse files
SW-2058-pop-up-to-guide-the-user-to-do-hard-refresh-after-update (mrbeam#1590)
* adding the hard refresh overlay * added translation Co-authored-by: khaledsherkawi <[email protected]>
1 parent a8bb7b1 commit 553c206

File tree

10 files changed

+161
-11
lines changed

10 files changed

+161
-11
lines changed

octoprint_mrbeam/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,7 @@ def get_assets(self):
709709
"js/calibration/watterott/camera_alignment.js",
710710
"js/calibration/watterott/calibration_qa.js",
711711
"js/calibration/watterott/label_printer.js",
712+
"js/hard_refresh_overlay.js",
712713
],
713714
css=[
714715
"css/mrbeam.css",

octoprint_mrbeam/static/css/mrbeam.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3407,3 +3407,23 @@ button#terminal-send {
34073407
#support_overlay > div.modal-body.scrollable > table {
34083408
margin: 20px auto;
34093409
}
3410+
/* Support Standalone */
3411+
3412+
/* Hard refresh overlay */
3413+
3414+
#hard_refresh_overlay {
3415+
width: 60%;
3416+
margin-left: -30%;
3417+
}
3418+
#hard_refresh_overlay .image_description {
3419+
padding: 40px;
3420+
}
3421+
#hard_refresh_overlay .modal-header {
3422+
padding-top: 20px;
3423+
padding-bottom: 20px;
3424+
}
3425+
#hard_refresh_overlay .icon-warning-sign{
3426+
color: #e25303;
3427+
}
3428+
3429+
/* Hard refresh overlay */
9.72 KB
Loading
9.88 KB
Loading
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
$(function () {
2+
function HardRefreshOverlayViewModel(params) {
3+
let self = this;
4+
window.mrbeam.viewModels["HardRefreshOverlayViewModel"] = self;
5+
6+
self.settings = params[0];
7+
self.loginState = params[1];
8+
9+
self.onUserLoggedIn = function () {
10+
if (
11+
self.loginState.currentUser?.()?.active
12+
) {
13+
let x = document.cookie.split('; ').find((row) => row.startsWith('f.u.extra='))?.split('=')[1]; // get cookie
14+
if (x && x === 'true') {
15+
$("#hard_refresh_overlay").modal("show");
16+
}
17+
}
18+
19+
};
20+
//can be used with newer octoprint version
21+
self.onEventplugin_softwareupdate_update_succeeded = function () {
22+
document.cookie = "f.u.extra=true" // add cookie
23+
}
24+
// needs to be used for oprint 1.3.6
25+
self.onDataUpdaterPluginMessage = function (plugin, data) {
26+
if (plugin === "softwareupdate") {
27+
if ("type" in data && (data["type"] === "success" || data["type"] === "restarting" || data["type"] === "restart_manually")) {
28+
document.cookie = "f.u.extra=true"; // add cookie
29+
}
30+
}
31+
}
32+
self.setUserHardRefreshed = function () {
33+
document.cookie = "f.u.extra=false; max-age=0" // delete cookie
34+
}
35+
}
36+
37+
// view model class, parameters for constructor, container to bind to
38+
OCTOPRINT_VIEWMODELS.push([
39+
HardRefreshOverlayViewModel,
40+
41+
// e.g. loginStateViewModel, settingsViewModel, ...
42+
["settingsViewModel", "loginStateViewModel"],
43+
44+
// e.g. #settings_plugin_mrbeam, #tab_plugin_mrbeam, ...
45+
["#hard_refresh_overlay"],
46+
]);
47+
});
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<div id="hard_refresh_overlay" class="modal hide fade" data-backdrop="static">
2+
<div class="modal-header">
3+
<h3><i class="icon icon-warning-sign"></i> {{ _('Refresh is needed after the last Software Update') }}</h3>
4+
</div>
5+
<div class="modal-body">
6+
<div class="row-fluid">
7+
<div class="span5">
8+
<div class="image_description">
9+
<p>{{ _("An update has been installed on this Mr Beam. To use the new functions, the user interace must be completely reloaded.") }}</p>
10+
<p> {{ _("We call this a hard refresh. To do this, press the three keys at the same time, depending on your operating system, as shown in the graphic:") }}</p>
11+
</div>
12+
</div>
13+
<div class="span7">
14+
<b>{{ _("Windows | Ctrl + Shift + R") }}</b>
15+
<img src="/plugin/mrbeam/static/img/windows_refresh.png">
16+
<b>{{ _("Mac | Command + Shift + R") }}</b>
17+
<img src="/plugin/mrbeam/static/img/mac_refresh.png">
18+
</div>
19+
</div>
20+
</div>
21+
<div class="modal-footer">
22+
<button class="btn btn-primary" id="#hard_refresh_confirmed" data-dismiss="modal"
23+
aria-hidden="true" data-bind="click: $root.setUserHardRefreshed">{{ _('Yes, I will reload the page') }}</button>
24+
</div>
25+
</div>

octoprint_mrbeam/templates/mrbeam_ui_index.jinja2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@
177177
{% include 'quick_shape.jinja2' %}
178178
{% include 'conversion_dialog.jinja2' %}
179179
{% include 'laserhead_changed.jinja2' %}
180+
{% include 'hard_refresh_overlay.jinja2' %}
180181
<!-- End of dialogs -->
181182

182183
<!-- Overlays -->
966 Bytes
Binary file not shown.

octoprint_mrbeam/translations/de/LC_MESSAGES/messages.po

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: Mr_Beam 0.1.61\n"
99
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
10-
"POT-Creation-Date: 2022-08-30 11:31+0200\n"
11-
"PO-Revision-Date: 2022-08-30 11:32+0200\n"
10+
"POT-Creation-Date: 2022-11-11 08:54+0100\n"
11+
"PO-Revision-Date: 2022-11-11 08:58+0100\n"
1212
"Last-Translator: Andy Werner <[email protected]>\n"
1313
"Language-Team: \n"
1414
"Language: de\n"
@@ -2576,6 +2576,38 @@ msgstr "Über das Material fahren"
25762576
msgid "It's focused!"
25772577
msgstr "Fokussiert!"
25782578

2579+
#: octoprint_mrbeam/templates/hard_refresh_overlay.jinja2:3
2580+
msgid "Refresh is needed after the last Software Update"
2581+
msgstr "Nach dem letzten Software-Update ist eine Aktualisierung erforderlich"
2582+
2583+
#: octoprint_mrbeam/templates/hard_refresh_overlay.jinja2:9
2584+
msgid ""
2585+
"An update has been installed on this Mr Beam. To use the new functions, the "
2586+
"user interace must be completely reloaded."
2587+
msgstr ""
2588+
"Auf dem Mr Beam wurde ein update installiert. Um die neuen Funktionen nutzen "
2589+
"zu können muss die Benutzeroberfläche komplett neu geladen werden."
2590+
2591+
#: octoprint_mrbeam/templates/hard_refresh_overlay.jinja2:10
2592+
msgid ""
2593+
"We call this a hard refresh. To do this, press the three keys at the same "
2594+
"time, depending on your operating system, as shown in the graphic:"
2595+
msgstr ""
2596+
"Wir nennen das einen hard refresh. Drücke dafür gleichzeitig die drei "
2597+
"Tasten, passend zu deinem Betriebssystem, wie in der Grafik dargestellt."
2598+
2599+
#: octoprint_mrbeam/templates/hard_refresh_overlay.jinja2:14
2600+
msgid "Windows | Ctrl + Shift + R"
2601+
msgstr "Windows | Strg + Shift + R"
2602+
2603+
#: octoprint_mrbeam/templates/hard_refresh_overlay.jinja2:16
2604+
msgid "Mac | Command + Shift + R"
2605+
msgstr "Mac | Command + Shift + R"
2606+
2607+
#: octoprint_mrbeam/templates/hard_refresh_overlay.jinja2:23
2608+
msgid "Yes, I will reload the page"
2609+
msgstr "Ja, ich werde die Seite neu laden"
2610+
25792611
#: octoprint_mrbeam/templates/homing_overlay.jinja2:50
25802612
msgid "Make sure your Mr Beam is empty."
25812613
msgstr "Stelle sicher, dass Dein Mr Beam leer ist."
@@ -3124,11 +3156,11 @@ msgstr ""
31243156
"Support Team kontaktieren um Dein Gerät zurückzusetzen. Mehr dazu findest Du "
31253157
"in der %(tag_open)sKnowledge Base%(tag_close)s."
31263158

3127-
#: octoprint_mrbeam/templates/mrbeam_doc_translation_placeholders.jinja2:1
3159+
#: octoprint_mrbeam/templates/mrbeam_doc_translation_placeholders.jinja2:2
31283160
msgid "Quickstart Guide"
31293161
msgstr "Quickstart Guide"
31303162

3131-
#: octoprint_mrbeam/templates/mrbeam_doc_translation_placeholders.jinja2:2
3163+
#: octoprint_mrbeam/templates/mrbeam_doc_translation_placeholders.jinja2:3
31323164
msgid "User Manual"
31333165
msgstr "Betriebsanleitung"
31343166

@@ -6377,10 +6409,6 @@ msgstr "Dämon zurücksetzen"
63776409
#~ "über 'Einstellungen' > 'Software-Update' aus, bevor Du einen Laserjob "
63786410
#~ "startest."
63796411

6380-
#~ msgid "iobeam version is outdated. Please try Software update."
6381-
#~ msgstr ""
6382-
#~ "Die iobeam-Version ist veraltet. Bitte versuche ein Software-Update."
6383-
63846412
#~ msgid "beamOS is reloading..."
63856413
#~ msgstr "beamOS lädt neu..."
63866414

translations/messages.pot

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PROJECT VERSION\n"
1010
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
11-
"POT-Creation-Date: 2022-08-30 11:31+0200\n"
11+
"POT-Creation-Date: 2022-11-11 08:54+0100\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <[email protected]>\n"
@@ -2214,6 +2214,34 @@ msgstr ""
22142214
msgid "It's focused!"
22152215
msgstr ""
22162216

2217+
#: octoprint_mrbeam/templates/hard_refresh_overlay.jinja2:3
2218+
msgid "Refresh is needed after the last Software Update"
2219+
msgstr ""
2220+
2221+
#: octoprint_mrbeam/templates/hard_refresh_overlay.jinja2:9
2222+
msgid ""
2223+
"An update has been installed on this Mr Beam. To use the new functions, "
2224+
"the user interace must be completely reloaded."
2225+
msgstr ""
2226+
2227+
#: octoprint_mrbeam/templates/hard_refresh_overlay.jinja2:10
2228+
msgid ""
2229+
"We call this a hard refresh. To do this, press the three keys at the same"
2230+
" time, depending on your operating system, as shown in the graphic:"
2231+
msgstr ""
2232+
2233+
#: octoprint_mrbeam/templates/hard_refresh_overlay.jinja2:14
2234+
msgid "Windows | Ctrl + Shift + R"
2235+
msgstr ""
2236+
2237+
#: octoprint_mrbeam/templates/hard_refresh_overlay.jinja2:16
2238+
msgid "Mac | Command + Shift + R"
2239+
msgstr ""
2240+
2241+
#: octoprint_mrbeam/templates/hard_refresh_overlay.jinja2:23
2242+
msgid "Yes, I will reload the page"
2243+
msgstr ""
2244+
22172245
#: octoprint_mrbeam/templates/homing_overlay.jinja2:50
22182246
msgid "Make sure your Mr Beam is empty."
22192247
msgstr ""
@@ -2626,11 +2654,11 @@ msgid ""
26262654
"Base%(tag_close)s."
26272655
msgstr ""
26282656

2629-
#: octoprint_mrbeam/templates/mrbeam_doc_translation_placeholders.jinja2:1
2657+
#: octoprint_mrbeam/templates/mrbeam_doc_translation_placeholders.jinja2:2
26302658
msgid "Quickstart Guide"
26312659
msgstr ""
26322660

2633-
#: octoprint_mrbeam/templates/mrbeam_doc_translation_placeholders.jinja2:2
2661+
#: octoprint_mrbeam/templates/mrbeam_doc_translation_placeholders.jinja2:3
26342662
msgid "User Manual"
26352663
msgstr ""
26362664

0 commit comments

Comments
 (0)