当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript TimeSrv.timeRange方法代码示例

本文整理汇总了TypeScript中app/features/dashboard/services/TimeSrv.TimeSrv.timeRange方法的典型用法代码示例。如果您正苦于以下问题:TypeScript TimeSrv.timeRange方法的具体用法?TypeScript TimeSrv.timeRange怎么用?TypeScript TimeSrv.timeRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app/features/dashboard/services/TimeSrv.TimeSrv的用法示例。


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

示例1: 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

示例2: getLabels

  async getLabels(metricType: string, refId: string) {
    const response = await this.getTimeSeries({
      targets: [
        {
          refId: refId,
          datasourceId: this.id,
          metricType: this.templateSrv.replace(metricType),
          crossSeriesReducer: 'REDUCE_NONE',
          view: 'HEADERS',
        },
      ],
      range: this.timeSrv.timeRange(),
    });

    return response.results[refId];
  }
开发者ID:grafana,项目名称:grafana,代码行数:16,代码来源:datasource.ts

示例3: doMetricQueryRequest

 doMetricQueryRequest(subtype, parameters) {
   const range = this.timeSrv.timeRange();
   return this.awsRequest('/api/tsdb/query', {
     from: range.from.valueOf().toString(),
     to: range.to.valueOf().toString(),
     queries: [
       _.extend(
         {
           refId: 'metricFindQuery',
           intervalMs: 1, // dummy
           maxDataPoints: 1, // dummy
           datasourceId: this.instanceSettings.id,
           type: 'metricFindQuery',
           subtype: subtype,
         },
         parameters
       ),
     ],
   }).then(r => {
     return this.transformSuggestDataFromTable(r);
   });
 }
开发者ID:johntdyer,项目名称:grafana,代码行数:22,代码来源:datasource.ts


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