Skip to content

WebUI fails to display job details when log contains empty line #1837

@klasyc

Description

@klasyc

Bareos component version

WebUI 23.0.3~pre135.a9e3d95ca
All components are installed from the official repository for Debian 12.

Steps to reproduce

I have run a job on a laptop which came into suspend mode during backup. The job finished with a warning. When I wanted to display job details by clicking the job id, WebUI pointed me to the /job/details/509 page, but console logs did not appear. In the browser console, I saw the following error:

Uncaught TypeError: msg is undefined
    formatLogMessage https://backup.int.mycompany.cz/js/bootstrap-table-formatter.js:469
    formatter https://backup.int.mycompany.cz/job/details/509:358
    calculateObjectValue https://backup.int.mycompany.cz/js/bootstrap-table.min.js:10
    value https://backup.int.mycompany.cz/js/bootstrap-table.min.js:10
    value https://backup.int.mycompany.cz/js/bootstrap-table.min.js:10
    value https://backup.int.mycompany.cz/js/bootstrap-table.min.js:10
    value https://backup.int.mycompany.cz/js/bootstrap-table.min.js:10
    success https://backup.int.mycompany.cz/js/bootstrap-table.min.js:10
    jQuery 6
    value https://backup.int.mycompany.cz/js/bootstrap-table.min.js:10
    value https://backup.int.mycompany.cz/js/bootstrap-table-cookie.min.js:10
    value https://backup.int.mycompany.cz/js/bootstrap-table.min.js:10
    value https://backup.int.mycompany.cz/js/bootstrap-table-cookie.min.js:10
    e https://backup.int.mycompany.cz/js/bootstrap-table.min.js:10
    o https://backup.int.mycompany.cz/js/bootstrap-table-cookie.min.js:10
    bootstrapTable https://backup.int.mycompany.cz/js/bootstrap-table.min.js:10
    jQuery 2
    bootstrapTable https://backup.int.mycompany.cz/js/bootstrap-table.min.js:10
    attachJobLogTable https://backup.int.mycompany.cz/job/details/509:333
    <anonymous> https://backup.int.mycompany.cz/job/details/509:398
    jQuery 13

After analyzing the error in the JavaScript debugger, I realized that the browser is trying to display a log message with undefined value. I am not sure, where that message came from. As a quick workaround I modified the module/Job/view/job/job/details.phtml file:

I modified line 271:

return formatLogMessage(value);

to

return formatLogMessage(value ?? "");

Now the WebUI works and displays an empty line among the log entries.

Expected results

WebUI should display job log trace.

Actual results

WebUI hangs when the log entry is undefined. I don't know where that value comes from. Maybe it is a backend problem, but still, the WebUI should handle faulty data better.

Environment

PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Relevant log output

No response

Relevant traces output

No response

Anything else?

No response

Metadata

Metadata

Assignees

Labels

bugThis addresses a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions