github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/ui/dashboard/src/components/dashboards/check/common/node/ControlEmptyResultNode.ts (about)

     1  import {
     2    CheckNodeStatus,
     3    CheckNodeType,
     4    CheckSummary,
     5    CheckNode,
     6    CheckResult,
     7    CheckSeveritySummary,
     8  } from "../index";
     9  
    10  class ControlEmptyResultNode implements CheckNode {
    11    private readonly _result: CheckResult;
    12  
    13    constructor(result: CheckResult) {
    14      this._result = result;
    15    }
    16  
    17    get sort(): string {
    18      return this.title;
    19    }
    20  
    21    get name(): string {
    22      return this._result.control.name;
    23    }
    24  
    25    get title(): string {
    26      return "No results";
    27    }
    28  
    29    get result(): CheckResult {
    30      return this._result;
    31    }
    32  
    33    get type(): CheckNodeType {
    34      return "empty_result";
    35    }
    36  
    37    get summary(): CheckSummary {
    38      return {
    39        alarm: 0,
    40        ok: 0,
    41        info: 0,
    42        skip: 0,
    43        error: 0,
    44      };
    45    }
    46  
    47    get severity_summary(): CheckSeveritySummary {
    48      // Bubble up the node's severity - always zero though as we have no results
    49      const summary = {};
    50      if (this._result.control.severity) {
    51        summary[this._result.control.severity] = 0;
    52      }
    53      return summary;
    54    }
    55  
    56    get status(): CheckNodeStatus {
    57      // If a control has no results, this node is complete
    58      return "complete";
    59    }
    60  }
    61  
    62  export default ControlEmptyResultNode;