• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript template_srv.TemplateSrv类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中app/features/templating/template_srv.TemplateSrv的典型用法代码示例。如果您正苦于以下问题:TypeScript TemplateSrv类的具体用法?TypeScript TemplateSrv怎么用?TypeScript TemplateSrv使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TemplateSrv类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: initTemplateSrv

function initTemplateSrv(values: any, multi = false) {
  const templateSrv = new TemplateSrv();
  templateSrv.init([
    new CustomVariable(
      {
        name: 'test',
        current: {
          value: values,
        },
        multi: multi,
      },
      {}
    ),
  ]);
  return templateSrv;
}
开发者ID:CorpGlory,项目名称:grafana,代码行数:16,代码来源:datasource.test.ts


示例2:

 getEc2InstanceAttribute(region, attributeName, filters) {
   return this.doMetricQueryRequest('ec2_instance_attribute', {
     region: this.templateSrv.replace(this.getActualRegion(region)),
     attributeName: this.templateSrv.replace(attributeName),
     filters: filters,
   });
 }
开发者ID:johntdyer,项目名称:grafana,代码行数:7,代码来源:datasource.ts


示例3: getResourceARNs

 getResourceARNs(region, resourceType, tags) {
   return this.doMetricQueryRequest('resource_arns', {
     region: this.templateSrv.replace(this.getActualRegion(region)),
     resourceType: this.templateSrv.replace(resourceType),
     tags: tags,
   });
 }
开发者ID:johntdyer,项目名称:grafana,代码行数:7,代码来源:datasource.ts


示例4: LogAnalyticsQuerystringBuilder

    }).map(target => {
      const item = target.azureLogAnalytics;

      const querystringBuilder = new LogAnalyticsQuerystringBuilder(
        this.templateSrv.replace(item.query, options.scopedVars, this.interpolateVariable),
        options,
        'TimeGenerated'
      );
      const generated = querystringBuilder.generate();

      const workspace = this.templateSrv.replace(item.workspace, options.scopedVars);

      const url = `${this.baseUrl}/${workspace}/query?${generated.uriString}`;

      return {
        refId: target.refId,
        intervalMs: options.intervalMs,
        maxDataPoints: options.maxDataPoints,
        datasourceId: this.id,
        url: url,
        query: generated.rawQuery,
        format: target.format,
        resultFormat: item.resultFormat,
      };
    });
开发者ID:grafana,项目名称:grafana,代码行数:25,代码来源:azure_log_analytics_datasource.ts


示例5: getDimensionValues

 getDimensionValues(region, namespace, metricName, dimensionKey, filterDimensions) {
   return this.doMetricQueryRequest('dimension_values', {
     region: this.templateSrv.replace(this.getActualRegion(region)),
     namespace: this.templateSrv.replace(namespace),
     metricName: this.templateSrv.replace(metricName),
     dimensionKey: this.templateSrv.replace(dimensionKey),
     dimensions: this.convertDimensionFormat(filterDimensions, {}),
   });
 }
开发者ID:johntdyer,项目名称:grafana,代码行数:9,代码来源:datasource.ts


示例6: targetContainsTemplate

 targetContainsTemplate(target) {
   return (
     this.templateSrv.variableExists(target.region) ||
     this.templateSrv.variableExists(target.namespace) ||
     this.templateSrv.variableExists(target.metricName) ||
     _.find(target.dimensions, (v, k) => {
       return this.templateSrv.variableExists(k) || this.templateSrv.variableExists(v);
     })
   );
 }
开发者ID:johntdyer,项目名称:grafana,代码行数:10,代码来源:datasource.ts


示例7: init

  init(dashboard: DashboardModel) {
    this.dashboard = dashboard;
    this.dashboard.events.on('time-range-updated', this.onTimeRangeUpdated.bind(this));
    this.dashboard.events.on('template-variable-value-updated', this.updateUrlParamsWithCurrentVariables.bind(this));

    // create working class models representing variables
    this.variables = dashboard.templating.list = dashboard.templating.list.map(this.createVariableFromModel.bind(this));
    this.templateSrv.init(this.variables, this.timeSrv.timeRange());

    // init variables
    for (const variable of this.variables) {
      variable.initLock = this.$q.defer();
    }

    const queryParams = this.$location.search();
    return this.$q
      .all(
        this.variables.map(variable => {
          return this.processVariable(variable, queryParams);
        })
      )
      .then(() => {
        this.templateSrv.updateIndex();
      });
  }
开发者ID:bergquist,项目名称:grafana,代码行数:25,代码来源:variable_srv.ts


示例8:

 .map(t => {
   return {
     refId: t.refId,
     intervalMs: options.intervalMs,
     datasourceId: this.id,
     metricType: this.templateSrv.replace(t.metricType, options.scopedVars || {}),
     crossSeriesReducer: this.templateSrv.replace(t.crossSeriesReducer || 'REDUCE_MEAN', options.scopedVars || {}),
     perSeriesAligner: this.templateSrv.replace(t.perSeriesAligner, options.scopedVars || {}),
     alignmentPeriod: this.templateSrv.replace(t.alignmentPeriod, options.scopedVars || {}),
     groupBys: this.interpolateGroupBys(t.groupBys, options.scopedVars),
     view: t.view || 'FULL',
     filters: this.interpolateFilters(t.filters, options.scopedVars),
     aliasBy: this.templateSrv.replace(t.aliasBy, options.scopedVars || {}),
     type: 'timeSeriesQuery',
   };
 });
开发者ID:grafana,项目名称:grafana,代码行数:16,代码来源:datasource.ts


示例9: annotationQuery

  annotationQuery(options) {
    const annotation = options.annotation;
    const statistics = _.map(annotation.statistics, s => {
      return this.templateSrv.replace(s);
    });
    const defaultPeriod = annotation.prefixMatching ? '' : '300';
    let period = annotation.period || defaultPeriod;
    period = parseInt(period, 10);
    const parameters = {
      prefixMatching: annotation.prefixMatching,
      region: this.templateSrv.replace(this.getActualRegion(annotation.region)),
      namespace: this.templateSrv.replace(annotation.namespace),
      metricName: this.templateSrv.replace(annotation.metricName),
      dimensions: this.convertDimensionFormat(annotation.dimensions, {}),
      statistics: statistics,
      period: period,
      actionPrefix: annotation.actionPrefix || '',
      alarmNamePrefix: annotation.alarmNamePrefix || '',
    };

    return this.awsRequest('/api/tsdb/query', {
      from: options.range.from.valueOf().toString(),
      to: options.range.to.valueOf().toString(),
      queries: [
        _.extend(
          {
            refId: 'annotationQuery',
            intervalMs: 1, // dummy
            maxDataPoints: 1, // dummy
            datasourceId: this.instanceSettings.id,
            type: 'annotationQuery',
          },
          parameters
        ),
      ],
    }).then(r => {
      return _.map(r.results['annotationQuery'].tables[0].rows, v => {
        return {
          annotation: annotation,
          time: Date.parse(v[0]),
          title: v[1],
          tags: [v[2]],
          text: v[3],
        };
      });
    });
  }
开发者ID:johntdyer,项目名称:grafana,代码行数:47,代码来源:datasource.ts



注:本文中的app/features/templating/template_srv.TemplateSrv类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript forms.Validators类代码示例发布时间:2022-05-25
下一篇:
TypeScript selectors.getTimeZone函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap