Skip to content

Commit

Permalink
Regex fix (#262)
Browse files Browse the repository at this point in the history
* excepion when not set full vars

* v5.1.1
  • Loading branch information
mamorett authored Mar 8, 2024
1 parent 234d828 commit 318ba9c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "oci-metrics-datasource",
"private": true,
"version": "5.1.0",
"version": "5.1.1",
"description": "Oracle Cloud Infrastructure Metrics Data Source for Grafana",
"scripts": {
"build": "webpack -c ./.config/webpack/webpack.config.ts --env production",
Expand Down
16 changes: 12 additions & 4 deletions src/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,18 @@ export class OCIDataSource extends DataSourceWithBackend<OCIQuery, OCIDataSource
interpolateProps<T extends Record<string, any>>(object: T, scopedVars: ScopedVars = {}): T {
const templateSrv = getTemplateSrv();
return Object.entries(object).reduce((acc, [key, value]) => {
return {
...acc,
[key]: value && isString(value) ? templateSrv.replace(value, scopedVars) : value,
};
if (key === "compartment"){
return {
...acc,
[key]: value && isString(value) ? templateSrv.replace(value, scopedVars, this.compartmentFormatter) : value,
};
} else {
return {
...acc,
[key]: value && isString(value) ? templateSrv.replace(value, scopedVars) : value,
};
}

}, {} as T);
}

Expand Down
4 changes: 2 additions & 2 deletions src/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
},
{ "name": "UPL", "url": "https://oss.oracle.com/licenses/upl" }
],
"version": "5.1.0",
"updated": "2024-03-07",
"version": "5.1.1",
"updated": "2024-03-08",
"screenshots":[
{
"name":"OCI Metrics Dashboard",
Expand Down

0 comments on commit 318ba9c

Please sign in to comment.