diff --git a/pkg/systemd/host.css b/pkg/systemd/host.css index c16b3d750..38bf274f7 100644 --- a/pkg/systemd/host.css +++ b/pkg/systemd/host.css @@ -434,3 +434,40 @@ body { .fa-exclamation-circle { color: var(--pf-global--danger-color--100); } + +.full-width { + width: 100%; +} + +table.reporting-table tr:first-child td { + border-top: none; +} + +table.reporting-table td:first-child { + white-space: nowrap; + width: 40%; +} + +table.reporting-table td:nth-child(2) { + text-align: start; + width: 60%; +} + +table.reporting-table td:nth-child(2) > .spinner { + display: inline-block; + margin-right: 0.5em; + vertical-align: middle; +} + +td.report-column { + flex-direction: row-reverse; +} + +#journal-entry-heading { + padding-bottom: 0.5rem; +} + +#journal-entry-message { + padding-left: 1.5rem; + +} diff --git a/pkg/systemd/logs.html b/pkg/systemd/logs.html index 4a5754b57..41b7b2679 100644 --- a/pkg/systemd/logs.html +++ b/pkg/systemd/logs.html @@ -81,17 +81,11 @@ along with Cockpit; If not, see . diff --git a/pkg/systemd/logs.js b/pkg/systemd/logs.js index b10e2a480..2367e9f74 100644 --- a/pkg/systemd/logs.js +++ b/pkg/systemd/logs.js @@ -20,6 +20,8 @@ import $ from "jquery"; import cockpit from "cockpit"; import { journal } from "journal"; +import moment from "moment"; +import { init_reporting } from "./reporting.jsx"; import ReactDOM from 'react-dom'; import React from 'react'; @@ -426,12 +428,14 @@ $(function() { var cursor = cockpit.location.path[0]; var out = $('#journal-entry-fields'); + const reportingTable = document.getElementById("journal-entry-reporting-table"); + if (reportingTable != null) { + reportingTable.remove(); + } + out.empty(); function show_entry(entry) { - var d = new Date(entry.__REALTIME_TIMESTAMP / 1000); - $('#journal-entry-date').text(d.toString()); - var id; if (entry.SYSLOG_IDENTIFIER) id = entry.SYSLOG_IDENTIFIER; @@ -446,13 +450,20 @@ $(function() { id = entry.PROBLEM_BINARY; } - $('#journal-entry-id').text(id); + $('#journal-entry-heading').text(id); + + const crumb = $("#journal-entry-crumb"); + const date = moment(new Date(entry.__REALTIME_TIMESTAMP / 1000)); if (is_problem) { + crumb.text(cockpit.format(_("$0: crash at $1"), id, date.format("YYYY-MM-DD HH:mm:ss"))); + find_problems().done(function() { create_problem(out, entry); }); } else { + crumb.text(cockpit.format(_("Entry at $0"), date.format("YYYY-MM-DD HH:mm:ss"))); + create_entry(out, entry); } } @@ -476,8 +487,21 @@ $(function() { }); } + function create_message_row(entry) { + const reasonColumn = document.createElement("th"); + reasonColumn.setAttribute("colspan", 2); + reasonColumn.setAttribute("id", "journal-entry-message"); + reasonColumn.appendChild(document.createTextNode(journal.printable(entry.MESSAGE))); + + const reason = document.createElement("tr"); + reason.appendChild(reasonColumn); + + return reason; + } + function create_entry(out, entry) { - $('#journal-entry-message').text(journal.printable(entry.MESSAGE)); + out.append(create_message_row(entry)); + var keys = Object.keys(entry).sort(); $.each(keys, function (i, key) { if (key !== 'MESSAGE') { @@ -515,7 +539,11 @@ $(function() { .replaceWith(new_content); } - $('#journal-entry-message').text(''); + const heading = document.createElement("h3"); + heading.appendChild(document.createTextNode(_("Extended Information"))); + + const caption = document.createElement("caption"); + caption.appendChild(heading); var ge_t = $('
  • ').append($('').append($('').text(_("General")))); var pi_t = $('
  • ').append($('').append($('').text(_("Problem info")))); @@ -527,56 +555,18 @@ $(function() { .append( $('').append($('
    '))); - var tab = $('