Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

1.3 KB
Raw Blame
import { t } from "ttag";

import type { DependencyGroupType, DependencyNode } from "metabase-types/api";

import { getNodeLabel } from "../../../../utils";

export function getHeaderLabel(
  node: DependencyNode,
  groupType: DependencyGroupType,
): string {
  const nodeLabel = getNodeLabel(node);

  switch (groupType) {
    case "question":
      return t`Questions that use ${nodeLabel}`;
    case "model":
      return t`Models that use ${nodeLabel}`;
    case "metric":
      return t`Metrics that use ${nodeLabel}`;
    case "table":
      return node.type === "transform"
        ? t`Table generated by ${nodeLabel}`
        : t`Tables that use ${nodeLabel}`;
    case "transform":
      return t`Transforms that use ${nodeLabel}`;
    case "snippet":
      return t`SQL snippets that use ${nodeLabel}`;
    case "dashboard":
      return t`Dashboards that use ${nodeLabel}`;
    case "document":
      return t`Documents that use ${nodeLabel}`;
    case "sandbox":
      return t`Row and column security rules that use ${nodeLabel}`;
    case "segment":
      return t`Segments that use ${nodeLabel}`;
    case "measure":
      return t`Measures that use ${nodeLabel}`;
    case "action":
      return t`Data actions that use ${nodeLabel}`;
    case "data-app":
      return t`Data apps that use ${nodeLabel}`;
  }
}