Skip to content

Commit

Permalink
Merge pull request #87 from GridProtectionAlliance/v3.0.0
Browse files Browse the repository at this point in the history
Update to V3.0.0
  • Loading branch information
elwills authored Sep 7, 2022
2 parents fde8f6e + 9d95ad9 commit 0d8a2f6
Show file tree
Hide file tree
Showing 7 changed files with 3,432 additions and 5,890 deletions.
2 changes: 1 addition & 1 deletion dist/module.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/module.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
}
],
"screenshots": [],
"version": "2.1.1",
"updated": "2022-07-25"
"version": "3.0.0",
"updated": "2022-09-02"
},
"dependencies": {
"grafanaDependency": ">=8.4.0",
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "grid-protection-alliance-osisoftpi-grafana",
"version": "2.1.1",
"version": "3.0.0",
"description": "OSISoft PI Grafana Plugin",
"scripts": {
"build": "grafana-toolkit plugin:build",
Expand All @@ -13,10 +13,10 @@
"author": "GridProtectionAlliance",
"license": "Apache-2.0",
"devDependencies": {
"@grafana/data": "^8.5.0",
"@grafana/runtime": "^8.5.0",
"@grafana/toolkit": "^8.5.0",
"@grafana/ui": "^8.5.0",
"@grafana/data": "^9.1.2",
"@grafana/runtime": "^9.1.2",
"@grafana/toolkit": "^9.1.2",
"@grafana/ui": "^9.1.2",
"@testing-library/jest-dom": "5.4.0",
"@testing-library/react": "^10.0.2",
"@types/lodash": "latest"
Expand Down
9 changes: 8 additions & 1 deletion src/QueryEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -794,12 +794,15 @@ export class PIWebAPIQueryEditor extends PureComponent<Props, State> {
componentDidMount = () => {
this.initialLoad(false);
};

componentDidUpdate = () => {
const { query } = this.props;
if (this.props.data?.state === 'Done' && !!this.props.data?.request?.scopedVars && !this.scopedVarsDone) {
this.scopedVarsDone = true;
this.initialLoad(true);
this.initialLoad(!query.isPiPoint);
}
};

initialLoad = (force: boolean) => {
const { query } = this.props;
const metricsQuery = defaults(query, defaultQuery) as PIWebAPIQuery;
Expand Down Expand Up @@ -860,6 +863,8 @@ export class PIWebAPIQueryEditor extends PureComponent<Props, State> {
});
}
}

console.log(query.elementPath);
} else {
query.elementPath = this.getSegmentPathUpTo(this.state.segments, this.state.segments.length);
query.target =
Expand All @@ -869,6 +874,8 @@ export class PIWebAPIQueryEditor extends PureComponent<Props, State> {
query.attributes.map((s) => s.value?.value),
';'
);

console.log(query.elementPath);
}

onChange(query);
Expand Down
8 changes: 4 additions & 4 deletions src/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,8 +562,8 @@ export class PiWebAPIDatasource extends DataSourceApi<PIWebAPIQuery, PIWebAPIDat
let num = !isSummary && typeof value.Value === 'object' ? value.Value?.Value : value.Value;

if (!value.Good || !!target.digitalStates?.enable) {
num = !isSummary && typeof value.Value === 'object' ? value.Value.Name : value.Name;
return [num.trim(), new Date(value.Timestamp).getTime()];
num = (!isSummary && typeof value.Value === 'object' ? value.Value?.Name : value.Name) ?? '';
return [this.checkNumber(num) ? Number(num) : num.trim(), new Date(value.Timestamp).getTime()];
}

return [this.checkNumber(num) ? Number(num) : num.trim(), new Date(value.Timestamp).getTime()];
Expand Down Expand Up @@ -813,7 +813,7 @@ export class PiWebAPIDatasource extends DataSourceApi<PIWebAPIQuery, PIWebAPIDat
let promises: Promise<PiwebapiRsp[]>;

if (noTemplate) {
if (target.attributes.length > 1) {
if (target.attributes.length > 1 && !target.isPiPoint) {
promises = ds
.restGetWebId(target.elementPath, target.isPiPoint)
.then((datarsp) =>
Expand All @@ -837,7 +837,7 @@ export class PiWebAPIDatasource extends DataSourceApi<PIWebAPIQuery, PIWebAPIDat
);
}
} else {
if (target.attributes.length > 1) {
if (target.attributes.length > 1 && !target.isPiPoint) {
promises = Promise.all(
target.elementPathArray.map((elementPath: PiwebapiElementPath) => {
return ds
Expand Down
Loading

0 comments on commit 0d8a2f6

Please sign in to comment.