Skip to content

Commit 34c108e

Browse files
authored
Merge pull request #38 from netdata/fix-labels-selector
2 parents b45398b + 4ce305e commit 34c108e

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "netdatacloud-netdata-datasource",
3-
"version": "3.0.1",
3+
"version": "3.0.2",
44
"description": "netdata datasource plugin",
55
"scripts": {
66
"build": "webpack -c ./.config/webpack/webpack.config.ts --env production",

src/shared/hooks/useGetChartData.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ export const useGetChartData = async ({
8383
break;
8484
}
8585

86+
const defaultScopeValue = [];
87+
const defaultSelectorValue = ['*'];
88+
const labels = filterBy && filterValue ? [`${filterBy}:${filterValue}`] : null;
89+
8690
return await Post({
8791
path: `/v3/spaces/${spaceId}/rooms/${roomId}/data`,
8892
baseUrl,
@@ -93,13 +97,14 @@ export const useGetChartData = async ({
9397
contexts: [contextId],
9498
nodes,
9599
dimensions,
100+
labels: labels || defaultScopeValue,
96101
},
97102
selectors: {
98103
contexts: ['*'],
99104
nodes: ['*'],
100105
instances: ['*'],
101-
dimensions: ['*'],
102-
labels: ['*'],
106+
dimensions: dimensions.length ? dimensions : defaultSelectorValue,
107+
labels: labels || defaultSelectorValue,
103108
},
104109
aggregations: {
105110
metrics,

0 commit comments

Comments
 (0)