LCOV - code coverage report
Current view: top level - pkg/playground - plot.js Coverage Total Hit
Test: cockpit Lines: 100.0 % 36 36
Test Date: 2026-07-03 14:25:32

            Line data    Source code
       1              : // SPDX-License-Identifier: LGPL-2.1-or-later
       2              : import './plot.css';
       3              : 
       4            1 : import React from 'react';
       5            1 : import { createRoot } from 'react-dom/client';
       6              : 
       7              : import { PlotState } from "plot.js";
       8              : import { SvgPlot, bytes_config } from "cockpit-components-plot.jsx";
       9              : 
      10            1 : const direct_metric = {
      11            1 :     direct: ["mem.util.available"],
      12            1 :     units: "bytes"
      13            1 : };
      14              : 
      15            1 : const pmcd_metric = {
      16            1 :     pmcd: ["mem.util.available"],
      17            1 :     units: "bytes"
      18            1 : };
      19              : 
      20            1 : const internal_metric = {
      21            1 :     internal: ["memory.used"],
      22            1 :     units: "bytes",
      23            1 : };
      24              : 
      25            1 : document.addEventListener("DOMContentLoaded", function() {
      26            1 :     const plot_state = new PlotState();
      27            1 :     plot_state.plot_single('direct', direct_metric);
      28            1 :     plot_state.plot_single('pmcd', pmcd_metric);
      29            1 :     plot_state.plot_single('internal', internal_metric);
      30              : 
      31              :     // For the tests
      32            1 :     window.plot_state = plot_state;
      33              : 
      34            1 :     createRoot(document.getElementById('plot-direct')).render(
      35            1 :         <SvgPlot className="mem-graph"
      36            1 :                  title="Direct" config={bytes_config}
      37            1 :                  plot_state={plot_state} plot_id="direct" />
      38            1 :     );
      39              : 
      40            1 :     createRoot(document.getElementById('plot-pmcd')).render(
      41            1 :         <SvgPlot className="mem-graph"
      42            1 :                  title="PMCD" config={bytes_config}
      43            1 :                  plot_state={plot_state} plot_id="pmcd" />
      44            1 :     );
      45              : 
      46            1 :     createRoot(document.getElementById('plot-internal')).render(
      47            1 :         <SvgPlot className="mem-graph"
      48            1 :                  title="Internal" config={bytes_config}
      49            1 :                  plot_state={plot_state} plot_id="internal" />
      50            1 :     );
      51            1 : });
        

Generated by: LCOV version 2.0-1