Skip to content

Commit

Permalink
column selector fix for variables editor
Browse files Browse the repository at this point in the history
  • Loading branch information
yesoreyeram committed May 20, 2024
1 parent 55c5709 commit 5e0a5b7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/lucky-starfishes-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'grafana-infinity-datasource': patch
---

Fixed a bug where column selectors weren't working in variables editor
20 changes: 12 additions & 8 deletions src/components/QueryColumnItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,27 @@ export const QueryColumnItem = (props: QueryColumnItemProps) => {
return <></>;
}
const onSelectorChange = () => {
let columns = [...(query.columns || [])];
columns[index].selector = selector;
const columns = [...query.columns];
let newItem = { ...columns[index], selector };
columns[index] = newItem;
onChange({ ...query, columns });
};
const onTextChange = () => {
let columns = [...(query.columns || [])];
columns[index].text = text;
const columns = [...query.columns];
let newItem = { ...columns[index], text };
columns[index] = newItem;
onChange({ ...query, columns });
};
const onTimeFormatChange = (timestampFormat: string) => {
let columns = [...(query.columns || [])];
columns[index].timestampFormat = timestampFormat;
const columns = [...query.columns];
let newItem = { ...columns[index], timestampFormat };
columns[index] = newItem;
onChange({ ...query, columns });
};
const onFormatChange = (type: InfinityColumnFormat) => {
let columns = [...(query.columns || [])];
columns[index].type = type;
const columns = [...query.columns];
let newItem = { ...columns[index], type };
columns[index] = newItem;
onChange({ ...query, columns });
};
return (
Expand Down

0 comments on commit 5e0a5b7

Please sign in to comment.