Skip to content

Commit eaafcc8

Browse files
authored
fix alerting queries (#1324)
1 parent 2abc00b commit eaafcc8

File tree

5 files changed

+9
-4
lines changed

5 files changed

+9
-4
lines changed

.changeset/great-papayas-chew.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'grafana-infinity-datasource': minor
3+
---
4+
5+
**BREAKING CHANGE:**: Renamed the Google Sheets range property to sheetRange to avoid conflicts with Grafana's built-in range field. See more information here [#1337](https://github.com/grafana/grafana-infinity-datasource/issues/1337)

pkg/models/query.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ type Query struct {
117117
QueryMode string `json:"query_mode"`
118118
Spreadsheet string `json:"spreadsheet,omitempty"`
119119
SheetName string `json:"sheetName,omitempty"`
120-
SheetRange string `json:"range,omitempty"`
120+
SheetRange string `json:"sheetRange,omitempty"`
121121
AzBlobContainerName string `json:"azContainerName,omitempty"`
122122
AzBlobName string `json:"azBlobName,omitempty"`
123123
PageMode PaginationMode `json:"pagination_mode,omitempty"`

src/editors/query/components/GoogleSheets.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const GoogleSheetsEditor = ({ query, onChange, onRunQuery }: { query: Inf
1313
<Input value={query.sheetName} width={20} onChange={(e) => onChange({ ...query, sheetName: e.currentTarget.value })} onBlur={onRunQuery} />
1414
</EditorField>
1515
<EditorField label="Range" horizontal={true}>
16-
<Input value={query.range} width={20} onChange={(e) => onChange({ ...query, range: e.currentTarget.value })} onBlur={onRunQuery} />
16+
<Input value={query.sheetRange} width={20} onChange={(e) => onChange({ ...query, sheetRange: e.currentTarget.value })} onBlur={onRunQuery} />
1717
</EditorField>
1818
</>
1919
);

src/interpolate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export const interpolateQuery = (query: InfinityQuery, scopedVars: ScopedVars):
8484
if (newQuery.type === 'google-sheets') {
8585
newQuery.spreadsheet = replaceVariable(newQuery.spreadsheet, scopedVars);
8686
newQuery.sheetName = replaceVariable(newQuery.sheetName, scopedVars);
87-
newQuery.range = replaceVariable(newQuery.range, scopedVars);
87+
newQuery.sheetRange = replaceVariable(newQuery.sheetRange, scopedVars);
8888
}
8989
return newQuery;
9090
};

src/types/query.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export type InfinityUQLQuerySource = InfinityQueryWithURLSource<'uql'> | Infinit
108108
export type InfinityUQLQuery = { uql: string; format: InfinityQueryFormat } & InfinityUQLQuerySource & InfinityQueryBase<'uql'>;
109109
export type InfinityGROQQuerySource = InfinityQueryWithURLSource<'groq'> | InfinityQueryWithInlineSource<'groq'>;
110110
export type InfinityGROQQuery = { groq: string; format: InfinityQueryFormat } & InfinityGROQQuerySource & InfinityQueryBase<'groq'>;
111-
export type InfinityGSheetsQuery = { spreadsheet: string; sheetName?: string; range: string; columns: InfinityColumn[] } & InfinityQueryBase<'google-sheets'>;
111+
export type InfinityGSheetsQuery = { spreadsheet: string; sheetName?: string; sheetRange: string; columns: InfinityColumn[] } & InfinityQueryBase<'google-sheets'>;
112112
export type PaginationType = 'none' | 'offset' | 'page' | 'cursor' | 'list';
113113
export type PaginationParamType = 'query' | 'header' | 'body_data' | 'body_json' | 'replace';
114114
export type PaginationBase<T extends PaginationType> = { pagination_mode?: T; pagination_max_pages?: number };

0 commit comments

Comments
 (0)