本文整理汇总了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();
});
}
示例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];
}
示例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);
});
}