detached c02e15b

Try fix: webui notify update not showing up

commit
c02e15bb744d8dca6483527d4fb611d892bd7473
author
bnema · · 2023-11-07 09:30 UTC
parent
cd460cf
signature
unsigned
1 file · +9 -7
M internal/webui/public/assets/js/custom.js +9 -7
@@ -1,17 +1,23 @@
11 function initializeVersionCheck() {
2- const updateStrTemplate =
3- "New version %VERSION% available, consider pulling the latest image";
2+ const updateStrTemplate = "New version %VERSION% available, consider pulling the latest image";
43
54 const checkVersion = (versionData) => {
65 const currentVersion = document.getElementById("actual-version").textContent.trim();
76 const fetchedVersionNumber = versionData?.amd64?.name.match(/\d+\.\d+\.\d+/)?.[0];
87
8+ if (!fetchedVersionNumber) {
9+ console.log("Dev mode detected, skipping version check.");
10+ return;
11+ }
12+
913 if (currentVersion !== fetchedVersionNumber) {
1014 const updateStr = updateStrTemplate.replace("%VERSION%", fetchedVersionNumber);
1115 console.log(updateStr);
1216 const updateElement = document.getElementById("update-available");
1317 updateElement.title = updateStr;
1418 updateElement.removeAttribute("hidden");
19+ updateElement.classList.remove("hidden"); // Remove the Tailwind `hidden` class
20+ updateElement.classList.add("block"); // Add the Tailwind `block` class
1521 } else {
1622 console.log("No new version. Current version is up-to-date:", currentVersion);
1723 }
@@ -26,18 +32,14 @@ function initializeVersionCheck() {
2632
2733 const init = () => {
2834 const currentVersion = document.getElementById("actual-version").textContent.trim();
29-
30- // If currentVersion is empty, assume dev mode and do not fetch version info
3135 if (!currentVersion) {
3236 console.log("Dev mode detected, skipping version check.");
3337 return;
3438 }
35-
3639 fetchVersionInfo();
3740 };
3841
3942 init();
4043 }
4144
42-// Ensure the document is fully loaded before running the script
43-document.addEventListener('DOMContentLoaded', initializeVersionCheck);// switched to hyperscript for the most part⏎̸
45+document.addEventListener('DOMContentLoaded', initializeVersionCheck);
@@ -1,17 +1,23 @@
1 function initializeVersionCheck() {1 function initializeVersionCheck() {
2- const updateStrTemplate =2+ const updateStrTemplate = "New version %VERSION% available, consider pulling the latest image";
3- "New version %VERSION% available, consider pulling the latest image";
4 3
5 const checkVersion = (versionData) => {4 const checkVersion = (versionData) => {
6 const currentVersion = document.getElementById("actual-version").textContent.trim();5 const currentVersion = document.getElementById("actual-version").textContent.trim();
7 const fetchedVersionNumber = versionData?.amd64?.name.match(/\d+\.\d+\.\d+/)?.[0];6 const fetchedVersionNumber = versionData?.amd64?.name.match(/\d+\.\d+\.\d+/)?.[0];
8 7
8+ if (!fetchedVersionNumber) {
9+ console.log("Dev mode detected, skipping version check.");
10+ return;
11+ }
12+
9 if (currentVersion !== fetchedVersionNumber) {13 if (currentVersion !== fetchedVersionNumber) {
10 const updateStr = updateStrTemplate.replace("%VERSION%", fetchedVersionNumber);14 const updateStr = updateStrTemplate.replace("%VERSION%", fetchedVersionNumber);
11 console.log(updateStr);15 console.log(updateStr);
12 const updateElement = document.getElementById("update-available");16 const updateElement = document.getElementById("update-available");
13 updateElement.title = updateStr;17 updateElement.title = updateStr;
14 updateElement.removeAttribute("hidden");18 updateElement.removeAttribute("hidden");
19+ updateElement.classList.remove("hidden"); // Remove the Tailwind `hidden` class
20+ updateElement.classList.add("block"); // Add the Tailwind `block` class
15 } else {21 } else {
16 console.log("No new version. Current version is up-to-date:", currentVersion);22 console.log("No new version. Current version is up-to-date:", currentVersion);
17 }23 }
@@ -26,18 +32,14 @@ function initializeVersionCheck() {
26 32
27 const init = () => {33 const init = () => {
28 const currentVersion = document.getElementById("actual-version").textContent.trim();34 const currentVersion = document.getElementById("actual-version").textContent.trim();
29-
30- // If currentVersion is empty, assume dev mode and do not fetch version info
31 if (!currentVersion) {35 if (!currentVersion) {
32 console.log("Dev mode detected, skipping version check.");36 console.log("Dev mode detected, skipping version check.");
33 return;37 return;
34 }38 }
35-
36 fetchVersionInfo();39 fetchVersionInfo();
37 };40 };
38 41
39 init();42 init();
40 }43 }
41 44
42-// Ensure the document is fully loaded before running the script45+document.addEventListener('DOMContentLoaded', initializeVersionCheck);
43-document.addEventListener('DOMContentLoaded', initializeVersionCheck);// switched to hyperscript for the most part⏎̸

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close