export function convertQueryTemplateVariable()

in scripts/dashboard-importer/src/dashboards/converter/template_variables/query.ts [38:50]


export function convertQueryTemplateVariable(
  templateVariable: TemplateVariable,
): Result<DashboardFilter> {
  const queryString = unnestQuery(templateVariable.query) || '';

  if (queryString.startsWith(QueryTemplateVariableTypes.LABEL_VALUES)) {
    return getDashboardFilterFromLabelKey(queryString, templateVariable);
  }

  return warning([
    `Template variable '${templateVariable.name}' was skipped because queries that start with '${queryString}' are not supported`,
  ]);
}