Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

936 B
Raw Blame
import { EngineIcon } from "@/components/EngineIcon";
import { HighlightLabelText } from "@/components/HighlightLabelText";
import type { SQLEditorTreeNode } from "@/types";
import { instanceV1Name } from "@/utils";

type Props = {
  readonly node: SQLEditorTreeNode;
  readonly keyword: string;
};

export function InstanceNode({ node, keyword }: Props) {
  const target = (node as SQLEditorTreeNode<"instance">).meta.target;
  const instance = {
    ...target,
    $typeName: "bytebase.v1.InstanceResource" as const,
  };
  return (
    <div className="flex items-center max-w-full overflow-hidden gap-x-1">
      <span className="inline-flex items-center gap-x-1">
        <EngineIcon engine={instance.engine} className="size-4" />
        <span className="truncate">
          <HighlightLabelText
            text={instanceV1Name(instance)}
            keyword={keyword}
          />
        </span>
      </span>
    </div>
  );
}