Skip to content

Commit c3b8d2d

Browse files
committed
Skip hidden targets.
1 parent d952454 commit c3b8d2d

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/QueryEditor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const QueryEditor: React.FC<Props> = ({ datasource, query, onChange, onRunQuery
5454
setTotalInstances(data.data.nodes.reduce((acc: number, node: any) => acc + node.chartIDs.length, 0));
5555
};
5656

57-
const IsGroupFunctionAvailable = React.useCallback(() => {
57+
const isGroupFunctionAvailable = React.useCallback(() => {
5858
if (groupBy === 'instance' || selectedGroupBy?.value === 'instance') {
5959
return false;
6060
}
@@ -335,7 +335,7 @@ const QueryEditor: React.FC<Props> = ({ datasource, query, onChange, onRunQuery
335335
labelWidth={10}
336336
inputEl={
337337
<Select
338-
disabled={!IsGroupFunctionAvailable()}
338+
disabled={!isGroupFunctionAvailable()}
339339
options={Methods}
340340
value={selectedMethod}
341341
onChange={onMethodChange}

src/datasource.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ export class DataSource extends DataSourceApi<MyQuery, MyDataSourceOptions> {
2525
const to = range!.to.valueOf();
2626

2727
const promises = options.targets.map(
28-
({ spaceId, roomId, contextId, nodes, groupBy, method, refId, dimensions, filterBy, filterValue }) => {
28+
({ spaceId, roomId, contextId, nodes, groupBy, method, refId, dimensions, filterBy, filterValue, hide }) => {
29+
if (target.hide) {
30+
continue;
31+
}
32+
2933
if (!spaceId || !roomId || !contextId) {
3034
const frame = new MutableDataFrame({
3135
refId: refId,

src/shared/hooks/useFetchDimensions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const useFetchDimensions = (baseUrl: string) => {
2424
const [isError, setIsError] = React.useState(false);
2525
const [allDimensions, setDimensions] = React.useState<any[]>([]);
2626
const [filters, setFilters] = React.useState<{ [key in string]: [] }>({});
27-
const [groupingByList, setGroupingByList] = React.useState<Dropdown[]>([]);
27+
const [groupingByList, setGroupingByList] = React.useState<Dropdown[]>(GroupByList);
2828
const [units, setUnits] = React.useState('');
2929

3030
const fetchDimensions = async ({ spaceId, roomId, contextId, nodeIDs }: any) => {

0 commit comments

Comments
 (0)