Skip to content

Commit

Permalink
Fix/v0.2.2 migration (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
lcc3108 authored Aug 28, 2024
1 parent 1880993 commit baa87d5
Show file tree
Hide file tree
Showing 3 changed files with 168 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/gav4/analytics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
155 changes: 155 additions & 0 deletions provisioning/dashboards/v0.2.2.json
Original file line number Diff line number Diff line change
@@ -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": ""
}
7 changes: 7 additions & 0 deletions tests/query/queryEdiyor.spec.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit baa87d5

Please sign in to comment.