diff --git a/pkg/gav4/analytics.go b/pkg/gav4/analytics.go index fb1949b..2c77fb9 100644 --- a/pkg/gav4/analytics.go +++ b/pkg/gav4/analytics.go @@ -84,7 +84,12 @@ func (ga *GoogleAnalytics) getReport(ctx context.Context, client *GoogleClient, return nil, err } default: - return nil, fmt.Errorf("unknown query mode [%s]", queryModel.Mode) + report, err = client.getReport(*queryModel) + log.DefaultLogger.Debug("getReport", "no query.mode use default timeseries") + if err != nil { + log.DefaultLogger.Error("Query", "error", err) + return nil, err + } } return report, nil } diff --git a/provisioning/dashboards/v0.2.2.json b/provisioning/dashboards/v0.2.2.json new file mode 100644 index 0000000..6400be8 --- /dev/null +++ b/provisioning/dashboards/v0.2.2.json @@ -0,0 +1,155 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 6, + "links": [], + "panels": [ + { + "datasource": { + "default": false, + "type": "blackcowmoo-googleanalytics-datasource", + "uid": "lcc3108_test" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 1, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "accountId": "accounts/145710468", + "cacheDurationSeconds": 300, + "datasource": { + "type": "blackcowmoo-googleanalytics-datasource", + "uid": "cdw6b7xsotw5cc" + }, + "displayName": {}, + "filtersExpression": "", + "metrics": [ + "active28DayUsers" + ], + "refId": "A", + "selectedMetrics": [ + { + "description": "The number of distinct active users on your site or app within a 28 day period. The 28 day period includes the last day in the report's date range.", + "label": "28-day active users", + "value": "active28DayUsers" + } + ], + "selectedTimeDimensions": { + "description": "The date of the event, formatted as YYYYMMDD.", + "label": "Date", + "value": "date" + }, + "timeDimension": "date", + "timezone": "Asia/Seoul", + "version": "v4", + "webPropertyId": "properties/323466308" + } + ], + "title": "Panel Title", + "type": "timeseries" + } + ], + "schemaVersion": 39, + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-30d", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "v0.2.2_test", + "uid": "edw6g1hc4zg1sa", + "version": 1, + "weekStart": "" +} diff --git a/tests/query/queryEdiyor.spec.ts b/tests/query/queryEdiyor.spec.ts index 5933bb7..e102866 100644 --- a/tests/query/queryEdiyor.spec.ts +++ b/tests/query/queryEdiyor.spec.ts @@ -1,6 +1,13 @@ import { expect, test } from '@grafana/plugin-e2e'; +test('0_2_2 migration test', async ({ readProvisionedDataSource, readProvisionedDashboard, gotoDashboardPage }) => { + // default settings + const dashboard = await readProvisionedDashboard({fileName: 'v0.2.2.json'}) + const dashboardPage = await gotoDashboardPage({uid: dashboard.uid}); + await dashboardPage.refreshDashboard() + await expect(dashboardPage.waitForQueryDataResponse()).toBeOK() +}); test('0_2_3 migration test', async ({ readProvisionedDataSource, readProvisionedDashboard, gotoDashboardPage }) => { // default settings