export async function getDashboardElement0()

in lib/looker.ts [34:54]


export async function getDashboardElement0(
  template: string,
): Promise<IDashboardElement> {
  const dashboardId = getDashboardIdForSurface(template);

  // XXX maybe switch this out for the more performant dashboard_element (see
  // https://mozilla.cloud.looker.com/extensions/marketplace_extension_api_explorer::api-explorer/4.0/methods/Dashboard/dashboard_element
  // for more info).

  const elements: IDashboardElement[] = await SDK.ok(
    // XXX whether search_dashboard_elements is a net win here isn't
    // clear, but the code is working, so I'm inclined to leave it alone for now.
    SDK.search_dashboard_elements({
      dashboard_id: dashboardId,
      title: "CTR and User Profiles Impressed",
      fields: "query",
    }),
  );

  return elements[0];
}