Update getTimeRangeParams to return start & end instead of from & to (#36268)

This commit is contained in:
Ivana Huckova 2021-06-29 12:06:42 -04:00 committed by GitHub
parent c3e26657e9
commit abb1c10776
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -289,7 +289,7 @@ export class LokiDatasource extends DataSourceApi<LokiQuery, LokiOptions> {
getTimeRangeParams() {
const timeRange = this.timeSrv.timeRange();
return { from: timeRange.from.valueOf() * NS_IN_MS, to: timeRange.to.valueOf() * NS_IN_MS };
return { start: timeRange.from.valueOf() * NS_IN_MS, end: timeRange.to.valueOf() * NS_IN_MS };
}
async importQueries(queries: DataQuery[], originDataSource: DataSourceApi): Promise<LokiQuery[]> {

View File

@ -442,7 +442,7 @@ export default class LokiLanguageProvider extends LanguageProvider {
*/
fetchSeriesLabels = async (match: string): Promise<Record<string, string[]>> => {
const url = '/loki/api/v1/series';
const { from: start, to: end } = this.datasource.getTimeRangeParams();
const { start, end } = this.datasource.getTimeRangeParams();
const cacheKey = this.generateCacheKey(url, start, end, match);
let value = this.seriesCache.get(cacheKey);
@ -464,7 +464,7 @@ export default class LokiLanguageProvider extends LanguageProvider {
*/
fetchSeries = async (match: string): Promise<Array<Record<string, string>>> => {
const url = '/loki/api/v1/series';
const { from: start, to: end } = this.datasource.getTimeRangeParams();
const { start, end } = this.datasource.getTimeRangeParams();
const params = { match, start, end };
return await this.request(url, params);
};
@ -489,7 +489,7 @@ export default class LokiLanguageProvider extends LanguageProvider {
async fetchLabelValues(key: string): Promise<string[]> {
const url = `/loki/api/v1/label/${key}/values`;
const rangeParams = this.datasource.getTimeRangeParams();
const { from: start, to: end } = rangeParams;
const { start, end } = rangeParams;
const cacheKey = this.generateCacheKey(url, start, end, key);
const params = { start, end };