sbom-tool icon indicating copy to clipboard operation
sbom-tool copied to clipboard

[Feature Request] Generate HTML page along with SBOM json

Open LanceMcCarthy opened this issue 3 years ago • 0 comments

It would be an excellent feature to add a flag, maybe -generate-webpage that would include an HTML page that is directly connected to the json file path at the same root.

Similar to how you can generate a webpage with MSIX's .appinstaller. As a simple example:

<html>
<head>
    <meta charset="utf-8"/>
    <title>SBOM</title>
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2022.2.621/styles/kendo.default-v2.min.css"/>
    <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
    <script src="https://kendo.cdn.telerik.com/2022.2.621/js/kendo.all.min.js"></script>
</head>

<body>

<div id="files-grid"></div>
<div id="packages-grid"></div>

<script>
  $(function() {
     var files = [];
     var packages = [];
    
// THIS LOADS THE JSON INTO AN EASY TO READ DATAGRID
    $.getJSON('/manifest.spdx.json', function(data) {
       $.each(data.files, function(i, f) {
           files.push(f);
       });

       $.each(data.packages, function(i, p) {
           packages.push(p);
       });
    });

    $("#files-grid").kendoGrid({
        height: "400px",
        columns: [
          { field: "SPDXID", title: "SPDX ID" },
          { field: "fileName", title: "File Name" }
        ],
        filterable: true,
        editable: false,
        dataSource: {
          data: files,
          schema: {
            model: {
              id: "SPDXID",
              fields: {
                SPDXID: { type: "string", editable: false },
                fileName: { type: "string", editable: false }
              }
            }
          }
        }
    });

    $("#packages-grid").kendoGrid({
        height: "400px",
        columns: [
          { field: "SPDXID", title: "SPDX ID" },
          { field: "name", title: "Package" },
          { field: "versionInfo", title: "Version" }
        ],
        filterable: true,
        editable: false,
        dataSource: {
          data: packages,
          schema: {
            model: {
              id: "SPDXID",
              fields: {
                SPDXID: { type: "string", editable: false },
                name: { type: "string", editable: false },
                versionInfo: { type: "string", editable: false }
              }
            }
          }
        }
    });
  });
</script>

</body>
</html>

LanceMcCarthy avatar Jul 29 '22 22:07 LanceMcCarthy