Skip to content

Commit

Permalink
Fix calculation. Added screenshots to plugin.json
Browse files Browse the repository at this point in the history
  • Loading branch information
coderReview committed May 2, 2023
1 parent 3d7296b commit fa2f4f5
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 10 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.

6 changes: 4 additions & 2 deletions dist/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@
"url": "https://www.osisoft.com/pi-system"
}
],
"screenshots": [],
"screenshots": [
{"name": "Query Editor", "path": "img/configurator.png"}
],
"version": "4.0.0",
"updated": "2023-04-03"
"updated": "2023-05-02"
},
"dependencies": {
"grafanaDependency": ">=8.4.0",
Expand Down
4 changes: 2 additions & 2 deletions src/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ export class PiWebAPIDatasource extends DataSourceApi<PIWebAPIQuery, PIWebAPIDat
): PiwebapTargetRsp[] {
const api = this;
const isSummary: boolean = target.summary && target.summary.types && target.summary.types.length > 0;
if (!target.isPiPoint && !target.display) {
if (!target.isPiPoint && !target.display && content.Path) {
if (api.newFormatConfig) {
name = (noTemplate ? getLastPath(content.Path) : getPath(target.elementPathArray, content.Path)) + '|' + name;
} else {
Expand Down Expand Up @@ -739,7 +739,7 @@ export class PiWebAPIDatasource extends DataSourceApi<PIWebAPIQuery, PIWebAPIDat
results.push(
ds.restGetWebId(target.elementPath, false).then((webidresponse: PiwebapiRsp) => {
return ds
.restPost(url + webidresponse.WebId)
.restPost(url + '&webId=' + webidresponse.WebId)
.then((response: any) =>
ds.processResults(response.data, target, displayName || targetName, false, webidresponse)
)
Expand Down
4 changes: 2 additions & 2 deletions src/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,10 @@ export function getLastPath(path: string): string {
* @returns {string} last item of the element path
*/
export function getPath(elementPathArray: PiwebapiElementPath[], path: string): string {
const splitStr = getLastPath(path);
if (elementPathArray.length === 0) {
if (!path || elementPathArray.length === 0) {
return '';
}
const splitStr = getLastPath(path);
const foundElement = elementPathArray.find((e) => path.indexOf(e.path) >= 0)?.variable;
return foundElement ? foundElement + '|' + splitStr : splitStr;
}
Expand Down
4 changes: 3 additions & 1 deletion src/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
"url": "https://www.osisoft.com/pi-system"
}
],
"screenshots": [],
"screenshots": [
{"name": "Query Editor", "path": "img/configurator.png"}
],
"version": "%VERSION%",
"updated": "%TODAY%"
},
Expand Down
2 changes: 1 addition & 1 deletion src/query/QueryEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ export class PIWebAPIQueryEditor extends PureComponent<Props, State> {
} else if (isPiPoint && segmentsArray.length > 0) {
this.piServer = segmentsArray;
}
this.updateArray(segmentsArray, attributesArray, summariesArray, true, () => {
this.updateArray(segmentsArray, attributesArray, summariesArray, !!isPiPoint, () => {
this.onChange(query);
});
};
Expand Down

0 comments on commit fa2f4f5

Please sign in to comment.