Skip to content

Commit 7fcdeae

Browse files
committed
✨ Make OctoPi-UpToDate build number visible in UI
Footer will reflect an UpToDate build via "OctoPi*" and build number. About page has also been adjusted to show both an about for UpToDate and regular OctoPi under "About OctoPi", if relevant.
1 parent e1e3be5 commit 7fcdeae

File tree

6 files changed

+81
-15
lines changed

6 files changed

+81
-15
lines changed

octoprint_pi_support/__init__.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,14 @@ def get_additional_environment(self):
382382

383383
if is_octopiuptodate():
384384
result["octopiuptodate_build"] = get_octopiuptodate_build()
385+
try:
386+
build = result["octopiuptodate_build"].split("-")[-1]
387+
388+
result["octopiuptodate_build_short"] = (
389+
build[0:4] + "." + build[4:6] + "." + build[6:8] + "." + build[8:]
390+
)
391+
except Exception:
392+
pass
385393

386394
return result
387395

@@ -426,7 +434,15 @@ def get_template_configs(self):
426434
}
427435
]
428436

429-
if is_octopi():
437+
if is_octopiuptodate():
438+
configs.append(
439+
{
440+
"type": "about",
441+
"name": "About OctoPi",
442+
"template": "pi_support_about_octopiuptodate.jinja2",
443+
}
444+
)
445+
elif is_octopi():
430446
configs.append(
431447
{
432448
"type": "about",

octoprint_pi_support/static/js/pi_support.js

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,30 @@ $(function () {
171171
$("#pi_support_footer").remove();
172172
if (!response.octopi_version) return;
173173

174-
var octoPiVersion = $(
175-
"<li id='pi_support_footer'><small>" +
176-
gettext("OctoPi") +
177-
" " +
178-
"<span class='octopi_version'>" +
179-
response.octopi_version +
180-
"</span></small></li>"
181-
);
182-
$("#footer_version").append(octoPiVersion);
174+
if (response.octopiuptodate_build_short) {
175+
var octoPiVersion = $(
176+
"<li id='pi_support_footer'><small>" +
177+
gettext("OctoPi") +
178+
"* " +
179+
"<span class='octopi_version'>" +
180+
response.octopi_version +
181+
" (build " +
182+
response.octopiuptodate_build_short +
183+
")" +
184+
"</span></small></li>"
185+
);
186+
$("#footer_version").append(octoPiVersion);
187+
} else {
188+
var octoPiVersion = $(
189+
"<li id='pi_support_footer'><small>" +
190+
gettext("OctoPi") +
191+
" " +
192+
"<span class='octopi_version'>" +
193+
response.octopi_version +
194+
"</span></small></li>"
195+
);
196+
$("#footer_version").append(octoPiVersion);
197+
}
183198
});
184199
};
185200

octoprint_pi_support/templates/pi_support_about_octopi.jinja2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
<p>Version <span class="plugin_pi_support_octopi_version">{{ plugin_pi_support_octopi_version }}</span>, running on <span class="plugin_pi_support_model">{{ plugin_pi_support_model }}</span></p>
66

7-
<ul>
8-
<li>Website: <a href="https://octoprint.org/download/" target="_blank" rel="noreferrer noopener">octoprint.org/download</a></li>
9-
<li>Source Code: <a href="https://github.com/guysoft/OctoPi" target="_blank" rel="noreferrer noopener">github.com/guysoft/OctoPi</a></li>
7+
<ul class="fa-ul">
8+
<li><i class="fa-li fab fa-github"></i> Source Code: <a href="https://github.com/guysoft/OctoPi" target="_blank" rel="noreferrer noopener">github.com/guysoft/OctoPi</a></li>
9+
<li><i class="fa-li fas fa-code-branch"></i> Changelog: <a href="https://github.com/guysoft/OctoPi/releases/tag/{{ plugin_pi_support_octopi_version }}" target="_blank" rel="noreferrer noopener">github.com/guysoft/OctoPi/releases/tag/{{ plugin_pi_support_octopi_version }}</a></li>
1010
</ul>
1111

1212
<p>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<h3>{{ _('About OctoPi-UpToDate') }}</h3>
2+
3+
<h4>The up-to-date version of OctoPi</h4>
4+
5+
<p>Build <span class="plugin_pi_support_octopiuptodate_build">{{ plugin_pi_support_octopiuptodate_build_short }}</span>, based on OctoPi {{ plugin_pi_support_octopi_version }}, running on <span class="plugin_pi_support_model">{{ plugin_pi_support_model }}</span></p>
6+
7+
<ul class="fa-ul">
8+
<li><i class="fa-li fas fa-home"></i> Website: <a href="https://octoprint.org/download/" target="_blank" rel="noreferrer noopener">octoprint.org/download</a></li>
9+
<li><i class="fa-li fab fa-github"></i> Source Code: <a href="https://github.com/OctoPrint/OctoPi-UpToDate" target="_blank" rel="noreferrer noopener">github.com/OctoPrint/OctoPi-UpToDate</a></li>
10+
<li><i class="fa-li fas fa-code-branch"></i> Changelog: <a href="https://github.com/OctoPrint/OctoPi-UpToDate/releases/tag/{{ plugin_pi_support_octopiuptodate_build }}" target="_blank" rel="noreferrer noopener">github.com/OctoPrint/OctoPrint/releases/tag/{{ plugin_pi_support_octopiuptodate_build }}</a></li>
11+
<li><i class="fa-li fas fa-heart"></i> Financial Support: <a href="https://support.octoprint.org" target="_blank" rel="noreferrer noopener">support.octoprint.org</a></li>
12+
</ul>
13+
14+
<p>
15+
&copy; 2013-{{ now.strftime("%Y") }} <a href="https://github.com/OctoPrint/OctoPi-UpToDate/graphs/contributors" target="_blank" rel="noreferrer noopener">The OctoPi-UpToDate Authors</a>
16+
</p>
17+
18+
<p>
19+
OctoPi-UpToDate is free software: you can redistribute it and/or modify
20+
it under the terms of the GNU General Public License as published by
21+
the Free Software Foundation, either version 3 of the License, or
22+
(at your option) any later version.
23+
</p>
24+
<p>
25+
OctoPi-UpToDate is distributed in the hope that it will be useful,
26+
but WITHOUT ANY WARRANTY; without even the implied warranty of
27+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28+
GNU General Public License for more details.
29+
</p>
30+
<p>
31+
For a copy of the GNU General Public License, see
32+
<a href="https://www.gnu.org/licenses/gpl-3.0.en.html" target="_blank" rel="noreferrer noopener">www.gnu.org/licenses/gpl-3.0.en.html</a>.
33+
</p>
34+
35+
{% include "pi_support_about_octopi.jinja2" %}

tests/fakes/fake_octopi.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.15.1
1+
1.0.0

tests/fakes/fake_octopiuptodate.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.18.0-1.7.2-20220119085355
1+
1.0.0-1.9.0-20230523082504

0 commit comments

Comments
 (0)