LCOV - code coverage report
Current view: top level - lcov - github-pr.diff Coverage Total Hit
Test: cockpit-podman Lines: 83.3 % 24 20
Test Date: 2025-05-21 17:35:03

            Line data    Source code
       1              : diff --git a/src/ContainerLogs.jsx b/src/ContainerLogs.jsx
       2              : index 0395ce3..e9a733a 100644
       3              : --- a/src/ContainerLogs.jsx
       4              : +++ b/src/ContainerLogs.jsx
       5              : @@ -19,6 +19,7 @@
       6              :  
       7              :  import React from 'react';
       8              :  
       9              : +import { Button } from "@patternfly/react-core/dist/esm/components/Button";
      10              :  import { ExclamationCircleIcon } from '@patternfly/react-icons';
      11              :  import { CanvasAddon } from '@xterm/addon-canvas';
      12              :  import { Terminal } from "@xterm/xterm";
      13              : @@ -165,8 +166,21 @@ class ContainerLogs extends React.Component {
      14              :  
      15              :      render() {
      16              :          let element = <div className="container-logs" ref={this.logRef} />;
      17              : -        if (this.state.errorMessage)
      18            6 : +        const { systemd_unit, uid } = this.props;
      19              : +
      20            1 : +        if (this.state.errorMessage) {
      21              :              element = <EmptyStatePanel icon={ExclamationCircleIcon} title={this.state.errorMessage} />;
      22            0 : +        } else if (systemd_unit !== undefined && uid === 0) {
      23            1 : +            element = (
      24            1 : +                <>
      25            1 : +                    {element}
      26            1 : +                    <Button variant="link" isInline className="pf-v6-u-mt-sm" onClick={
      27            1 : +                        () => cockpit.jump(`/system/logs/#/?priority=info&_SYSTEMD_UNIT=${systemd_unit}`)}>
      28            1 : +                        {cockpit.format(_("View $0 logs"), systemd_unit)}
      29            1 : +                    </Button>
      30            1 : +                </>
      31              : +            );
      32            1 : +        }
      33              :  
      34              :          return element;
      35              :      }
      36              : @@ -175,7 +189,8 @@ class ContainerLogs extends React.Component {
      37              :  ContainerLogs.propTypes = {
      38              :      containerId: PropTypes.string.isRequired,
      39              :      uid: PropTypes.number,
      40              : -    width: PropTypes.number.isRequired
      41           43 : +    width: PropTypes.number.isRequired,
      42           43 : +    systemd_unit: PropTypes.string
      43              :  };
      44              :  
      45              :  export default ContainerLogs;
      46              : diff --git a/src/Containers.jsx b/src/Containers.jsx
      47              : index 1e09b3f..aafe22b 100644
      48              : --- a/src/Containers.jsx
      49              : +++ b/src/Containers.jsx
      50              : @@ -452,7 +452,13 @@ class Containers extends React.Component {
      51              :                  tabs.push({
      52              :                      name: _("Logs"),
      53              :                      renderer: ContainerLogs,
      54              : -                    data: { containerId: container.Id, containerStatus: container.State.Status, width: this.state.width, uid: container.uid }
      55           41 : +                    data: {
      56           41 : +                        containerId: container.Id,
      57           41 : +                        containerStatus: container.State.Status,
      58           41 : +                        width: this.state.width,
      59           41 : +                        uid: container.uid,
      60           21 : +                        systemd_unit: container.Config?.Labels?.PODMAN_SYSTEMD_UNIT,
      61           41 : +                    }
      62              :                  });
      63              :                  tabs.push({
      64              :                      name: _("Console"),
      65              : diff --git a/src/index.js b/src/index.js
      66              : index 2a39f59..ed2481a 100644
      67              : --- a/src/index.js
      68              : +++ b/src/index.js
      69              : @@ -29,4 +29,8 @@ import './podman.scss';
      70              :  document.addEventListener("DOMContentLoaded", function () {
      71              :      const root = createRoot(document.getElementById('app'));
      72              :      root.render(<Application />);
      73            0 : +    window.onerror = function(message, source, lineno, colno, error) {
      74            0 : +        console.log('Global error caught:', message, source, lineno, colno, error);
      75              : +    // You can return true to prevent the default error handling
      76            0 : +    };
      77              :  });
      78              : diff --git a/test/check-application b/test/check-application
      79              : index 079de0a..25b8c5b 100755
      80              : --- a/test/check-application
      81              : +++ b/test/check-application
      82              : @@ -3322,6 +3322,7 @@ PodName={name}
      83              :  
      84              :          self.toggleExpandedContainer(service_name)
      85              :  
      86              : +        # Service link integration
      87              :          b.click(f"#containers-containers tbody tr:contains('{service_name}') button:contains({service_name}.service)")
      88              :          b.switch_to_top()
      89              :          if system:
      90              : @@ -3330,6 +3331,20 @@ PodName={name}
      91              :              b.wait_js_cond(f'window.location.hash === "#/{service_name}.service?owner=user"')
      92              :          b.wait_js_cond('window.location.pathname === "/system/services"')
      93              :  
      94              : +        # Logs page link integration
      95              : +        if system:
      96              : +            b.go("/podman")
      97              : +            b.enter_page("/podman")
      98              : +            b.wait_visible("#app")
      99              : +
     100              : +            b.click(".pf-m-expanded button:contains('Logs')")
     101              : +            b.click(f"#containers-containers tbody button:contains(View {service_name}.service logs)")
     102              : +            b.switch_to_top()
     103              : +            b.wait_js_cond('window.location.pathname === "/system/logs"')
     104              : +            b.wait_js_cond(f'window.location.hash === "#/?priority=info&_SYSTEMD_UNIT={service_name}.service"')
     105              : +
     106              : +        print(b.get_js_log())
     107              : +
     108              :      # HACK: quadlets broken on RHEL-8 https://issues.redhat.com/browse/RHEL-5870
     109              :      @testlib.skipImage("no quadlet support", "debian-stable", "ubuntu-2204", "rhel-8-10")
     110              :      def testQuadletsSystem(self) -> None:
        

Generated by: LCOV version 2.0-1