Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for log files with unknown size #453

Merged
merged 1 commit into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/locales/c.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"home.link": "",
"home.title": "",
"logs.empty-file": "",
"logs.file-size-unknown": "",
"logs.file-too-large": "",
"logs.not-selected": "",
"logs.select-file-placeholder": "",
Expand Down
3 changes: 2 additions & 1 deletion src/locales/source/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -271,5 +271,6 @@
"btn.check-updates": "Kontrola aktualizací",
"btn.upgrade": "Aktualizovat",
"conn.error_status": "Chyba",
"conn.printer.not-supported": ""
"conn.printer.not-supported": "",
"logs.file-size-unknown": ""
}
3 changes: 2 additions & 1 deletion src/locales/source/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -285,5 +285,6 @@
"conn.error_status": "Fehler",
"msg.file-exists.overwrite-it": "Möchten Sie sie überschreiben?",
"msg.file-exists.title": "Datei existiert bereits",
"conn.printer.not-supported": ""
"conn.printer.not-supported": "",
"logs.file-size-unknown": ""
}
1 change: 1 addition & 0 deletions src/locales/source/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"home.title": "Printer Status",
"logs.empty-file": "Log file is empty!",
"logs.file-too-large": "Log files of size larger than {{size}} are available only for downloading.",
"logs.file-size-unknown": "The log file is of an unknown size and therefore is available only for downloading",
"logs.not-selected": "No log file is selected!",
"logs.select-file": "Select File",
"logs.select-file-placeholder": "Select log file",
Expand Down
3 changes: 2 additions & 1 deletion src/locales/source/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,5 +266,6 @@
"conn.error_status": "Error",
"msg.file-exists.overwrite-it": "¿Quieres sobrescribirlo?",
"msg.file-exists.title": "El archivo ya existe",
"conn.printer.not-supported": ""
"conn.printer.not-supported": "",
"logs.file-size-unknown": ""
}
3 changes: 2 additions & 1 deletion src/locales/source/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,5 +277,6 @@
"msg.file-exists.overwrite-it": "Voulez-vous l'écraser ?",
"msg.file-exists.title": "Le fichier existe déjà",
"conn.error_status": "Erreur",
"conn.printer.not-supported": ""
"conn.printer.not-supported": "",
"logs.file-size-unknown": ""
}
3 changes: 2 additions & 1 deletion src/locales/source/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,5 +266,6 @@
"conn.error_status": "Errore",
"msg.file-exists.overwrite-it": "Vuoi sovrascriverlo?",
"msg.file-exists.title": "File già esistente",
"conn.printer.not-supported": ""
"conn.printer.not-supported": "",
"logs.file-size-unknown": ""
}
5 changes: 3 additions & 2 deletions src/locales/source/kr.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,5 +275,6 @@
"conn.error_status": "에러",
"msg.file-exists.overwrite-it": "덮어쓰시겠습니까?",
"msg.file-exists.title": "파일이 이미 존재합니다.",
"conn.printer.not-supported": ""
}
"conn.printer.not-supported": "",
"logs.file-size-unknown": ""
}
3 changes: 2 additions & 1 deletion src/locales/source/lt.json
Original file line number Diff line number Diff line change
Expand Up @@ -274,5 +274,6 @@
"conn.error_status": "",
"msg.file-exists.overwrite-it": "",
"msg.file-exists.title": "",
"conn.printer.not-supported": ""
"conn.printer.not-supported": "",
"logs.file-size-unknown": ""
}
3 changes: 2 additions & 1 deletion src/locales/source/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -274,5 +274,6 @@
"msg.file-exists": "",
"msg.file-exists.overwrite-it": "",
"msg.file-exists.title": "",
"conn.printer.not-supported": ""
"conn.printer.not-supported": "",
"logs.file-size-unknown": ""
}
3 changes: 2 additions & 1 deletion src/locales/source/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,5 +266,6 @@
"conn.error_status": "Błąd",
"msg.file-exists.overwrite-it": "Czy chcesz go nadpisać?",
"msg.file-exists.title": "Plik już istnieje",
"conn.printer.not-supported": ""
"conn.printer.not-supported": "",
"logs.file-size-unknown": ""
}
3 changes: 2 additions & 1 deletion src/locales/source/sk.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,5 +277,6 @@
"conn.error_status": "",
"msg.file-exists.overwrite-it": "",
"msg.file-exists.title": "",
"conn.printer.not-supported": ""
"conn.printer.not-supported": "",
"logs.file-size-unknown": ""
}
11 changes: 7 additions & 4 deletions src/printer/components/settings/logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ function showLogContent(filename) {
})
}

function showLogExceedSizeLimit() {
function showLogLimitMessage(message) {
const ul = document.querySelector("ul.logs");
const message = translate("logs.file-too-large", { size: formatData("size", sizeLimit) });
if (ul) {
ul.innerHTML = createLi(message);
}
Expand All @@ -78,8 +77,12 @@ const update = () => {
if (file) {
if (!selectedFileDate || file.date > selectedFileDate) {
selectedFileDate = file.date;
if (file.size > sizeLimit) {
showLogExceedSizeLimit();
if (file.size === null) {
showLogLimitMessage(translate("logs.file-size-unknown"));
} else if (file.size > sizeLimit) {
showLogLimitMessage(
translate("logs.file-too-large", { size: formatData("size", sizeLimit) })
);
} else {
showLogContent(selectedFileName);
}
Expand Down
Loading