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

     1  import {
     2    CheckNodeStatus,
     3    CheckNodeType,
     4    CheckSummary,
     5    CheckNode,
     6    CheckResult,
     7    CheckSeveritySummary,
     8  } from "../index";
     9  
    10  class ControlRunningNode 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 this._result.control.title || this.name;
    27    }
    28  
    29    get type(): CheckNodeType {
    30      return "running";
    31    }
    32  
    33    get summary(): CheckSummary {
    34      return {
    35        alarm: 0,
    36        ok: 0,
    37        info: 0,
    38        skip: 0,
    39        error: 0,
    40      };
    41    }
    42  
    43    get severity_summary(): CheckSeveritySummary {
    44      // Bubble up the node's severity - always zero though as we have no results
    45      const summary = {};
    46      if (this._result.control.severity) {
    47        summary[this._result.control.severity] = 0;
    48      }
    49      return summary;
    50    }
    51  
    52    get status(): CheckNodeStatus {
    53      // This will bubble up through the hierarchy and put all ancestral nodes in a running state
    54      return "running";
    55    }
    56  }
    57  
    58  export default ControlRunningNode;