Skip to content

Commit 7073038

Browse files
authored
Fix issue with upgrading panels from version 2.3.0 and older (#63)
* Fix issue with upgrading panels from version 2.3.0 and older * linting
1 parent dfbb312 commit 7073038

File tree

8 files changed

+25
-7
lines changed

8 files changed

+25
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 2.3.2
4+
5+
Fix issue with migrating panels from versions 2.3.0 and older to version 2.3.1 (TBD) (Yan Shnayder)
6+
37
## 2.3.1
48

59
Align terminology with Scalyr API (#59) (Rein Achten)

dist/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ can find documentation on API Keys [here](https://www.scalyr.com/help/api#scalyr
3535

3636
```bash
3737
grafana-cli --pluginUrl \
38-
https://github.com/scalyr/scalyr-grafana-datasource-plugin/releases/download/2.3.1/scalyr_grafana_plugin_d8e1e08.zip \
38+
https://github.com/scalyr/scalyr-grafana-datasource-plugin/releases/download/2.3.1/scalyr_grafana_plugin_31da5c7.zip \
3939
plugins install scalyr-datasource
4040
```
4141

@@ -78,7 +78,7 @@ from GitHub.
7878
Stable version:
7979

8080
```bash
81-
tar -xvf scalyr_grafana_plugin_d8e1e08.tar.gz
81+
tar -xvf scalyr_grafana_plugin_31da5c7.tar.gz
8282
cp -rf dist/ /var/lib/grafana/plugins/scalyr/
8383
```
8484

dist/module.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"name": "Scalyr",
77
"id": "scalyr-datasource",
88
"info": {
9-
"version": "2.3.1",
9+
"version": "2.3.2",
1010
"description": "Scalyr Observability Platform",
1111
"author": {
1212
"name": "Scalyr",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "scalyr-grafana-datasource-plugin",
3-
"version": "2.3.1",
3+
"version": "2.3.2",
44
"description": "This grafana plugin allows Scalyr as a datasource for metrics and graphs",
55
"main": "webpack.config.js",
66
"scripts": {

src/datasource.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ export class GenericDatasource {
3737
* @param {*} options - query settings/options https://grafana.com/docs/plugins/developing/datasources/#query
3838
*/
3939
query(options) {
40+
// Migrate filters from versions 2.3.0 and older
41+
for (let i = 0; i < options.targets.length; i += 1) {
42+
if (options.targets[i].queryText) {
43+
options.targets[i].filter = options.targets[i].queryText;
44+
options.targets[i].queryText = null;
45+
}
46+
}
47+
4048
const queryType = options.targets[0].queryType;
4149
if (!options.targets.every(x => x.queryType === queryType)) {
4250
return {

src/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"name": "Scalyr",
77
"id": "scalyr-datasource",
88
"info": {
9-
"version": "2.3.1",
9+
"version": "2.3.2",
1010
"description": "Scalyr Observability Platform",
1111
"author": {
1212
"name": "Scalyr",

src/query_ctrl.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ export class GenericDatasourceQueryCtrl extends QueryCtrl {
2222
this.target.dataLink = createDataLinkURL(this.target.queryText, this.getScalyrDatasourceUrl());
2323

2424
this.target.copyText = "Copy";
25+
26+
// Migrate filters from versions 2.3.0 and older
27+
if (this.target.queryText) {
28+
this.target.filter = this.target.queryText;
29+
this.target.queryText = null;
30+
}
2531
}
2632

2733
/**

0 commit comments

Comments
 (0)