diff --git a/package.json b/package.json index 45e0f59..71104ee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "netdatacloud-netdata-datasource", - "version": "3.0.1", + "version": "3.0.2", "description": "netdata datasource plugin", "scripts": { "build": "webpack -c ./.config/webpack/webpack.config.ts --env production", diff --git a/src/shared/hooks/useGetChartData.ts b/src/shared/hooks/useGetChartData.ts index 775347a..d8409f2 100644 --- a/src/shared/hooks/useGetChartData.ts +++ b/src/shared/hooks/useGetChartData.ts @@ -83,6 +83,10 @@ export const useGetChartData = async ({ break; } + const defaultScopeValue = []; + const defaultSelectorValue = ['*']; + const labels = filterBy && filterValue ? [`${filterBy}:${filterValue}`] : null; + return await Post({ path: `/v3/spaces/${spaceId}/rooms/${roomId}/data`, baseUrl, @@ -93,13 +97,14 @@ export const useGetChartData = async ({ contexts: [contextId], nodes, dimensions, + labels: labels || defaultScopeValue, }, selectors: { contexts: ['*'], nodes: ['*'], instances: ['*'], - dimensions: ['*'], - labels: ['*'], + dimensions: dimensions.length ? dimensions : defaultSelectorValue, + labels: labels || defaultSelectorValue, }, aggregations: { metrics,