diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d618d5a..89b2135 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,7 @@ jobs: if: steps.check-for-backend.outputs.has-backend == 'true' uses: actions/setup-go@v4 with: - go-version: "1.21" + go-version: "1.22" - name: Test backend if: steps.check-for-backend.outputs.has-backend == 'true' diff --git a/CHANGELOG.md b/CHANGELOG.md index 64eaf64..648bbcc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,9 +52,12 @@ - Fixed digital state - issue #159 - Fixed summary data - issue #160 - Fixed an error in recorded max number of points - issue #162 +- Fix issue with summary when migrating from previous versions - issue $160 - Updated the query editor layout - Added boundary type support in recorded values - Recognize partial usage of variables in elements - Added configuration to hide API errors in panel - Truncate time from grafana date time picker to seconds +- Fixed warnings during deploy +- Fixed LICENSE file diff --git a/LICENSE b/LICENSE index 8dada3e..a4c9336 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright {yyyy} {name of copyright owner} + Copyright 2024 Grid Protection Alliance Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/dist/LICENSE b/dist/LICENSE index 8dada3e..a4c9336 100644 --- a/dist/LICENSE +++ b/dist/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright {yyyy} {name of copyright owner} + Copyright 2024 Grid Protection Alliance Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/dist/module.js b/dist/module.js index 25a5e29..83a49d8 100644 --- a/dist/module.js +++ b/dist/module.js @@ -1,2 +1,2 @@ -define(["@grafana/data","react","@grafana/ui","lodash","rxjs","@grafana/runtime"],((e,t,a,n,l,r)=>(()=>{"use strict";var i={781:t=>{t.exports=e},531:e=>{e.exports=r},7:e=>{e.exports=a},241:e=>{e.exports=n},959:e=>{e.exports=t},269:e=>{e.exports=l}},s={};function o(e){var t=s[e];if(void 0!==t)return t.exports;var a=s[e]={exports:{}};return i[e](a,a.exports,o),a.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var a in t)o.o(t,a)&&!o.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var u={};o.r(u),o.d(u,{plugin:()=>z});var m=o(781),h=o(959),d=o.n(h),c=o(7);function p(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function v(e){for(var t=1;tg(v({},e),{jsonData:g(v({},e.jsonData),{url:e.url})});class f extends h.PureComponent{render(){const{options:e}=this.props,t=y(e);return d().createElement("div",null,d().createElement(c.DataSourceHttpSettings,{defaultUrl:"https://server.name/piwebapi",dataSourceConfig:t,onChange:this.onHttpOptionsChange,showAccessOptions:!0}),d().createElement("h3",{className:"page-heading"},"Custom Configuration"),d().createElement("div",{className:"gf-form-group"},d().createElement("div",{className:"gf-form-inline"},d().createElement(c.InlineField,{label:"Enable PI Points in Query",labelWidth:24},d().createElement(c.InlineSwitch,{value:t.jsonData.pipoint,onChange:this.onPiPointChange}))),d().createElement("div",{className:"gf-form-inline"},d().createElement(c.InlineField,{label:"Enable New Data Format",labelWidth:24},d().createElement(c.InlineSwitch,{value:t.jsonData.newFormat,onChange:this.onNewFormatChange}))),d().createElement("div",{className:"gf-form-inline"},d().createElement(c.InlineField,{label:"Enable Unit in Data",labelWidth:24},d().createElement(c.InlineSwitch,{value:t.jsonData.useUnit,onChange:this.onUseUnitChange}))),d().createElement("div",{className:"gf-form-inline"},d().createElement(c.InlineField,{label:"Enable Experimental Features",labelWidth:24},d().createElement(c.InlineSwitch,{value:t.jsonData.useExperimental,onChange:this.onUseExperimentalChange}))),t.jsonData.useExperimental&&d().createElement("div",{className:"gf-form-inline"},d().createElement(c.InlineField,{label:"Enable Steaming Support",labelWidth:24},d().createElement(c.InlineSwitch,{value:t.jsonData.useStreaming,onChange:this.onUseStreamingChange})))),d().createElement("h3",{className:"page-heading"},"PI/AF Connection Details"),d().createElement("div",{className:"gf-form-group"},t.jsonData.pipoint&&d().createElement("div",{className:"gf-form"},d().createElement(b,{label:"PI Server",labelWidth:10,inputWidth:25,onChange:this.onPIServerChange,value:t.jsonData.piserver||"",placeholder:"Default PI Server to use for data requests"})),d().createElement("div",{className:"gf-form"},d().createElement(b,{label:"AF Server",labelWidth:10,inputWidth:25,onChange:this.onAFServerChange,value:t.jsonData.afserver||"",placeholder:"Default AF Server to use for data requests"})),d().createElement("div",{className:"gf-form"},d().createElement(b,{label:"AF Database",labelWidth:10,inputWidth:25,onChange:this.onAFDatabaseChange,value:t.jsonData.afdatabase||"",placeholder:"Default AF Database server for AF queries"}))))}constructor(...e){super(...e),p(this,"onPIServerChange",(e=>{const{onOptionsChange:t,options:a}=this.props,n=g(v({},a.jsonData),{piserver:e.target.value});t(g(v({},a),{jsonData:n}))})),p(this,"onAFServerChange",(e=>{const{onOptionsChange:t,options:a}=this.props,n=g(v({},a.jsonData),{afserver:e.target.value});t(g(v({},a),{jsonData:n}))})),p(this,"onAFDatabaseChange",(e=>{const{onOptionsChange:t,options:a}=this.props,n=g(v({},a.jsonData),{afdatabase:e.target.value});t(g(v({},a),{jsonData:n}))})),p(this,"onHttpOptionsChange",(e=>{const{onOptionsChange:t}=this.props;t(y(e))})),p(this,"onPiPointChange",(e=>{const{onOptionsChange:t,options:a}=this.props,n=g(v({},a.jsonData),{piserver:e.target.checked?a.jsonData.piserver:"",pipoint:e.target.checked});t(g(v({},a),{jsonData:n}))})),p(this,"onNewFormatChange",(e=>{const{onOptionsChange:t,options:a}=this.props,n=g(v({},a.jsonData),{newFormat:e.target.checked});t(g(v({},a),{jsonData:n}))})),p(this,"onUseUnitChange",(e=>{const{onOptionsChange:t,options:a}=this.props,n=g(v({},a.jsonData),{useUnit:e.target.checked});t(g(v({},a),{jsonData:n}))})),p(this,"onUseExperimentalChange",(e=>{const{onOptionsChange:t,options:a}=this.props,n=g(v({},a.jsonData),{useExperimental:e.target.checked,useStreaming:!!e.target.checked&&a.jsonData.useStreaming});t(g(v({},a),{jsonData:n}))})),p(this,"onUseStreamingChange",(e=>{const{onOptionsChange:t,options:a}=this.props,n=g(v({},a.jsonData),{useStreaming:e.target.checked});t(g(v({},a),{jsonData:n}))}))}}var E=o(241);function S(){return S=Object.assign||function(e){for(var t=1;td().createElement(d().Fragment,null,d().createElement(c.InlineFormLabel,{width:t,tooltip:a},e),n),P=()=>d().createElement("div",{className:"gf-form gf-form--grow"},d().createElement("div",{className:"gf-form-label gf-form-label--grow"})),w=e=>{var t=S({},I(e));return d().createElement(O,null,d().createElement(C,t))},O=e=>d().createElement("div",{className:"gf-form-inline"},e.children,d().createElement(P,null)),x=e=>{var t=S({},I(e));return d().createElement(F,null,d().createElement(C,t))},F=e=>d().createElement(d().Fragment,null,e.children),D={target:";",attributes:[],segments:[],regex:{enable:!1},nodata:"Null",summary:{enable:!1,types:[],basis:"EventWeighted",duration:"",sampleTypeInterval:!1,sampleInterval:""},expression:"",interpolate:{enable:!1},useLastValue:{enable:!1},recordedValues:{enable:!1,boundaryType:"Inside"},digitalStates:{enable:!1},enableStreaming:{enable:!1},useUnit:{enable:!1},isPiPoint:!1},j=({isRaw:e,onChange:t})=>{const[a,n]=(0,h.useState)(!1);return(0,h.useEffect)((()=>{n(!1)}),[e]),e?d().createElement(d().Fragment,null,d().createElement(c.Button,{"aria-label":"Switch to visual editor",icon:"pen",variant:"secondary",type:"button",onClick:()=>{n(!0)}}),d().createElement(c.ConfirmModal,{isOpen:a,title:"Switch to visual editor mode",body:"Are you sure to switch to visual editor mode? You will lose the changes done in raw query mode.",confirmText:"Yes, switch to editor mode",dismissText:"No, stay in raw query mode",onConfirm:()=>{t(!1)},onDismiss:()=>{n(!1)}})):d().createElement(c.Button,{"aria-label":"Switch to text editor",icon:"pen",variant:"secondary",type:"button",onClick:()=>{t(!0)}})};function A(e){return(0,E.map)(e,(e=>{var t,a;return{text:e.Name,expandable:void 0===e.HasChildren||!0===e.HasChildren||(null!==(t=e.Path)&&void 0!==t?t:"").split("\\").length<=3,HasChildren:e.HasChildren,Items:null!==(a=e.Items)&&void 0!==a?a:[],Path:e.Path,WebId:e.WebId}}))}function W(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function V(e){for(var t=1;t{var t;return e.value?d().createElement("div",{style:{width:e.width,marginRight:e.marginRight},className:"gf-form-label "+("template"===e.value.type?"query-keyword":"")},null!==(t=e.label)&&void 0!==t?t:"--no label--"):d().createElement("a",{className:"gf-form-label query-part"},d().createElement(c.Icon,{name:"plus"}))};class R extends h.PureComponent{isValueEmpty(e){return!e||!e.value||!e.value.length||e.value===q}calcBasisValueChanged(e){const t=this.props.query,a=t.summary;var n;a&&(a.basis=null===(n=e.value)||void 0===n?void 0:n.value),this.onChange(T(V({},t),{summary:a}))}getCalcBasisSegments(){return(0,E.map)(this.calculationBasis,(e=>({label:e,value:{value:e,expandable:!0}})))}recordedBoundaryTypeValueChanged(e){const t=this.props.query,a=t.recordedValues;var n;a&&(a.boundaryType=null===(n=e.value)||void 0===n?void 0:n.value),this.onChange(T(V({},t),{recordedValues:a}))}getRecordedBoundaryTypeSegments(){return(0,E.map)(this.recordedBoundaryTypes,(e=>({label:e,value:{value:e,expandable:!0}})))}calcNoDataValueChanged(e){var t;const a=this.props.query,n=null===(t=e.value)||void 0===t?void 0:t.value;this.onChange(T(V({},a),{nodata:n}))}getNoDataSegments(){return(0,E.map)(this.noDataReplacement,(e=>({label:e,value:{value:e,expandable:!0}})))}onSummaryValueChanged(e,t){const a=this.state.summaries.slice(0);a[t]=e,this.isValueEmpty(e.value)&&a.splice(t,1),this.setState({summaries:a},this.stateCallback)}getSummarySegments(){const e=(0,E.filter)(this.summaryTypes,(e=>-1===this.state.summaries.map((e=>{var t;return null===(t=e.value)||void 0===t?void 0:t.value})).indexOf(e))),t=(0,E.map)(e,(e=>({label:e,value:{value:e,expandable:!0}})));return t.unshift({label:q,value:{value:q}}),t}removeSummary(e){const t=(0,E.filter)(this.state.summaries,(t=>t!==e));this.setState({summaries:t})}onSummaryAction(e){const t=this.state.summaries.slice(0);if(!this.isValueEmpty(e.value)){var a;let n={label:e.label,value:{value:null===(a=e.value)||void 0===a?void 0:a.value,expandable:!0}};t.push(n)}this.setState({summarySegment:{},summaries:t},this.stateCallback)}removeAttribute(e){const t=(0,E.filter)(this.state.attributes,(t=>t!==e));this.attributeChangeValue(t)}onAttributeAction(e){const{query:t}=this.props,a=this.state.attributes.slice(0);if(null!==e.value&&"object"!=typeof e.value&&!Array.isArray(e.value)){const t=String(e.value);e.value={type:t.match(/\${\w+}/gi)?"template":void 0,value:t}}if(!this.isValueEmpty(e.value)){var n,l,r;let i={label:e.label,value:{type:(null===(n=e.value)||void 0===n?void 0:n.value)&&(null===(l=e.value)||void 0===l?void 0:l.value.match(/\${\w+}/gi))?"template":void 0,value:null===(r=e.value)||void 0===r?void 0:r.value,expandable:!t.isPiPoint}};a.push(i)}this.attributeChangeValue(a)}getSegmentPathUpTo(e,t){const a=e.slice(0,t);return(0,E.reduce)(a,((e,t)=>{var a;return t.value?(null===(a=t.value.value)||void 0===a?void 0:a.startsWith("-Select"))?e:e?e+"\\"+t.value.value:t.value.value:""}),"")}checkAttributeSegments(e,t){var a;const{datasource:n,data:l}=this.props,r=this,i={path:this.getSegmentPathUpTo(t.slice(0),t.length),type:"attributes"};var s;return n.metricFindQuery(i,Object.assign(null!==(s=null==l||null===(a=l.request)||void 0===a?void 0:a.scopedVars)&&void 0!==s?s:{},{isPiPoint:!1})).then((t=>{const a={};(0,E.each)(t,(e=>{a[e.Path.substring(e.Path.indexOf("|")+1)]=e.WebId}));const l=(0,E.filter)(e,(e=>{var t;const l=n.templateSrv.replace(null===(t=e.value)||void 0===t?void 0:t.value);return void 0!==a[l]}));return r.availableAttributes=a,this.attributeChangeValue(l)})).catch((t=>(r.error=t.message||"Failed to issue metric query",this.attributeChangeValue(e))))}checkPiPointSegments(e,t){var a;const{datasource:n,data:l}=this.props,r=this,i={path:e.path,webId:r.getSelectedPIServer(),pointName:e.label,type:"pipoint"};var s;return n.metricFindQuery(i,Object.assign(null!==(s=null==l||null===(a=l.request)||void 0===a?void 0:a.scopedVars)&&void 0!==s?s:{},{isPiPoint:!0})).then((()=>r.attributeChangeValue(t))).catch((e=>(r.error=e.message||"Failed to issue metric query",r.attributeChangeValue([]))))}getSelectedPIServer(){var e;let t="";return this.piServer.forEach((e=>{const a=this.props.query.target.split(";");a.length>=2&&a[0]===e.text&&(t=e.WebId)})),this.piServer.length>0?null===(e=this.piServer[0].value)||void 0===e?void 0:e.webId:t}textEditorChanged(){const{query:e}=this.props,t=e.target.split(";"),a=t.length>0?t[0].split("\\"):[];let n=[],l=[];a.length>1||1===a.length&&""!==a[0]?(t.splice(0,1),(0,E.each)(a,((e,t)=>{n.push({label:e,value:{type:e.match(/\${\w+}/gi)?"template":void 0,value:e,expandable:!0}})})),(0,E.each)(t,(function(e,t){""!==e&&l.push({label:e,value:{type:e.match(/\${\w+}/gi)?"template":void 0,value:e,expandable:!1}})})),this.getElementSegments(a.length+1,n).then((e=>{e.length>0&&n.push({label:"Select Element",value:{value:"-Select Element-"}})})).then((()=>{this.updateArray(n,l,this.state.summaries,e.isPiPoint,(()=>{this.onChange(T(V({},e),{query:void 0,rawQuery:!1,attributes:this.state.attributes,segments:this.state.segments}))}))}))):(n=this.checkAfServer(),this.updateArray(n,this.state.attributes,this.state.summaries,e.isPiPoint,(()=>{this.onChange(T(V({},e),{query:void 0,rawQuery:!1,attributes:this.state.attributes,segments:this.state.segments}))})))}render(){const{query:e,onChange:t,onRunQuery:a}=this.props,n=(0,E.defaults)(e,D),{useLastValue:l,useUnit:r,interpolate:i,query:s,rawQuery:o,digitalStates:u,enableStreaming:m,recordedValues:h,expression:p,isPiPoint:v,hideError:g,summary:b,nodata:y,display:f,regex:S}=n;return d().createElement(d().Fragment,null,this.props.datasource.piPointConfig&&d().createElement(c.InlineField,{label:"Is Pi Point?",labelWidth:B},d().createElement(c.InlineSwitch,{value:v,onChange:this.onIsPiPointChange})),!!o&&d().createElement(c.InlineFieldRow,null,d().createElement(c.InlineField,{label:"Raw Query",labelWidth:B,grow:!0},d().createElement(c.Input,{onBlur:this.stateCallback,value:s,onChange:e=>t(T(V({},n),{query:e.target.value})),placeholder:"enter query"})),d().createElement(j,{isRaw:!0,onChange:e=>this.textEditorChanged()})),!o&&d().createElement(d().Fragment,null,d().createElement("div",{className:"gf-form-inline"},d().createElement(x,{label:v?"PI Server":"AF Elements",tooltip:v?"Select PI server.":"Select AF Element."},this.state.segments.map(((e,t)=>d().createElement(c.SegmentAsync,{key:"element-"+t,Component:d().createElement(k,{value:e.value,label:e.label}),onChange:e=>this.onSegmentChange(e,t),loadOptions:e=>this.getElementSegments(t),allowCustomValue:!0,inputMinWidth:200}))),d().createElement(P,null),!v&&d().createElement(j,{isRaw:!1,onChange:e=>{t(T(V({},n),{query:n.target,rawQuery:e}))}}))),d().createElement(w,{label:v?"Pi Points":"Attributes"},this.state.attributes.map(((e,t)=>v?d().createElement(c.SegmentAsync,{key:"attributes-"+t,Component:d().createElement(k,{value:e.value,label:e.label}),disabled:0===this.piServer.length,onChange:e=>this.onPiPointChange(e,t),loadOptions:this.getAttributeSegmentsPI,reloadOptionsOnChange:!0,allowCustomValue:!0,inputMinWidth:N}):d().createElement(c.Segment,{key:"attributes-"+t,Component:d().createElement(k,{value:e.value,label:e.label}),disabled:this.state.segments.length<=2,onChange:e=>this.onAttributeChange(e,t),options:this.getAttributeSegmentsAF(),allowCustomValue:!0,inputMinWidth:N}))),v&&d().createElement(c.SegmentAsync,{Component:d().createElement(k,{value:this.state.attributeSegment.value,label:this.state.attributeSegment.label}),disabled:0===this.piServer.length,onChange:this.onAttributeAction,loadOptions:this.getAttributeSegmentsPI,reloadOptionsOnChange:!0,allowCustomValue:!0,inputMinWidth:N}),!v&&d().createElement(c.Segment,{Component:d().createElement(k,{value:this.state.attributeSegment.value,label:this.state.attributeSegment.label}),disabled:this.state.segments.length<=2,onChange:this.onAttributeAction,options:this.getAttributeSegmentsAF(),allowCustomValue:!0,inputMinWidth:N}))),d().createElement(c.InlineFieldRow,null,d().createElement(c.InlineField,{label:"Calculation",grow:!0,labelWidth:B,tooltip:"Modify all attributes by an equation. Use '.' for current item. Leave Attributes empty if you wish to perform element based calculations."},d().createElement(c.Input,{onBlur:a,value:p,onChange:e=>t(T(V({},n),{expression:e.target.value})),placeholder:"'.'*2"}))),d().createElement(c.InlineFieldRow,null,d().createElement(c.InlineField,{label:"Use Last Value",tooltip:"Fetch only last value from time range",labelWidth:B},d().createElement(c.InlineSwitch,{value:l.enable,onChange:()=>this.onChange(T(V({},n),{useLastValue:T(V({},l),{enable:!l.enable})}))})),d().createElement(c.InlineField,{label:"Digital States",labelWidth:B},d().createElement(c.InlineSwitch,{value:u.enable,onChange:()=>this.onChange(T(V({},n),{digitalStates:T(V({},u),{enable:!u.enable})}))})),d().createElement(c.InlineField,{label:"Replace Bad Data",labelWidth:B,tooltip:"Replacement for bad quality values."},d().createElement(c.Segment,{Component:d().createElement(k,{width:96,value:{value:y},label:y}),onChange:this.calcNoDataValueChanged,options:this.getNoDataSegments(),allowCustomValue:!0})),d().createElement(c.InlineField,{label:"Ignore API Error?",labelWidth:B},d().createElement(c.InlineSwitch,{value:g,onChange:this.onHideErrorChange})),this.props.datasource.useUnitConfig&&d().createElement(c.InlineField,{label:"Use unit from datapoints",tooltip:"Use unit in label from PI tag or PI AF attribute",labelWidth:B},d().createElement(c.InlineSwitch,{value:r.enable,onChange:()=>this.onChange(T(V({},n),{useUnit:T(V({},r),{enable:!r.enable})}))})),this.props.datasource.useStreaming&&d().createElement(c.InlineField,{label:"Enable Streaming",labelWidth:B,tooltip:"Enable streaming data if it is supported for the point type."},d().createElement(c.InlineSwitch,{value:m.enable,onChange:()=>this.onChange(T(V({},n),{enableStreaming:T(V({},m),{enable:!m.enable})}))}))),(i.enable||!l.enable&&!h.enable)&&d().createElement(c.InlineFieldRow,null,d().createElement(c.InlineField,{label:p?"Interval Values":"Interpolate",labelWidth:B},d().createElement(c.InlineSwitch,{value:i.enable,onChange:()=>this.onChange(T(V({},n),{interpolate:T(V({},i),{enable:!i.enable,interval:null})}))})),d().createElement(c.InlineField,{disabled:!i.enable,label:p?"Interval Period":"Interpolate Period",labelWidth:B,tooltip:"Override time between sampling, e.g. '30s'. Defaults to timespan/chart width."},d().createElement(c.Input,{onBlur:a,width:30.633375,value:i.interval,onChange:e=>t(T(V({},n),{interpolate:T(V({},i),{interval:e.target.value})})),placeholder:"30s"}))),(h.enable||!l.enable&&!i.enable)&&d().createElement(c.InlineFieldRow,null,d().createElement(c.InlineField,{label:"Recorded Values",labelWidth:B},d().createElement(c.InlineSwitch,{value:h.enable,onChange:()=>this.onChange(T(V({},n),{recordedValues:T(V({},h),{enable:!h.enable,maxNumber:null,boundaryType:"Inside"})}))})),d().createElement(c.InlineField,{disabled:!(null==h?void 0:h.enable),label:"Max Recorded Values",labelWidth:B,tooltip:"Maximum number of recorded value to retrive from the data archive, without using interpolation."},d().createElement(c.Input,{onBlur:a,width:30.633375,value:h.maxNumber,onChange:e=>t(T(V({},n),{recordedValues:T(V({},h),{maxNumber:parseInt(e.target.value,10)})})),type:"number",placeholder:"1000"})),d().createElement(c.InlineField,{disabled:!(null==h?void 0:h.enable),label:"Boundary Type",labelWidth:B,tooltip:"Defines the behavior of data retrieval at the end points of a specified time range."},d().createElement(c.Segment,{Component:d().createElement(k,{width:96,value:{value:null==h?void 0:h.boundaryType},label:null==h?void 0:h.boundaryType}),onChange:this.recordedBoundaryTypeValueChanged,options:this.getRecordedBoundaryTypeSegments(),allowCustomValue:!0}))),!l.enable&&d().createElement(c.InlineFieldRow,null,d().createElement(c.InlineField,{label:"Summary Enable",labelWidth:B},d().createElement(c.InlineSwitch,{value:null==b?void 0:b.enable,onChange:()=>this.onChange(T(V({},n),{summary:T(V({},b),{enable:!(null==b?void 0:b.enable)})}))})),d().createElement(c.InlineField,{disabled:!(null==b?void 0:b.enable),label:"Summary Basis",labelWidth:B,tooltip:"Defines the possible calculation options when performing summary calculations over time-series data."},d().createElement(c.Segment,{Component:d().createElement(k,{width:245.067,marginRight:"0",value:{value:null==b?void 0:b.basis},label:null==b?void 0:b.basis}),onChange:this.calcBasisValueChanged,options:this.getCalcBasisSegments(),allowCustomValue:!0})),d().createElement(c.InlineField,{disabled:!(null==b?void 0:b.enable),label:"Summaries Types",labelWidth:B,tooltip:"PI Web API summary options."},d().createElement(c.InlineFieldRow,null,this.state.summaries.map(((e,t)=>d().createElement(c.Segment,{key:"summaries-"+t,Component:d().createElement(k,{value:e.value,label:e.label}),onChange:e=>this.onSummaryValueChanged(e,t),options:this.getSummarySegments(),allowCustomValue:!0}))),d().createElement(c.Segment,{Component:d().createElement(k,{value:this.state.summarySegment.value,label:this.state.summarySegment.label}),onChange:this.onSummaryAction,options:this.getSummarySegments(),allowCustomValue:!0})))),(null==b?void 0:b.enable)&&d().createElement(c.InlineFieldRow,null,d().createElement(c.InlineField,{label:"Enable interval",labelWidth:B,tooltip:"Enable summary type interval."},d().createElement(c.InlineSwitch,{value:!!(null==b?void 0:b.sampleTypeInterval),onChange:()=>this.onChange(T(V({},n),{summary:T(V({},b),{sampleTypeInterval:!(null==b?void 0:b.sampleTypeInterval)})}))})),d().createElement(c.InlineField,{disabled:!b.sampleTypeInterval,label:"Sample Interval",labelWidth:B,tooltip:"A time span specifies how often the filter expression is evaluated when computing the summary for an interval, if the sampleType is enable."},d().createElement(c.Input,{onBlur:a,width:30.633375,value:null==b?void 0:b.sampleInterval,onChange:e=>t(T(V({},n),{summary:T(V({},b),{sampleInterval:e.target.value})})),placeholder:"30s"})),d().createElement(c.InlineField,{label:"Summary Period",labelWidth:B,tooltip:"The duration of each summary interval, e.g. '30s'."},d().createElement(c.Input,{onBlur:a,width:30.633375,value:null==b?void 0:b.duration,onChange:e=>t(T(V({},n),{summary:T(V({},b),{duration:e.target.value})})),placeholder:"30s"}))),d().createElement(c.InlineFieldRow,null,d().createElement(c.InlineField,{label:"Display Name",labelWidth:B,tooltip:"If single attribute, modify display name. Otherwise use regex to modify display name."},d().createElement(c.Input,{onBlur:a,width:30.633375,value:f,onChange:e=>t(T(V({},n),{display:e.target.value})),placeholder:"Display"})),d().createElement(c.InlineField,{label:"Enable Regex Replace",labelWidth:B},d().createElement(c.InlineSwitch,{value:S.enable,onChange:()=>{this.onChange(T(V({},n),{regex:T(V({},S),{enable:!S.enable})}))}})),d().createElement(c.InlineField,{label:"Search",labelWidth:B},d().createElement(c.Input,{onBlur:a,width:B,value:S.search,onChange:e=>t(T(V({},n),{regex:T(V({},S),{search:e.target.value})})),placeholder:"(.*)"})),d().createElement(c.InlineField,{label:"Replace",labelWidth:B},d().createElement(c.Input,{onBlur:a,width:B,value:S.replace,onChange:e=>t(T(V({},n),{regex:T(V({},S),{replace:e.target.value})})),placeholder:"$1"}))))}constructor(e){super(e),W(this,"error",void 0),W(this,"piServer",[]),W(this,"availableAttributes",{}),W(this,"summaryTypes",void 0),W(this,"calculationBasis",void 0),W(this,"recordedBoundaryTypes",void 0),W(this,"noDataReplacement",void 0),W(this,"state",{isPiPoint:!1,hideError:!1,segments:[],attributes:[],summaries:[],attributeSegment:{},summarySegment:{},calculationBasisSegment:{},noDataReplacementSegment:{}}),W(this,"segmentChangeValue",(e=>{const t=this.props.query;this.setState({segments:e},(()=>this.onChange(T(V({},t),{segments:e}))))})),W(this,"attributeChangeValue",(e=>{const t=this.props.query;return new Promise((a=>this.setState({attributes:e},(()=>{this.onChange(T(V({},t),{attributes:e})),a()}))))})),W(this,"onPiPointChange",((e,t)=>{let a=this.state.attributes.slice(0);e.label===q?(0,E.remove)(a,((e,a)=>a===t)):a[t]=e,this.checkPiPointSegments(e,a)})),W(this,"onAttributeChange",((e,t)=>{var a;let n=this.state.attributes.slice(0);n[t].label!==(null===(a=e.value)||void 0===a?void 0:a.value)&&(n[t]=e,this.checkAttributeSegments(n,this.state.segments))})),W(this,"onSegmentChange",((e,t)=>{var a;const{query:n}=this.props;let l=this.state.segments.slice(0);if(null!==e.value&&"object"!=typeof e.value&&!Array.isArray(e.value)){const t=String(e.value);e.value={type:t.match(/\${\w+}/gi)?"template":void 0,value:t}}l[t].label!==(null===(a=e.value)||void 0===a?void 0:a.value)&&this.setState({attributes:[]},(()=>e.label===q?(l=(0,E.slice)(l,0,t),void this.checkAttributeSegments([],l).then((()=>{var e;0===l.length?l.push({label:""}):(null===(e=l[l.length-1].value)||void 0===e?void 0:e.expandable)&&l.push({label:"Select Element",value:{value:"-Select Element-"}}),n.isPiPoint&&(this.piServer=[]),this.segmentChangeValue(l)}))):(l[t]=e,n.isPiPoint?(this.piServer.push(e),void this.segmentChangeValue(l)):(t{var a,n;return"template"===(null===(a=e.value)||void 0===a?void 0:a.type)?this.getElementSegments(l.length+1,l).then((e=>(e.length>0&&(l[t].value.expandable=!0,l.push({label:"Select Element",value:{value:"-Select Element-"}})),this.segmentChangeValue(l),l))):((null===(n=e.value)||void 0===n?void 0:n.expandable)&&l.push({label:"Select Element",value:{value:"-Select Element-"}}),new Promise((e=>{this.segmentChangeValue(l),e(l)})))}))))))})),W(this,"getElementSegments",((e,t)=>{var a;const{datasource:n,query:l,data:r}=this.props,i=this,s=l.isPiPoint?{type:"dataserver"}:{path:this.getSegmentPathUpTo(null!=t?t:this.state.segments.slice(0),e),afServerWebId:this.state.segments.length>0&&this.state.segments[0].value?this.state.segments[0].value.webId:void 0};if(!l.isPiPoint){var o,u,m;if((null===(o=n.afserver)||void 0===o?void 0:o.name)&&0===e)return Promise.resolve([{label:n.afserver.name,value:{value:n.afserver.name,expandable:!0}}]);if((null===(u=n.afserver)||void 0===u?void 0:u.name)&&(null===(m=n.afdatabase)||void 0===m?void 0:m.name)&&1===e)return Promise.resolve([{label:n.afdatabase.name,value:{value:n.afdatabase.name,expandable:!0}}])}var h;return n.metricFindQuery(s,Object.assign(null!==(h=null==r||null===(a=r.request)||void 0===a?void 0:a.scopedVars)&&void 0!==h?h:{},{isPiPoint:l.isPiPoint})).then((e=>{const t=(0,E.map)(e,(e=>({label:e.text,value:{webId:e.WebId,value:e.text,expandable:!l.isPiPoint&&e.expandable}})));if(0===t.length)return t;const a=n.templateSrv.getVariables();return(0,E.each)(a,(e=>{let a={label:"${"+e.name+"}",value:{type:"template",value:"${"+e.name+"}",expandable:!l.isPiPoint}};t.unshift(a)})),t.unshift({label:q,value:{value:q}}),t})).catch((e=>(i.error=e.message||"Failed to issue metric query",[])))})),W(this,"getAttributeSegmentsPI",(e=>{var t;const{datasource:a,query:n,data:l}=this.props,r=this,i={path:"",webId:this.getSelectedPIServer(),pointName:(null!=e?e:"")+"*",type:"pipoint"};let s=[];var o;return a.metricFindQuery(i,Object.assign(null!==(o=null==l||null===(t=l.request)||void 0===t?void 0:t.scopedVars)&&void 0!==o?o:{},{isPiPoint:n.isPiPoint})).then((t=>{s=(0,E.map)(t,(e=>({path:e.Path,label:e.text,value:{value:e.text,expandable:!1}}))),e&&e.length>0&&s.unshift({label:e,value:{value:e,expandable:!1}});const l=a.templateSrv.getVariables();return(0,E.each)(l,(e=>{let t={label:"${"+e.name+"}",value:{type:"template",value:"${"+e.name+"}",expandable:!n.isPiPoint}};s.unshift(t)})),s.unshift({label:q,value:{value:q}}),s})).catch((e=>(r.error=e.message||"Failed to issue metric query",s)))})),W(this,"getAttributeSegmentsAF",(e=>{const{datasource:t}=this.props;let a=[];a.push({label:q,value:{value:q}});const n=t.templateSrv.getVariables();return(0,E.each)(n,(e=>{let t={label:"${"+e.name+"}",value:{type:"template",value:"${"+e.name+"}",expandable:!1}};a.push(t)})),(0,E.forOwn)(this.availableAttributes,((e,t)=>{let n={label:t,value:{value:t,expandable:!0}};a.push(n)})),a})),W(this,"buildFromTarget",((e,t,a)=>{const n=e.target.split(";"),l=n.length>0?n[0].split("\\"):[];return l.length>1||1===l.length&&""!==l[0]?(n.splice(0,1),(0,E.each)(l,((e,a)=>{t.push({label:e,value:{type:e.match(/\${\w+}/gi)?"template":void 0,value:e,expandable:!0}})})),(0,E.each)(n,((e,t)=>{""!==e&&a.push({label:e,value:{type:e.match(/\${\w+}/gi)?"template":void 0,value:e,expandable:!1}})})),this.getElementSegments(l.length+1,t).then((e=>(e.length>0&&t.push({label:"Select Element",value:{value:"-Select Element-"}}),t)))):Promise.resolve(t)})),W(this,"checkAfServer",(()=>{var e;const{datasource:t}=this.props,a=[];var n;return(null===(e=t.afserver)||void 0===e?void 0:e.name)?(a.push({label:t.afserver.name,value:{value:t.afserver.name,expandable:!0}}),(null===(n=t.afdatabase)||void 0===n?void 0:n.name)&&a.push({label:t.afdatabase.name,value:{value:t.afdatabase.name,expandable:!0}}),a.push({label:"Select Element",value:{value:"-Select Element-"}})):a.push({label:""}),a})),W(this,"updateArray",((e,t,a,n,l)=>{this.setState({segments:e,attributes:t,summaries:a,isPiPoint:n},(()=>{n||this.checkAttributeSegments(t,this.state.segments).then((()=>{l&&l()}))}))})),W(this,"scopedVarsDone",!1),W(this,"componentDidMount",(()=>{this.initialLoad(!1)})),W(this,"componentDidUpdate",(()=>{var e,t,a;const{query:n}=this.props;"Done"===(null===(e=this.props.data)||void 0===e?void 0:e.state)&&(null===(a=this.props.data)||void 0===a||null===(t=a.request)||void 0===t?void 0:t.scopedVars)&&!this.scopedVarsDone&&(this.scopedVarsDone=!0,this.initialLoad(!n.isPiPoint))})),W(this,"initialLoad",(e=>{const{query:t}=this.props,a=(0,E.defaults)(t,D),{segments:n,attributes:l,summary:r,isPiPoint:i}=a;var s;let o=e?[]:null!==(s=null==n?void 0:n.slice(0))&&void 0!==s?s:[];var u;let m=e?[]:null!==(u=null==l?void 0:l.slice(0))&&void 0!==u?u:[];var h;let d=null!==(h=null==r?void 0:r.types)&&void 0!==h?h:[];if(i||0!==o.length)i&&o.length>0&&(this.piServer=o);else{if(t.target&&t.target.length>0&&";"!==t.target)return m=[],void this.buildFromTarget(t,o,m).then((e=>{this.updateArray(e,m,d,!1)})).catch((e=>console.error(e)));o=this.checkAfServer()}this.updateArray(o,m,d,!!i,(()=>{this.onChange(t)}))})),W(this,"onChange",(e=>{const{onChange:t,onRunQuery:a}=this.props;var n,l;if(e.rawQuery){if(e.target=null!==(n=e.query)&&void 0!==n?n:"",e.query){const{attributes:t,elementPath:a}=function(e){const t=e.split(";"),a=t[0].split("\\");t.splice(0,1);let n=[];if(a.length>1||1===a.length&&""!==a[0]){const e=a.join("\\");return(0,E.each)(t,(function(e,t){""!==e&&n.push({label:e,value:{value:e,expandable:!1}})})),{attributes:n,elementPath:e}}return{attributes:n,elementPath:null}}(e.target);e.attributes=t,e.elementPath=a}}else e.elementPath=this.getSegmentPathUpTo(this.state.segments,this.state.segments.length),e.target=e.elementPath+";"+(0,E.join)(null===(l=e.attributes)||void 0===l?void 0:l.map((e=>{var t;return null===(t=e.value)||void 0===t?void 0:t.value})),";");const r=e.summary;r&&(r.types=this.state.summaries),t(T(V({},e),{summary:r})),this.isValidQuery(e)&&a()})),W(this,"isValidQuery",(e=>{if(e.target&&e.target.length>0&&";"!==e.target){e.target=e.target.trim();const t=e.target.split(";",2);return 2===t.length&&t[0].length>0&&t[1].length>0}return!1})),W(this,"stateCallback",(()=>{const e=this.props.query;this.onChange(e)})),W(this,"onIsPiPointChange",(e=>{const{query:t}=this.props,a=!t.isPiPoint;this.setState({segments:a?[{label:""}]:this.checkAfServer(),attributes:[],isPiPoint:a},(()=>{this.onChange(T(V({},t),{expression:"",attributes:this.state.attributes,segments:this.state.segments,isPiPoint:a}))}))})),W(this,"onHideErrorChange",(e=>{const{query:t}=this.props,a=!t.hideError;this.setState({hideError:a},(()=>{this.onChange(T(V({},t),{hideError:a}))}))})),this.onSegmentChange=this.onSegmentChange.bind(this),this.calcBasisValueChanged=this.calcBasisValueChanged.bind(this),this.recordedBoundaryTypeValueChanged=this.recordedBoundaryTypeValueChanged.bind(this),this.calcNoDataValueChanged=this.calcNoDataValueChanged.bind(this),this.onSummaryAction=this.onSummaryAction.bind(this),this.onSummaryValueChanged=this.onSummaryValueChanged.bind(this),this.onAttributeAction=this.onAttributeAction.bind(this),this.onAttributeChange=this.onAttributeChange.bind(this),this.summaryTypes=["Total","Average","Minimum","Maximum","Range","StdDev","PopulationStdDev","Count","PercentGood","All","AllForNonNumeric"],this.calculationBasis=["TimeWeighted","EventWeighted","TimeWeightedContinuous","TimeWeightedDiscrete","EventWeightedExcludeMostRecentEvent","EventWeightedExcludeEarliestEvent","EventWeightedIncludeBothEnds"],this.recordedBoundaryTypes=["Inside","Outside","Interpolated"],this.noDataReplacement=["Null","Drop","Previous","0","Keep"]}}var U=o(269),M=o(531);function Q(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function $(e){for(var t=1;t{const t=u.target;if(t&&t[e])return{label:t[e].Name,value:t[e]}};var S;return o.getAssetServer(o.afserver.name).then((e=>{g(e.WebId)})),d().createElement(d().Fragment,null,d().createElement("div",{className:"gf-form-group"},d().createElement(c.InlineFieldRow,null,d().createElement(c.InlineField,{label:"Database",labelWidth:G,grow:!0},d().createElement(c.AsyncSelect,{key:null!=v?v:"database-key",loadOptions:()=>o.getDatabases(v).then((e=>e.map((e=>({label:e.Name,value:e}))))),loadingMessage:"Loading",value:E("database"),onChange:e=>{f(e.value),m(L($({},s),{database:e.value,template:void 0}))},defaultOptions:!0})),d().createElement(c.InlineField,{label:"Event Frames",labelWidth:G,grow:!0},d().createElement(c.AsyncSelect,{key:null!==(S=null==y?void 0:y.WebId)&&void 0!==S?S:"default-template-key",loadOptions:()=>o.getEventFrameTemplates(null==y?void 0:y.WebId).then((e=>e.map((e=>({label:e.Name,value:e}))))),loadingMessage:"Loading",value:E("template"),onChange:e=>m(L($({},s),{template:e.value})),defaultOptions:!0})),d().createElement(c.InlineField,{label:"Show Start and End Time",labelWidth:G,grow:!0},d().createElement(c.InlineSwitch,{value:!!s.showEndTime,onChange:e=>m(L($({},s),{showEndTime:e.currentTarget.checked}))}))),d().createElement(c.InlineFieldRow,null,d().createElement(c.InlineField,{label:"Category name",labelWidth:G,grow:!0},d().createElement(c.Input,{type:"text",value:s.categoryName,onBlur:e=>p(),onChange:e=>m(L($({},s),{categoryName:e.currentTarget.value})),placeholder:"Enter category name"})),d().createElement(c.InlineField,{label:"Name Filter",labelWidth:G,grow:!0},d().createElement(c.Input,{type:"text",value:s.nameFilter,onBlur:e=>p(),onChange:e=>m(L($({},s),{nameFilter:e.currentTarget.value})),placeholder:"Enter name filter"}))),d().createElement(c.InlineFieldRow,null,d().createElement(c.InlineField,{label:"Enable Name Regex Replacement",labelWidth:G,grow:!1},d().createElement(c.InlineSwitch,{value:null===(a=s.regex)||void 0===a?void 0:a.enable,onChange:e=>m(L($({},s),{regex:L($({},s.regex),{enable:e.currentTarget.checked})}))})),d().createElement(c.InlineField,{label:"Name Filter",labelWidth:20,grow:!1},d().createElement(c.Input,{type:"text",value:null===(n=s.regex)||void 0===n?void 0:n.search,onBlur:e=>p(),onChange:e=>m(L($({},s),{regex:L($({},s.regex),{search:e.currentTarget.value})})),placeholder:"(.*)",width:50})),d().createElement(c.InlineField,{label:"Replace",labelWidth:20,grow:!0},d().createElement(c.Input,{type:"text",value:null==s||null===(l=s.regex)||void 0===l?void 0:l.replace,onBlur:e=>p(),onChange:e=>m(L($({},s),{regex:L($({},s.regex),{replace:e.currentTarget.value})})),placeholder:"$1"}))),d().createElement(c.InlineFieldRow,null,d().createElement(c.InlineField,{label:"Enable Attribute Usage",labelWidth:G,grow:!1},d().createElement(c.InlineSwitch,{value:null===(r=s.attribute)||void 0===r?void 0:r.enable,onChange:e=>m(L($({},s),{attribute:L($({},s.attribute),{enable:e.currentTarget.checked})}))})),d().createElement(c.InlineField,{label:"Attribute Name",labelWidth:G,grow:!0},d().createElement(c.Input,{type:"text",value:null===(i=s.attribute)||void 0===i?void 0:i.name,onBlur:e=>p(),onChange:e=>m(L($({},s),{attribute:L($({},s.attribute),{name:e.currentTarget.value})})),placeholder:"Enter name"})))))}));function _(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function Y(e){for(var t=1;te.substring(1,e.length-2).split(",")[0]))),e.filter=null!==(l=e.filter)&&void 0!==l?l:"*",e.max=null!==(r=e.max)&&void 0!==r?r:1e4,"servers"===e.type?(null===(i=a.afserver)||void 0===i?void 0:i.name)?a.getAssetServer(a.afserver.name).then((e=>[e])).then(A):a.getAssetServers().then(A):"databases"===e.type&&e.afServerWebId?a.getDatabases(e.afServerWebId,{}).then(A):"databases"===e.type?a.getAssetServer(e.path).then((e=>{var t;return a.getDatabases(null!==(t=e.WebId)&&void 0!==t?t:"",{})})).then(A):"databaseElements"===e.type?a.getDatabase(e.path).then((e=>{var t;return a.getDatabaseElements(null!==(t=e.WebId)&&void 0!==t?t:"",{selectedFields:"Items.WebId%3BItems.Name%3BItems.Items%3BItems.Path%3BItems.HasChildren"})})).then(A):"elements"===e.type?a.getElement(e.path).then((t=>{var n;return a.getElements(null!==(n=t.WebId)&&void 0!==n?n:"",{selectedFields:"Items.Description%3BItems.WebId%3BItems.Name%3BItems.Items%3BItems.Path%3BItems.HasChildren",nameFilter:e.filter})})).then(A):"attributes"===e.type?a.getElement(e.path).then((t=>{var n;return a.getAttributes(null!==(n=t.WebId)&&void 0!==n?n:"",{searchFullHierarchy:"true",selectedFields:"Items.Type%3BItems.DefaultUnitsName%3BItems.Description%3BItems.WebId%3BItems.Name%3BItems.Path",nameFilter:e.filter,maxCount:e.max})})).then(A):"dataserver"===e.type?a.getDataServers().then(A):"pipoint"===e.type?a.piPointSearch(e.webId,e.pointName).then(A):Promise.reject("Bad type")}buildQueryParameters(e){return e.targets=(0,E.filter)(e.targets,(e=>{var t;return!(!e||!e.target||0===(null===(t=e.attributes)||void 0===t?void 0:t.length)||";"===e.target||e.hide||e.target.startsWith("Select AF"))})),e.maxDataPoints&&(e.maxDataPoints=e.maxDataPoints>3e4?3e4:e.maxDataPoints),e.targets=(0,E.map)(e.targets,(t=>{var a;const n={enableStreaming:t.enableStreaming,target:this.templateSrv.replace(t.target,e.scopedVars),elementPath:this.templateSrv.replace(t.elementPath,e.scopedVars),attributes:(0,E.map)(t.attributes,(t=>(t.value&&(t.value.value=this.templateSrv.replace(t.value.value,e.scopedVars)),t))),segments:(0,E.map)(t.segments,(t=>(t.value&&(t.value.value=this.templateSrv.replace(t.value.value,e.scopedVars)),t))),isAnnotation:!!t.isAnnotation,display:t.display?this.templateSrv.replace(t.display,e.scopedVars):void 0,refId:t.refId,hide:t.hide,interpolate:t.interpolate?J(Y({},t.interpolate),{interval:this.templateSrv.replace(t.interpolate.interval,e.scopedVars)}):{enable:!1},useLastValue:t.useLastValue||{enable:!1},useUnit:t.useUnit||{enable:!1},recordedValues:t.recordedValues||{enable:!1},digitalStates:t.digitalStates||{enable:!1},webid:null!==(a=t.webid)&&void 0!==a?a:"",regex:t.regex||{enable:!1},expression:t.expression||"",summary:t.summary||{enable:!1,types:[]},nodata:t.nodata,startTime:e.range.from,endTime:e.range.to,isPiPoint:!!t.isPiPoint,hideError:!!t.hideError,scopedVars:e.scopedVars};return n.expression&&(n.expression=this.templateSrv.replace(n.expression,e.scopedVars)),n.summary.enable&&void 0!==n.summary.types&&(n.summary.types=(0,E.filter)(n.summary.types,(e=>null!=e&&""!==e)),n.summary.duration=n.summary.duration?this.templateSrv.replace(n.summary.duration,e.scopedVars):n.summary.duration,n.summary.sampleTypeInterval=!!n.summary.sampleTypeInterval,n.summary.sampleInterval=n.summary.sampleInterval?this.templateSrv.replace(n.summary.sampleInterval,e.scopedVars):n.summary.sampleInterval),n})),e}eventFrameToAnnotation(e,t){const a=e.target,n=[],l=Intl.DateTimeFormat().resolvedOptions().locale;return t.forEach((e=>{let t=this.transformDataFrameToMap(e);for(let e=0;eStart: "+new Date(t.time[e]).toLocaleString(l)+"
End: ",t.timeEnd[e]?i+=new Date(t.timeEnd[e]).toLocaleString(l):i+="Eventframe is open";const s={time:t.time[e],timeEnd:a.showEndTime?t.timeEnd[e]:void 0,title:r,id:t.id[e],text:i,tags:["OSISoft PI"]};n.push(s)}})),n}transformDataFrameToMap(e){const t={};return e.fields.forEach((e=>{t[e.name]=e.values.toArray()})),t}restGet(e){return this.getResource(`${e}`).then((e=>e))}getDataServers(){return this.restGet("/dataservers").then((e=>{var t;return null!==(t=e.Items)&&void 0!==t?t:[]}))}getDataServer(e){return e?this.restGet("/dataservers?name="+e).then((e=>e)):Promise.resolve({})}getAssetServers(){return this.restGet("/assetservers").then((e=>{var t;return null!==(t=e.Items)&&void 0!==t?t:[]}))}getAssetServer(e){return e?this.restGet("/assetservers?path=\\\\"+e).then((e=>e)):Promise.resolve({})}getDatabase(e){return e?this.restGet("/assetdatabases?path=\\\\"+e).then((e=>e)):Promise.resolve({})}getDatabases(e,t){return e?this.restGet("/assetservers/"+e+"/assetdatabases").then((e=>{var t;return null!==(t=e.Items)&&void 0!==t?t:[]})):Promise.resolve([])}getElement(e){return e?this.restGet("/elements?path=\\\\"+e).then((e=>e)):Promise.resolve({})}getEventFrameTemplates(e){return e?this.restGet("/assetdatabases/"+e+"/elementtemplates?selectedFields=Items.InstanceType%3BItems.Name%3BItems.WebId").then((e=>{var t;return(0,E.filter)(null!==(t=e.Items)&&void 0!==t?t:[],(e=>"EventFrame"===e.InstanceType))})):Promise.resolve([])}getElementTemplates(e){return e?this.restGet("/assetdatabases/"+e+"/elementtemplates?selectedFields=Items.InstanceType%3BItems.Name%3BItems.WebId").then((e=>{var t;return(0,E.filter)(null!==(t=e.Items)&&void 0!==t?t:[],(e=>"Element"===e.InstanceType))})):Promise.resolve([])}getAttributes(e,t){let a="?"+(0,E.map)(t,((e,t)=>t+"="+e)).join("&");return"?"===a&&(a=""),this.restGet("/elements/"+e+"/attributes"+a).then((e=>{var t;return null!==(t=e.Items)&&void 0!==t?t:[]}))}getDatabaseElements(e,t){let a="?"+(0,E.map)(t,((e,t)=>t+"="+e)).join("&");return"?"===a&&(a=""),this.restGet("/assetdatabases/"+e+"/elements"+a).then((e=>{var t;return null!==(t=e.Items)&&void 0!==t?t:[]}))}getElements(e,t){let a="?"+(0,E.map)(t,((e,t)=>t+"="+e)).join("&");return"?"===a&&(a=""),this.restGet("/elements/"+e+"/elements"+a).then((e=>{var t;return null!==(t=e.Items)&&void 0!==t?t:[]}))}piPointSearch(e,t){let a=this.templateSrv.replace(t),n=`${a}`,l=!1;if(a!==t){const e=/\{(\w|,)+\}/g;let t;for(;null!==(t=e.exec(a));)t.index===e.lastIndex&&e.lastIndex++,t.forEach(((e,t)=>{0===t&&(a=a.replace(e,e.replace("{","(").replace("}",")").replace(",","|")),n=n.replace(e,"*"),l=!0)}))}return this.restGet("/dataservers/"+e+"/points?maxCount=100&nameFilter="+n).then((e=>e&&(null==e?void 0:e.Items)?l?e.Items.filter((e=>{var t;return null===(t=e.Name)||void 0===t?void 0:t.match(a)})):e.Items:[]))}constructor(e,t=(0,M.getTemplateSrv)()){super(e),_(this,"templateSrv",void 0),_(this,"piserver",void 0),_(this,"afserver",void 0),_(this,"afdatabase",void 0),_(this,"piPointConfig",void 0),_(this,"newFormatConfig",void 0),_(this,"useUnitConfig",void 0),_(this,"useExperimental",void 0),_(this,"useStreaming",void 0),this.templateSrv=t,this.piserver={name:(e.jsonData||{}).piserver,webid:void 0},this.afserver={name:(e.jsonData||{}).afserver,webid:void 0},this.afdatabase={name:(e.jsonData||{}).afdatabase,webid:void 0},this.piPointConfig=e.jsonData.pipoint||!1,this.newFormatConfig=e.jsonData.newFormat||!1,this.useUnitConfig=e.jsonData.useUnit||!1,this.useExperimental=e.jsonData.useExperimental||!1,this.useStreaming=e.jsonData.useStreaming||!1,this.annotations={QueryEditor:H,prepareQuery:e=>(e.target&&(e.target.queryType="Annotation",e.target.isAnnotation=!0),e.target),processEvents:(e,t)=>(0,U.of)(this.eventFrameToAnnotation(e,t))},Promise.all([this.getDataServer(this.piserver.name).then((e=>this.piserver.webid=e.WebId)),this.getAssetServer(this.afserver.name).then((e=>this.afserver.webid=e.WebId)),this.getDatabase(this.afserver.name&&this.afdatabase.name?this.afserver.name+"\\"+this.afdatabase.name:void 0).then((e=>this.afdatabase.webid=e.WebId))])}}const z=new m.DataSourcePlugin(K).setQueryEditor(R).setConfigEditor(f);return u})())); +define(["@grafana/data","react","@grafana/ui","lodash","rxjs","@grafana/runtime"],((e,t,a,n,l,r)=>(()=>{"use strict";var i={781:t=>{t.exports=e},531:e=>{e.exports=r},7:e=>{e.exports=a},241:e=>{e.exports=n},959:e=>{e.exports=t},269:e=>{e.exports=l}},s={};function o(e){var t=s[e];if(void 0!==t)return t.exports;var a=s[e]={exports:{}};return i[e](a,a.exports,o),a.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var a in t)o.o(t,a)&&!o.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var u={};o.r(u),o.d(u,{plugin:()=>X});var m=o(781),h=o(959),d=o.n(h),c=o(7);function p(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function v(e){for(var t=1;tg(v({},e),{jsonData:g(v({},e.jsonData),{url:e.url})});class f extends h.PureComponent{render(){const{options:e}=this.props,t=y(e);return d().createElement("div",null,d().createElement(c.DataSourceHttpSettings,{defaultUrl:"https://server.name/piwebapi",dataSourceConfig:t,onChange:this.onHttpOptionsChange,showAccessOptions:!0}),d().createElement("h3",{className:"page-heading"},"Custom Configuration"),d().createElement("div",{className:"gf-form-group"},d().createElement("div",{className:"gf-form-inline"},d().createElement(c.InlineField,{label:"Enable PI Points in Query",labelWidth:24},d().createElement(c.InlineSwitch,{value:t.jsonData.pipoint,onChange:this.onPiPointChange}))),d().createElement("div",{className:"gf-form-inline"},d().createElement(c.InlineField,{label:"Enable New Data Format",labelWidth:24},d().createElement(c.InlineSwitch,{value:t.jsonData.newFormat,onChange:this.onNewFormatChange}))),d().createElement("div",{className:"gf-form-inline"},d().createElement(c.InlineField,{label:"Enable Unit in Data",labelWidth:24},d().createElement(c.InlineSwitch,{value:t.jsonData.useUnit,onChange:this.onUseUnitChange}))),d().createElement("div",{className:"gf-form-inline"},d().createElement(c.InlineField,{label:"Enable Experimental Features",labelWidth:24},d().createElement(c.InlineSwitch,{value:t.jsonData.useExperimental,onChange:this.onUseExperimentalChange}))),t.jsonData.useExperimental&&d().createElement("div",{className:"gf-form-inline"},d().createElement(c.InlineField,{label:"Enable Steaming Support",labelWidth:24},d().createElement(c.InlineSwitch,{value:t.jsonData.useStreaming,onChange:this.onUseStreamingChange})))),d().createElement("h3",{className:"page-heading"},"PI/AF Connection Details"),d().createElement("div",{className:"gf-form-group"},t.jsonData.pipoint&&d().createElement("div",{className:"gf-form"},d().createElement(b,{label:"PI Server",labelWidth:10,inputWidth:25,onChange:this.onPIServerChange,value:t.jsonData.piserver||"",placeholder:"Default PI Server to use for data requests"})),d().createElement("div",{className:"gf-form"},d().createElement(b,{label:"AF Server",labelWidth:10,inputWidth:25,onChange:this.onAFServerChange,value:t.jsonData.afserver||"",placeholder:"Default AF Server to use for data requests"})),d().createElement("div",{className:"gf-form"},d().createElement(b,{label:"AF Database",labelWidth:10,inputWidth:25,onChange:this.onAFDatabaseChange,value:t.jsonData.afdatabase||"",placeholder:"Default AF Database server for AF queries"}))))}constructor(...e){super(...e),p(this,"onPIServerChange",(e=>{const{onOptionsChange:t,options:a}=this.props,n=g(v({},a.jsonData),{piserver:e.target.value});t(g(v({},a),{jsonData:n}))})),p(this,"onAFServerChange",(e=>{const{onOptionsChange:t,options:a}=this.props,n=g(v({},a.jsonData),{afserver:e.target.value});t(g(v({},a),{jsonData:n}))})),p(this,"onAFDatabaseChange",(e=>{const{onOptionsChange:t,options:a}=this.props,n=g(v({},a.jsonData),{afdatabase:e.target.value});t(g(v({},a),{jsonData:n}))})),p(this,"onHttpOptionsChange",(e=>{const{onOptionsChange:t}=this.props;t(y(e))})),p(this,"onPiPointChange",(e=>{const{onOptionsChange:t,options:a}=this.props,n=g(v({},a.jsonData),{piserver:e.target.checked?a.jsonData.piserver:"",pipoint:e.target.checked});t(g(v({},a),{jsonData:n}))})),p(this,"onNewFormatChange",(e=>{const{onOptionsChange:t,options:a}=this.props,n=g(v({},a.jsonData),{newFormat:e.target.checked});t(g(v({},a),{jsonData:n}))})),p(this,"onUseUnitChange",(e=>{const{onOptionsChange:t,options:a}=this.props,n=g(v({},a.jsonData),{useUnit:e.target.checked});t(g(v({},a),{jsonData:n}))})),p(this,"onUseExperimentalChange",(e=>{const{onOptionsChange:t,options:a}=this.props,n=g(v({},a.jsonData),{useExperimental:e.target.checked,useStreaming:!!e.target.checked&&a.jsonData.useStreaming});t(g(v({},a),{jsonData:n}))})),p(this,"onUseStreamingChange",(e=>{const{onOptionsChange:t,options:a}=this.props,n=g(v({},a.jsonData),{useStreaming:e.target.checked});t(g(v({},a),{jsonData:n}))}))}}var E=o(241);function S(){return S=Object.assign||function(e){for(var t=1;td().createElement(d().Fragment,null,d().createElement(c.InlineFormLabel,{width:t,tooltip:a},e),n),P=()=>d().createElement("div",{className:"gf-form gf-form--grow"},d().createElement("div",{className:"gf-form-label gf-form-label--grow"})),w=e=>{var t=S({},I(e));return d().createElement(O,null,d().createElement(C,t))},O=e=>d().createElement("div",{className:"gf-form-inline"},e.children,d().createElement(P,null)),x=e=>{var t=S({},I(e));return d().createElement(F,null,d().createElement(C,t))},F=e=>d().createElement(d().Fragment,null,e.children),D={target:";",attributes:[],segments:[],regex:{enable:!1},nodata:"Null",summary:{enable:!1,types:[],basis:"EventWeighted",duration:"",sampleTypeInterval:!1,sampleInterval:""},expression:"",interpolate:{enable:!1},useLastValue:{enable:!1},recordedValues:{enable:!1,boundaryType:"Inside"},digitalStates:{enable:!1},enableStreaming:{enable:!1},useUnit:{enable:!1},isPiPoint:!1},j=({isRaw:e,onChange:t})=>{const[a,n]=(0,h.useState)(!1);return(0,h.useEffect)((()=>{n(!1)}),[e]),e?d().createElement(d().Fragment,null,d().createElement(c.Button,{"aria-label":"Switch to visual editor",icon:"pen",variant:"secondary",type:"button",onClick:()=>{n(!0)}}),d().createElement(c.ConfirmModal,{isOpen:a,title:"Switch to visual editor mode",body:"Are you sure to switch to visual editor mode? You will lose the changes done in raw query mode.",confirmText:"Yes, switch to editor mode",dismissText:"No, stay in raw query mode",onConfirm:()=>{t(!1)},onDismiss:()=>{n(!1)}})):d().createElement(c.Button,{"aria-label":"Switch to text editor",icon:"pen",variant:"secondary",type:"button",onClick:()=>{t(!0)}})};function A(e){var t;return(0,E.filter)(null!==(t=null==e?void 0:e.types)&&void 0!==t?t:[],(e=>null!=e&&""!==String(e))).map((e=>{if("string"==typeof e||e instanceof String){const t=String(e);return{label:t,value:{value:t,expandable:!0}}}return e}))}function W(e){return(0,E.map)(e,(e=>{var t,a;return{text:e.Name,expandable:void 0===e.HasChildren||!0===e.HasChildren||(null!==(t=e.Path)&&void 0!==t?t:"").split("\\").length<=3,HasChildren:e.HasChildren,Items:null!==(a=e.Items)&&void 0!==a?a:[],Path:e.Path,WebId:e.WebId}}))}function V(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function T(e){for(var t=1;t{var t;return e.value?d().createElement("div",{style:{width:e.width,marginRight:e.marginRight},className:"gf-form-label "+("template"===e.value.type?"query-keyword":"")},null!==(t=e.label)&&void 0!==t?t:"--no label--"):d().createElement("a",{className:"gf-form-label query-part"},d().createElement(c.Icon,{name:"plus"}))};class U extends h.PureComponent{isValueEmpty(e){return!e||!e.value||!e.value.length||e.value===k}calcBasisValueChanged(e){const t=this.props.query,a=t.summary;var n;a&&(a.basis=null===(n=e.value)||void 0===n?void 0:n.value),this.onChange(B(T({},t),{summary:a}))}getCalcBasisSegments(){return(0,E.map)(this.calculationBasis,(e=>({label:e,value:{value:e,expandable:!0}})))}recordedBoundaryTypeValueChanged(e){const t=this.props.query,a=t.recordedValues;var n;a&&(a.boundaryType=null===(n=e.value)||void 0===n?void 0:n.value),this.onChange(B(T({},t),{recordedValues:a}))}getRecordedBoundaryTypeSegments(){return(0,E.map)(this.recordedBoundaryTypes,(e=>({label:e,value:{value:e,expandable:!0}})))}calcNoDataValueChanged(e){var t;const a=this.props.query,n=null===(t=e.value)||void 0===t?void 0:t.value;this.onChange(B(T({},a),{nodata:n}))}getNoDataSegments(){return(0,E.map)(this.noDataReplacement,(e=>({label:e,value:{value:e,expandable:!0}})))}onSummaryValueChanged(e,t){const a=this.state.summaries.slice(0);a[t]=e,this.isValueEmpty(e.value)&&a.splice(t,1),this.setState({summaries:a},this.stateCallback)}getSummarySegments(){const e=(0,E.filter)(this.summaryTypes,(e=>-1===this.state.summaries.map((e=>{var t;return null===(t=e.value)||void 0===t?void 0:t.value})).indexOf(e))),t=(0,E.map)(e,(e=>({label:e,value:{value:e,expandable:!0}})));return t.unshift({label:k,value:{value:k}}),t}removeSummary(e){const t=(0,E.filter)(this.state.summaries,(t=>t!==e));this.setState({summaries:t})}onSummaryAction(e){const t=this.state.summaries.slice(0);if(!this.isValueEmpty(e.value)){var a;let n={label:e.label,value:{value:null===(a=e.value)||void 0===a?void 0:a.value,expandable:!0}};t.push(n)}this.setState({summarySegment:{},summaries:t},this.stateCallback)}removeAttribute(e){const t=(0,E.filter)(this.state.attributes,(t=>t!==e));this.attributeChangeValue(t)}onAttributeAction(e){const{query:t}=this.props,a=this.state.attributes.slice(0);if(null!==e.value&&"object"!=typeof e.value&&!Array.isArray(e.value)){const t=String(e.value);e.value={type:t.match(/\${\w+}/gi)?"template":void 0,value:t}}if(!this.isValueEmpty(e.value)){var n,l,r;let i={label:e.label,value:{type:(null===(n=e.value)||void 0===n?void 0:n.value)&&(null===(l=e.value)||void 0===l?void 0:l.value.match(/\${\w+}/gi))?"template":void 0,value:null===(r=e.value)||void 0===r?void 0:r.value,expandable:!t.isPiPoint}};a.push(i)}this.attributeChangeValue(a)}getSegmentPathUpTo(e,t){const a=e.slice(0,t);return(0,E.reduce)(a,((e,t)=>{var a;return t.value?(null===(a=t.value.value)||void 0===a?void 0:a.startsWith("-Select"))?e:e?e+"\\"+t.value.value:t.value.value:""}),"")}checkAttributeSegments(e,t){var a;const{datasource:n,data:l}=this.props,r=this,i={path:this.getSegmentPathUpTo(t.slice(0),t.length),type:"attributes"};var s;return n.metricFindQuery(i,Object.assign(null!==(s=null==l||null===(a=l.request)||void 0===a?void 0:a.scopedVars)&&void 0!==s?s:{},{isPiPoint:!1})).then((t=>{const a={};(0,E.each)(t,(e=>{a[e.Path.substring(e.Path.indexOf("|")+1)]=e.WebId}));const l=(0,E.filter)(e,(e=>{var t;const l=n.templateSrv.replace(null===(t=e.value)||void 0===t?void 0:t.value);return void 0!==a[l]}));return r.availableAttributes=a,this.attributeChangeValue(l)})).catch((t=>(r.error=t.message||"Failed to issue metric query",this.attributeChangeValue(e))))}checkPiPointSegments(e,t){var a;const{datasource:n,data:l}=this.props,r=this,i={path:e.path,webId:r.getSelectedPIServer(),pointName:e.label,type:"pipoint"};var s;return n.metricFindQuery(i,Object.assign(null!==(s=null==l||null===(a=l.request)||void 0===a?void 0:a.scopedVars)&&void 0!==s?s:{},{isPiPoint:!0})).then((()=>r.attributeChangeValue(t))).catch((e=>(r.error=e.message||"Failed to issue metric query",r.attributeChangeValue([]))))}getSelectedPIServer(){var e;let t="";return this.piServer.forEach((e=>{const a=this.props.query.target.split(";");a.length>=2&&a[0]===e.text&&(t=e.WebId)})),this.piServer.length>0?null===(e=this.piServer[0].value)||void 0===e?void 0:e.webId:t}textEditorChanged(){const{query:e}=this.props,t=e.target.split(";"),a=t.length>0?t[0].split("\\"):[];let n=[],l=[];a.length>1||1===a.length&&""!==a[0]?(t.splice(0,1),(0,E.each)(a,((e,t)=>{n.push({label:e,value:{type:e.match(/\${\w+}/gi)?"template":void 0,value:e,expandable:!0}})})),(0,E.each)(t,(function(e,t){""!==e&&l.push({label:e,value:{type:e.match(/\${\w+}/gi)?"template":void 0,value:e,expandable:!1}})})),this.getElementSegments(a.length+1,n).then((e=>{e.length>0&&n.push({label:"Select Element",value:{value:"-Select Element-"}})})).then((()=>{this.updateArray(n,l,this.state.summaries,e.isPiPoint,(()=>{this.onChange(B(T({},e),{query:void 0,rawQuery:!1,attributes:this.state.attributes,segments:this.state.segments}))}))}))):(n=this.checkAfServer(),this.updateArray(n,this.state.attributes,this.state.summaries,e.isPiPoint,(()=>{this.onChange(B(T({},e),{query:void 0,rawQuery:!1,attributes:this.state.attributes,segments:this.state.segments}))})))}render(){const{query:e,onChange:t,onRunQuery:a}=this.props,n=(0,E.defaults)(e,D),{useLastValue:l,useUnit:r,interpolate:i,query:s,rawQuery:o,digitalStates:u,enableStreaming:m,recordedValues:h,expression:p,isPiPoint:v,hideError:g,summary:b,nodata:y,display:f,regex:S}=n;return d().createElement(d().Fragment,null,this.props.datasource.piPointConfig&&d().createElement(c.InlineField,{label:"Is Pi Point?",labelWidth:N},d().createElement(c.InlineSwitch,{value:v,onChange:this.onIsPiPointChange})),!!o&&d().createElement(c.InlineFieldRow,null,d().createElement(c.InlineField,{label:"Raw Query",labelWidth:N,grow:!0},d().createElement(c.Input,{onBlur:this.stateCallback,value:s,onChange:e=>t(B(T({},n),{query:e.target.value})),placeholder:"enter query"})),d().createElement(j,{isRaw:!0,onChange:e=>this.textEditorChanged()})),!o&&d().createElement(d().Fragment,null,d().createElement("div",{className:"gf-form-inline"},d().createElement(x,{label:v?"PI Server":"AF Elements",tooltip:v?"Select PI server.":"Select AF Element."},this.state.segments.map(((e,t)=>d().createElement(c.SegmentAsync,{key:"element-"+t,Component:d().createElement(R,{value:e.value,label:e.label}),onChange:e=>this.onSegmentChange(e,t),loadOptions:e=>this.getElementSegments(t),allowCustomValue:!0,inputMinWidth:200}))),d().createElement(P,null),!v&&d().createElement(j,{isRaw:!1,onChange:e=>{t(B(T({},n),{query:n.target,rawQuery:e}))}}))),d().createElement(w,{label:v?"Pi Points":"Attributes"},this.state.attributes.map(((e,t)=>v?d().createElement(c.SegmentAsync,{key:"attributes-"+t,Component:d().createElement(R,{value:e.value,label:e.label}),disabled:0===this.piServer.length,onChange:e=>this.onPiPointChange(e,t),loadOptions:this.getAttributeSegmentsPI,reloadOptionsOnChange:!0,allowCustomValue:!0,inputMinWidth:q}):d().createElement(c.Segment,{key:"attributes-"+t,Component:d().createElement(R,{value:e.value,label:e.label}),disabled:this.state.segments.length<=2,onChange:e=>this.onAttributeChange(e,t),options:this.getAttributeSegmentsAF(),allowCustomValue:!0,inputMinWidth:q}))),v&&d().createElement(c.SegmentAsync,{Component:d().createElement(R,{value:this.state.attributeSegment.value,label:this.state.attributeSegment.label}),disabled:0===this.piServer.length,onChange:this.onAttributeAction,loadOptions:this.getAttributeSegmentsPI,reloadOptionsOnChange:!0,allowCustomValue:!0,inputMinWidth:q}),!v&&d().createElement(c.Segment,{Component:d().createElement(R,{value:this.state.attributeSegment.value,label:this.state.attributeSegment.label}),disabled:this.state.segments.length<=2,onChange:this.onAttributeAction,options:this.getAttributeSegmentsAF(),allowCustomValue:!0,inputMinWidth:q}))),d().createElement(c.InlineFieldRow,null,d().createElement(c.InlineField,{label:"Calculation",grow:!0,labelWidth:N,tooltip:"Modify all attributes by an equation. Use '.' for current item. Leave Attributes empty if you wish to perform element based calculations."},d().createElement(c.Input,{onBlur:a,value:p,onChange:e=>t(B(T({},n),{expression:e.target.value})),placeholder:"'.'*2"}))),d().createElement(c.InlineFieldRow,null,d().createElement(c.InlineField,{label:"Use Last Value",tooltip:"Fetch only last value from time range",labelWidth:N},d().createElement(c.InlineSwitch,{value:l.enable,onChange:()=>this.onChange(B(T({},n),{useLastValue:B(T({},l),{enable:!l.enable})}))})),d().createElement(c.InlineField,{label:"Digital States",labelWidth:N},d().createElement(c.InlineSwitch,{value:u.enable,onChange:()=>this.onChange(B(T({},n),{digitalStates:B(T({},u),{enable:!u.enable})}))})),d().createElement(c.InlineField,{label:"Replace Bad Data",labelWidth:N,tooltip:"Replacement for bad quality values."},d().createElement(c.Segment,{Component:d().createElement(R,{width:96,value:{value:y},label:y}),onChange:this.calcNoDataValueChanged,options:this.getNoDataSegments(),allowCustomValue:!0})),d().createElement(c.InlineField,{label:"Ignore API Error?",labelWidth:N},d().createElement(c.InlineSwitch,{value:g,onChange:this.onHideErrorChange})),this.props.datasource.useUnitConfig&&d().createElement(c.InlineField,{label:"Use unit from datapoints",tooltip:"Use unit in label from PI tag or PI AF attribute",labelWidth:N},d().createElement(c.InlineSwitch,{value:r.enable,onChange:()=>this.onChange(B(T({},n),{useUnit:B(T({},r),{enable:!r.enable})}))})),this.props.datasource.useStreaming&&d().createElement(c.InlineField,{label:"Enable Streaming",labelWidth:N,tooltip:"Enable streaming data if it is supported for the point type."},d().createElement(c.InlineSwitch,{value:m.enable,onChange:()=>this.onChange(B(T({},n),{enableStreaming:B(T({},m),{enable:!m.enable})}))}))),(i.enable||!l.enable&&!h.enable)&&d().createElement(c.InlineFieldRow,null,d().createElement(c.InlineField,{label:p?"Interval Values":"Interpolate",labelWidth:N},d().createElement(c.InlineSwitch,{value:i.enable,onChange:()=>this.onChange(B(T({},n),{interpolate:B(T({},i),{enable:!i.enable,interval:void 0})}))})),d().createElement(c.InlineField,{disabled:!i.enable,label:p?"Interval Period":"Interpolate Period",labelWidth:N,tooltip:"Override time between sampling, e.g. '30s'. Defaults to timespan/chart width."},d().createElement(c.Input,{onBlur:a,width:30.633375,value:i.interval,onChange:e=>t(B(T({},n),{interpolate:B(T({},i),{interval:e.target.value})})),placeholder:"30s"}))),(h.enable||!l.enable&&!i.enable)&&d().createElement(c.InlineFieldRow,null,d().createElement(c.InlineField,{label:"Recorded Values",labelWidth:N},d().createElement(c.InlineSwitch,{value:h.enable,onChange:()=>this.onChange(B(T({},n),{recordedValues:B(T({},h),{enable:!h.enable,maxNumber:void 0,boundaryType:"Inside"})}))})),d().createElement(c.InlineField,{disabled:!(null==h?void 0:h.enable),label:"Max Recorded Values",labelWidth:N,tooltip:"Maximum number of recorded value to retrive from the data archive, without using interpolation."},d().createElement(c.Input,{onBlur:a,width:30.633375,value:h.maxNumber,onChange:e=>t(B(T({},n),{recordedValues:B(T({},h),{maxNumber:parseInt(e.target.value,10)})})),type:"number",placeholder:"1000"})),d().createElement(c.InlineField,{disabled:!(null==h?void 0:h.enable),label:"Boundary Type",labelWidth:N,tooltip:"Defines the behavior of data retrieval at the end points of a specified time range."},d().createElement(c.Segment,{Component:d().createElement(R,{width:96,value:{value:null==h?void 0:h.boundaryType},label:null==h?void 0:h.boundaryType}),onChange:this.recordedBoundaryTypeValueChanged,options:this.getRecordedBoundaryTypeSegments(),allowCustomValue:!0}))),!l.enable&&d().createElement(c.InlineFieldRow,null,d().createElement(c.InlineField,{label:"Summary Enable",labelWidth:N},d().createElement(c.InlineSwitch,{value:null==b?void 0:b.enable,onChange:()=>this.onChange(B(T({},n),{summary:B(T({},b),{enable:!(null==b?void 0:b.enable)})}))})),d().createElement(c.InlineField,{disabled:!(null==b?void 0:b.enable),label:"Summary Basis",labelWidth:N,tooltip:"Defines the possible calculation options when performing summary calculations over time-series data."},d().createElement(c.Segment,{Component:d().createElement(R,{width:245.067,marginRight:"0",value:{value:null==b?void 0:b.basis},label:null==b?void 0:b.basis}),onChange:this.calcBasisValueChanged,options:this.getCalcBasisSegments(),allowCustomValue:!0})),d().createElement(c.InlineField,{disabled:!(null==b?void 0:b.enable),label:"Summaries Types",labelWidth:N,tooltip:"PI Web API summary options."},d().createElement(c.InlineFieldRow,null,this.state.summaries.map(((e,t)=>d().createElement(c.Segment,{key:"summaries-"+t,Component:d().createElement(R,{value:e.value,label:e.label}),onChange:e=>this.onSummaryValueChanged(e,t),options:this.getSummarySegments(),allowCustomValue:!0}))),d().createElement(c.Segment,{Component:d().createElement(R,{value:this.state.summarySegment.value,label:this.state.summarySegment.label}),onChange:this.onSummaryAction,options:this.getSummarySegments(),allowCustomValue:!0})))),(null==b?void 0:b.enable)&&d().createElement(c.InlineFieldRow,null,d().createElement(c.InlineField,{label:"Enable interval",labelWidth:N,tooltip:"Enable summary type interval."},d().createElement(c.InlineSwitch,{value:!!(null==b?void 0:b.sampleTypeInterval),onChange:()=>this.onChange(B(T({},n),{summary:B(T({},b),{sampleTypeInterval:!(null==b?void 0:b.sampleTypeInterval)})}))})),d().createElement(c.InlineField,{disabled:!b.sampleTypeInterval,label:"Sample Interval",labelWidth:N,tooltip:"A time span specifies how often the filter expression is evaluated when computing the summary for an interval, if the sampleType is enable."},d().createElement(c.Input,{onBlur:a,width:30.633375,value:null==b?void 0:b.sampleInterval,onChange:e=>t(B(T({},n),{summary:B(T({},b),{sampleInterval:e.target.value})})),placeholder:"30s"})),d().createElement(c.InlineField,{label:"Summary Period",labelWidth:N,tooltip:"The duration of each summary interval, e.g. '30s'."},d().createElement(c.Input,{onBlur:a,width:30.633375,value:null==b?void 0:b.duration,onChange:e=>t(B(T({},n),{summary:B(T({},b),{duration:e.target.value})})),placeholder:"30s"}))),d().createElement(c.InlineFieldRow,null,d().createElement(c.InlineField,{label:"Display Name",labelWidth:N,tooltip:"If single attribute, modify display name. Otherwise use regex to modify display name."},d().createElement(c.Input,{onBlur:a,width:30.633375,value:f,onChange:e=>t(B(T({},n),{display:e.target.value})),placeholder:"Display"})),d().createElement(c.InlineField,{label:"Enable Regex Replace",labelWidth:N},d().createElement(c.InlineSwitch,{value:S.enable,onChange:()=>{this.onChange(B(T({},n),{regex:B(T({},S),{enable:!S.enable})}))}})),d().createElement(c.InlineField,{label:"Search",labelWidth:N},d().createElement(c.Input,{onBlur:a,width:N,value:S.search,onChange:e=>t(B(T({},n),{regex:B(T({},S),{search:e.target.value})})),placeholder:"(.*)"})),d().createElement(c.InlineField,{label:"Replace",labelWidth:N},d().createElement(c.Input,{onBlur:a,width:N,value:S.replace,onChange:e=>t(B(T({},n),{regex:B(T({},S),{replace:e.target.value})})),placeholder:"$1"}))))}constructor(e){super(e),V(this,"error",void 0),V(this,"piServer",[]),V(this,"availableAttributes",{}),V(this,"summaryTypes",void 0),V(this,"calculationBasis",void 0),V(this,"recordedBoundaryTypes",void 0),V(this,"noDataReplacement",void 0),V(this,"state",{isPiPoint:!1,hideError:!1,segments:[],attributes:[],summaries:[],attributeSegment:{},summarySegment:{},calculationBasisSegment:{},noDataReplacementSegment:{}}),V(this,"segmentChangeValue",(e=>{const t=this.props.query;this.setState({segments:e},(()=>this.onChange(B(T({},t),{segments:e}))))})),V(this,"attributeChangeValue",(e=>{const t=this.props.query;return new Promise((a=>this.setState({attributes:e},(()=>{this.onChange(B(T({},t),{attributes:e})),a()}))))})),V(this,"onPiPointChange",((e,t)=>{let a=this.state.attributes.slice(0);e.label===k?(0,E.remove)(a,((e,a)=>a===t)):a[t]=e,this.checkPiPointSegments(e,a)})),V(this,"onAttributeChange",((e,t)=>{var a;let n=this.state.attributes.slice(0);n[t].label!==(null===(a=e.value)||void 0===a?void 0:a.value)&&(n[t]=e,this.checkAttributeSegments(n,this.state.segments))})),V(this,"onSegmentChange",((e,t)=>{var a;const{query:n}=this.props;let l=this.state.segments.slice(0);if(null!==e.value&&"object"!=typeof e.value&&!Array.isArray(e.value)){const t=String(e.value);e.value={type:t.match(/\${\w+}/gi)?"template":void 0,value:t}}l[t].label!==(null===(a=e.value)||void 0===a?void 0:a.value)&&this.setState({attributes:[]},(()=>e.label===k?(l=(0,E.slice)(l,0,t),void this.checkAttributeSegments([],l).then((()=>{var e;0===l.length?l.push({label:""}):(null===(e=l[l.length-1].value)||void 0===e?void 0:e.expandable)&&l.push({label:"Select Element",value:{value:"-Select Element-"}}),n.isPiPoint&&(this.piServer=[]),this.segmentChangeValue(l)}))):(l[t]=e,n.isPiPoint?(this.piServer.push(e),void this.segmentChangeValue(l)):(t{var a,n;return"template"===(null===(a=e.value)||void 0===a?void 0:a.type)?this.getElementSegments(l.length+1,l).then((e=>(e.length>0&&(l[t].value.expandable=!0,l.push({label:"Select Element",value:{value:"-Select Element-"}})),this.segmentChangeValue(l),l))):((null===(n=e.value)||void 0===n?void 0:n.expandable)&&l.push({label:"Select Element",value:{value:"-Select Element-"}}),new Promise((e=>{this.segmentChangeValue(l),e(l)})))}))))))})),V(this,"getElementSegments",((e,t)=>{var a;const{datasource:n,query:l,data:r}=this.props,i=this,s=l.isPiPoint?{type:"dataserver"}:{path:this.getSegmentPathUpTo(null!=t?t:this.state.segments.slice(0),e),afServerWebId:this.state.segments.length>0&&this.state.segments[0].value?this.state.segments[0].value.webId:void 0};if(!l.isPiPoint){var o,u,m;if((null===(o=n.afserver)||void 0===o?void 0:o.name)&&0===e)return Promise.resolve([{label:n.afserver.name,value:{value:n.afserver.name,expandable:!0}}]);if((null===(u=n.afserver)||void 0===u?void 0:u.name)&&(null===(m=n.afdatabase)||void 0===m?void 0:m.name)&&1===e)return Promise.resolve([{label:n.afdatabase.name,value:{value:n.afdatabase.name,expandable:!0}}])}var h;return n.metricFindQuery(s,Object.assign(null!==(h=null==r||null===(a=r.request)||void 0===a?void 0:a.scopedVars)&&void 0!==h?h:{},{isPiPoint:l.isPiPoint})).then((e=>{const t=(0,E.map)(e,(e=>({label:e.text,value:{webId:e.WebId,value:e.text,expandable:!l.isPiPoint&&e.expandable}})));if(0===t.length)return t;const a=n.templateSrv.getVariables();return(0,E.each)(a,(e=>{let a={label:"${"+e.name+"}",value:{type:"template",value:"${"+e.name+"}",expandable:!l.isPiPoint}};t.unshift(a)})),t.unshift({label:k,value:{value:k}}),t})).catch((e=>(i.error=e.message||"Failed to issue metric query",[])))})),V(this,"getAttributeSegmentsPI",(e=>{var t;const{datasource:a,query:n,data:l}=this.props,r=this,i={path:"",webId:this.getSelectedPIServer(),pointName:(null!=e?e:"")+"*",type:"pipoint"};let s=[];var o;return a.metricFindQuery(i,Object.assign(null!==(o=null==l||null===(t=l.request)||void 0===t?void 0:t.scopedVars)&&void 0!==o?o:{},{isPiPoint:n.isPiPoint})).then((t=>{s=(0,E.map)(t,(e=>({path:e.Path,label:e.text,value:{value:e.text,expandable:!1}}))),e&&e.length>0&&s.unshift({label:e,value:{value:e,expandable:!1}});const l=a.templateSrv.getVariables();return(0,E.each)(l,(e=>{let t={label:"${"+e.name+"}",value:{type:"template",value:"${"+e.name+"}",expandable:!n.isPiPoint}};s.unshift(t)})),s.unshift({label:k,value:{value:k}}),s})).catch((e=>(r.error=e.message||"Failed to issue metric query",s)))})),V(this,"getAttributeSegmentsAF",(e=>{const{datasource:t}=this.props;let a=[];a.push({label:k,value:{value:k}});const n=t.templateSrv.getVariables();return(0,E.each)(n,(e=>{let t={label:"${"+e.name+"}",value:{type:"template",value:"${"+e.name+"}",expandable:!1}};a.push(t)})),(0,E.forOwn)(this.availableAttributes,((e,t)=>{let n={label:t,value:{value:t,expandable:!0}};a.push(n)})),a})),V(this,"buildFromTarget",((e,t,a)=>{const n=e.target.split(";"),l=n.length>0?n[0].split("\\"):[];return l.length>1||1===l.length&&""!==l[0]?(n.splice(0,1),(0,E.each)(l,((e,a)=>{t.push({label:e,value:{type:e.match(/\${\w+}/gi)?"template":void 0,value:e,expandable:!0}})})),(0,E.each)(n,((e,t)=>{""!==e&&a.push({label:e,value:{type:e.match(/\${\w+}/gi)?"template":void 0,value:e,expandable:!1}})})),this.getElementSegments(l.length+1,t).then((e=>(e.length>0&&t.push({label:"Select Element",value:{value:"-Select Element-"}}),t)))):Promise.resolve(t)})),V(this,"checkAfServer",(()=>{var e;const{datasource:t}=this.props,a=[];var n;return(null===(e=t.afserver)||void 0===e?void 0:e.name)?(a.push({label:t.afserver.name,value:{value:t.afserver.name,expandable:!0}}),(null===(n=t.afdatabase)||void 0===n?void 0:n.name)&&a.push({label:t.afdatabase.name,value:{value:t.afdatabase.name,expandable:!0}}),a.push({label:"Select Element",value:{value:"-Select Element-"}})):a.push({label:""}),a})),V(this,"updateArray",((e,t,a,n,l)=>{this.setState({segments:e,attributes:t,summaries:a,isPiPoint:n},(()=>{n||this.checkAttributeSegments(t,this.state.segments).then((()=>{l&&l()}))}))})),V(this,"scopedVarsDone",!1),V(this,"componentDidMount",(()=>{this.initialLoad(!1)})),V(this,"componentDidUpdate",(()=>{var e,t,a;const{query:n}=this.props;"Done"===(null===(e=this.props.data)||void 0===e?void 0:e.state)&&(null===(a=this.props.data)||void 0===a||null===(t=a.request)||void 0===t?void 0:t.scopedVars)&&!this.scopedVarsDone&&(this.scopedVarsDone=!0,this.initialLoad(!n.isPiPoint))})),V(this,"initialLoad",(e=>{const{query:t}=this.props,a=(0,E.defaults)(t,D),{segments:n,attributes:l,summary:r,isPiPoint:i}=a;var s;let o=e?[]:null!==(s=null==n?void 0:n.slice(0))&&void 0!==s?s:[];var u;let m=e?[]:null!==(u=null==l?void 0:l.slice(0))&&void 0!==u?u:[],h=A(r);if(i||0!==o.length)i&&o.length>0&&(this.piServer=o);else{if(t.target&&t.target.length>0&&";"!==t.target)return m=[],void this.buildFromTarget(t,o,m).then((e=>{this.updateArray(e,m,h,!1)})).catch((e=>console.error(e)));o=this.checkAfServer()}this.updateArray(o,m,h,!!i,(()=>{this.onChange(t)}))})),V(this,"onChange",(e=>{const{onChange:t,onRunQuery:a}=this.props;var n,l;if(e.rawQuery){if(e.target=null!==(n=e.query)&&void 0!==n?n:"",e.query){const{attributes:t,elementPath:a}=function(e){const t=e.split(";"),a=t[0].split("\\");t.splice(0,1);let n=[];if(a.length>1||1===a.length&&""!==a[0]){const e=a.join("\\");return(0,E.each)(t,(function(e,t){""!==e&&n.push({label:e,value:{value:e,expandable:!1}})})),{attributes:n,elementPath:e}}return{attributes:n,elementPath:null}}(e.target);e.attributes=t,e.elementPath=a}}else e.elementPath=this.getSegmentPathUpTo(this.state.segments,this.state.segments.length),e.target=e.elementPath+";"+(0,E.join)(null===(l=e.attributes)||void 0===l?void 0:l.map((e=>{var t;return null===(t=e.value)||void 0===t?void 0:t.value})),";");const r=T({},D.summary,e.summary);r&&(r.types=this.state.summaries),t(B(T({},e),{summary:r})),this.isValidQuery(e)&&a()})),V(this,"isValidQuery",(e=>{if(e.target&&e.target.length>0&&";"!==e.target){e.target=e.target.trim();const t=e.target.split(";",2);return 2===t.length&&t[0].length>0&&t[1].length>0}return!1})),V(this,"stateCallback",(()=>{const e=this.props.query;this.onChange(e)})),V(this,"onIsPiPointChange",(e=>{const{query:t}=this.props,a=!t.isPiPoint;this.setState({segments:a?[{label:""}]:this.checkAfServer(),attributes:[],isPiPoint:a},(()=>{this.onChange(B(T({},t),{expression:"",attributes:this.state.attributes,segments:this.state.segments,isPiPoint:a}))}))})),V(this,"onHideErrorChange",(e=>{const{query:t}=this.props,a=!t.hideError;this.setState({hideError:a},(()=>{this.onChange(B(T({},t),{hideError:a}))}))})),this.onSegmentChange=this.onSegmentChange.bind(this),this.calcBasisValueChanged=this.calcBasisValueChanged.bind(this),this.recordedBoundaryTypeValueChanged=this.recordedBoundaryTypeValueChanged.bind(this),this.calcNoDataValueChanged=this.calcNoDataValueChanged.bind(this),this.onSummaryAction=this.onSummaryAction.bind(this),this.onSummaryValueChanged=this.onSummaryValueChanged.bind(this),this.onAttributeAction=this.onAttributeAction.bind(this),this.onAttributeChange=this.onAttributeChange.bind(this),this.summaryTypes=["Total","Average","Minimum","Maximum","Range","StdDev","PopulationStdDev","Count","PercentGood","All","AllForNonNumeric"],this.calculationBasis=["TimeWeighted","EventWeighted","TimeWeightedContinuous","TimeWeightedDiscrete","EventWeightedExcludeMostRecentEvent","EventWeightedExcludeEarliestEvent","EventWeightedIncludeBothEnds"],this.recordedBoundaryTypes=["Inside","Outside","Interpolated"],this.noDataReplacement=["Null","Drop","Previous","0","Keep"]}}var M=o(269),Q=o(531);function $(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function L(e){for(var t=1;t{const t=u.target;if(t&&t[e])return{label:t[e].Name,value:t[e]}};var S;return o.getAssetServer(o.afserver.name).then((e=>{g(e.WebId)})),d().createElement(d().Fragment,null,d().createElement("div",{className:"gf-form-group"},d().createElement(c.InlineFieldRow,null,d().createElement(c.InlineField,{label:"Database",labelWidth:H,grow:!0},d().createElement(c.AsyncSelect,{key:null!=v?v:"database-key",loadOptions:()=>o.getDatabases(v).then((e=>e.map((e=>({label:e.Name,value:e}))))),loadingMessage:"Loading",value:E("database"),onChange:e=>{f(e.value),m(G(L({},s),{database:e.value,template:void 0}))},defaultOptions:!0})),d().createElement(c.InlineField,{label:"Event Frames",labelWidth:H,grow:!0},d().createElement(c.AsyncSelect,{key:null!==(S=null==y?void 0:y.WebId)&&void 0!==S?S:"default-template-key",loadOptions:()=>o.getEventFrameTemplates(null==y?void 0:y.WebId).then((e=>e.map((e=>({label:e.Name,value:e}))))),loadingMessage:"Loading",value:E("template"),onChange:e=>m(G(L({},s),{template:e.value})),defaultOptions:!0})),d().createElement(c.InlineField,{label:"Show Start and End Time",labelWidth:H,grow:!0},d().createElement(c.InlineSwitch,{value:!!s.showEndTime,onChange:e=>m(G(L({},s),{showEndTime:e.currentTarget.checked}))}))),d().createElement(c.InlineFieldRow,null,d().createElement(c.InlineField,{label:"Category name",labelWidth:H,grow:!0},d().createElement(c.Input,{type:"text",value:s.categoryName,onBlur:e=>p(),onChange:e=>m(G(L({},s),{categoryName:e.currentTarget.value})),placeholder:"Enter category name"})),d().createElement(c.InlineField,{label:"Name Filter",labelWidth:H,grow:!0},d().createElement(c.Input,{type:"text",value:s.nameFilter,onBlur:e=>p(),onChange:e=>m(G(L({},s),{nameFilter:e.currentTarget.value})),placeholder:"Enter name filter"}))),d().createElement(c.InlineFieldRow,null,d().createElement(c.InlineField,{label:"Enable Name Regex Replacement",labelWidth:H,grow:!1},d().createElement(c.InlineSwitch,{value:null===(a=s.regex)||void 0===a?void 0:a.enable,onChange:e=>m(G(L({},s),{regex:G(L({},s.regex),{enable:e.currentTarget.checked})}))})),d().createElement(c.InlineField,{label:"Name Filter",labelWidth:20,grow:!1},d().createElement(c.Input,{type:"text",value:null===(n=s.regex)||void 0===n?void 0:n.search,onBlur:e=>p(),onChange:e=>m(G(L({},s),{regex:G(L({},s.regex),{search:e.currentTarget.value})})),placeholder:"(.*)",width:50})),d().createElement(c.InlineField,{label:"Replace",labelWidth:20,grow:!0},d().createElement(c.Input,{type:"text",value:null==s||null===(l=s.regex)||void 0===l?void 0:l.replace,onBlur:e=>p(),onChange:e=>m(G(L({},s),{regex:G(L({},s.regex),{replace:e.currentTarget.value})})),placeholder:"$1"}))),d().createElement(c.InlineFieldRow,null,d().createElement(c.InlineField,{label:"Enable Attribute Usage",labelWidth:H,grow:!1},d().createElement(c.InlineSwitch,{value:null===(r=s.attribute)||void 0===r?void 0:r.enable,onChange:e=>m(G(L({},s),{attribute:G(L({},s.attribute),{enable:e.currentTarget.checked})}))})),d().createElement(c.InlineField,{label:"Attribute Name",labelWidth:H,grow:!0},d().createElement(c.Input,{type:"text",value:null===(i=s.attribute)||void 0===i?void 0:i.name,onBlur:e=>p(),onChange:e=>m(G(L({},s),{attribute:G(L({},s.attribute),{name:e.currentTarget.value})})),placeholder:"Enter name"})))))}));function Y(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function J(e){for(var t=1;te.substring(1,e.length-2).split(",")[0]))),e.filter=null!==(l=e.filter)&&void 0!==l?l:"*",e.max=null!==(r=e.max)&&void 0!==r?r:1e4,"servers"===e.type?(null===(i=a.afserver)||void 0===i?void 0:i.name)?a.getAssetServer(a.afserver.name).then((e=>[e])).then(W):a.getAssetServers().then(W):"databases"===e.type&&e.afServerWebId?a.getDatabases(e.afServerWebId,{}).then(W):"databases"===e.type?a.getAssetServer(e.path).then((e=>{var t;return a.getDatabases(null!==(t=e.WebId)&&void 0!==t?t:"",{})})).then(W):"databaseElements"===e.type?a.getDatabase(e.path).then((e=>{var t;return a.getDatabaseElements(null!==(t=e.WebId)&&void 0!==t?t:"",{selectedFields:"Items.WebId%3BItems.Name%3BItems.Items%3BItems.Path%3BItems.HasChildren"})})).then(W):"elements"===e.type?a.getElement(e.path).then((t=>{var n;return a.getElements(null!==(n=t.WebId)&&void 0!==n?n:"",{selectedFields:"Items.Description%3BItems.WebId%3BItems.Name%3BItems.Items%3BItems.Path%3BItems.HasChildren",nameFilter:e.filter})})).then(W):"attributes"===e.type?a.getElement(e.path).then((t=>{var n;return a.getAttributes(null!==(n=t.WebId)&&void 0!==n?n:"",{searchFullHierarchy:"true",selectedFields:"Items.Type%3BItems.DefaultUnitsName%3BItems.Description%3BItems.WebId%3BItems.Name%3BItems.Path",nameFilter:e.filter,maxCount:e.max})})).then(W):"dataserver"===e.type?a.getDataServers().then(W):"pipoint"===e.type?a.piPointSearch(e.webId,e.pointName).then(W):Promise.reject("Bad type")}buildQueryParameters(e){return e.targets=(0,E.filter)(e.targets,(e=>{var t;return!(!e||!e.target||0===(null===(t=e.attributes)||void 0===t?void 0:t.length)||";"===e.target||e.hide||e.target.startsWith("Select AF"))})),e.maxDataPoints&&(e.maxDataPoints=e.maxDataPoints>3e4?3e4:e.maxDataPoints),e.targets=(0,E.map)(e.targets,(t=>{var a;const n={enableStreaming:t.enableStreaming,target:this.templateSrv.replace(t.target,e.scopedVars),elementPath:this.templateSrv.replace(t.elementPath,e.scopedVars),attributes:(0,E.map)(t.attributes,(t=>(t.value&&(t.value.value=this.templateSrv.replace(t.value.value,e.scopedVars)),t))),segments:(0,E.map)(t.segments,(t=>(t.value&&(t.value.value=this.templateSrv.replace(t.value.value,e.scopedVars)),t))),isAnnotation:!!t.isAnnotation,display:t.display?this.templateSrv.replace(t.display,e.scopedVars):void 0,refId:t.refId,hide:t.hide,interpolate:t.interpolate?K(J({},t.interpolate),{interval:this.templateSrv.replace(t.interpolate.interval,e.scopedVars)}):{enable:!1},useLastValue:t.useLastValue||{enable:!1},useUnit:t.useUnit||{enable:!1},recordedValues:t.recordedValues||{enable:!1},digitalStates:t.digitalStates||{enable:!1},webid:null!==(a=t.webid)&&void 0!==a?a:"",regex:t.regex||{enable:!1},expression:t.expression||"",summary:t.summary||{enable:!1,types:[]},nodata:t.nodata,startTime:e.range.from,endTime:e.range.to,isPiPoint:!!t.isPiPoint,hideError:!!t.hideError,scopedVars:e.scopedVars};return n.expression&&(n.expression=this.templateSrv.replace(n.expression,e.scopedVars)),n.summary.enable&&(n.summary.duration=n.summary.duration?this.templateSrv.replace(n.summary.duration,e.scopedVars):n.summary.duration,n.summary.sampleTypeInterval=!!n.summary.sampleTypeInterval,n.summary.sampleInterval=n.summary.sampleInterval?this.templateSrv.replace(n.summary.sampleInterval,e.scopedVars):n.summary.sampleInterval),n.summary.types=A(n.summary),n})),e}eventFrameToAnnotation(e,t){const a=e.target,n=[],l=Intl.DateTimeFormat().resolvedOptions().locale;return t.forEach((e=>{let t=this.transformDataFrameToMap(e);for(let e=0;eStart: "+new Date(t.time[e]).toLocaleString(l)+"
End: ",t.timeEnd[e]?s+=new Date(t.timeEnd[e]).toLocaleString(l):s+="Eventframe is open";const o={time:t.time[e],timeEnd:a.showEndTime?t.timeEnd[e]:void 0,title:i,id:t.id[e],text:s,tags:["OSISoft PI"]};n.push(o)}})),n}transformDataFrameToMap(e){const t={};return e.fields.forEach((e=>{t[e.name]=e.values.toArray()})),t}restGet(e){return this.getResource(`${e}`).then((e=>e))}getDataServers(){return this.restGet("/dataservers").then((e=>{var t;return null!==(t=e.Items)&&void 0!==t?t:[]}))}getDataServer(e){return e?this.restGet("/dataservers?name="+e).then((e=>e)):Promise.resolve({})}getAssetServers(){return this.restGet("/assetservers").then((e=>{var t;return null!==(t=e.Items)&&void 0!==t?t:[]}))}getAssetServer(e){return e?this.restGet("/assetservers?path=\\\\"+e).then((e=>e)):Promise.resolve({})}getDatabase(e){return e?this.restGet("/assetdatabases?path=\\\\"+e).then((e=>e)):Promise.resolve({})}getDatabases(e,t){return e?this.restGet("/assetservers/"+e+"/assetdatabases").then((e=>{var t;return null!==(t=e.Items)&&void 0!==t?t:[]})):Promise.resolve([])}getElement(e){return e?this.restGet("/elements?path=\\\\"+e).then((e=>e)):Promise.resolve({})}getEventFrameTemplates(e){return e?this.restGet("/assetdatabases/"+e+"/elementtemplates?selectedFields=Items.InstanceType%3BItems.Name%3BItems.WebId").then((e=>{var t;return(0,E.filter)(null!==(t=e.Items)&&void 0!==t?t:[],(e=>"EventFrame"===e.InstanceType))})):Promise.resolve([])}getElementTemplates(e){return e?this.restGet("/assetdatabases/"+e+"/elementtemplates?selectedFields=Items.InstanceType%3BItems.Name%3BItems.WebId").then((e=>{var t;return(0,E.filter)(null!==(t=e.Items)&&void 0!==t?t:[],(e=>"Element"===e.InstanceType))})):Promise.resolve([])}getAttributes(e,t){let a="?"+(0,E.map)(t,((e,t)=>t+"="+e)).join("&");return"?"===a&&(a=""),this.restGet("/elements/"+e+"/attributes"+a).then((e=>{var t;return null!==(t=e.Items)&&void 0!==t?t:[]}))}getDatabaseElements(e,t){let a="?"+(0,E.map)(t,((e,t)=>t+"="+e)).join("&");return"?"===a&&(a=""),this.restGet("/assetdatabases/"+e+"/elements"+a).then((e=>{var t;return null!==(t=e.Items)&&void 0!==t?t:[]}))}getElements(e,t){let a="?"+(0,E.map)(t,((e,t)=>t+"="+e)).join("&");return"?"===a&&(a=""),this.restGet("/elements/"+e+"/elements"+a).then((e=>{var t;return null!==(t=e.Items)&&void 0!==t?t:[]}))}piPointSearch(e,t){let a=this.templateSrv.replace(t),n=`${a}`,l=!1;if(a!==t){const e=/\{(\w|,)+\}/g;let t;for(;null!==(t=e.exec(a));)t.index===e.lastIndex&&e.lastIndex++,t.forEach(((e,t)=>{0===t&&(a=a.replace(e,e.replace("{","(").replace("}",")").replace(",","|")),n=n.replace(e,"*"),l=!0)}))}return this.restGet("/dataservers/"+e+"/points?maxCount=100&nameFilter="+n).then((e=>e&&(null==e?void 0:e.Items)?l?e.Items.filter((e=>{var t;return null===(t=e.Name)||void 0===t?void 0:t.match(a)})):e.Items:[]))}constructor(e,t=(0,Q.getTemplateSrv)()){super(e),Y(this,"templateSrv",void 0),Y(this,"piserver",void 0),Y(this,"afserver",void 0),Y(this,"afdatabase",void 0),Y(this,"piPointConfig",void 0),Y(this,"newFormatConfig",void 0),Y(this,"useUnitConfig",void 0),Y(this,"useExperimental",void 0),Y(this,"useStreaming",void 0),this.templateSrv=t,this.piserver={name:(e.jsonData||{}).piserver,webid:void 0},this.afserver={name:(e.jsonData||{}).afserver,webid:void 0},this.afdatabase={name:(e.jsonData||{}).afdatabase,webid:void 0},this.piPointConfig=e.jsonData.pipoint||!1,this.newFormatConfig=e.jsonData.newFormat||!1,this.useUnitConfig=e.jsonData.useUnit||!1,this.useExperimental=e.jsonData.useExperimental||!1,this.useStreaming=e.jsonData.useStreaming||!1,this.annotations={QueryEditor:_,prepareQuery:e=>(e.target&&(e.target.queryType="Annotation",e.target.isAnnotation=!0),e.target),processEvents:(e,t)=>(0,M.of)(this.eventFrameToAnnotation(e,t))},Promise.all([this.getDataServer(this.piserver.name).then((e=>this.piserver.webid=e.WebId)),this.getAssetServer(this.afserver.name).then((e=>this.afserver.webid=e.WebId)),this.getDatabase(this.afserver.name&&this.afdatabase.name?this.afserver.name+"\\"+this.afdatabase.name:void 0).then((e=>this.afdatabase.webid=e.WebId))])}}const X=new m.DataSourcePlugin(z).setQueryEditor(U).setConfigEditor(f);return u})())); //# sourceMappingURL=module.js.map \ No newline at end of file diff --git a/dist/module.js.map b/dist/module.js.map index 1e8c839..c0f88b3 100644 --- a/dist/module.js.map +++ b/dist/module.js.map @@ -1 +1 @@ -{"version":3,"file":"module.js","mappings":"oIAAAA,EAAOC,QAAUC,C,UCAjBF,EAAOC,QAAUE,C,QCAjBH,EAAOC,QAAUG,C,UCAjBJ,EAAOC,QAAUI,C,UCAjBL,EAAOC,QAAUK,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AAiBtX,SAAS6B,eAAgB,EAE9DvB,KAAKmX,YAAc,CACjBC,YAAazG,EACb0G,aAAaC,IACPA,EAAKnV,SACPmV,EAAKnV,OAAOoV,UAAY,aACxBD,EAAKnV,OAAOiQ,cAAe,GAEtBkF,EAAKnV,QAEdqV,cAAe,CACbF,EACA3N,KAEO2I,EAAAA,EAAAA,IAAGtS,KAAKyX,uBAAuBH,EAAM3N,KAIhD6E,QAAQkJ,IAAI,CACV1X,KAAKiW,cAAcjW,KAAK2B,SAASgF,MAAMyD,MAAMZ,GAAyBxJ,KAAK2B,SAASwS,MAAQ3K,EAAOrD,QACnGnG,KAAKmR,eAAenR,KAAK8B,SAAS6E,MAAMyD,MAAMZ,GAAyBxJ,KAAK8B,SAASqS,MAAQ3K,EAAOrD,QACpGnG,KAAKiT,YACHjT,KAAK8B,SAAS6E,MAAQ3G,KAAKgC,WAAW2E,KAAO3G,KAAK8B,SAAS6E,KAAO,KAAO3G,KAAKgC,WAAW2E,UAAO5I,GAChGqM,MAAMZ,GAAyBxJ,KAAKgC,WAAWmS,MAAQ3K,EAAOrD,SAEpE,EChEK,MAAMwR,EAAS,IAAIC,EAAAA,iBACxB5F,GAEC6F,eAAejR,GACfkR,gBAAgBlY,G","sources":["webpack://gridprotectionalliance-osisoftpi-datasource/external amd \"@grafana/data\"","webpack://gridprotectionalliance-osisoftpi-datasource/external amd \"@grafana/runtime\"","webpack://gridprotectionalliance-osisoftpi-datasource/external amd \"@grafana/ui\"","webpack://gridprotectionalliance-osisoftpi-datasource/external amd \"lodash\"","webpack://gridprotectionalliance-osisoftpi-datasource/external amd \"react\"","webpack://gridprotectionalliance-osisoftpi-datasource/external amd \"rxjs\"","webpack://gridprotectionalliance-osisoftpi-datasource/webpack/bootstrap","webpack://gridprotectionalliance-osisoftpi-datasource/webpack/runtime/compat get default export","webpack://gridprotectionalliance-osisoftpi-datasource/webpack/runtime/define property getters","webpack://gridprotectionalliance-osisoftpi-datasource/webpack/runtime/hasOwnProperty shorthand","webpack://gridprotectionalliance-osisoftpi-datasource/webpack/runtime/make namespace object","webpack://gridprotectionalliance-osisoftpi-datasource/./config/ConfigEditor.tsx","webpack://gridprotectionalliance-osisoftpi-datasource/./components/Forms.tsx","webpack://gridprotectionalliance-osisoftpi-datasource/./types.ts","webpack://gridprotectionalliance-osisoftpi-datasource/./components/QueryEditorModeSwitcher.tsx","webpack://gridprotectionalliance-osisoftpi-datasource/./helper.ts","webpack://gridprotectionalliance-osisoftpi-datasource/./query/QueryEditor.tsx","webpack://gridprotectionalliance-osisoftpi-datasource/./query/AnnotationsQueryEditor.tsx","webpack://gridprotectionalliance-osisoftpi-datasource/./datasource.ts","webpack://gridprotectionalliance-osisoftpi-datasource/./module.ts"],"sourcesContent":["module.exports = __WEBPACK_EXTERNAL_MODULE__781__;","module.exports = __WEBPACK_EXTERNAL_MODULE__531__;","module.exports = __WEBPACK_EXTERNAL_MODULE__7__;","module.exports = __WEBPACK_EXTERNAL_MODULE__241__;","module.exports = __WEBPACK_EXTERNAL_MODULE__959__;","module.exports = __WEBPACK_EXTERNAL_MODULE__269__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import React, { ChangeEvent, PureComponent } from 'react';\nimport { LegacyForms, DataSourceHttpSettings, InlineField, InlineSwitch } from '@grafana/ui';\nimport { DataSourcePluginOptionsEditorProps, DataSourceJsonData, DataSourceSettings } from '@grafana/data';\nimport { PIWebAPIDataSourceJsonData } from '../types';\n\nconst { FormField } = LegacyForms;\n\ninterface Props extends DataSourcePluginOptionsEditorProps {}\n\nconst coerceOptions = (\n options: DataSourceSettings\n): DataSourceSettings => {\n return {\n ...options,\n jsonData: {\n ...options.jsonData,\n url: options.url,\n },\n };\n};\n\ninterface State {}\n\nexport class PIWebAPIConfigEditor extends PureComponent {\n onPIServerChange = (event: ChangeEvent) => {\n const { onOptionsChange, options } = this.props;\n const jsonData = {\n ...options.jsonData,\n piserver: event.target.value,\n };\n onOptionsChange({ ...options, jsonData });\n };\n\n onAFServerChange = (event: ChangeEvent) => {\n const { onOptionsChange, options } = this.props;\n const jsonData = {\n ...options.jsonData,\n afserver: event.target.value,\n };\n onOptionsChange({ ...options, jsonData });\n };\n\n onAFDatabaseChange = (event: ChangeEvent) => {\n const { onOptionsChange, options } = this.props;\n const jsonData = {\n ...options.jsonData,\n afdatabase: event.target.value,\n };\n onOptionsChange({ ...options, jsonData });\n };\n\n onHttpOptionsChange = (options: DataSourceSettings) => {\n const { onOptionsChange } = this.props;\n onOptionsChange(coerceOptions(options));\n };\n\n onPiPointChange = (event: ChangeEvent) => {\n const { onOptionsChange, options } = this.props;\n const jsonData = {\n ...options.jsonData,\n piserver: event.target.checked ? options.jsonData.piserver : '',\n pipoint: event.target.checked,\n };\n onOptionsChange({ ...options, jsonData });\n };\n\n onNewFormatChange = (event: ChangeEvent) => {\n const { onOptionsChange, options } = this.props;\n const jsonData = {\n ...options.jsonData,\n newFormat: event.target.checked,\n };\n onOptionsChange({ ...options, jsonData });\n };\n\n onUseUnitChange = (event: ChangeEvent) => {\n const { onOptionsChange, options } = this.props;\n const jsonData = {\n ...options.jsonData,\n useUnit: event.target.checked,\n };\n onOptionsChange({ ...options, jsonData });\n };\n\n onUseExperimentalChange = (event: ChangeEvent) => {\n const { onOptionsChange, options } = this.props;\n const jsonData = {\n ...options.jsonData,\n useExperimental : event.target.checked,\n useStreaming : event.target.checked ? options.jsonData.useStreaming : false,\n };\n onOptionsChange({ ...options, jsonData });\n };\n\n onUseStreamingChange = (event: ChangeEvent) => {\n const { onOptionsChange, options } = this.props;\n const jsonData = {\n ...options.jsonData,\n useStreaming: event.target.checked,\n };\n onOptionsChange({ ...options, jsonData });\n };\n\n render() {\n const { options: originalOptions } = this.props;\n const options = coerceOptions(originalOptions);\n\n return (\n
\n \n\n

Custom Configuration

\n\n
\n
\n \n \n \n
\n
\n \n \n \n
\n
\n \n \n \n
\n
\n \n \n \n
\n {options.jsonData.useExperimental && (\n
\n \n \n \n
\n )}\n
\n\n

PI/AF Connection Details

\n\n
\n {options.jsonData.pipoint && (\n
\n \n
\n )}\n
\n \n
\n
\n \n
\n
\n
\n );\n }\n}\n","import React, { InputHTMLAttributes, FunctionComponent } from 'react';\nimport { InlineFormLabel } from '@grafana/ui';\n\nexport interface Props extends InputHTMLAttributes {\n label: string;\n tooltip?: string;\n labelWidth?: number;\n children?: React.ReactNode;\n queryEditor?: JSX.Element;\n}\n\nexport const QueryField: FunctionComponent> = ({ label, labelWidth = 12, tooltip, children }) => (\n <>\n \n {label}\n \n {children}\n \n);\n\nexport const QueryRowTerminator = () => {\n return (\n
\n
\n
\n );\n};\n\nexport const QueryInlineField = ({ ...props }) => {\n return (\n \n \n \n );\n};\n\nexport const QueryEditorRow = (props: Partial) => {\n return (\n
\n {props.children}\n \n
\n );\n};\n\nexport const QueryRawInlineField = ({ ...props }) => {\n return (\n \n \n \n );\n};\n\nexport const QueryRawEditorRow = (props: Partial) => {\n return <>{props.children};\n};\n","import { DataQuery } from '@grafana/schema';\nimport { DataSourceJsonData, SelectableValue } from '@grafana/data';\n\nexport interface PiwebapiElementPath {\n path: string;\n variable: string;\n}\n\nexport interface PiwebapiInternalRsp {\n data: PiwebapiRsp;\n status: number;\n url: string;\n}\n\nexport interface PiwebapiRsp {\n Name?: string;\n InstanceType?: string;\n Items?: PiwebapiRsp[];\n WebId?: string;\n HasChildren?: boolean;\n Type?: string;\n DefaultUnitsName?: string;\n Description?: string;\n Path?: string;\n}\n\nexport interface PiDataServer {\n name: string | undefined;\n webid: string | undefined;\n}\n\nexport interface PIWebAPISelectableValue {\n webId?: string;\n value?: string;\n type?: string;\n expandable?: boolean;\n}\n\nexport interface PIWebAPIAnnotationsQuery extends DataQuery {\n target: string;\n}\n\nexport interface PIWebAPIQuery extends DataQuery {\n target?: string;\n elementPath?: string;\n attributes?: Array>;\n segments?: any[];\n isPiPoint?: boolean;\n hideError?: boolean;\n isAnnotation?: boolean;\n webid?: string;\n display?: any;\n interpolate?: any;\n recordedValues?: any;\n digitalStates?: any;\n enableStreaming: any;\n useLastValue?: any;\n useUnit?: any;\n regex?: any;\n nodata?: string,\n summary?: {\n enable?: boolean,\n types?: any[],\n basis?: string,\n duration?: string,\n sampleTypeInterval?: boolean,\n sampleInterval?: string\n };\n expression?: string;\n rawQuery?: boolean;\n query?: string;\n // annotations items\n database?: PiwebapiRsp;\n template?: PiwebapiRsp;\n showEndTime?: boolean;\n attribute?: any;\n nameFilter?: string;\n categoryName?: string;\n}\n\nexport const defaultQuery: Partial = {\n target: ';',\n attributes: [],\n segments: [],\n regex: { enable: false },\n nodata: 'Null',\n summary: {\n enable: false,\n types: [],\n basis: 'EventWeighted',\n duration: '',\n sampleTypeInterval: false,\n sampleInterval: ''\n },\n expression: '',\n interpolate: { enable: false },\n useLastValue: { enable: false },\n recordedValues: { enable: false, boundaryType: 'Inside' },\n digitalStates: { enable: false },\n enableStreaming: { enable: false },\n useUnit: { enable: false },\n isPiPoint: false,\n};\n\n/**\n * These are options configured for each DataSource instance\n */\nexport interface PIWebAPIDataSourceJsonData extends DataSourceJsonData {\n url?: string;\n access?: string;\n piserver?: string;\n afserver?: string;\n afdatabase?: string;\n pipoint?: boolean;\n newFormat?: boolean;\n useUnit?: boolean;\n useExperimental?: boolean;\n useStreaming?: boolean;\n}\n\n/**\n * Value that is used in the backend, but never sent over HTTP to the frontend\n */\nexport interface PIWebAPISecureJsonData {\n apiKey?: string;\n}\n","import React, { useEffect, useState } from 'react';\nimport { Button, ConfirmModal } from '@grafana/ui';\n\ntype Props = {\n isRaw: boolean;\n onChange: (newIsRaw: boolean) => void;\n};\n\nexport const QueryEditorModeSwitcher = ({ isRaw, onChange }: Props): JSX.Element => {\n const [isModalOpen, setModalOpen] = useState(false);\n\n useEffect(() => {\n // if the isRaw changes, we hide the modal\n setModalOpen(false);\n }, [isRaw]);\n\n if (isRaw) {\n return (\n <>\n {\n // we show the are-you-sure modal\n setModalOpen(true);\n }}\n >\n {\n onChange(false);\n }}\n onDismiss={() => {\n setModalOpen(false);\n }}\n />\n \n );\n } else {\n return (\n {\n onChange(true);\n }}\n >\n );\n }\n};\n","import { each, map } from 'lodash';\r\n\r\nimport {\r\n AnnotationQuery,\r\n DataFrame,\r\n TableData,\r\n MetricFindValue,\r\n Field,\r\n toDataFrame,\r\n} from '@grafana/data';\r\n\r\nimport { PiwebapiElementPath, PiwebapiRsp, PIWebAPIQuery } from 'types';\r\n\r\nexport function parseRawQuery(tr: string): any {\r\n const splitAttributes = tr.split(';');\r\n const splitElements = splitAttributes[0].split('\\\\');\r\n\r\n // remove element hierarchy from attribute collection\r\n splitAttributes.splice(0, 1);\r\n\r\n let attributes: any[] = [];\r\n if (splitElements.length > 1 || (splitElements.length === 1 && splitElements[0] !== '')) {\r\n const elementPath: string = splitElements.join('\\\\');\r\n each(splitAttributes, function (item, index) {\r\n if (item !== '') {\r\n attributes.push({\r\n label: item,\r\n value: {\r\n value: item,\r\n expandable: false,\r\n },\r\n });\r\n }\r\n });\r\n\r\n return { attributes, elementPath };\r\n }\r\n\r\n return { attributes, elementPath: null };\r\n}\r\n\r\nexport function lowerCaseFirstLetter(string: string): string {\r\n return string.charAt(0).toLocaleLowerCase() + string.slice(1);\r\n}\r\n\r\n/**\r\n * Builds the Grafana metric segment for use on the query user interface.\r\n *\r\n * @param {any} response - response from PI Web API.\r\n * @returns - Grafana metric segment.\r\n *\r\n * @memberOf PiWebApiDatasource\r\n */\r\nexport function metricQueryTransform(response: PiwebapiRsp[]): MetricFindValue[] {\r\n return map(response, (item) => {\r\n return {\r\n text: item.Name,\r\n expandable:\r\n item.HasChildren === undefined || item.HasChildren === true || (item.Path ?? '').split('\\\\').length <= 3,\r\n HasChildren: item.HasChildren,\r\n Items: item.Items ?? [],\r\n Path: item.Path,\r\n WebId: item.WebId,\r\n } as MetricFindValue;\r\n });\r\n}\r\n\r\n/**\r\n * Check if all items are selected.\r\n *\r\n * @param {any} current the current variable selection\r\n * @return {boolean} true if all value is selected, false otherwise\r\n */\r\nexport function isAllSelected(current: any): boolean {\r\n if (!current) {\r\n return false;\r\n }\r\n if (Array.isArray(current.text)) {\r\n return current.text.indexOf('All') >= 0;\r\n }\r\n return current.text === 'All';\r\n}\r\n\r\nexport function processAnnotationQuery(annon: AnnotationQuery,data: DataFrame[]): DataFrame[] {\r\n let processedFrames: DataFrame[] = [];\r\n \r\n data.forEach((d: DataFrame) => {\r\n d.fields.forEach((f: Field) => {\r\n\r\n // check if the label has been set, if it hasn't been set then the eventframe annotation is not valid. \r\n if (!f.labels) { \r\n return \r\n }\r\n\r\n if (!('eventframe' in f.labels)) {\r\n return;\r\n }\r\n\r\n let attribute = 'attribute' in f.labels\r\n\r\n // Check whether f.values is an array or not to allow for each.\r\n // Check whether f.values is an array or not to allow for each.\r\n if (Array.isArray(f.values)) {\r\n f.values.forEach((value: any) => {\r\n\r\n if (attribute) {\r\n let annotation = value['1'].Content\r\n let valueData: any[] = []\r\n for (let i = 2; i in value; i++) {\r\n valueData.push(value[i].Content.Items)\r\n }\r\n\r\n const processedFrame = convertToTableData(annotation.Items!, valueData).map((r) => {\r\n return toDataFrame(r)});\r\n processedFrames = processedFrames.concat(processedFrame);\r\n } else {\r\n let annotation = value['1'].Content\r\n const processedFrame = convertToTableData(annotation.Items!).map((r) => {\r\n return toDataFrame(r)});\r\n processedFrames = processedFrames.concat(processedFrame);\r\n }\r\n });\r\n } \r\n });\r\n });\r\n return processedFrames;\r\n}\r\n\r\nexport function convertToTableData(items: any[], valueData?: any[]): TableData[] {\r\n const response: TableData[] = items.map((item: any, index: number) => {\r\n const columns = [{ text: 'StartTime' }, { text: 'EndTime' }];\r\n const rows = [item.StartTime, item.EndTime];\r\n if (valueData) {\r\n for (let attributeIndex = 0; attributeIndex < valueData.length; attributeIndex++) {\r\n let attributeData = valueData[attributeIndex]\r\n let eventframeAributeData = attributeData[index].Content.Items\r\n eventframeAributeData.forEach((attribute: any) => {\r\n columns.push({ text: attribute.Name });\r\n rows.push(String(attribute.Value.Value ? attribute.Value.Value.Name || attribute.Value.Value.Value || attribute.Value.Value : ''));\r\n });\r\n }\r\n }\r\n\r\n return {\r\n name: item.Name,\r\n columns,\r\n rows: [rows],\r\n };\r\n });\r\n return response;\r\n}\r\n\r\n/**\r\n * Resolve PIWebAPI response 'value' data to value - timestamp pairs.\r\n *\r\n * @param {any} item - 'Item' object from PIWebAPI\r\n * @param {any} noDataReplacementMode - String state of how to replace 'No Data'\r\n * @param {any} grafanaDataPoint - Single Grafana value pair (value, timestamp).\r\n * @returns grafanaDataPoint - Single Grafana value pair (value, timestamp).\r\n * @returns perviousValue - {any} Grafana value (value only).\r\n *\r\n */\r\nexport function noDataReplace(\r\n item: any,\r\n noDataReplacementMode: any,\r\n grafanaDataPoint: any[]\r\n): {\r\n grafanaDataPoint: any[];\r\n previousValue: any;\r\n drop: boolean;\r\n} {\r\n let previousValue = null;\r\n let drop = false;\r\n if (!item.Good || item.Value === 'No Data' || (item.Value?.Name && item.Value?.Name === 'No Data')) {\r\n if (noDataReplacementMode === 'Drop') {\r\n drop = true;\r\n } else if (noDataReplacementMode === '0') {\r\n grafanaDataPoint[0] = 0;\r\n } else if (noDataReplacementMode === 'Keep') {\r\n // Do nothing keep\r\n } else if (noDataReplacementMode === 'Null') {\r\n grafanaDataPoint[0] = null;\r\n } else if (noDataReplacementMode === 'Previous' && previousValue !== null) {\r\n grafanaDataPoint[0] = previousValue;\r\n }\r\n } else {\r\n previousValue = item.Value;\r\n }\r\n return { grafanaDataPoint, previousValue, drop };\r\n}\r\n\r\n/**\r\n * Check if the value is a number.\r\n *\r\n * @param {any} number the value to check\r\n * @returns {boolean} true if the value is a number, false otherwise\r\n */\r\nexport function checkNumber(number: any): boolean {\r\n return typeof number === 'number' && !Number.isNaN(number) && Number.isFinite(number);\r\n}\r\n\r\n/**\r\n * Returns the last item of the element path.\r\n *\r\n * @param {string} path element path\r\n * @returns {string} last item of the element path\r\n */\r\nexport function getLastPath(path: string): string {\r\n let splitPath = path.split('|');\r\n if (splitPath.length === 0) {\r\n return '';\r\n }\r\n splitPath = splitPath[0].split('\\\\');\r\n return splitPath.length === 0 ? '' : splitPath.pop() ?? '';\r\n}\r\n\r\n/**\r\n * Returns the last item of the element path plus variable.\r\n *\r\n * @param {PiwebapiElementPath[]} elementPathArray array of element paths\r\n * @param {string} path element path\r\n * @returns {string} last item of the element path\r\n */\r\nexport function getPath(elementPathArray: PiwebapiElementPath[], path: string): string {\r\n if (!path || elementPathArray.length === 0) {\r\n return '';\r\n }\r\n const splitStr = getLastPath(path);\r\n const foundElement = elementPathArray.find((e) => path.indexOf(e.path) >= 0)?.variable;\r\n return foundElement ? foundElement + '|' + splitStr : splitStr;\r\n}\r\n\r\n/**\r\n * Replace calculation dot in expression with PI point name.\r\n *\r\n * @param {boolean} replace - is pi point and calculation.\r\n * @param {PiwebapiRsp} webid - Pi web api response object.\r\n * @param {string} url - original url.\r\n * @returns Modified url\r\n */\r\nexport function getFinalUrl(replace: boolean, webid: PiwebapiRsp, url: string) {\r\n const newUrl = replace ? url.replace(/'\\.'/g, `'${webid.Name}'`) : url;\r\n return newUrl;\r\n}\r\n","import { each, filter, forOwn, join, reduce, map, slice, remove, defaults } from 'lodash';\n\nimport React, { PureComponent, ChangeEvent } from 'react';\nimport { Icon, InlineField, InlineFieldRow, InlineSwitch, Input, SegmentAsync, Segment } from '@grafana/ui';\nimport { QueryEditorProps, SelectableValue, TypedVariableModel } from '@grafana/data';\n\nimport { PiWebAPIDatasource } from '../datasource';\nimport { QueryInlineField, QueryRawInlineField, QueryRowTerminator } from '../components/Forms';\nimport { PIWebAPISelectableValue, PIWebAPIDataSourceJsonData, PIWebAPIQuery, defaultQuery } from '../types';\nimport { QueryEditorModeSwitcher } from 'components/QueryEditorModeSwitcher';\nimport { parseRawQuery } from 'helper';\nimport { types } from '@babel/core';\n\nconst LABEL_WIDTH = 24;\nconst LABEL_SWITCH_WIDTH = 49.067 / 8.0;\nconst MIN_ELEM_INPUT_WIDTH = 200;\nconst MIN_ATTR_INPUT_WIDTH = 250;\n\ninterface State {\n isPiPoint: boolean;\n hideError: boolean;\n segments: Array>;\n attributes: Array>;\n summaries: Array>;\n attributeSegment: SelectableValue;\n summarySegment: SelectableValue;\n calculationBasisSegment: SelectableValue;\n noDataReplacementSegment: SelectableValue;\n}\n\ntype Props = QueryEditorProps;\n\nconst REMOVE_LABEL = '-REMOVE-';\n\nconst CustomLabelComponent = (props: any) => {\n if (props.value) {\n return (\n
\n {props.label ?? '--no label--'}\n
\n );\n }\n return (\n \n \n \n );\n};\n\nexport class PIWebAPIQueryEditor extends PureComponent {\n error: any;\n piServer: any[] = [];\n availableAttributes: any = {};\n summaryTypes: string[];\n calculationBasis: string[];\n recordedBoundaryTypes: string [];\n noDataReplacement: string[];\n state: State = {\n isPiPoint: false,\n hideError: false,\n segments: [],\n attributes: [],\n summaries: [],\n attributeSegment: {},\n summarySegment: {},\n calculationBasisSegment: {},\n noDataReplacementSegment: {},\n };\n\n constructor(props: any) {\n super(props);\n this.onSegmentChange = this.onSegmentChange.bind(this);\n this.calcBasisValueChanged = this.calcBasisValueChanged.bind(this);\n this.recordedBoundaryTypeValueChanged = this.recordedBoundaryTypeValueChanged.bind(this);\n this.calcNoDataValueChanged = this.calcNoDataValueChanged.bind(this);\n this.onSummaryAction = this.onSummaryAction.bind(this);\n this.onSummaryValueChanged = this.onSummaryValueChanged.bind(this);\n this.onAttributeAction = this.onAttributeAction.bind(this);\n this.onAttributeChange = this.onAttributeChange.bind(this);\n\n this.summaryTypes = [\n // 'None', // A summary type is not specified.\n 'Total', // A totalization over the time range.\n 'Average', // The average value over the time range.\n 'Minimum', // The minimum value over the time range.\n 'Maximum', // The maximum value over the time range.\n 'Range', // The range value over the time range (minimum-maximum).\n 'StdDev', // The standard deviation over the time range.\n 'PopulationStdDev', // The population standard deviation over the time range.\n 'Count', // The sum of event count over the time range when calculation basis is event weighted. The sum of event time duration over the time range when calculation basis is time weighted.\n 'PercentGood', // Percent of data with good value during the calculation period. For time weighted calculations, the percentage is based on time. For event weighted calculations, the percent is based on event count.\n 'All', // A convenience for requesting all available summary calculations.\n 'AllForNonNumeric', // A convenience for requesting all available summary calculations for non-numeric data.\n ];\n\n this.calculationBasis = [\n 'TimeWeighted', // Weight the values in the calculation by the time over which they apply. Interpolation is based on whether the attribute is stepped. Interpolated events are generated at the boundaries if necessary.\n 'EventWeighted', // Evaluate values with equal weighting for each event. No interpolation is done. There must be at least one event within the time range to perform a successful calculation. Two events are required for standard deviation. In handling events at the boundary of the calculation, the AFSDK uses following rules:\n 'TimeWeightedContinuous', // Apply weighting as in TimeWeighted, but do all interpolation between values as if they represent continuous data, (standard interpolation) regardless of whether the attribute is stepped.\n 'TimeWeightedDiscrete', // Apply weighting as in TimeWeighted but interpolation between values is performed as if they represent discrete, unrelated values (stair step plot) regardless of the attribute is stepped.\n 'EventWeightedExcludeMostRecentEvent', // The calculation behaves the same as _EventWeighted_, except in the handling of events at the boundary of summary intervals in a multiple intervals calculation. Use this option to prevent events at the intervals boundary from being double count at both intervals. With this option, events at the end time (most recent time) of an interval is not used in that interval.\n 'EventWeightedExcludeEarliestEvent', // Similar to the option _EventWeightedExcludeMostRecentEvent_. Events at the start time(earliest time) of an interval is not used in that interval.\n 'EventWeightedIncludeBothEnds', // Events at both ends of the interval boundaries are included in the event weighted calculation.\n ];\n\n this.recordedBoundaryTypes = [\n 'Inside', // Default. Specifies to return the recorded values on the inside of the requested time range as the first and last values. \n 'Outside', // Specifies to return the recorded values on the outside of the requested time range as the first and last values.\n 'Interpolated', //Specifies to create an interpolated value at the end points of the requested time range if a recorded value does not exist at that time.\n ]\n\n this.noDataReplacement = [\n 'Null', // replace with nulls\n 'Drop', // drop items\n 'Previous', // use previous value if available\n '0', // replace with 0\n 'Keep', // Keep value\n ];\n }\n\n // is selected segment empty\n isValueEmpty(value: PIWebAPISelectableValue | undefined) {\n return !value || !value.value || !value.value.length || value.value === REMOVE_LABEL;\n }\n\n segmentChangeValue = (segments: Array>) => {\n const query = this.props.query;\n this.setState({ segments }, () => this.onChange({ ...query, segments }));\n };\n\n attributeChangeValue = (attributes: Array>): Promise => {\n const query = this.props.query;\n return new Promise((resolve) => this.setState({ attributes }, () => {\n this.onChange({ ...query, attributes })\n resolve();\n }));\n };\n\n // summary calculation basis change event\n calcBasisValueChanged(segment: SelectableValue) {\n const metricsQuery = this.props.query as PIWebAPIQuery;\n const summary = metricsQuery.summary;\n if (summary) {\n summary.basis = segment.value?.value;\n }\n this.onChange({ ...metricsQuery, summary });\n }\n // get summary calculation basis user interface segments\n getCalcBasisSegments() {\n const segments = map(this.calculationBasis, (item: string) => {\n let selectableValue: SelectableValue = {\n label: item,\n value: {\n value: item,\n expandable: true,\n },\n };\n return selectableValue;\n });\n return segments;\n }\n\n // recorded boundary type change event\n recordedBoundaryTypeValueChanged(segment: SelectableValue) {\n const metricsQuery = this.props.query as PIWebAPIQuery;\n const recordedValues = metricsQuery.recordedValues;\n if (recordedValues) {\n recordedValues.boundaryType = segment.value?.value;\n }\n this.onChange({ ...metricsQuery, recordedValues });\n }\n // get recorded boundary type user interface segments\n getRecordedBoundaryTypeSegments() {\n const segments = map(this.recordedBoundaryTypes, (item: string) => {\n let selectableValue: SelectableValue = {\n label: item,\n value: {\n value: item,\n expandable: true,\n },\n };\n return selectableValue;\n });\n return segments;\n }\n\n // no data change event\n calcNoDataValueChanged(segment: SelectableValue) {\n const metricsQuery = this.props.query as PIWebAPIQuery;\n const nodata = segment.value?.value;\n this.onChange({ ...metricsQuery, nodata });\n }\n // get no data user interface segments\n getNoDataSegments() {\n const segments = map(this.noDataReplacement, (item: string) => {\n let selectableValue: SelectableValue = {\n label: item,\n value: {\n value: item,\n expandable: true,\n },\n };\n return selectableValue;\n });\n return segments;\n }\n\n // summary query change event\n onSummaryValueChanged(item: SelectableValue, index: number) {\n const summaries = this.state.summaries.slice(0) as Array>;\n summaries[index] = item;\n if (this.isValueEmpty(item.value)) {\n summaries.splice(index, 1);\n }\n this.setState({ summaries }, this.stateCallback);\n }\n // get the list of summaries available\n getSummarySegments() {\n const summaryTypes = filter(this.summaryTypes, (type) => {\n return this.state.summaries.map((s) => s.value?.value).indexOf(type) === -1;\n });\n\n const segments = map(summaryTypes, (item: string) => {\n let selectableValue: SelectableValue = {\n label: item,\n value: {\n value: item,\n expandable: true,\n },\n };\n return selectableValue;\n });\n\n segments.unshift({\n label: REMOVE_LABEL,\n value: {\n value: REMOVE_LABEL,\n },\n });\n\n return segments;\n }\n\n // remove a summary from the user interface and the query\n removeSummary(part: SelectableValue) {\n const summaries = filter(this.state.summaries, (item: SelectableValue) => {\n return item !== part;\n });\n this.setState({ summaries });\n }\n // add a new summary to the query\n onSummaryAction(item: SelectableValue) {\n const summaries = this.state.summaries.slice(0) as Array>;\n // if value is not empty, add new attribute segment\n if (!this.isValueEmpty(item.value)) {\n let selectableValue: SelectableValue = {\n label: item.label,\n value: {\n value: item.value?.value,\n expandable: true,\n },\n };\n summaries.push(selectableValue);\n }\n this.setState({ summarySegment: {}, summaries }, this.stateCallback);\n }\n\n // remove an attribute from the query\n removeAttribute(part: SelectableValue) {\n const attributes = filter(this.state.attributes, (item: SelectableValue) => {\n return item !== part;\n });\n this.attributeChangeValue(attributes);\n }\n // add an attribute to the query\n onAttributeAction(item: SelectableValue) {\n const { query } = this.props;\n const attributes = this.state.attributes.slice(0);\n // partial variable\n if (item.value !== null && typeof item.value !== 'object' && !Array.isArray(item.value)) {\n const value = String(item.value! as string);\n item.value = {\n type: value.match(/\\${\\w+}/gi) ? 'template' : undefined,\n value: value,\n }\n }\n\n // if value is not empty, add new attribute segment\n if (!this.isValueEmpty(item.value)) {\n let selectableValue: SelectableValue = {\n label: item.label,\n value: {\n type: item.value?.value && item.value?.value.match(/\\${\\w+}/gi) ? 'template' : undefined,\n value: item.value?.value,\n expandable: !query.isPiPoint,\n },\n };\n attributes.push(selectableValue);\n }\n this.attributeChangeValue(attributes);\n }\n\n // pi point change event\n onPiPointChange = (item: SelectableValue, index: number) => {\n let attributes = this.state.attributes.slice(0);\n\n if (item.label === REMOVE_LABEL) {\n remove(attributes, (_, n) => n === index);\n } else {\n // set current value\n attributes[index] = item;\n }\n\n this.checkPiPointSegments(item, attributes);\n };\n // attribute change event\n onAttributeChange = (item: SelectableValue, index: number) => {\n let attributes = this.state.attributes.slice(0);\n\n // ignore if no change\n if (attributes[index].label === item.value?.value) {\n return;\n }\n\n // set current value\n attributes[index] = item;\n\n this.checkAttributeSegments(attributes, this.state.segments);\n };\n // segment change\n onSegmentChange = (item: SelectableValue, index: number) => {\n const { query } = this.props;\n let segments = this.state.segments.slice(0);\n\n // partial variable\n if (item.value !== null && typeof item.value !== 'object' && !Array.isArray(item.value)) {\n const value = String(item.value! as string);\n item.value = {\n type: value.match(/\\${\\w+}/gi) ? 'template' : undefined,\n value: value,\n }\n }\n\n // ignore if no change\n if (segments[index].label === item.value?.value) {\n return;\n }\n\n // reset attributes list\n this.setState({ attributes: [] }, () => {\n if (item.label === REMOVE_LABEL) {\n segments = slice(segments, 0, index);\n this.checkAttributeSegments([], segments).then(() => {\n if (segments.length === 0) {\n segments.push({\n label: '',\n });\n } else if (!!segments[segments.length - 1].value?.expandable) {\n segments.push({\n label: 'Select Element',\n value: {\n value: '-Select Element-',\n },\n });\n }\n if (query.isPiPoint) {\n this.piServer = [];\n }\n this.segmentChangeValue(segments);\n });\n return;\n }\n\n // set current value\n segments[index] = item;\n\n // Accept only one PI server\n if (query.isPiPoint) {\n this.piServer.push(item);\n this.segmentChangeValue(segments);\n return;\n }\n\n // changed internal selection\n if (index < segments.length - 1) {\n segments = slice(segments, 0, index + 1);\n }\n this.checkAttributeSegments([], segments).then((): Promise>> => {\n // add new options\n if (item.value?.type === 'template') { // if it's a variable we need to check for new elements\\\n return this.getElementSegments(segments.length + 1, segments).then((elements) => {\n if (elements.length > 0) {\n segments[index].value!.expandable = true;\n segments.push({\n label: 'Select Element',\n value: {\n value: '-Select Element-',\n },\n });\n }\n this.segmentChangeValue(segments);\n return segments;\n });\n } else if (!!item.value?.expandable) {\n segments.push({\n label: 'Select Element',\n value: {\n value: '-Select Element-',\n },\n });\n }\n return new Promise((resolve) => {\n this.segmentChangeValue(segments);\n resolve(segments);\n });\n });\n });\n };\n\n // get a ui segment for the attributes\n getElementSegments = (\n index: number,\n currentSegment?: Array>\n ): Promise>> => {\n const { datasource, query, data } = this.props;\n const ctrl = this;\n const findQuery = query.isPiPoint\n ? { type: 'dataserver' }\n : {\n path: this.getSegmentPathUpTo(currentSegment ?? this.state.segments.slice(0), index),\n afServerWebId: this.state.segments.length > 0 && this.state.segments[0].value ? this.state.segments[0].value.webId : undefined,\n };\n\n if (!query.isPiPoint) {\n if (datasource.afserver?.name && index === 0) {\n return Promise.resolve([\n {\n label: datasource.afserver.name,\n value: {\n value: datasource.afserver.name,\n expandable: true,\n },\n },\n ]);\n }\n if (datasource.afserver?.name && datasource.afdatabase?.name && index === 1) {\n return Promise.resolve([\n {\n label: datasource.afdatabase.name,\n value: {\n value: datasource.afdatabase.name,\n expandable: true,\n },\n },\n ]);\n }\n }\n return datasource\n .metricFindQuery(findQuery, Object.assign(data?.request?.scopedVars ?? {}, { isPiPoint: query.isPiPoint }))\n .then((items: any[]) => {\n const altSegments = map(items, (item: any) => {\n let selectableValue: SelectableValue = {\n label: item.text,\n value: {\n webId: item.WebId,\n value: item.text,\n expandable: !query.isPiPoint && item.expandable,\n },\n };\n return selectableValue;\n });\n\n if (altSegments.length === 0) {\n return altSegments;\n }\n\n // add template variables\n const variables = datasource.templateSrv.getVariables();\n each(variables, (variable: TypedVariableModel) => {\n let selectableValue: SelectableValue = {\n label: '${' + variable.name + '}',\n value: {\n type: 'template',\n value: '${' + variable.name + '}',\n expandable: !query.isPiPoint,\n },\n };\n altSegments.unshift(selectableValue);\n });\n\n // add remove label\n altSegments.unshift({\n label: REMOVE_LABEL,\n value: {\n value: REMOVE_LABEL,\n },\n });\n\n return altSegments;\n })\n .catch((err: any) => {\n ctrl.error = err.message || 'Failed to issue metric query';\n return [];\n });\n };\n\n // get the list of attributes for the user interface - PI\n getAttributeSegmentsPI = (attributeText?: string): Promise>> => {\n const { datasource, query, data } = this.props;\n const ctrl = this;\n const findQuery = {\n path: '',\n webId: this.getSelectedPIServer(),\n pointName: (attributeText ?? '') + '*',\n type: 'pipoint',\n };\n let segments: Array> = [];\n return datasource\n .metricFindQuery(findQuery, Object.assign(data?.request?.scopedVars ?? {}, { isPiPoint: query.isPiPoint }))\n .then((items: any[]) => {\n segments = map(items, (item: any) => {\n let selectableValue: SelectableValue = {\n path: item.Path,\n label: item.text,\n value: {\n value: item.text,\n expandable: false,\n },\n };\n return selectableValue;\n });\n if (!!attributeText && attributeText.length > 0) {\n segments.unshift({\n label: attributeText,\n value: {\n value: attributeText,\n expandable: false,\n },\n });\n }\n // add template variables\n const variables = datasource.templateSrv.getVariables();\n each(variables, (variable: TypedVariableModel) => {\n let selectableValue: SelectableValue = {\n label: '${' + variable.name + '}',\n value: {\n type: 'template',\n value: '${' + variable.name + '}',\n expandable: !query.isPiPoint,\n },\n };\n segments.unshift(selectableValue);\n });\n\n // add remove label\n segments.unshift({\n label: REMOVE_LABEL,\n value: {\n value: REMOVE_LABEL,\n },\n });\n\n return segments;\n })\n .catch((err: any) => {\n ctrl.error = err.message || 'Failed to issue metric query';\n return segments;\n });\n };\n\n // get the list of attributes for the user interface - AF\n getAttributeSegmentsAF = (attributeText?: string): Array> => {\n const { datasource } = this.props;\n const ctrl = this;\n let segments: Array> = [];\n\n segments.push({\n label: REMOVE_LABEL,\n value: {\n value: REMOVE_LABEL,\n },\n });\n\n // add template variables\n const variables = datasource.templateSrv.getVariables();\n each(variables, (variable: TypedVariableModel) => {\n let selectableValue: SelectableValue = {\n label: '${' + variable.name + '}',\n value: {\n type: 'template',\n value: '${' + variable.name + '}',\n expandable: false,\n },\n };\n segments.push(selectableValue);\n });\n\n forOwn(ctrl.availableAttributes, (val: any, key: string) => {\n let selectableValue: SelectableValue = {\n label: key,\n value: {\n value: key,\n expandable: true,\n },\n };\n segments.push(selectableValue);\n });\n\n return segments;\n };\n\n // build data from target string\n buildFromTarget = (\n query: PIWebAPIQuery,\n segmentsArray: Array>,\n attributesArray: Array>\n ) => {\n const splitAttributes = query.target!.split(';');\n const splitElements = splitAttributes.length > 0 ? splitAttributes[0].split('\\\\') : [];\n\n if (splitElements.length > 1 || (splitElements.length === 1 && splitElements[0] !== '')) {\n // remove element hierarchy from attribute collection\n splitAttributes.splice(0, 1);\n\n each(splitElements, (item, _) => {\n segmentsArray.push({\n label: item,\n value: {\n type: item.match(/\\${\\w+}/gi) ? 'template' : undefined,\n value: item,\n expandable: true,\n },\n });\n });\n each(splitAttributes, (item, _) => {\n if (item !== '') {\n // set current value\n attributesArray.push({\n label: item,\n value: {\n type: item.match(/\\${\\w+}/gi) ? 'template' : undefined,\n value: item,\n expandable: false,\n },\n });\n }\n });\n return this.getElementSegments(splitElements.length + 1, segmentsArray).then((elements) => {\n if (elements.length > 0) {\n segmentsArray.push({\n label: 'Select Element',\n value: {\n value: '-Select Element-',\n },\n });\n }\n return segmentsArray;\n });\n }\n return Promise.resolve(segmentsArray);\n };\n\n /**\n * Gets the segment information and parses it to a string.\n *\n * @param {any} index - Last index of segment to use.\n * @returns - AF Path or PI Point name.\n *\n * @memberOf PIWebAPIQueryEditor\n */\n getSegmentPathUpTo(segments: Array>, index: number): string {\n const arr = segments.slice(0, index);\n\n return reduce(\n arr,\n (result: any, segment: SelectableValue) => {\n if (!segment.value) {\n return '';\n }\n if (!segment.value.value?.startsWith('-Select')) {\n return result ? result + '\\\\' + segment.value.value : segment.value.value;\n }\n return result;\n },\n ''\n );\n }\n\n /**\n * Get the current AF Element's child attributes. Validates when the element selection changes.\n *\n * @returns - Collection of attributes.\n *\n * @memberOf PIWebAPIQueryEditor\n */\n checkAttributeSegments(\n attributes: Array>,\n segments: Array>\n ): Promise {\n const { datasource, data } = this.props;\n const ctrl = this;\n const findQuery = {\n path: this.getSegmentPathUpTo(segments.slice(0), segments.length),\n type: 'attributes',\n };\n return datasource\n .metricFindQuery(findQuery, Object.assign(data?.request?.scopedVars ?? {}, { isPiPoint: false }))\n .then((attributesResponse: any) => {\n const validAttributes: any = {};\n\n each(attributesResponse, (attribute: any) => {\n validAttributes[attribute.Path.substring(attribute.Path.indexOf('|') + 1)] = attribute.WebId;\n });\n\n const filteredAttributes = filter(attributes, (attrib: SelectableValue) => {\n const changedValue = datasource.templateSrv.replace(attrib.value?.value);\n return validAttributes[changedValue] !== undefined;\n });\n\n ctrl.availableAttributes = validAttributes;\n return this.attributeChangeValue(filteredAttributes);\n })\n .catch((err: any) => {\n ctrl.error = err.message || 'Failed to issue metric query';\n return this.attributeChangeValue(attributes);\n });\n }\n\n /**\n * Get PI points from server.\n *\n * @returns - Collection of attributes.\n *\n * @memberOf PIWebAPIQueryEditor\n */\n checkPiPointSegments(\n attribute: SelectableValue,\n attributes: Array>\n ) {\n const { datasource, data } = this.props;\n const ctrl = this;\n const findQuery = {\n path: attribute.path,\n webId: ctrl.getSelectedPIServer(),\n pointName: attribute.label,\n type: 'pipoint',\n };\n return datasource\n .metricFindQuery(findQuery, Object.assign(data?.request?.scopedVars ?? {}, { isPiPoint: true }))\n .then(() => {\n return ctrl.attributeChangeValue(attributes);\n })\n .catch((err: any) => {\n ctrl.error = err.message || 'Failed to issue metric query';\n return ctrl.attributeChangeValue([]);\n });\n }\n\n /**\n * Gets the webid of the current selected pi data server.\n *\n * @memberOf PIWebAPIQueryEditor\n */\n getSelectedPIServer() {\n let webID = '';\n\n this.piServer.forEach((s) => {\n const parts = this.props.query.target!.split(';');\n if (parts.length >= 2) {\n if (parts[0] === s.text) {\n webID = s.WebId;\n return;\n }\n }\n });\n return this.piServer.length > 0 ? this.piServer[0].value?.webId : webID;\n }\n\n /**\n * Queries PI Web API for child elements and attributes when the raw query text editor is changed.\n *\n * @memberOf PIWebAPIQueryEditor\n */\n textEditorChanged() {\n const { query } = this.props;\n const splitAttributes = query.target!.split(';');\n const splitElements = splitAttributes.length > 0 ? splitAttributes[0].split('\\\\') : [];\n\n let segments: Array> = [];\n let attributes: Array> = [];\n\n if (splitElements.length > 1 || (splitElements.length === 1 && splitElements[0] !== '')) {\n // remove element hierarchy from attribute collection\n splitAttributes.splice(0, 1);\n\n each(splitElements, (item, _) => {\n segments.push({\n label: item,\n value: {\n type: item.match(/\\${\\w+}/gi) ? 'template' : undefined,\n value: item,\n expandable: true,\n },\n });\n });\n each(splitAttributes, function (item, index) {\n if (item !== '') {\n attributes.push({\n label: item,\n value: {\n type: item.match(/\\${\\w+}/gi) ? 'template' : undefined,\n value: item,\n expandable: false,\n },\n });\n }\n });\n this.getElementSegments(splitElements.length + 1, segments)\n .then((elements) => {\n if (elements.length > 0) {\n segments.push({\n label: 'Select Element',\n value: {\n value: '-Select Element-',\n },\n });\n }\n })\n .then(() => {\n this.updateArray(segments, attributes, this.state.summaries, query.isPiPoint!, () => {\n this.onChange({\n ...query,\n query: undefined,\n rawQuery: false,\n attributes: this.state.attributes,\n segments: this.state.segments,\n });\n });\n });\n } else {\n segments = this.checkAfServer();\n this.updateArray(segments, this.state.attributes, this.state.summaries, query.isPiPoint!, () => {\n this.onChange({\n ...query,\n query: undefined,\n rawQuery: false,\n attributes: this.state.attributes,\n segments: this.state.segments,\n });\n });\n }\n }\n\n /**\n * Check if the AF server and database are configured in the datasoure config.\n *\n * @returns the segments array\n *\n * @memberOf PIWebAPIQueryEditor\n */\n checkAfServer = () => {\n const { datasource } = this.props;\n const segmentsArray = [];\n if (datasource.afserver?.name) {\n segmentsArray.push({\n label: datasource.afserver.name,\n value: {\n value: datasource.afserver.name,\n expandable: true,\n },\n });\n if (datasource.afdatabase?.name) {\n segmentsArray.push({\n label: datasource.afdatabase.name,\n value: {\n value: datasource.afdatabase.name,\n expandable: true,\n },\n });\n }\n segmentsArray.push({\n label: 'Select Element',\n value: {\n value: '-Select Element-',\n },\n });\n } else {\n segmentsArray.push({\n label: '',\n });\n }\n return segmentsArray;\n };\n\n /**\n * Update the internal state of the datasource.\n *\n * @param segmentsArray the segments array to update\n * @param attributesArray the AF attributes array to update\n * @param summariesArray the summaries array to update\n * @param isPiPoint the is PI point flag\n * @param cb optional callback function\n *\n * @memberOf PIWebAPIQueryEditor\n */\n updateArray = (\n segmentsArray: Array>,\n attributesArray: Array>,\n summariesArray: Array>,\n isPiPoint: boolean,\n cb?: (() => void) | undefined\n ) => {\n this.setState(\n {\n segments: segmentsArray,\n attributes: attributesArray,\n summaries: summariesArray,\n isPiPoint,\n },\n () => {\n if (!isPiPoint) {\n this.checkAttributeSegments(attributesArray, this.state.segments).then(() => {\n if (cb) {\n cb();\n }\n });\n }\n }\n );\n };\n\n // React action when component is initialized/updated\n scopedVarsDone = false;\n componentDidMount = () => {\n this.initialLoad(false);\n };\n\n componentDidUpdate = () => {\n const { query } = this.props;\n if (this.props.data?.state === 'Done' && !!this.props.data?.request?.scopedVars && !this.scopedVarsDone) {\n this.scopedVarsDone = true;\n this.initialLoad(!query.isPiPoint);\n }\n };\n\n initialLoad = (force: boolean) => {\n const { query } = this.props;\n const metricsQuery = defaults(query, defaultQuery) as PIWebAPIQuery;\n const { segments, attributes, summary, isPiPoint } = metricsQuery;\n\n let segmentsArray: Array> = force ? [] : segments?.slice(0) ?? [];\n let attributesArray: Array> = force ? [] : attributes?.slice(0) ?? [];\n let summariesArray = summary?.types ?? [];\n\n if (!isPiPoint && segmentsArray.length === 0) {\n if (query.target && query.target.length > 0 && query.target !== ';') {\n attributesArray = [];\n // Build query from target\n this.buildFromTarget(query, segmentsArray, attributesArray)\n .then((_segmentsArray) => {\n this.updateArray(_segmentsArray, attributesArray, summariesArray, false);\n })\n .catch((e) => console.error(e));\n return;\n } else {\n segmentsArray = this.checkAfServer();\n }\n } else if (isPiPoint && segmentsArray.length > 0) {\n this.piServer = segmentsArray;\n }\n this.updateArray(segmentsArray, attributesArray, summariesArray, !!isPiPoint, () => {\n this.onChange(query);\n });\n };\n\n onChange = (query: PIWebAPIQuery) => {\n const { onChange, onRunQuery } = this.props;\n\n if (query.rawQuery) {\n query.target = query.query ?? '';\n if (!!query.query) {\n const { attributes, elementPath } = parseRawQuery(query.target);\n query.attributes = attributes;\n query.elementPath = elementPath;\n }\n } else {\n query.elementPath = this.getSegmentPathUpTo(this.state.segments, this.state.segments.length);\n query.target =\n query.elementPath +\n ';' +\n join(\n query.attributes?.map((s) => s.value?.value),\n ';'\n );\n }\n const summary = query.summary;\n if (summary) {\n summary.types = this.state.summaries;\n }\n\n onChange({...query, summary});\n\n if (this.isValidQuery(query)) {\n onRunQuery();\n }\n };\n\n isValidQuery = (query: PIWebAPIQuery): boolean => {\n if (query.target && query.target.length > 0 && query.target !== \";\") {\n query.target = query.target.trim();\n const targetSplit = query.target.split(\";\", 2);\n return targetSplit.length === 2 && targetSplit[0].length > 0 && targetSplit[1].length > 0;\n }\n return false;\n }\n\n stateCallback = () => {\n const query = this.props.query as PIWebAPIQuery;\n this.onChange(query);\n };\n\n onIsPiPointChange = (event: React.SyntheticEvent) => {\n const { query: queryChange } = this.props;\n const isPiPoint = !queryChange.isPiPoint;\n this.setState(\n {\n segments: isPiPoint ? [{ label: '' }] : this.checkAfServer(),\n attributes: [],\n isPiPoint,\n },\n () => {\n this.onChange({\n ...queryChange,\n expression: '',\n attributes: this.state.attributes,\n segments: this.state.segments,\n isPiPoint,\n });\n }\n );\n };\n\n onHideErrorChange = (event: React.SyntheticEvent) => {\n const { query: queryChange } = this.props;\n const hideError = !queryChange.hideError;\n this.setState(\n {\n hideError,\n },\n () => {\n this.onChange({\n ...queryChange,\n hideError,\n });\n }\n );\n };\n\n render() {\n const { query: queryProps, onChange, onRunQuery } = this.props;\n const metricsQuery = defaults(queryProps, defaultQuery) as PIWebAPIQuery;\n const {\n useLastValue,\n useUnit,\n interpolate,\n query,\n rawQuery,\n digitalStates,\n enableStreaming,\n recordedValues,\n expression,\n isPiPoint,\n hideError,\n summary,\n nodata,\n display,\n regex,\n } = metricsQuery;\n\n return (\n <>\n {this.props.datasource.piPointConfig && (\n \n \n \n )}\n\n {!!rawQuery && (\n \n \n ) =>\n onChange({ ...metricsQuery, query: event.target.value })\n }\n placeholder=\"enter query\"\n />\n \n this.textEditorChanged()} />\n \n )}\n\n {!rawQuery && (\n <>\n
\n \n {this.state.segments.map((segment: SelectableValue, index: number) => {\n return (\n }\n onChange={(item) => this.onSegmentChange(item, index)}\n loadOptions={(query?: string | undefined) => {\n return this.getElementSegments(index);\n }}\n allowCustomValue\n inputMinWidth={MIN_ELEM_INPUT_WIDTH}\n />\n );\n })}\n \n {!isPiPoint && (\n {\n onChange({ ...metricsQuery, query: metricsQuery.target, rawQuery: value });\n }}\n />\n )}\n \n
\n\n \n {this.state.attributes.map((attribute: SelectableValue, index: number) => {\n if (isPiPoint) {\n return (\n }\n disabled={this.piServer.length === 0}\n onChange={(item) => this.onPiPointChange(item, index)}\n loadOptions={this.getAttributeSegmentsPI}\n reloadOptionsOnChange\n allowCustomValue\n inputMinWidth={MIN_ATTR_INPUT_WIDTH}\n />\n );\n }\n return (\n }\n disabled={this.state.segments.length <= 2}\n onChange={(item) => this.onAttributeChange(item, index)}\n options={this.getAttributeSegmentsAF()}\n allowCustomValue\n inputMinWidth={MIN_ATTR_INPUT_WIDTH}\n />\n );\n })}\n\n {isPiPoint && (\n \n }\n disabled={this.piServer.length === 0}\n onChange={this.onAttributeAction}\n loadOptions={this.getAttributeSegmentsPI}\n reloadOptionsOnChange\n allowCustomValue\n inputMinWidth={MIN_ATTR_INPUT_WIDTH}\n />\n )}\n {!isPiPoint && (\n \n }\n disabled={this.state.segments.length <= 2}\n onChange={this.onAttributeAction}\n options={this.getAttributeSegmentsAF()}\n allowCustomValue\n inputMinWidth={MIN_ATTR_INPUT_WIDTH}\n />\n )}\n \n \n )}\n\n \n \n ) =>\n onChange({ ...metricsQuery, expression: event.target.value })\n }\n placeholder=\"'.'*2\"\n />\n \n \n\n \n \n \n this.onChange({\n ...metricsQuery,\n useLastValue: { ...useLastValue, enable: !useLastValue.enable },\n })\n }\n />\n \n \n \n this.onChange({\n ...metricsQuery,\n digitalStates: { ...digitalStates, enable: !digitalStates.enable },\n })\n }\n />\n \n \n \n }\n onChange={this.calcNoDataValueChanged}\n options={this.getNoDataSegments()}\n allowCustomValue\n />\n \n \n \n \n {this.props.datasource.useUnitConfig && (\n \n \n this.onChange({\n ...metricsQuery,\n useUnit: { ...useUnit, enable: !useUnit.enable },\n })\n }\n />\n \n )}\n {this.props.datasource.useStreaming && (\n \n \n this.onChange({ ...metricsQuery, enableStreaming: { ...enableStreaming, enable: !enableStreaming.enable } })\n }\n />\n \n )}\n \n \n {(interpolate.enable || (!useLastValue.enable && !recordedValues.enable)) && (\n \n \n \n this.onChange({ ...metricsQuery, interpolate: { ...interpolate, enable: !interpolate.enable, interval: null } })\n }\n />\n \n \n ) =>\n onChange({ ...metricsQuery, interpolate: { ...interpolate, interval: event.target.value } })\n }\n placeholder=\"30s\"\n />\n \n \n )}\n\n {(recordedValues.enable || (!useLastValue.enable && !interpolate.enable)) && (\n \n \n \n this.onChange({\n ...metricsQuery,\n recordedValues: { ...recordedValues, enable: !recordedValues.enable, maxNumber: null, boundaryType: 'Inside' },\n })\n }\n />\n \n \n ) =>\n onChange({\n ...metricsQuery,\n recordedValues: { ...recordedValues, maxNumber: parseInt(event.target.value, 10) },\n })\n }\n type=\"number\"\n placeholder=\"1000\"\n />\n \n \n \n }\n onChange={this.recordedBoundaryTypeValueChanged}\n options={this.getRecordedBoundaryTypeSegments()}\n allowCustomValue\n />\n \n \n )}\n\n {!useLastValue.enable && (\n \n \n \n this.onChange({\n ...metricsQuery,\n summary: { ...summary, enable: !(summary?.enable) },\n })\n }\n />\n \n \n \n }\n onChange={this.calcBasisValueChanged}\n options={this.getCalcBasisSegments()}\n allowCustomValue\n />\n \n \n \n {this.state.summaries.map((s: SelectableValue, index: number) => {\n return (\n }\n onChange={(item) => this.onSummaryValueChanged(item, index)}\n options={this.getSummarySegments()}\n allowCustomValue\n />\n );\n })}\n \n }\n onChange={this.onSummaryAction}\n options={this.getSummarySegments()}\n allowCustomValue\n />\n \n \n \n )}\n {summary?.enable && (\n \n \n \n this.onChange({ ...metricsQuery, summary: { ...summary, sampleTypeInterval: !(summary?.sampleTypeInterval) } })\n }\n />\n \n \n ) =>\n onChange({ ...metricsQuery, summary: { ...summary, sampleInterval: event.target.value } })\n }\n placeholder=\"30s\"\n />\n \n \n ) =>\n onChange({ ...metricsQuery, summary: { ...summary, duration: event.target.value } })\n }\n placeholder=\"30s\"\n />\n \n \n )}\n\n \n \n ) =>\n onChange({ ...metricsQuery, display: event.target.value })\n }\n placeholder=\"Display\"\n />\n \n \n {\n this.onChange({ ...metricsQuery, regex: { ...regex, enable: !regex.enable } });\n }}\n />\n \n \n ) =>\n onChange({ ...metricsQuery, regex: { ...regex, search: event.target.value } })\n }\n placeholder=\"(.*)\"\n />\n \n \n ) =>\n onChange({ ...metricsQuery, regex: { ...regex, replace: event.target.value } })\n }\n placeholder=\"$1\"\n />\n \n \n \n );\n }\n}\n","import React, { memo, useState } from 'react';\n\nimport { AnnotationQuery, QueryEditorProps, SelectableValue } from '@grafana/data';\nimport { AsyncSelect, InlineField, InlineFieldRow, InlineSwitch, Input } from '@grafana/ui';\n\nimport { PiWebAPIDatasource } from 'datasource';\nimport { PIWebAPIDataSourceJsonData, PIWebAPIQuery, PiwebapiRsp } from 'types';\n\nconst SMALL_LABEL_WIDTH = 20;\nconst LABEL_WIDTH = 30;\nconst MIN_INPUT_WIDTH = 50;\n\ntype PiWebAPIQueryEditorProps = QueryEditorProps;\n\ntype Props = PiWebAPIQueryEditorProps & {\n annotation?: AnnotationQuery;\n onAnnotationChange?: (annotation: AnnotationQuery) => void;\n};\n\nexport const PiWebAPIAnnotationsQueryEditor = memo(function PiWebAPIAnnotationQueryEditor(props: Props) {\n const { query, datasource, annotation, onChange, onRunQuery } = props;\n\n const [afWebId, setAfWebId] = useState('');\n const [database, setDatabase] = useState(annotation?.target?.database ?? {});\n\n // this should never happen, but we want to keep typescript happy\n if (annotation === undefined) {\n return null;\n }\n\n const getEventFrames = (): Promise>> => {\n return datasource.getEventFrameTemplates(database?.WebId!).then((templ: PiwebapiRsp[]) => {\n return templ.map((d) => ({ label: d.Name, value: d }));\n });\n };\n\n const getDatabases = (): Promise>> => {\n return datasource.getDatabases(afWebId).then((dbs: PiwebapiRsp[]) => {\n return dbs.map((d) => ({ label: d.Name, value: d }));\n });\n };\n\n const getValue = (key: string) => {\n const query: any = annotation.target as any;\n if (!query || !query[key]) {\n return;\n }\n return { label: query[key].Name, value: query[key] };\n };\n\n datasource.getAssetServer(datasource.afserver.name).then((result) => {\n setAfWebId(result.WebId!);\n });\n\n return (\n <>\n
\n \n \n {\n setDatabase(e.value);\n onChange({ ...query, database: e.value, template: undefined });\n }}\n defaultOptions\n />\n \n \n onChange({ ...query, template: e.value })}\n defaultOptions\n />\n \n \n onChange({ ...query, showEndTime: e.currentTarget.checked })}\n />\n \n \n \n \n onRunQuery()}\n onChange={(e) => onChange({ ...query, categoryName: e.currentTarget.value })}\n placeholder=\"Enter category name\"\n />\n \n \n onRunQuery()}\n onChange={(e) => onChange({ ...query, nameFilter: e.currentTarget.value })}\n placeholder=\"Enter name filter\"\n />\n \n \n \n \n \n onChange({\n ...query,\n regex: { ...query.regex, enable: e.currentTarget.checked },\n })\n }\n />\n \n \n onRunQuery()}\n onChange={(e) =>\n onChange({\n ...query,\n regex: { ...query.regex, search: e.currentTarget.value },\n })\n }\n placeholder=\"(.*)\"\n width={MIN_INPUT_WIDTH}\n />\n \n \n onRunQuery()}\n onChange={(e) =>\n onChange({\n ...query,\n regex: { ...query.regex, replace: e.currentTarget.value },\n })\n }\n placeholder=\"$1\"\n />\n \n \n \n \n \n onChange({\n ...query!,\n attribute: { ...query.attribute, enable: e.currentTarget.checked },\n })\n }\n />\n \n \n onRunQuery()}\n onChange={(e) =>\n onChange({\n ...query!,\n attribute: { ...query.attribute, name: e.currentTarget.value },\n })\n }\n placeholder=\"Enter name\"\n />\n \n \n
\n \n );\n});\n","import { filter, map } from 'lodash';\n\nimport { Observable, of } from 'rxjs';\n\nimport {\n DataSourceInstanceSettings,\n MetricFindValue,\n AnnotationQuery,\n ScopedVars,\n AnnotationEvent,\n DataFrame,\n DataQueryRequest,\n DataQueryResponse,\n} from '@grafana/data';\nimport { getTemplateSrv, TemplateSrv, DataSourceWithBackend } from '@grafana/runtime';\n\nimport { PIWebAPIQuery, PIWebAPIDataSourceJsonData, PiDataServer, PiwebapiRsp } from './types';\nimport { metricQueryTransform } from 'helper';\n\nimport { PiWebAPIAnnotationsQueryEditor } from 'query/AnnotationsQueryEditor';\n\nexport class PiWebAPIDatasource extends DataSourceWithBackend {\n piserver: PiDataServer;\n afserver: PiDataServer;\n afdatabase: PiDataServer;\n piPointConfig: boolean;\n newFormatConfig: boolean;\n useUnitConfig: boolean;\n useExperimental: boolean;\n useStreaming: boolean;\n\n constructor(\n instanceSettings: DataSourceInstanceSettings,\n readonly templateSrv: TemplateSrv = getTemplateSrv()\n ) {\n super(instanceSettings);\n\n this.piserver = { name: (instanceSettings.jsonData || {}).piserver, webid: undefined };\n this.afserver = { name: (instanceSettings.jsonData || {}).afserver, webid: undefined };\n this.afdatabase = { name: (instanceSettings.jsonData || {}).afdatabase, webid: undefined };\n this.piPointConfig = instanceSettings.jsonData.pipoint || false;\n this.newFormatConfig = instanceSettings.jsonData.newFormat || false;\n this.useUnitConfig = instanceSettings.jsonData.useUnit || false;\n this.useExperimental = instanceSettings.jsonData.useExperimental || false;\n this.useStreaming = instanceSettings.jsonData.useStreaming || false;\n\n this.annotations = {\n QueryEditor: PiWebAPIAnnotationsQueryEditor,\n prepareQuery(anno: AnnotationQuery): PIWebAPIQuery | undefined {\n if (anno.target) {\n anno.target.queryType = 'Annotation';\n anno.target.isAnnotation = true;\n }\n return anno.target;\n },\n processEvents: (\n anno: AnnotationQuery,\n data: DataFrame[]\n ): Observable => {\n return of(this.eventFrameToAnnotation(anno, data));\n },\n };\n\n Promise.all([\n this.getDataServer(this.piserver.name).then((result: PiwebapiRsp) => (this.piserver.webid = result.WebId)),\n this.getAssetServer(this.afserver.name).then((result: PiwebapiRsp) => (this.afserver.webid = result.WebId)),\n this.getDatabase(\n this.afserver.name && this.afdatabase.name ? this.afserver.name + '\\\\' + this.afdatabase.name : undefined\n ).then((result: PiwebapiRsp) => (this.afdatabase.webid = result.WebId)),\n ]);\n }\n\n /**\n * This method overrides the applyTemplateVariables() method from the DataSourceWithBackend class.\n * It is responsible for replacing the template variables in the query configuration prior\n * to sending the query to the backend. Templated variables are not able to be used for alerts\n * or public facing dashboards.\n *\n * @param {PIWebAPIQuery} query - The raw query configuration from the frontend as defined in the query editor.\n * @param {ScopedVars} scopedVars - The template variables that are defined in the query editor and dashboard.\n * @returns - PIWebAPIQuery.\n *\n * @memberOf PiWebApiDatasource\n */\n applyTemplateVariables(query: PIWebAPIQuery, scopedVars: ScopedVars) {\n return {\n ...query,\n target: query.target ? this.templateSrv.replace(query.target, scopedVars) : '',\n };\n }\n\n /**\n * This method makes the query to the backend.\n *\n * @param {DataQueryRequest} options\n *\n * @memberOf PiWebApiDatasource\n */\n query(options: DataQueryRequest): Observable {\n if (options.targets.length === 1 && !!options.targets[0].isAnnotation) {\n return super.query(options);\n }\n\n const query = this.buildQueryParameters(options);\n if (query.targets.length <= 0) {\n return of({ data: [] });\n }\n\n return super.query(query);\n }\n\n /**\n * This method does the discovery of the AF Hierarchy and populates the query user interface segments.\n *\n * @param {any} query - Parses the query configuration and builds a PI Web API query.\n * @returns - Segment information.\n *\n * @memberOf PiWebApiDatasource\n */\n metricFindQuery(query: any, queryOptions: any): Promise {\n const ds = this;\n const querydepth = ['servers', 'databases', 'databaseElements', 'elements'];\n if (typeof query === 'string') {\n query = JSON.parse(query as string);\n }\n if (queryOptions.isPiPoint) {\n query.path = this.templateSrv.replace(query.path, queryOptions);\n } else {\n if (query.path === '') {\n query.type = querydepth[0];\n } else {\n query.path = this.templateSrv.replace(query.path, queryOptions); // replace variables in the path\n query.path = query.path.split(';')[0]; // if the attribute is in the path, let's remote it\n if (query.type !== 'attributes') {\n query.type = querydepth[Math.max(0, Math.min(query.path.split('\\\\').length, querydepth.length - 1))];\n }\n }\n query.path = query.path.replace(/\\{([^\\\\])*\\}/gi, (r: string) => r.substring(1, r.length - 2).split(',')[0]);\n }\n\n query.filter = query.filter ?? '*';\n query.max = query.max ?? 10000;\n\n if (query.type === 'servers') {\n return ds.afserver?.name\n ? ds\n .getAssetServer(ds.afserver.name)\n .then((result: PiwebapiRsp) => [result])\n .then(metricQueryTransform)\n : ds.getAssetServers().then(metricQueryTransform);\n } else if (query.type === 'databases' && !!query.afServerWebId) {\n return ds.getDatabases(query.afServerWebId, {}).then(metricQueryTransform);\n } else if (query.type === 'databases') {\n return ds\n .getAssetServer(query.path)\n .then((server) => ds.getDatabases(server.WebId ?? '', {}))\n .then(metricQueryTransform);\n } else if (query.type === 'databaseElements') {\n return ds\n .getDatabase(query.path)\n .then((db) =>\n ds.getDatabaseElements(db.WebId ?? '', {\n selectedFields: 'Items.WebId%3BItems.Name%3BItems.Items%3BItems.Path%3BItems.HasChildren',\n })\n )\n .then(metricQueryTransform);\n } else if (query.type === 'elements') {\n return ds\n .getElement(query.path)\n .then((element) =>\n ds.getElements(element.WebId ?? '', {\n selectedFields:\n 'Items.Description%3BItems.WebId%3BItems.Name%3BItems.Items%3BItems.Path%3BItems.HasChildren',\n nameFilter: query.filter,\n })\n )\n .then(metricQueryTransform);\n } else if (query.type === 'attributes') {\n return ds\n .getElement(query.path)\n .then((element) =>\n ds.getAttributes(element.WebId ?? '', {\n searchFullHierarchy: 'true',\n selectedFields:\n 'Items.Type%3BItems.DefaultUnitsName%3BItems.Description%3BItems.WebId%3BItems.Name%3BItems.Path',\n nameFilter: query.filter,\n maxCount: query.max,\n })\n )\n .then(metricQueryTransform);\n } else if (query.type === 'dataserver') {\n return ds.getDataServers().then(metricQueryTransform);\n } else if (query.type === 'pipoint') {\n return ds.piPointSearch(query.webId, query.pointName).then(metricQueryTransform);\n }\n return Promise.reject('Bad type');\n }\n\n /** PRIVATE SECTION */\n\n /**\n * Builds the PIWebAPI query parameters.\n *\n * @param {any} options - Grafana query and panel options.\n * @returns - PIWebAPI query parameters.\n *\n * @memberOf PiWebApiDatasource\n */\n private buildQueryParameters(options: DataQueryRequest) {\n options.targets = filter(options.targets, (target) => {\n if (!target || !target.target || target.attributes?.length === 0 || target.target === ';' || !!target.hide) {\n return false;\n }\n return !target.target.startsWith('Select AF');\n });\n\n if (options.maxDataPoints) {\n options.maxDataPoints = options.maxDataPoints > 30000 ? 30000 : options.maxDataPoints;\n }\n options.targets = map(options.targets, (target) => {\n const tar = {\n enableStreaming: target.enableStreaming,\n target: this.templateSrv.replace(target.target, options.scopedVars),\n elementPath: this.templateSrv.replace(target.elementPath, options.scopedVars),\n attributes: map(target.attributes, (att) => {\n if (att.value) {\n att.value.value = this.templateSrv.replace(att.value.value, options.scopedVars);\n }\n return att;\n }),\n segments: map(target.segments, (att) => {\n if (att.value) {\n att.value.value = this.templateSrv.replace(att.value.value, options.scopedVars);\n }\n return att;\n }),\n isAnnotation: !!target.isAnnotation,\n display: !!target.display ? this.templateSrv.replace(target.display, options.scopedVars) : undefined,\n refId: target.refId,\n hide: target.hide,\n interpolate: !!target.interpolate\n ? {\n ...target.interpolate,\n interval: this.templateSrv.replace(target.interpolate.interval, options.scopedVars),\n }\n : { enable: false },\n useLastValue: target.useLastValue || { enable: false },\n useUnit: target.useUnit || { enable: false },\n recordedValues: target.recordedValues || { enable: false },\n digitalStates: target.digitalStates || { enable: false },\n webid: target.webid ?? '',\n regex: target.regex || { enable: false },\n expression: target.expression || '',\n summary: target.summary || { enable: false, types: [] },\n nodata: target.nodata,\n startTime: options.range.from,\n endTime: options.range.to,\n isPiPoint: !!target.isPiPoint,\n hideError: !!target.hideError,\n scopedVars: options.scopedVars,\n };\n\n if (tar.expression) {\n tar.expression = this.templateSrv.replace(tar.expression, options.scopedVars);\n }\n\n if (tar.summary.enable && tar.summary.types !== undefined) {\n tar.summary.types = filter(tar.summary.types, (item) => {\n return item !== undefined && item !== null && item !== '';\n });\n tar.summary.duration = !!tar.summary.duration\n ? this.templateSrv.replace(tar.summary.duration, options.scopedVars)\n : tar.summary.duration;\n tar.summary.sampleTypeInterval = !!tar.summary.sampleTypeInterval;\n tar.summary.sampleInterval = !!tar.summary.sampleInterval\n ? this.templateSrv.replace(tar.summary.sampleInterval, options.scopedVars)\n : tar.summary.sampleInterval;\n }\n\n return tar;\n });\n\n return options;\n }\n\n /**\n * Localize the eventFrame dataFrame records to Grafana Annotations.\n * @param {any} annon - The annotation object.\n * @param {any} data - The dataframe recrords.\n * @returns - Grafana Annotation\n *\n * @memberOf PiWebApiDatasource\n */\n private eventFrameToAnnotation(annon: AnnotationQuery, data: DataFrame[]): AnnotationEvent[] {\n const annotationOptions = annon.target!;\n const events: AnnotationEvent[] = [];\n const currentLocale = Intl.DateTimeFormat().resolvedOptions().locale;\n\n data.forEach((d: DataFrame) => {\n let values = this.transformDataFrameToMap(d);\n for (let i = 0; i < values['time'].length; i++) {\n // replace Dataframe name using Regex\n let title = values['title'][i];\n if (annotationOptions.regex && annotationOptions.regex.enable) {\n title = title.replace(new RegExp(annotationOptions.regex.search), annotationOptions.regex.replace);\n }\n\n // test if timeEnd is negative and if so, set it to null\n if (values['timeEnd'][i] < 0) {\n values['timeEnd'][i] = null;\n }\n\n // format the text and localize the dates to browser locale\n let text = 'Tag: ' + title;\n if (annotationOptions.attribute && annotationOptions.attribute.enable) {\n text += values['attributeText'][i];\n }\n text += '
Start: ' + new Date(values['time'][i]).toLocaleString(currentLocale) + '
End: ';\n\n if (values['timeEnd'][i]) {\n text += new Date(values['timeEnd'][i]).toLocaleString(currentLocale);\n } else {\n text += 'Eventframe is open';\n }\n\n const event: AnnotationEvent = {\n time: values['time'][i],\n timeEnd: !!annotationOptions.showEndTime ? values['timeEnd'][i] : undefined,\n title: title,\n id: values['id'][i],\n text: text,\n tags: ['OSISoft PI'],\n };\n\n events.push(event);\n }\n });\n return events;\n }\n\n /**\n *\n */\n private transformDataFrameToMap(dataFrame: DataFrame): Record {\n const map: Record = {};\n\n dataFrame.fields.forEach((field) => {\n map[field.name] = field.values.toArray();\n });\n\n return map;\n }\n\n /**\n * Abstraction for calling the PI Web API REST endpoint\n *\n * @param {any} path - the path to append to the base server URL.\n * @returns - The full URL.\n *\n * @memberOf PiWebApiDatasource\n */\n private restGet(path: string): Promise {\n return this.getResource(`${path}`).then((response: any) => {\n return response as PiwebapiRsp;\n });\n }\n\n // Get a list of all data (PI) servers\n private getDataServers(): Promise {\n return this.restGet('/dataservers').then((response) => response.Items ?? []);\n }\n private getDataServer(name: string | undefined): Promise {\n if (!name) {\n return Promise.resolve({});\n }\n return this.restGet('/dataservers?name=' + name).then((response) => response);\n }\n // Get a list of all asset (AF) servers\n private getAssetServers(): Promise {\n return this.restGet('/assetservers').then((response) => response.Items ?? []);\n }\n getAssetServer(name: string | undefined): Promise {\n if (!name) {\n return Promise.resolve({});\n }\n return this.restGet('/assetservers?path=\\\\\\\\' + name).then((response) => response);\n }\n getDatabase(path: string | undefined): Promise {\n if (!path) {\n return Promise.resolve({});\n }\n return this.restGet('/assetdatabases?path=\\\\\\\\' + path).then((response) => response);\n }\n getDatabases(serverId: string, options?: any): Promise {\n if (!serverId) {\n return Promise.resolve([]);\n }\n return this.restGet('/assetservers/' + serverId + '/assetdatabases').then((response) => response.Items ?? []);\n }\n getElement(path: string): Promise {\n if (!path) {\n return Promise.resolve({});\n }\n return this.restGet('/elements?path=\\\\\\\\' + path).then((response) => response);\n }\n getEventFrameTemplates(databaseId: string): Promise {\n if (!databaseId) {\n return Promise.resolve([]);\n }\n return this.restGet(\n '/assetdatabases/' + databaseId + '/elementtemplates?selectedFields=Items.InstanceType%3BItems.Name%3BItems.WebId'\n ).then((response) => {\n return filter(response.Items ?? [], (item) => item.InstanceType === 'EventFrame');\n });\n }\n getElementTemplates(databaseId: string): Promise {\n if (!databaseId) {\n return Promise.resolve([]);\n }\n return this.restGet(\n '/assetdatabases/' + databaseId + '/elementtemplates?selectedFields=Items.InstanceType%3BItems.Name%3BItems.WebId'\n ).then((response) => {\n return filter(response.Items ?? [], (item) => item.InstanceType === 'Element');\n });\n }\n\n /**\n * @description\n * Get the child attributes of the current resource.\n * GET attributes/{webId}/attributes\n * @param {string} elementId - The ID of the parent resource. See WebID for more information.\n * @param {Object} options - Query Options\n * @param {string} options.nameFilter - The name query string used for finding attributes. The default is no filter. See Query String for more information.\n * @param {string} options.categoryName - Specify that returned attributes must have this category. The default is no category filter.\n * @param {string} options.templateName - Specify that returned attributes must be members of this template. The default is no template filter.\n * @param {string} options.valueType - Specify that returned attributes' value type must be the given value type. The default is no value type filter.\n * @param {string} options.searchFullHierarchy - Specifies if the search should include attributes nested further than the immediate attributes of the searchRoot. The default is 'false'.\n * @param {string} options.sortField - The field or property of the object used to sort the returned collection. The default is 'Name'.\n * @param {string} options.sortOrder - The order that the returned collection is sorted. The default is 'Ascending'.\n * @param {string} options.startIndex - The starting index (zero based) of the items to be returned. The default is 0.\n * @param {string} options.showExcluded - Specified if the search should include attributes with the Excluded property set. The default is 'false'.\n * @param {string} options.showHidden - Specified if the search should include attributes with the Hidden property set. The default is 'false'.\n * @param {string} options.maxCount - The maximum number of objects to be returned per call (page size). The default is 1000.\n * @param {string} options.selectedFields - List of fields to be returned in the response, separated by semicolons (;). If this parameter is not specified, all available fields will be returned. See Selected Fields for more information.\n */\n private getAttributes(elementId: string, options: any): Promise {\n let querystring =\n '?' +\n map(options, (value, key) => {\n return key + '=' + value;\n }).join('&');\n\n if (querystring === '?') {\n querystring = '';\n }\n\n return this.restGet('/elements/' + elementId + '/attributes' + querystring).then(\n (response) => response.Items ?? []\n );\n }\n\n /**\n * @description\n * Retrieve elements based on the specified conditions. By default, this method selects immediate children of the current resource.\n * Users can search for the elements based on specific search parameters. If no parameters are specified in the search, the default values for each parameter will be used and will return the elements that match the default search.\n * GET assetdatabases/{webId}/elements\n * @param {string} databaseId - The ID of the parent resource. See WebID for more information.\n * @param {Object} options - Query Options\n * @param {string} options.webId - The ID of the resource to use as the root of the search. See WebID for more information.\n * @param {string} options.nameFilter - The name query string used for finding objects. The default is no filter. See Query String for more information.\n * @param {string} options.categoryName - Specify that returned elements must have this category. The default is no category filter.\n * @param {string} options.templateName - Specify that returned elements must have this template or a template derived from this template. The default is no template filter.\n * @param {string} options.elementType - Specify that returned elements must have this type. The default type is 'Any'. See Element Type for more information.\n * @param {string} options.searchFullHierarchy - Specifies if the search should include objects nested further than the immediate children of the searchRoot. The default is 'false'.\n * @param {string} options.sortField - The field or property of the object used to sort the returned collection. The default is 'Name'.\n * @param {string} options.sortOrder - The order that the returned collection is sorted. The default is 'Ascending'.\n * @param {number} options.startIndex - The starting index (zero based) of the items to be returned. The default is 0.\n * @param {number} options.maxCount - The maximum number of objects to be returned per call (page size). The default is 1000.\n * @param {string} options.selectedFields - List of fields to be returned in the response, separated by semicolons (;). If this parameter is not specified, all available fields will be returned. See Selected Fields for more information.\n */\n private getDatabaseElements(databaseId: string, options: any): Promise {\n let querystring =\n '?' +\n map(options, (value, key) => {\n return key + '=' + value;\n }).join('&');\n\n if (querystring === '?') {\n querystring = '';\n }\n\n return this.restGet('/assetdatabases/' + databaseId + '/elements' + querystring).then(\n (response) => response.Items ?? []\n );\n }\n\n /**\n * @description\n * Retrieve elements based on the specified conditions. By default, this method selects immediate children of the current resource.\n * Users can search for the elements based on specific search parameters. If no parameters are specified in the search, the default values for each parameter will be used and will return the elements that match the default search.\n * GET elements/{webId}/elements\n * @param {string} databaseId - The ID of the resource to use as the root of the search. See WebID for more information.\n * @param {Object} options - Query Options\n * @param {string} options.webId - The ID of the resource to use as the root of the search. See WebID for more information.\n * @param {string} options.nameFilter - The name query string used for finding objects. The default is no filter. See Query String for more information.\n * @param {string} options.categoryName - Specify that returned elements must have this category. The default is no category filter.\n * @param {string} options.templateName - Specify that returned elements must have this template or a template derived from this template. The default is no template filter.\n * @param {string} options.elementType - Specify that returned elements must have this type. The default type is 'Any'. See Element Type for more information.\n * @param {string} options.searchFullHierarchy - Specifies if the search should include objects nested further than the immediate children of the searchRoot. The default is 'false'.\n * @param {string} options.sortField - The field or property of the object used to sort the returned collection. The default is 'Name'.\n * @param {string} options.sortOrder - The order that the returned collection is sorted. The default is 'Ascending'.\n * @param {number} options.startIndex - The starting index (zero based) of the items to be returned. The default is 0.\n * @param {number} options.maxCount - The maximum number of objects to be returned per call (page size). The default is 1000.\n * @param {string} options.selectedFields - List of fields to be returned in the response, separated by semicolons (;). If this parameter is not specified, all available fields will be returned. See Selected Fields for more information.\n */\n private getElements(elementId: string, options: any): Promise {\n let querystring =\n '?' +\n map(options, (value, key) => {\n return key + '=' + value;\n }).join('&');\n\n if (querystring === '?') {\n querystring = '';\n }\n\n return this.restGet('/elements/' + elementId + '/elements' + querystring).then(\n (response) => response.Items ?? []\n );\n }\n\n /**\n * Retrieve a list of points on a specified Data Server.\n *\n * @param {string} serverId - The ID of the server. See WebID for more information.\n * @param {string} nameFilter - A query string for filtering by point name. The default is no filter. *, ?, [ab], [!ab]\n */\n private piPointSearch(serverId: string, nameFilter: string): Promise {\n let filter1 = this.templateSrv.replace(nameFilter);\n let filter2 = `${filter1}`;\n let doFilter = false;\n if (filter1 !== nameFilter) {\n const regex = /\\{(\\w|,)+\\}/g;\n let m;\n while ((m = regex.exec(filter1)) !== null) {\n // This is necessary to avoid infinite loops with zero-width matches\n if (m.index === regex.lastIndex) {\n regex.lastIndex++;\n }\n\n // The result can be accessed through the `m`-variable.\n m.forEach((match, groupIndex) => {\n if (groupIndex === 0) {\n filter1 = filter1.replace(match, match.replace('{', '(').replace('}', ')').replace(',', '|'));\n filter2 = filter2.replace(match, '*');\n doFilter = true;\n }\n });\n }\n }\n return this.restGet('/dataservers/' + serverId + '/points?maxCount=100&nameFilter=' + filter2).then((results) => {\n if (!!results && !!results?.Items) {\n return doFilter ? results.Items.filter((item) => item.Name?.match(filter1)) : results.Items;\n }\n return [];\n });\n }\n}\n","import { DataSourcePlugin } from '@grafana/data';\nimport { PIWebAPIConfigEditor } from './config/ConfigEditor';\nimport { PIWebAPIQueryEditor } from './query/QueryEditor';\nimport { PiWebAPIDatasource } from './datasource';\nimport { PIWebAPIQuery, PIWebAPIDataSourceJsonData } from './types';\n\nexport const plugin = new DataSourcePlugin(\n PiWebAPIDatasource\n)\n .setQueryEditor(PIWebAPIQueryEditor)\n .setConfigEditor(PIWebAPIConfigEditor);\n"],"names":["module","exports","__WEBPACK_EXTERNAL_MODULE__781__","__WEBPACK_EXTERNAL_MODULE__531__","__WEBPACK_EXTERNAL_MODULE__7__","__WEBPACK_EXTERNAL_MODULE__241__","__WEBPACK_EXTERNAL_MODULE__959__","__WEBPACK_EXTERNAL_MODULE__269__","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","FormField","LegacyForms","coerceOptions","options","jsonData","url","PIWebAPIConfigEditor","PureComponent","render","originalOptions","this","props","div","DataSourceHttpSettings","defaultUrl","dataSourceConfig","onChange","onHttpOptionsChange","showAccessOptions","h3","className","InlineField","label","labelWidth","InlineSwitch","pipoint","onPiPointChange","newFormat","onNewFormatChange","useUnit","onUseUnitChange","useExperimental","onUseExperimentalChange","useStreaming","onUseStreamingChange","inputWidth","onPIServerChange","piserver","placeholder","onAFServerChange","afserver","onAFDatabaseChange","afdatabase","event","onOptionsChange","target","checked","QueryField","tooltip","children","InlineFormLabel","width","QueryRowTerminator","QueryInlineField","QueryEditorRow","QueryRawInlineField","QueryRawEditorRow","defaultQuery","attributes","segments","regex","enable","nodata","summary","types","basis","duration","sampleTypeInterval","sampleInterval","expression","interpolate","useLastValue","recordedValues","boundaryType","digitalStates","enableStreaming","isPiPoint","QueryEditorModeSwitcher","isRaw","isModalOpen","setModalOpen","useState","useEffect","Button","aria-label","icon","variant","type","onClick","ConfirmModal","isOpen","title","body","confirmText","dismissText","onConfirm","onDismiss","metricQueryTransform","response","map","item","text","Name","expandable","HasChildren","Path","split","length","Items","WebId","LABEL_WIDTH","MIN_ATTR_INPUT_WIDTH","REMOVE_LABEL","CustomLabelComponent","style","marginRight","Icon","name","PIWebAPIQueryEditor","isValueEmpty","calcBasisValueChanged","segment","metricsQuery","query","getCalcBasisSegments","calculationBasis","recordedBoundaryTypeValueChanged","getRecordedBoundaryTypeSegments","recordedBoundaryTypes","calcNoDataValueChanged","getNoDataSegments","noDataReplacement","onSummaryValueChanged","index","summaries","state","slice","splice","setState","stateCallback","getSummarySegments","summaryTypes","filter","s","indexOf","unshift","removeSummary","part","onSummaryAction","selectableValue","push","summarySegment","removeAttribute","attributeChangeValue","onAttributeAction","Array","isArray","String","match","getSegmentPathUpTo","arr","reduce","result","startsWith","checkAttributeSegments","data","datasource","ctrl","findQuery","path","metricFindQuery","assign","request","scopedVars","then","attributesResponse","validAttributes","each","attribute","substring","filteredAttributes","attrib","changedValue","templateSrv","replace","availableAttributes","catch","err","error","message","checkPiPointSegments","webId","getSelectedPIServer","pointName","webID","piServer","forEach","parts","textEditorChanged","splitAttributes","splitElements","_","getElementSegments","elements","updateArray","rawQuery","checkAfServer","queryProps","onRunQuery","defaults","hideError","display","piPointConfig","onIsPiPointChange","InlineFieldRow","grow","Input","onBlur","SegmentAsync","Component","onSegmentChange","loadOptions","allowCustomValue","inputMinWidth","disabled","getAttributeSegmentsPI","reloadOptionsOnChange","Segment","onAttributeChange","getAttributeSegmentsAF","attributeSegment","onHideErrorChange","useUnitConfig","interval","maxNumber","parseInt","search","constructor","super","calculationBasisSegment","noDataReplacementSegment","segmentChangeValue","Promise","resolve","remove","currentSegment","afServerWebId","items","altSegments","variables","getVariables","variable","attributeText","forOwn","val","buildFromTarget","segmentsArray","attributesArray","summariesArray","cb","scopedVarsDone","componentDidMount","initialLoad","componentDidUpdate","force","_segmentsArray","e","console","elementPath","tr","join","parseRawQuery","isValidQuery","trim","targetSplit","queryChange","bind","PiWebAPIAnnotationsQueryEditor","memo","annotation","afWebId","setAfWebId","database","setDatabase","getValue","getAssetServer","AsyncSelect","getDatabases","dbs","loadingMessage","template","defaultOptions","getEventFrameTemplates","templ","showEndTime","currentTarget","categoryName","nameFilter","PiWebAPIDatasource","DataSourceWithBackend","applyTemplateVariables","targets","isAnnotation","buildQueryParameters","of","queryOptions","ds","querydepth","JSON","parse","Math","max","min","getAssetServers","server","getDatabase","db","getDatabaseElements","selectedFields","getElement","element","getElements","getAttributes","searchFullHierarchy","maxCount","getDataServers","piPointSearch","reject","hide","maxDataPoints","tar","att","refId","webid","startTime","range","from","endTime","to","annon","annotationOptions","events","currentLocale","Intl","DateTimeFormat","resolvedOptions","locale","values","transformDataFrameToMap","i","RegExp","Date","toLocaleString","time","timeEnd","id","tags","dataFrame","fields","field","toArray","getResource","restGet","getDataServer","serverId","databaseId","InstanceType","getElementTemplates","elementId","querystring","filter1","filter2","doFilter","m","exec","lastIndex","groupIndex","results","instanceSettings","getTemplateSrv","newFormatConfig","annotations","QueryEditor","prepareQuery","anno","queryType","processEvents","eventFrameToAnnotation","all","plugin","DataSourcePlugin","setQueryEditor","setConfigEditor"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"module.js","mappings":"oIAAAA,EAAOC,QAAUC,C,UCAjBF,EAAOC,QAAUE,C,QCAjBH,EAAOC,QAAUG,C,UCAjBJ,EAAOC,QAAUI,C,UCAjBL,EAAOC,QAAUK,C,UCAjBN,EAAOC,QAAUM,C,GCCbC,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaV,QAGrB,IAAID,EAASQ,EAAyBE,GAAY,CAGjDT,QAAS,CAAC,GAOX,OAHAY,EAAoBH,GAAUV,EAAQA,EAAOC,QAASQ,GAG/CT,EAAOC,OACf,CCrBAQ,EAAoBK,EAAKd,IACxB,IAAIe,EAASf,GAAUA,EAAOgB,WAC7B,IAAOhB,EAAiB,QACxB,IAAM,EAEP,OADAS,EAAoBQ,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdN,EAAoBQ,EAAI,CAAChB,EAASkB,KACjC,IAAI,IAAIC,KAAOD,EACXV,EAAoBY,EAAEF,EAAYC,KAASX,EAAoBY,EAAEpB,EAASmB,IAC5EE,OAAOC,eAAetB,EAASmB,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDX,EAAoBY,EAAI,CAACK,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFlB,EAAoBsB,EAAK9B,IACH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G,KAAKoT,YACHpT,KAAK8B,SAASkF,MAAQhH,KAAKgC,WAAWgF,KAAOhH,KAAK8B,SAASkF,KAAO,KAAOhH,KAAKgC,WAAWgF,UAAOjJ,GAChGwM,MAAMZ,GAAyB3J,KAAKgC,WAAWsS,MAAQ3K,EAAOnD,SAEpE,EChEK,MAAMsR,EAAS,IAAIC,EAAAA,iBACxB5F,GAEC6F,eAAe/Q,GACfgR,gBAAgBrY,G","sources":["webpack://gridprotectionalliance-osisoftpi-datasource/external amd \"@grafana/data\"","webpack://gridprotectionalliance-osisoftpi-datasource/external amd \"@grafana/runtime\"","webpack://gridprotectionalliance-osisoftpi-datasource/external amd \"@grafana/ui\"","webpack://gridprotectionalliance-osisoftpi-datasource/external amd \"lodash\"","webpack://gridprotectionalliance-osisoftpi-datasource/external amd \"react\"","webpack://gridprotectionalliance-osisoftpi-datasource/external amd \"rxjs\"","webpack://gridprotectionalliance-osisoftpi-datasource/webpack/bootstrap","webpack://gridprotectionalliance-osisoftpi-datasource/webpack/runtime/compat get default export","webpack://gridprotectionalliance-osisoftpi-datasource/webpack/runtime/define property getters","webpack://gridprotectionalliance-osisoftpi-datasource/webpack/runtime/hasOwnProperty shorthand","webpack://gridprotectionalliance-osisoftpi-datasource/webpack/runtime/make namespace object","webpack://gridprotectionalliance-osisoftpi-datasource/./config/ConfigEditor.tsx","webpack://gridprotectionalliance-osisoftpi-datasource/./components/Forms.tsx","webpack://gridprotectionalliance-osisoftpi-datasource/./types.ts","webpack://gridprotectionalliance-osisoftpi-datasource/./components/QueryEditorModeSwitcher.tsx","webpack://gridprotectionalliance-osisoftpi-datasource/./helper.ts","webpack://gridprotectionalliance-osisoftpi-datasource/./query/QueryEditor.tsx","webpack://gridprotectionalliance-osisoftpi-datasource/./query/AnnotationsQueryEditor.tsx","webpack://gridprotectionalliance-osisoftpi-datasource/./datasource.ts","webpack://gridprotectionalliance-osisoftpi-datasource/./module.ts"],"sourcesContent":["module.exports = __WEBPACK_EXTERNAL_MODULE__781__;","module.exports = __WEBPACK_EXTERNAL_MODULE__531__;","module.exports = __WEBPACK_EXTERNAL_MODULE__7__;","module.exports = __WEBPACK_EXTERNAL_MODULE__241__;","module.exports = __WEBPACK_EXTERNAL_MODULE__959__;","module.exports = __WEBPACK_EXTERNAL_MODULE__269__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import React, { ChangeEvent, PureComponent } from 'react';\nimport { LegacyForms, DataSourceHttpSettings, InlineField, InlineSwitch } from '@grafana/ui';\nimport { DataSourcePluginOptionsEditorProps, DataSourceJsonData, DataSourceSettings } from '@grafana/data';\nimport { PIWebAPIDataSourceJsonData } from '../types';\n\nconst { FormField } = LegacyForms;\n\ninterface Props extends DataSourcePluginOptionsEditorProps {}\n\nconst coerceOptions = (\n options: DataSourceSettings\n): DataSourceSettings => {\n return {\n ...options,\n jsonData: {\n ...options.jsonData,\n url: options.url,\n },\n };\n};\n\ninterface State {}\n\nexport class PIWebAPIConfigEditor extends PureComponent {\n onPIServerChange = (event: ChangeEvent) => {\n const { onOptionsChange, options } = this.props;\n const jsonData = {\n ...options.jsonData,\n piserver: event.target.value,\n };\n onOptionsChange({ ...options, jsonData });\n };\n\n onAFServerChange = (event: ChangeEvent) => {\n const { onOptionsChange, options } = this.props;\n const jsonData = {\n ...options.jsonData,\n afserver: event.target.value,\n };\n onOptionsChange({ ...options, jsonData });\n };\n\n onAFDatabaseChange = (event: ChangeEvent) => {\n const { onOptionsChange, options } = this.props;\n const jsonData = {\n ...options.jsonData,\n afdatabase: event.target.value,\n };\n onOptionsChange({ ...options, jsonData });\n };\n\n onHttpOptionsChange = (options: DataSourceSettings) => {\n const { onOptionsChange } = this.props;\n onOptionsChange(coerceOptions(options));\n };\n\n onPiPointChange = (event: ChangeEvent) => {\n const { onOptionsChange, options } = this.props;\n const jsonData = {\n ...options.jsonData,\n piserver: event.target.checked ? options.jsonData.piserver : '',\n pipoint: event.target.checked,\n };\n onOptionsChange({ ...options, jsonData });\n };\n\n onNewFormatChange = (event: ChangeEvent) => {\n const { onOptionsChange, options } = this.props;\n const jsonData = {\n ...options.jsonData,\n newFormat: event.target.checked,\n };\n onOptionsChange({ ...options, jsonData });\n };\n\n onUseUnitChange = (event: ChangeEvent) => {\n const { onOptionsChange, options } = this.props;\n const jsonData = {\n ...options.jsonData,\n useUnit: event.target.checked,\n };\n onOptionsChange({ ...options, jsonData });\n };\n\n onUseExperimentalChange = (event: ChangeEvent) => {\n const { onOptionsChange, options } = this.props;\n const jsonData = {\n ...options.jsonData,\n useExperimental : event.target.checked,\n useStreaming : event.target.checked ? options.jsonData.useStreaming : false,\n };\n onOptionsChange({ ...options, jsonData });\n };\n\n onUseStreamingChange = (event: ChangeEvent) => {\n const { onOptionsChange, options } = this.props;\n const jsonData = {\n ...options.jsonData,\n useStreaming: event.target.checked,\n };\n onOptionsChange({ ...options, jsonData });\n };\n\n render() {\n const { options: originalOptions } = this.props;\n const options = coerceOptions(originalOptions);\n\n return (\n
\n \n\n

Custom Configuration

\n\n
\n
\n \n \n \n
\n
\n \n \n \n
\n
\n \n \n \n
\n
\n \n \n \n
\n {options.jsonData.useExperimental && (\n
\n \n \n \n
\n )}\n
\n\n

PI/AF Connection Details

\n\n
\n {options.jsonData.pipoint && (\n
\n \n
\n )}\n
\n \n
\n
\n \n
\n
\n
\n );\n }\n}\n","import React, { InputHTMLAttributes, FunctionComponent } from 'react';\nimport { InlineFormLabel } from '@grafana/ui';\n\nexport interface Props extends InputHTMLAttributes {\n label: string;\n tooltip?: string;\n labelWidth?: number;\n children?: React.ReactNode;\n queryEditor?: JSX.Element;\n}\n\nexport const QueryField: FunctionComponent> = ({ label, labelWidth = 12, tooltip, children }) => (\n <>\n \n {label}\n \n {children}\n \n);\n\nexport const QueryRowTerminator = () => {\n return (\n
\n
\n
\n );\n};\n\nexport const QueryInlineField = ({ ...props }) => {\n return (\n \n \n \n );\n};\n\nexport const QueryEditorRow = (props: Partial) => {\n return (\n
\n {props.children}\n \n
\n );\n};\n\nexport const QueryRawInlineField = ({ ...props }) => {\n return (\n \n \n \n );\n};\n\nexport const QueryRawEditorRow = (props: Partial) => {\n return <>{props.children};\n};\n","import { DataQuery } from '@grafana/schema';\nimport { DataSourceJsonData, SelectableValue } from '@grafana/data';\n\nexport interface PiwebapiElementPath {\n path: string;\n variable: string;\n}\n\nexport interface PiwebapiInternalRsp {\n data: PiwebapiRsp;\n status: number;\n url: string;\n}\n\nexport interface PiwebapiRsp {\n Name?: string;\n InstanceType?: string;\n Items?: PiwebapiRsp[];\n WebId?: string;\n HasChildren?: boolean;\n Type?: string;\n DefaultUnitsName?: string;\n Description?: string;\n Path?: string;\n}\n\nexport interface PiDataServer {\n name: string | undefined;\n webid: string | undefined;\n}\n\nexport interface PIWebAPISelectableValue {\n webId?: string;\n value?: string;\n type?: string;\n expandable?: boolean;\n}\n\nexport interface PiWebAPIEnable {\n enable: boolean;\n}\n\nexport interface PiWebAPIRegex extends PiWebAPIEnable {\n search?: string;\n replace?: string\n}\n\nexport interface PiWebAPIRecordedValue extends PiWebAPIEnable {\n maxNumber?: number;\n boundaryType?: string;\n}\n\nexport interface PiWebAPIInterpolate extends PiWebAPIEnable {\n interval?: string;\n}\n\nexport interface PiWebAPISummary extends PiWebAPIEnable {\n types?: Array>;\n basis?: string,\n duration?: string,\n sampleTypeInterval?: boolean,\n sampleInterval?: string\n}\n\nexport interface PIWebAPIAnnotationsQuery extends DataQuery {\n target: string;\n}\n\nexport interface PIWebAPIQuery extends DataQuery {\n target: string;\n attributes: Array>;\n segments: Array>;\n useUnit: PiWebAPIEnable;\n regex: PiWebAPIRegex;\n interpolate: PiWebAPIInterpolate;\n recordedValues: PiWebAPIRecordedValue;\n useLastValue: PiWebAPIEnable;\n summary: PiWebAPISummary;\n digitalStates: PiWebAPIEnable;\n isPiPoint: boolean;\n elementPath?: string;\n hideError?: boolean;\n isAnnotation?: boolean;\n webid?: string;\n display?: any;\n nodata?: string,\n enableStreaming?: any;\n expression?: string;\n rawQuery?: boolean;\n query?: string;\n // annotations items\n database?: PiwebapiRsp;\n template?: PiwebapiRsp;\n showEndTime?: boolean;\n attribute?: any;\n nameFilter?: string;\n categoryName?: string;\n}\n\nexport const defaultQuery: Partial = {\n target: ';',\n attributes: [],\n segments: [],\n regex: { enable: false },\n nodata: 'Null',\n summary: {\n enable: false,\n types: [],\n basis: 'EventWeighted',\n duration: '',\n sampleTypeInterval: false,\n sampleInterval: ''\n },\n expression: '',\n interpolate: { enable: false },\n useLastValue: { enable: false },\n recordedValues: { enable: false, boundaryType: 'Inside' },\n digitalStates: { enable: false },\n enableStreaming: { enable: false },\n useUnit: { enable: false },\n isPiPoint: false,\n};\n\n/**\n * These are options configured for each DataSource instance\n */\nexport interface PIWebAPIDataSourceJsonData extends DataSourceJsonData {\n url?: string;\n access?: string;\n piserver?: string;\n afserver?: string;\n afdatabase?: string;\n pipoint?: boolean;\n newFormat?: boolean;\n useUnit?: boolean;\n useExperimental?: boolean;\n useStreaming?: boolean;\n}\n\n/**\n * Value that is used in the backend, but never sent over HTTP to the frontend\n */\nexport interface PIWebAPISecureJsonData {\n apiKey?: string;\n}\n","import React, { useEffect, useState } from 'react';\nimport { Button, ConfirmModal } from '@grafana/ui';\n\ntype Props = {\n isRaw: boolean;\n onChange: (newIsRaw: boolean) => void;\n};\n\nexport const QueryEditorModeSwitcher = ({ isRaw, onChange }: Props): JSX.Element => {\n const [isModalOpen, setModalOpen] = useState(false);\n\n useEffect(() => {\n // if the isRaw changes, we hide the modal\n setModalOpen(false);\n }, [isRaw]);\n\n if (isRaw) {\n return (\n <>\n {\n // we show the are-you-sure modal\n setModalOpen(true);\n }}\n >\n {\n onChange(false);\n }}\n onDismiss={() => {\n setModalOpen(false);\n }}\n />\n \n );\n } else {\n return (\n {\n onChange(true);\n }}\n >\n );\n }\n};\n","import { each, filter, map } from 'lodash';\r\n\r\nimport {\r\n AnnotationQuery,\r\n DataFrame,\r\n TableData,\r\n MetricFindValue,\r\n Field,\r\n toDataFrame,\r\n} from '@grafana/data';\r\n\r\nimport { PiwebapiElementPath, PiwebapiRsp, PIWebAPIQuery, PiWebAPISummary } from 'types';\r\n\r\nexport function getSummaryTypes(summary: PiWebAPISummary | undefined) {\r\n let types = filter(summary?.types ?? [], (item) => {\r\n return item !== undefined && item !== null && String(item) !== '';\r\n });\r\n return types.map((t) => {\r\n if (typeof t === 'string' || t instanceof String) {\r\n const new_type = String(t);\r\n return { label: new_type, value: { value: new_type, expandable: true } };\r\n }\r\n return t;\r\n });\r\n}\r\n\r\nexport function parseRawQuery(tr: string): any {\r\n const splitAttributes = tr.split(';');\r\n const splitElements = splitAttributes[0].split('\\\\');\r\n\r\n // remove element hierarchy from attribute collection\r\n splitAttributes.splice(0, 1);\r\n\r\n let attributes: any[] = [];\r\n if (splitElements.length > 1 || (splitElements.length === 1 && splitElements[0] !== '')) {\r\n const elementPath: string = splitElements.join('\\\\');\r\n each(splitAttributes, function (item, index) {\r\n if (item !== '') {\r\n attributes.push({\r\n label: item,\r\n value: {\r\n value: item,\r\n expandable: false,\r\n },\r\n });\r\n }\r\n });\r\n\r\n return { attributes, elementPath };\r\n }\r\n\r\n return { attributes, elementPath: null };\r\n}\r\n\r\nexport function lowerCaseFirstLetter(string: string): string {\r\n return string.charAt(0).toLocaleLowerCase() + string.slice(1);\r\n}\r\n\r\n/**\r\n * Builds the Grafana metric segment for use on the query user interface.\r\n *\r\n * @param {any} response - response from PI Web API.\r\n * @returns - Grafana metric segment.\r\n *\r\n * @memberOf PiWebApiDatasource\r\n */\r\nexport function metricQueryTransform(response: PiwebapiRsp[]): MetricFindValue[] {\r\n return map(response, (item) => {\r\n return {\r\n text: item.Name,\r\n expandable:\r\n item.HasChildren === undefined || item.HasChildren === true || (item.Path ?? '').split('\\\\').length <= 3,\r\n HasChildren: item.HasChildren,\r\n Items: item.Items ?? [],\r\n Path: item.Path,\r\n WebId: item.WebId,\r\n } as MetricFindValue;\r\n });\r\n}\r\n\r\n/**\r\n * Check if all items are selected.\r\n *\r\n * @param {any} current the current variable selection\r\n * @return {boolean} true if all value is selected, false otherwise\r\n */\r\nexport function isAllSelected(current: any): boolean {\r\n if (!current) {\r\n return false;\r\n }\r\n if (Array.isArray(current.text)) {\r\n return current.text.indexOf('All') >= 0;\r\n }\r\n return current.text === 'All';\r\n}\r\n\r\nexport function processAnnotationQuery(annon: AnnotationQuery,data: DataFrame[]): DataFrame[] {\r\n let processedFrames: DataFrame[] = [];\r\n \r\n data.forEach((d: DataFrame) => {\r\n d.fields.forEach((f: Field) => {\r\n\r\n // check if the label has been set, if it hasn't been set then the eventframe annotation is not valid. \r\n if (!f.labels) { \r\n return \r\n }\r\n\r\n if (!('eventframe' in f.labels)) {\r\n return;\r\n }\r\n\r\n let attribute = 'attribute' in f.labels\r\n\r\n // Check whether f.values is an array or not to allow for each.\r\n // Check whether f.values is an array or not to allow for each.\r\n if (Array.isArray(f.values)) {\r\n f.values.forEach((value: any) => {\r\n\r\n if (attribute) {\r\n let annotation = value['1'].Content\r\n let valueData: any[] = []\r\n for (let i = 2; i in value; i++) {\r\n valueData.push(value[i].Content.Items)\r\n }\r\n\r\n const processedFrame = convertToTableData(annotation.Items!, valueData).map((r) => {\r\n return toDataFrame(r)});\r\n processedFrames = processedFrames.concat(processedFrame);\r\n } else {\r\n let annotation = value['1'].Content\r\n const processedFrame = convertToTableData(annotation.Items!).map((r) => {\r\n return toDataFrame(r)});\r\n processedFrames = processedFrames.concat(processedFrame);\r\n }\r\n });\r\n } \r\n });\r\n });\r\n return processedFrames;\r\n}\r\n\r\nexport function convertToTableData(items: any[], valueData?: any[]): TableData[] {\r\n const response: TableData[] = items.map((item: any, index: number) => {\r\n const columns = [{ text: 'StartTime' }, { text: 'EndTime' }];\r\n const rows = [item.StartTime, item.EndTime];\r\n if (valueData) {\r\n for (let attributeIndex = 0; attributeIndex < valueData.length; attributeIndex++) {\r\n let attributeData = valueData[attributeIndex]\r\n let eventframeAributeData = attributeData[index].Content.Items\r\n eventframeAributeData.forEach((attribute: any) => {\r\n columns.push({ text: attribute.Name });\r\n rows.push(String(attribute.Value.Value ? attribute.Value.Value.Name || attribute.Value.Value.Value || attribute.Value.Value : ''));\r\n });\r\n }\r\n }\r\n\r\n return {\r\n name: item.Name,\r\n columns,\r\n rows: [rows],\r\n };\r\n });\r\n return response;\r\n}\r\n\r\n/**\r\n * Resolve PIWebAPI response 'value' data to value - timestamp pairs.\r\n *\r\n * @param {any} item - 'Item' object from PIWebAPI\r\n * @param {any} noDataReplacementMode - String state of how to replace 'No Data'\r\n * @param {any} grafanaDataPoint - Single Grafana value pair (value, timestamp).\r\n * @returns grafanaDataPoint - Single Grafana value pair (value, timestamp).\r\n * @returns perviousValue - {any} Grafana value (value only).\r\n *\r\n */\r\nexport function noDataReplace(\r\n item: any,\r\n noDataReplacementMode: any,\r\n grafanaDataPoint: any[]\r\n): {\r\n grafanaDataPoint: any[];\r\n previousValue: any;\r\n drop: boolean;\r\n} {\r\n let previousValue = null;\r\n let drop = false;\r\n if (!item.Good || item.Value === 'No Data' || (item.Value?.Name && item.Value?.Name === 'No Data')) {\r\n if (noDataReplacementMode === 'Drop') {\r\n drop = true;\r\n } else if (noDataReplacementMode === '0') {\r\n grafanaDataPoint[0] = 0;\r\n } else if (noDataReplacementMode === 'Keep') {\r\n // Do nothing keep\r\n } else if (noDataReplacementMode === 'Null') {\r\n grafanaDataPoint[0] = null;\r\n } else if (noDataReplacementMode === 'Previous' && previousValue !== null) {\r\n grafanaDataPoint[0] = previousValue;\r\n }\r\n } else {\r\n previousValue = item.Value;\r\n }\r\n return { grafanaDataPoint, previousValue, drop };\r\n}\r\n\r\n/**\r\n * Check if the value is a number.\r\n *\r\n * @param {any} number the value to check\r\n * @returns {boolean} true if the value is a number, false otherwise\r\n */\r\nexport function checkNumber(number: any): boolean {\r\n return typeof number === 'number' && !Number.isNaN(number) && Number.isFinite(number);\r\n}\r\n\r\n/**\r\n * Returns the last item of the element path.\r\n *\r\n * @param {string} path element path\r\n * @returns {string} last item of the element path\r\n */\r\nexport function getLastPath(path: string): string {\r\n let splitPath = path.split('|');\r\n if (splitPath.length === 0) {\r\n return '';\r\n }\r\n splitPath = splitPath[0].split('\\\\');\r\n return splitPath.length === 0 ? '' : splitPath.pop() ?? '';\r\n}\r\n\r\n/**\r\n * Returns the last item of the element path plus variable.\r\n *\r\n * @param {PiwebapiElementPath[]} elementPathArray array of element paths\r\n * @param {string} path element path\r\n * @returns {string} last item of the element path\r\n */\r\nexport function getPath(elementPathArray: PiwebapiElementPath[], path: string): string {\r\n if (!path || elementPathArray.length === 0) {\r\n return '';\r\n }\r\n const splitStr = getLastPath(path);\r\n const foundElement = elementPathArray.find((e) => path.indexOf(e.path) >= 0)?.variable;\r\n return foundElement ? foundElement + '|' + splitStr : splitStr;\r\n}\r\n\r\n/**\r\n * Replace calculation dot in expression with PI point name.\r\n *\r\n * @param {boolean} replace - is pi point and calculation.\r\n * @param {PiwebapiRsp} webid - Pi web api response object.\r\n * @param {string} url - original url.\r\n * @returns Modified url\r\n */\r\nexport function getFinalUrl(replace: boolean, webid: PiwebapiRsp, url: string) {\r\n const newUrl = replace ? url.replace(/'\\.'/g, `'${webid.Name}'`) : url;\r\n return newUrl;\r\n}\r\n","import { each, filter, forOwn, join, reduce, map, slice, remove, defaults } from 'lodash';\n\nimport React, { PureComponent, ChangeEvent } from 'react';\nimport { Icon, InlineField, InlineFieldRow, InlineSwitch, Input, SegmentAsync, Segment } from '@grafana/ui';\nimport { QueryEditorProps, SelectableValue, TypedVariableModel } from '@grafana/data';\n\nimport { PiWebAPIDatasource } from '../datasource';\nimport { QueryInlineField, QueryRawInlineField, QueryRowTerminator } from '../components/Forms';\nimport { PIWebAPISelectableValue, PIWebAPIDataSourceJsonData, PIWebAPIQuery, defaultQuery, PiWebAPISummary } from '../types';\nimport { QueryEditorModeSwitcher } from 'components/QueryEditorModeSwitcher';\nimport { parseRawQuery, getSummaryTypes } from 'helper';\n\nconst LABEL_WIDTH = 24;\nconst LABEL_SWITCH_WIDTH = 49.067 / 8.0;\nconst MIN_ELEM_INPUT_WIDTH = 200;\nconst MIN_ATTR_INPUT_WIDTH = 250;\n\ninterface State {\n isPiPoint: boolean;\n hideError: boolean;\n segments: Array>;\n attributes: Array>;\n summaries: Array>;\n attributeSegment: SelectableValue;\n summarySegment: SelectableValue;\n calculationBasisSegment: SelectableValue;\n noDataReplacementSegment: SelectableValue;\n}\n\ntype Props = QueryEditorProps;\n\nconst REMOVE_LABEL = '-REMOVE-';\n\nconst CustomLabelComponent = (props: any) => {\n if (props.value) {\n return (\n
\n {props.label ?? '--no label--'}\n
\n );\n }\n return (\n \n \n \n );\n};\n\nexport class PIWebAPIQueryEditor extends PureComponent {\n error: any;\n piServer: any[] = [];\n availableAttributes: any = {};\n summaryTypes: string[];\n calculationBasis: string[];\n recordedBoundaryTypes: string [];\n noDataReplacement: string[];\n state: State = {\n isPiPoint: false,\n hideError: false,\n segments: [],\n attributes: [],\n summaries: [],\n attributeSegment: {},\n summarySegment: {},\n calculationBasisSegment: {},\n noDataReplacementSegment: {},\n };\n\n constructor(props: any) {\n super(props);\n this.onSegmentChange = this.onSegmentChange.bind(this);\n this.calcBasisValueChanged = this.calcBasisValueChanged.bind(this);\n this.recordedBoundaryTypeValueChanged = this.recordedBoundaryTypeValueChanged.bind(this);\n this.calcNoDataValueChanged = this.calcNoDataValueChanged.bind(this);\n this.onSummaryAction = this.onSummaryAction.bind(this);\n this.onSummaryValueChanged = this.onSummaryValueChanged.bind(this);\n this.onAttributeAction = this.onAttributeAction.bind(this);\n this.onAttributeChange = this.onAttributeChange.bind(this);\n\n this.summaryTypes = [\n // 'None', // A summary type is not specified.\n 'Total', // A totalization over the time range.\n 'Average', // The average value over the time range.\n 'Minimum', // The minimum value over the time range.\n 'Maximum', // The maximum value over the time range.\n 'Range', // The range value over the time range (minimum-maximum).\n 'StdDev', // The standard deviation over the time range.\n 'PopulationStdDev', // The population standard deviation over the time range.\n 'Count', // The sum of event count over the time range when calculation basis is event weighted. The sum of event time duration over the time range when calculation basis is time weighted.\n 'PercentGood', // Percent of data with good value during the calculation period. For time weighted calculations, the percentage is based on time. For event weighted calculations, the percent is based on event count.\n 'All', // A convenience for requesting all available summary calculations.\n 'AllForNonNumeric', // A convenience for requesting all available summary calculations for non-numeric data.\n ];\n\n this.calculationBasis = [\n 'TimeWeighted', // Weight the values in the calculation by the time over which they apply. Interpolation is based on whether the attribute is stepped. Interpolated events are generated at the boundaries if necessary.\n 'EventWeighted', // Evaluate values with equal weighting for each event. No interpolation is done. There must be at least one event within the time range to perform a successful calculation. Two events are required for standard deviation. In handling events at the boundary of the calculation, the AFSDK uses following rules:\n 'TimeWeightedContinuous', // Apply weighting as in TimeWeighted, but do all interpolation between values as if they represent continuous data, (standard interpolation) regardless of whether the attribute is stepped.\n 'TimeWeightedDiscrete', // Apply weighting as in TimeWeighted but interpolation between values is performed as if they represent discrete, unrelated values (stair step plot) regardless of the attribute is stepped.\n 'EventWeightedExcludeMostRecentEvent', // The calculation behaves the same as _EventWeighted_, except in the handling of events at the boundary of summary intervals in a multiple intervals calculation. Use this option to prevent events at the intervals boundary from being double count at both intervals. With this option, events at the end time (most recent time) of an interval is not used in that interval.\n 'EventWeightedExcludeEarliestEvent', // Similar to the option _EventWeightedExcludeMostRecentEvent_. Events at the start time(earliest time) of an interval is not used in that interval.\n 'EventWeightedIncludeBothEnds', // Events at both ends of the interval boundaries are included in the event weighted calculation.\n ];\n\n this.recordedBoundaryTypes = [\n 'Inside', // Default. Specifies to return the recorded values on the inside of the requested time range as the first and last values. \n 'Outside', // Specifies to return the recorded values on the outside of the requested time range as the first and last values.\n 'Interpolated', //Specifies to create an interpolated value at the end points of the requested time range if a recorded value does not exist at that time.\n ]\n\n this.noDataReplacement = [\n 'Null', // replace with nulls\n 'Drop', // drop items\n 'Previous', // use previous value if available\n '0', // replace with 0\n 'Keep', // Keep value\n ];\n }\n\n // is selected segment empty\n isValueEmpty(value: PIWebAPISelectableValue | undefined) {\n return !value || !value.value || !value.value.length || value.value === REMOVE_LABEL;\n }\n\n segmentChangeValue = (segments: Array>) => {\n const query = this.props.query;\n this.setState({ segments }, () => this.onChange({ ...query, segments }));\n };\n\n attributeChangeValue = (attributes: Array>): Promise => {\n const query = this.props.query;\n return new Promise((resolve) => this.setState({ attributes }, () => {\n this.onChange({ ...query, attributes })\n resolve();\n }));\n };\n\n // summary calculation basis change event\n calcBasisValueChanged(segment: SelectableValue) {\n const metricsQuery = this.props.query as PIWebAPIQuery;\n const summary = metricsQuery.summary;\n if (summary) {\n summary.basis = segment.value?.value;\n }\n this.onChange({ ...metricsQuery, summary });\n }\n // get summary calculation basis user interface segments\n getCalcBasisSegments() {\n const segments = map(this.calculationBasis, (item: string) => {\n let selectableValue: SelectableValue = {\n label: item,\n value: {\n value: item,\n expandable: true,\n },\n };\n return selectableValue;\n });\n return segments;\n }\n\n // recorded boundary type change event\n recordedBoundaryTypeValueChanged(segment: SelectableValue) {\n const metricsQuery = this.props.query as PIWebAPIQuery;\n const recordedValues = metricsQuery.recordedValues;\n if (recordedValues) {\n recordedValues.boundaryType = segment.value?.value;\n }\n this.onChange({ ...metricsQuery, recordedValues });\n }\n // get recorded boundary type user interface segments\n getRecordedBoundaryTypeSegments() {\n const segments = map(this.recordedBoundaryTypes, (item: string) => {\n let selectableValue: SelectableValue = {\n label: item,\n value: {\n value: item,\n expandable: true,\n },\n };\n return selectableValue;\n });\n return segments;\n }\n\n // no data change event\n calcNoDataValueChanged(segment: SelectableValue) {\n const metricsQuery = this.props.query as PIWebAPIQuery;\n const nodata = segment.value?.value;\n this.onChange({ ...metricsQuery, nodata });\n }\n // get no data user interface segments\n getNoDataSegments() {\n const segments = map(this.noDataReplacement, (item: string) => {\n let selectableValue: SelectableValue = {\n label: item,\n value: {\n value: item,\n expandable: true,\n },\n };\n return selectableValue;\n });\n return segments;\n }\n\n // summary query change event\n onSummaryValueChanged(item: SelectableValue, index: number) {\n const summaries = this.state.summaries.slice(0) as Array>;\n summaries[index] = item;\n if (this.isValueEmpty(item.value)) {\n summaries.splice(index, 1);\n }\n this.setState({ summaries }, this.stateCallback);\n }\n // get the list of summaries available\n getSummarySegments() {\n const summaryTypes = filter(this.summaryTypes, (type) => {\n return this.state.summaries.map((s) => s.value?.value).indexOf(type) === -1;\n });\n\n const segments = map(summaryTypes, (item: string) => {\n let selectableValue: SelectableValue = {\n label: item,\n value: {\n value: item,\n expandable: true,\n },\n };\n return selectableValue;\n });\n\n segments.unshift({\n label: REMOVE_LABEL,\n value: {\n value: REMOVE_LABEL,\n },\n });\n\n return segments;\n }\n\n // remove a summary from the user interface and the query\n removeSummary(part: SelectableValue) {\n const summaries = filter(this.state.summaries, (item: SelectableValue) => {\n return item !== part;\n });\n this.setState({ summaries });\n }\n // add a new summary to the query\n onSummaryAction(item: SelectableValue) {\n const summaries = this.state.summaries.slice(0) as Array>;\n // if value is not empty, add new attribute segment\n if (!this.isValueEmpty(item.value)) {\n let selectableValue: SelectableValue = {\n label: item.label,\n value: {\n value: item.value?.value,\n expandable: true,\n },\n };\n summaries.push(selectableValue);\n }\n this.setState({ summarySegment: {}, summaries }, this.stateCallback);\n }\n\n // remove an attribute from the query\n removeAttribute(part: SelectableValue) {\n const attributes = filter(this.state.attributes, (item: SelectableValue) => {\n return item !== part;\n });\n this.attributeChangeValue(attributes);\n }\n // add an attribute to the query\n onAttributeAction(item: SelectableValue) {\n const { query } = this.props;\n const attributes = this.state.attributes.slice(0);\n // partial variable\n if (item.value !== null && typeof item.value !== 'object' && !Array.isArray(item.value)) {\n const value = String(item.value! as string);\n item.value = {\n type: value.match(/\\${\\w+}/gi) ? 'template' : undefined,\n value: value,\n }\n }\n\n // if value is not empty, add new attribute segment\n if (!this.isValueEmpty(item.value)) {\n let selectableValue: SelectableValue = {\n label: item.label,\n value: {\n type: item.value?.value && item.value?.value.match(/\\${\\w+}/gi) ? 'template' : undefined,\n value: item.value?.value,\n expandable: !query.isPiPoint,\n },\n };\n attributes.push(selectableValue);\n }\n this.attributeChangeValue(attributes);\n }\n\n // pi point change event\n onPiPointChange = (item: SelectableValue, index: number) => {\n let attributes = this.state.attributes.slice(0);\n\n if (item.label === REMOVE_LABEL) {\n remove(attributes, (_, n) => n === index);\n } else {\n // set current value\n attributes[index] = item;\n }\n\n this.checkPiPointSegments(item, attributes);\n };\n // attribute change event\n onAttributeChange = (item: SelectableValue, index: number) => {\n let attributes = this.state.attributes.slice(0);\n\n // ignore if no change\n if (attributes[index].label === item.value?.value) {\n return;\n }\n\n // set current value\n attributes[index] = item;\n\n this.checkAttributeSegments(attributes, this.state.segments);\n };\n // segment change\n onSegmentChange = (item: SelectableValue, index: number) => {\n const { query } = this.props;\n let segments = this.state.segments.slice(0);\n\n // partial variable\n if (item.value !== null && typeof item.value !== 'object' && !Array.isArray(item.value)) {\n const value = String(item.value! as string);\n item.value = {\n type: value.match(/\\${\\w+}/gi) ? 'template' : undefined,\n value: value,\n }\n }\n\n // ignore if no change\n if (segments[index].label === item.value?.value) {\n return;\n }\n\n // reset attributes list\n this.setState({ attributes: [] }, () => {\n if (item.label === REMOVE_LABEL) {\n segments = slice(segments, 0, index);\n this.checkAttributeSegments([], segments).then(() => {\n if (segments.length === 0) {\n segments.push({\n label: '',\n });\n } else if (!!segments[segments.length - 1].value?.expandable) {\n segments.push({\n label: 'Select Element',\n value: {\n value: '-Select Element-',\n },\n });\n }\n if (query.isPiPoint) {\n this.piServer = [];\n }\n this.segmentChangeValue(segments);\n });\n return;\n }\n\n // set current value\n segments[index] = item;\n\n // Accept only one PI server\n if (query.isPiPoint) {\n this.piServer.push(item);\n this.segmentChangeValue(segments);\n return;\n }\n\n // changed internal selection\n if (index < segments.length - 1) {\n segments = slice(segments, 0, index + 1);\n }\n this.checkAttributeSegments([], segments).then((): Promise>> => {\n // add new options\n if (item.value?.type === 'template') { // if it's a variable we need to check for new elements\\\n return this.getElementSegments(segments.length + 1, segments).then((elements) => {\n if (elements.length > 0) {\n segments[index].value!.expandable = true;\n segments.push({\n label: 'Select Element',\n value: {\n value: '-Select Element-',\n },\n });\n }\n this.segmentChangeValue(segments);\n return segments;\n });\n } else if (!!item.value?.expandable) {\n segments.push({\n label: 'Select Element',\n value: {\n value: '-Select Element-',\n },\n });\n }\n return new Promise((resolve) => {\n this.segmentChangeValue(segments);\n resolve(segments);\n });\n });\n });\n };\n\n // get a ui segment for the attributes\n getElementSegments = (\n index: number,\n currentSegment?: Array>\n ): Promise>> => {\n const { datasource, query, data } = this.props;\n const ctrl = this;\n const findQuery = query.isPiPoint\n ? { type: 'dataserver' }\n : {\n path: this.getSegmentPathUpTo(currentSegment ?? this.state.segments.slice(0), index),\n afServerWebId: this.state.segments.length > 0 && this.state.segments[0].value ? this.state.segments[0].value.webId : undefined,\n };\n\n if (!query.isPiPoint) {\n if (datasource.afserver?.name && index === 0) {\n return Promise.resolve([\n {\n label: datasource.afserver.name,\n value: {\n value: datasource.afserver.name,\n expandable: true,\n },\n },\n ]);\n }\n if (datasource.afserver?.name && datasource.afdatabase?.name && index === 1) {\n return Promise.resolve([\n {\n label: datasource.afdatabase.name,\n value: {\n value: datasource.afdatabase.name,\n expandable: true,\n },\n },\n ]);\n }\n }\n return datasource\n .metricFindQuery(findQuery, Object.assign(data?.request?.scopedVars ?? {}, { isPiPoint: query.isPiPoint }))\n .then((items: any[]) => {\n const altSegments = map(items, (item: any) => {\n let selectableValue: SelectableValue = {\n label: item.text,\n value: {\n webId: item.WebId,\n value: item.text,\n expandable: !query.isPiPoint && item.expandable,\n },\n };\n return selectableValue;\n });\n\n if (altSegments.length === 0) {\n return altSegments;\n }\n\n // add template variables\n const variables = datasource.templateSrv.getVariables();\n each(variables, (variable: TypedVariableModel) => {\n let selectableValue: SelectableValue = {\n label: '${' + variable.name + '}',\n value: {\n type: 'template',\n value: '${' + variable.name + '}',\n expandable: !query.isPiPoint,\n },\n };\n altSegments.unshift(selectableValue);\n });\n\n // add remove label\n altSegments.unshift({\n label: REMOVE_LABEL,\n value: {\n value: REMOVE_LABEL,\n },\n });\n\n return altSegments;\n })\n .catch((err: any) => {\n ctrl.error = err.message || 'Failed to issue metric query';\n return [];\n });\n };\n\n // get the list of attributes for the user interface - PI\n getAttributeSegmentsPI = (attributeText?: string): Promise>> => {\n const { datasource, query, data } = this.props;\n const ctrl = this;\n const findQuery = {\n path: '',\n webId: this.getSelectedPIServer(),\n pointName: (attributeText ?? '') + '*',\n type: 'pipoint',\n };\n let segments: Array> = [];\n return datasource\n .metricFindQuery(findQuery, Object.assign(data?.request?.scopedVars ?? {}, { isPiPoint: query.isPiPoint }))\n .then((items: any[]) => {\n segments = map(items, (item: any) => {\n let selectableValue: SelectableValue = {\n path: item.Path,\n label: item.text,\n value: {\n value: item.text,\n expandable: false,\n },\n };\n return selectableValue;\n });\n if (!!attributeText && attributeText.length > 0) {\n segments.unshift({\n label: attributeText,\n value: {\n value: attributeText,\n expandable: false,\n },\n });\n }\n // add template variables\n const variables = datasource.templateSrv.getVariables();\n each(variables, (variable: TypedVariableModel) => {\n let selectableValue: SelectableValue = {\n label: '${' + variable.name + '}',\n value: {\n type: 'template',\n value: '${' + variable.name + '}',\n expandable: !query.isPiPoint,\n },\n };\n segments.unshift(selectableValue);\n });\n\n // add remove label\n segments.unshift({\n label: REMOVE_LABEL,\n value: {\n value: REMOVE_LABEL,\n },\n });\n\n return segments;\n })\n .catch((err: any) => {\n ctrl.error = err.message || 'Failed to issue metric query';\n return segments;\n });\n };\n\n // get the list of attributes for the user interface - AF\n getAttributeSegmentsAF = (attributeText?: string): Array> => {\n const { datasource } = this.props;\n const ctrl = this;\n let segments: Array> = [];\n\n segments.push({\n label: REMOVE_LABEL,\n value: {\n value: REMOVE_LABEL,\n },\n });\n\n // add template variables\n const variables = datasource.templateSrv.getVariables();\n each(variables, (variable: TypedVariableModel) => {\n let selectableValue: SelectableValue = {\n label: '${' + variable.name + '}',\n value: {\n type: 'template',\n value: '${' + variable.name + '}',\n expandable: false,\n },\n };\n segments.push(selectableValue);\n });\n\n forOwn(ctrl.availableAttributes, (val: any, key: string) => {\n let selectableValue: SelectableValue = {\n label: key,\n value: {\n value: key,\n expandable: true,\n },\n };\n segments.push(selectableValue);\n });\n\n return segments;\n };\n\n // build data from target string\n buildFromTarget = (\n query: PIWebAPIQuery,\n segmentsArray: Array>,\n attributesArray: Array>\n ) => {\n const splitAttributes = query.target!.split(';');\n const splitElements = splitAttributes.length > 0 ? splitAttributes[0].split('\\\\') : [];\n\n if (splitElements.length > 1 || (splitElements.length === 1 && splitElements[0] !== '')) {\n // remove element hierarchy from attribute collection\n splitAttributes.splice(0, 1);\n\n each(splitElements, (item, _) => {\n segmentsArray.push({\n label: item,\n value: {\n type: item.match(/\\${\\w+}/gi) ? 'template' : undefined,\n value: item,\n expandable: true,\n },\n });\n });\n each(splitAttributes, (item, _) => {\n if (item !== '') {\n // set current value\n attributesArray.push({\n label: item,\n value: {\n type: item.match(/\\${\\w+}/gi) ? 'template' : undefined,\n value: item,\n expandable: false,\n },\n });\n }\n });\n return this.getElementSegments(splitElements.length + 1, segmentsArray).then((elements) => {\n if (elements.length > 0) {\n segmentsArray.push({\n label: 'Select Element',\n value: {\n value: '-Select Element-',\n },\n });\n }\n return segmentsArray;\n });\n }\n return Promise.resolve(segmentsArray);\n };\n\n /**\n * Gets the segment information and parses it to a string.\n *\n * @param {any} index - Last index of segment to use.\n * @returns - AF Path or PI Point name.\n *\n * @memberOf PIWebAPIQueryEditor\n */\n getSegmentPathUpTo(segments: Array>, index: number): string {\n const arr = segments.slice(0, index);\n\n return reduce(\n arr,\n (result: any, segment: SelectableValue) => {\n if (!segment.value) {\n return '';\n }\n if (!segment.value.value?.startsWith('-Select')) {\n return result ? result + '\\\\' + segment.value.value : segment.value.value;\n }\n return result;\n },\n ''\n );\n }\n\n /**\n * Get the current AF Element's child attributes. Validates when the element selection changes.\n *\n * @returns - Collection of attributes.\n *\n * @memberOf PIWebAPIQueryEditor\n */\n checkAttributeSegments(\n attributes: Array>,\n segments: Array>\n ): Promise {\n const { datasource, data } = this.props;\n const ctrl = this;\n const findQuery = {\n path: this.getSegmentPathUpTo(segments.slice(0), segments.length),\n type: 'attributes',\n };\n return datasource\n .metricFindQuery(findQuery, Object.assign(data?.request?.scopedVars ?? {}, { isPiPoint: false }))\n .then((attributesResponse: any) => {\n const validAttributes: any = {};\n\n each(attributesResponse, (attribute: any) => {\n validAttributes[attribute.Path.substring(attribute.Path.indexOf('|') + 1)] = attribute.WebId;\n });\n\n const filteredAttributes = filter(attributes, (attrib: SelectableValue) => {\n const changedValue = datasource.templateSrv.replace(attrib.value?.value);\n return validAttributes[changedValue] !== undefined;\n });\n\n ctrl.availableAttributes = validAttributes;\n return this.attributeChangeValue(filteredAttributes);\n })\n .catch((err: any) => {\n ctrl.error = err.message || 'Failed to issue metric query';\n return this.attributeChangeValue(attributes);\n });\n }\n\n /**\n * Get PI points from server.\n *\n * @returns - Collection of attributes.\n *\n * @memberOf PIWebAPIQueryEditor\n */\n checkPiPointSegments(\n attribute: SelectableValue,\n attributes: Array>\n ) {\n const { datasource, data } = this.props;\n const ctrl = this;\n const findQuery = {\n path: attribute.path,\n webId: ctrl.getSelectedPIServer(),\n pointName: attribute.label,\n type: 'pipoint',\n };\n return datasource\n .metricFindQuery(findQuery, Object.assign(data?.request?.scopedVars ?? {}, { isPiPoint: true }))\n .then(() => {\n return ctrl.attributeChangeValue(attributes);\n })\n .catch((err: any) => {\n ctrl.error = err.message || 'Failed to issue metric query';\n return ctrl.attributeChangeValue([]);\n });\n }\n\n /**\n * Gets the webid of the current selected pi data server.\n *\n * @memberOf PIWebAPIQueryEditor\n */\n getSelectedPIServer() {\n let webID = '';\n\n this.piServer.forEach((s) => {\n const parts = this.props.query.target!.split(';');\n if (parts.length >= 2) {\n if (parts[0] === s.text) {\n webID = s.WebId;\n return;\n }\n }\n });\n return this.piServer.length > 0 ? this.piServer[0].value?.webId : webID;\n }\n\n /**\n * Queries PI Web API for child elements and attributes when the raw query text editor is changed.\n *\n * @memberOf PIWebAPIQueryEditor\n */\n textEditorChanged() {\n const { query } = this.props;\n const splitAttributes = query.target!.split(';');\n const splitElements = splitAttributes.length > 0 ? splitAttributes[0].split('\\\\') : [];\n\n let segments: Array> = [];\n let attributes: Array> = [];\n\n if (splitElements.length > 1 || (splitElements.length === 1 && splitElements[0] !== '')) {\n // remove element hierarchy from attribute collection\n splitAttributes.splice(0, 1);\n\n each(splitElements, (item, _) => {\n segments.push({\n label: item,\n value: {\n type: item.match(/\\${\\w+}/gi) ? 'template' : undefined,\n value: item,\n expandable: true,\n },\n });\n });\n each(splitAttributes, function (item, index) {\n if (item !== '') {\n attributes.push({\n label: item,\n value: {\n type: item.match(/\\${\\w+}/gi) ? 'template' : undefined,\n value: item,\n expandable: false,\n },\n });\n }\n });\n this.getElementSegments(splitElements.length + 1, segments)\n .then((elements) => {\n if (elements.length > 0) {\n segments.push({\n label: 'Select Element',\n value: {\n value: '-Select Element-',\n },\n });\n }\n })\n .then(() => {\n this.updateArray(segments, attributes, this.state.summaries, query.isPiPoint!, () => {\n this.onChange({\n ...query,\n query: undefined,\n rawQuery: false,\n attributes: this.state.attributes,\n segments: this.state.segments,\n });\n });\n });\n } else {\n segments = this.checkAfServer();\n this.updateArray(segments, this.state.attributes, this.state.summaries, query.isPiPoint!, () => {\n this.onChange({\n ...query,\n query: undefined,\n rawQuery: false,\n attributes: this.state.attributes,\n segments: this.state.segments,\n });\n });\n }\n }\n\n /**\n * Check if the AF server and database are configured in the datasoure config.\n *\n * @returns the segments array\n *\n * @memberOf PIWebAPIQueryEditor\n */\n checkAfServer = () => {\n const { datasource } = this.props;\n const segmentsArray = [];\n if (datasource.afserver?.name) {\n segmentsArray.push({\n label: datasource.afserver.name,\n value: {\n value: datasource.afserver.name,\n expandable: true,\n },\n });\n if (datasource.afdatabase?.name) {\n segmentsArray.push({\n label: datasource.afdatabase.name,\n value: {\n value: datasource.afdatabase.name,\n expandable: true,\n },\n });\n }\n segmentsArray.push({\n label: 'Select Element',\n value: {\n value: '-Select Element-',\n },\n });\n } else {\n segmentsArray.push({\n label: '',\n });\n }\n return segmentsArray;\n };\n\n /**\n * Update the internal state of the datasource.\n *\n * @param segmentsArray the segments array to update\n * @param attributesArray the AF attributes array to update\n * @param summariesArray the summaries array to update\n * @param isPiPoint the is PI point flag\n * @param cb optional callback function\n *\n * @memberOf PIWebAPIQueryEditor\n */\n updateArray = (\n segmentsArray: Array>,\n attributesArray: Array>,\n summariesArray: Array>,\n isPiPoint: boolean,\n cb?: (() => void) | undefined\n ) => {\n this.setState(\n {\n segments: segmentsArray,\n attributes: attributesArray,\n summaries: summariesArray,\n isPiPoint,\n },\n () => {\n if (!isPiPoint) {\n this.checkAttributeSegments(attributesArray, this.state.segments).then(() => {\n if (cb) {\n cb();\n }\n });\n }\n }\n );\n };\n\n // React action when component is initialized/updated\n scopedVarsDone = false;\n componentDidMount = () => {\n this.initialLoad(false);\n };\n\n componentDidUpdate = () => {\n const { query } = this.props;\n if (this.props.data?.state === 'Done' && !!this.props.data?.request?.scopedVars && !this.scopedVarsDone) {\n this.scopedVarsDone = true;\n this.initialLoad(!query.isPiPoint);\n }\n };\n\n initialLoad = (force: boolean) => {\n const { query } = this.props;\n const metricsQuery = defaults(query, defaultQuery) as PIWebAPIQuery;\n const { segments, attributes, summary, isPiPoint } = metricsQuery;\n\n let segmentsArray: Array> = force ? [] : segments?.slice(0) ?? [];\n let attributesArray: Array> = force ? [] : attributes?.slice(0) ?? [];\n let summariesArray = getSummaryTypes(summary);\n\n if (!isPiPoint && segmentsArray.length === 0) {\n if (query.target && query.target.length > 0 && query.target !== ';') {\n attributesArray = [];\n // Build query from target\n this.buildFromTarget(query, segmentsArray, attributesArray)\n .then((_segmentsArray) => {\n this.updateArray(_segmentsArray, attributesArray, summariesArray, false);\n })\n .catch((e) => console.error(e));\n return;\n } else {\n segmentsArray = this.checkAfServer();\n }\n } else if (isPiPoint && segmentsArray.length > 0) {\n this.piServer = segmentsArray;\n }\n this.updateArray(segmentsArray, attributesArray, summariesArray, !!isPiPoint, () => {\n this.onChange(query);\n });\n };\n\n onChange = (query: PIWebAPIQuery) => {\n const { onChange, onRunQuery } = this.props;\n\n if (query.rawQuery) {\n query.target = query.query ?? '';\n if (!!query.query) {\n const { attributes, elementPath } = parseRawQuery(query.target);\n query.attributes = attributes;\n query.elementPath = elementPath;\n }\n } else {\n query.elementPath = this.getSegmentPathUpTo(this.state.segments, this.state.segments.length);\n query.target =\n query.elementPath +\n ';' +\n join(\n query.attributes?.map((s) => s.value?.value),\n ';'\n );\n }\n\n // recover summary due to format change\n // TODO: remove in 6.0.0\n const summary = {\n ...defaultQuery.summary,\n ...query.summary,\n };\n if (summary) {\n summary.types = this.state.summaries;\n }\n\n onChange({...query, summary});\n\n if (this.isValidQuery(query)) {\n onRunQuery();\n }\n };\n\n isValidQuery = (query: PIWebAPIQuery): boolean => {\n if (query.target && query.target.length > 0 && query.target !== \";\") {\n query.target = query.target.trim();\n const targetSplit = query.target.split(\";\", 2);\n return targetSplit.length === 2 && targetSplit[0].length > 0 && targetSplit[1].length > 0;\n }\n return false;\n }\n\n stateCallback = () => {\n const query = this.props.query as PIWebAPIQuery;\n this.onChange(query);\n };\n\n onIsPiPointChange = (event: React.SyntheticEvent) => {\n const { query: queryChange } = this.props;\n const isPiPoint = !queryChange.isPiPoint;\n this.setState(\n {\n segments: isPiPoint ? [{ label: '' }] : this.checkAfServer(),\n attributes: [],\n isPiPoint,\n },\n () => {\n this.onChange({\n ...queryChange,\n expression: '',\n attributes: this.state.attributes,\n segments: this.state.segments,\n isPiPoint,\n });\n }\n );\n };\n\n onHideErrorChange = (event: React.SyntheticEvent) => {\n const { query: queryChange } = this.props;\n const hideError = !queryChange.hideError;\n this.setState(\n {\n hideError,\n },\n () => {\n this.onChange({\n ...queryChange,\n hideError,\n });\n }\n );\n };\n\n render() {\n const { query: queryProps, onChange, onRunQuery } = this.props;\n const metricsQuery = defaults(queryProps, defaultQuery) as PIWebAPIQuery;\n const {\n useLastValue,\n useUnit,\n interpolate,\n query,\n rawQuery,\n digitalStates,\n enableStreaming,\n recordedValues,\n expression,\n isPiPoint,\n hideError,\n summary,\n nodata,\n display,\n regex,\n } = metricsQuery;\n\n return (\n <>\n {this.props.datasource.piPointConfig && (\n \n \n \n )}\n\n {!!rawQuery && (\n \n \n ) =>\n onChange({ ...metricsQuery, query: event.target.value })\n }\n placeholder=\"enter query\"\n />\n \n this.textEditorChanged()} />\n \n )}\n\n {!rawQuery && (\n <>\n
\n \n {this.state.segments.map((segment: SelectableValue, index: number) => {\n return (\n }\n onChange={(item) => this.onSegmentChange(item, index)}\n loadOptions={(query?: string | undefined) => {\n return this.getElementSegments(index);\n }}\n allowCustomValue\n inputMinWidth={MIN_ELEM_INPUT_WIDTH}\n />\n );\n })}\n \n {!isPiPoint && (\n {\n onChange({ ...metricsQuery, query: metricsQuery.target, rawQuery: value });\n }}\n />\n )}\n \n
\n\n \n {this.state.attributes.map((attribute: SelectableValue, index: number) => {\n if (isPiPoint) {\n return (\n }\n disabled={this.piServer.length === 0}\n onChange={(item) => this.onPiPointChange(item, index)}\n loadOptions={this.getAttributeSegmentsPI}\n reloadOptionsOnChange\n allowCustomValue\n inputMinWidth={MIN_ATTR_INPUT_WIDTH}\n />\n );\n }\n return (\n }\n disabled={this.state.segments.length <= 2}\n onChange={(item) => this.onAttributeChange(item, index)}\n options={this.getAttributeSegmentsAF()}\n allowCustomValue\n inputMinWidth={MIN_ATTR_INPUT_WIDTH}\n />\n );\n })}\n\n {isPiPoint && (\n \n }\n disabled={this.piServer.length === 0}\n onChange={this.onAttributeAction}\n loadOptions={this.getAttributeSegmentsPI}\n reloadOptionsOnChange\n allowCustomValue\n inputMinWidth={MIN_ATTR_INPUT_WIDTH}\n />\n )}\n {!isPiPoint && (\n \n }\n disabled={this.state.segments.length <= 2}\n onChange={this.onAttributeAction}\n options={this.getAttributeSegmentsAF()}\n allowCustomValue\n inputMinWidth={MIN_ATTR_INPUT_WIDTH}\n />\n )}\n \n \n )}\n\n \n \n ) =>\n onChange({ ...metricsQuery, expression: event.target.value })\n }\n placeholder=\"'.'*2\"\n />\n \n \n\n \n \n \n this.onChange({\n ...metricsQuery,\n useLastValue: { ...useLastValue, enable: !useLastValue.enable },\n })\n }\n />\n \n \n \n this.onChange({\n ...metricsQuery,\n digitalStates: { ...digitalStates, enable: !digitalStates.enable },\n })\n }\n />\n \n \n \n }\n onChange={this.calcNoDataValueChanged}\n options={this.getNoDataSegments()}\n allowCustomValue\n />\n \n \n \n \n {this.props.datasource.useUnitConfig && (\n \n \n this.onChange({\n ...metricsQuery,\n useUnit: { ...useUnit, enable: !useUnit.enable },\n })\n }\n />\n \n )}\n {this.props.datasource.useStreaming && (\n \n \n this.onChange({ ...metricsQuery, enableStreaming: { ...enableStreaming, enable: !enableStreaming.enable } })\n }\n />\n \n )}\n \n \n {(interpolate.enable || (!useLastValue.enable && !recordedValues.enable)) && (\n \n \n \n this.onChange({ ...metricsQuery, interpolate: { ...interpolate, enable: !interpolate.enable, interval: undefined } })\n }\n />\n \n \n ) =>\n onChange({ ...metricsQuery, interpolate: { ...interpolate, interval: event.target.value } })\n }\n placeholder=\"30s\"\n />\n \n \n )}\n\n {(recordedValues.enable || (!useLastValue.enable && !interpolate.enable)) && (\n \n \n \n this.onChange({\n ...metricsQuery,\n recordedValues: { ...recordedValues, enable: !recordedValues.enable, maxNumber: undefined, boundaryType: 'Inside' },\n })\n }\n />\n \n \n ) =>\n onChange({\n ...metricsQuery,\n recordedValues: { ...recordedValues, maxNumber: parseInt(event.target.value, 10) },\n })\n }\n type=\"number\"\n placeholder=\"1000\"\n />\n \n \n \n }\n onChange={this.recordedBoundaryTypeValueChanged}\n options={this.getRecordedBoundaryTypeSegments()}\n allowCustomValue\n />\n \n \n )}\n\n {!useLastValue.enable && (\n \n \n \n this.onChange({\n ...metricsQuery,\n summary: { ...summary, enable: !(summary?.enable) },\n })\n }\n />\n \n \n \n }\n onChange={this.calcBasisValueChanged}\n options={this.getCalcBasisSegments()}\n allowCustomValue\n />\n \n \n \n {this.state.summaries.map((s: SelectableValue, index: number) => {\n return (\n }\n onChange={(item) => this.onSummaryValueChanged(item, index)}\n options={this.getSummarySegments()}\n allowCustomValue\n />\n );\n })}\n \n }\n onChange={this.onSummaryAction}\n options={this.getSummarySegments()}\n allowCustomValue\n />\n \n \n \n )}\n {summary?.enable && (\n \n \n \n this.onChange({ ...metricsQuery, summary: { ...summary, sampleTypeInterval: !(summary?.sampleTypeInterval) } })\n }\n />\n \n \n ) =>\n onChange({ ...metricsQuery, summary: { ...summary, sampleInterval: event.target.value } })\n }\n placeholder=\"30s\"\n />\n \n \n ) =>\n onChange({ ...metricsQuery, summary: { ...summary, duration: event.target.value } })\n }\n placeholder=\"30s\"\n />\n \n \n )}\n\n \n \n ) =>\n onChange({ ...metricsQuery, display: event.target.value })\n }\n placeholder=\"Display\"\n />\n \n \n {\n this.onChange({ ...metricsQuery, regex: { ...regex, enable: !regex.enable } });\n }}\n />\n \n \n ) =>\n onChange({ ...metricsQuery, regex: { ...regex, search: event.target.value } })\n }\n placeholder=\"(.*)\"\n />\n \n \n ) =>\n onChange({ ...metricsQuery, regex: { ...regex, replace: event.target.value } })\n }\n placeholder=\"$1\"\n />\n \n \n \n );\n }\n}\n","import React, { memo, useState } from 'react';\n\nimport { AnnotationQuery, QueryEditorProps, SelectableValue } from '@grafana/data';\nimport { AsyncSelect, InlineField, InlineFieldRow, InlineSwitch, Input } from '@grafana/ui';\n\nimport { PiWebAPIDatasource } from 'datasource';\nimport { PIWebAPIDataSourceJsonData, PIWebAPIQuery, PiwebapiRsp } from 'types';\n\nconst SMALL_LABEL_WIDTH = 20;\nconst LABEL_WIDTH = 30;\nconst MIN_INPUT_WIDTH = 50;\n\ntype PiWebAPIQueryEditorProps = QueryEditorProps;\n\ntype Props = PiWebAPIQueryEditorProps & {\n annotation?: AnnotationQuery;\n onAnnotationChange?: (annotation: AnnotationQuery) => void;\n};\n\nexport const PiWebAPIAnnotationsQueryEditor = memo(function PiWebAPIAnnotationQueryEditor(props: Props) {\n const { query, datasource, annotation, onChange, onRunQuery } = props;\n\n const [afWebId, setAfWebId] = useState('');\n const [database, setDatabase] = useState(annotation?.target?.database ?? {});\n\n // this should never happen, but we want to keep typescript happy\n if (annotation === undefined) {\n return null;\n }\n\n const getEventFrames = (): Promise>> => {\n return datasource.getEventFrameTemplates(database?.WebId!).then((templ: PiwebapiRsp[]) => {\n return templ.map((d) => ({ label: d.Name, value: d }));\n });\n };\n\n const getDatabases = (): Promise>> => {\n return datasource.getDatabases(afWebId).then((dbs: PiwebapiRsp[]) => {\n return dbs.map((d) => ({ label: d.Name, value: d }));\n });\n };\n\n const getValue = (key: string) => {\n const query: any = annotation.target as any;\n if (!query || !query[key]) {\n return;\n }\n return { label: query[key].Name, value: query[key] };\n };\n\n datasource.getAssetServer(datasource.afserver.name).then((result) => {\n setAfWebId(result.WebId!);\n });\n\n return (\n <>\n
\n \n \n {\n setDatabase(e.value);\n onChange({ ...query, database: e.value, template: undefined });\n }}\n defaultOptions\n />\n \n \n onChange({ ...query, template: e.value })}\n defaultOptions\n />\n \n \n onChange({ ...query, showEndTime: e.currentTarget.checked })}\n />\n \n \n \n \n onRunQuery()}\n onChange={(e) => onChange({ ...query, categoryName: e.currentTarget.value })}\n placeholder=\"Enter category name\"\n />\n \n \n onRunQuery()}\n onChange={(e) => onChange({ ...query, nameFilter: e.currentTarget.value })}\n placeholder=\"Enter name filter\"\n />\n \n \n \n \n \n onChange({\n ...query,\n regex: { ...query.regex, enable: e.currentTarget.checked },\n })\n }\n />\n \n \n onRunQuery()}\n onChange={(e) =>\n onChange({\n ...query,\n regex: { ...query.regex, search: e.currentTarget.value },\n })\n }\n placeholder=\"(.*)\"\n width={MIN_INPUT_WIDTH}\n />\n \n \n onRunQuery()}\n onChange={(e) =>\n onChange({\n ...query,\n regex: { ...query.regex, replace: e.currentTarget.value },\n })\n }\n placeholder=\"$1\"\n />\n \n \n \n \n \n onChange({\n ...query!,\n attribute: { ...query.attribute, enable: e.currentTarget.checked },\n })\n }\n />\n \n \n onRunQuery()}\n onChange={(e) =>\n onChange({\n ...query!,\n attribute: { ...query.attribute, name: e.currentTarget.value },\n })\n }\n placeholder=\"Enter name\"\n />\n \n \n
\n \n );\n});\n","import { filter, map } from 'lodash';\n\nimport { Observable, of } from 'rxjs';\n\nimport {\n DataSourceInstanceSettings,\n MetricFindValue,\n AnnotationQuery,\n ScopedVars,\n AnnotationEvent,\n DataFrame,\n DataQueryRequest,\n DataQueryResponse,\n} from '@grafana/data';\nimport { getTemplateSrv, TemplateSrv, DataSourceWithBackend } from '@grafana/runtime';\n\nimport { PIWebAPIQuery, PIWebAPIDataSourceJsonData, PiDataServer, PiwebapiRsp } from './types';\nimport { getSummaryTypes, metricQueryTransform } from 'helper';\n\nimport { PiWebAPIAnnotationsQueryEditor } from 'query/AnnotationsQueryEditor';\n\nexport class PiWebAPIDatasource extends DataSourceWithBackend {\n piserver: PiDataServer;\n afserver: PiDataServer;\n afdatabase: PiDataServer;\n piPointConfig: boolean;\n newFormatConfig: boolean;\n useUnitConfig: boolean;\n useExperimental: boolean;\n useStreaming: boolean;\n\n constructor(\n instanceSettings: DataSourceInstanceSettings,\n readonly templateSrv: TemplateSrv = getTemplateSrv()\n ) {\n super(instanceSettings);\n\n this.piserver = { name: (instanceSettings.jsonData || {}).piserver, webid: undefined };\n this.afserver = { name: (instanceSettings.jsonData || {}).afserver, webid: undefined };\n this.afdatabase = { name: (instanceSettings.jsonData || {}).afdatabase, webid: undefined };\n this.piPointConfig = instanceSettings.jsonData.pipoint || false;\n this.newFormatConfig = instanceSettings.jsonData.newFormat || false;\n this.useUnitConfig = instanceSettings.jsonData.useUnit || false;\n this.useExperimental = instanceSettings.jsonData.useExperimental || false;\n this.useStreaming = instanceSettings.jsonData.useStreaming || false;\n\n this.annotations = {\n QueryEditor: PiWebAPIAnnotationsQueryEditor,\n prepareQuery(anno: AnnotationQuery): PIWebAPIQuery | undefined {\n if (anno.target) {\n anno.target.queryType = 'Annotation';\n anno.target.isAnnotation = true;\n }\n return anno.target;\n },\n processEvents: (\n anno: AnnotationQuery,\n data: DataFrame[]\n ): Observable => {\n return of(this.eventFrameToAnnotation(anno, data));\n },\n };\n\n Promise.all([\n this.getDataServer(this.piserver.name).then((result: PiwebapiRsp) => (this.piserver.webid = result.WebId)),\n this.getAssetServer(this.afserver.name).then((result: PiwebapiRsp) => (this.afserver.webid = result.WebId)),\n this.getDatabase(\n this.afserver.name && this.afdatabase.name ? this.afserver.name + '\\\\' + this.afdatabase.name : undefined\n ).then((result: PiwebapiRsp) => (this.afdatabase.webid = result.WebId)),\n ]);\n }\n\n /**\n * This method overrides the applyTemplateVariables() method from the DataSourceWithBackend class.\n * It is responsible for replacing the template variables in the query configuration prior\n * to sending the query to the backend. Templated variables are not able to be used for alerts\n * or public facing dashboards.\n *\n * @param {PIWebAPIQuery} query - The raw query configuration from the frontend as defined in the query editor.\n * @param {ScopedVars} scopedVars - The template variables that are defined in the query editor and dashboard.\n * @returns - PIWebAPIQuery.\n *\n * @memberOf PiWebApiDatasource\n */\n applyTemplateVariables(query: PIWebAPIQuery, scopedVars: ScopedVars) {\n return {\n ...query,\n target: query.target ? this.templateSrv.replace(query.target, scopedVars) : '',\n };\n }\n\n /**\n * This method makes the query to the backend.\n *\n * @param {DataQueryRequest} options\n *\n * @memberOf PiWebApiDatasource\n */\n query(options: DataQueryRequest): Observable {\n if (options.targets.length === 1 && !!options.targets[0].isAnnotation) {\n return super.query(options);\n }\n\n const query = this.buildQueryParameters(options);\n if (query.targets.length <= 0) {\n return of({ data: [] });\n }\n\n return super.query(query);\n }\n\n /**\n * This method does the discovery of the AF Hierarchy and populates the query user interface segments.\n *\n * @param {any} query - Parses the query configuration and builds a PI Web API query.\n * @returns - Segment information.\n *\n * @memberOf PiWebApiDatasource\n */\n metricFindQuery(query: any, queryOptions: any): Promise {\n const ds = this;\n const querydepth = ['servers', 'databases', 'databaseElements', 'elements'];\n if (typeof query === 'string') {\n query = JSON.parse(query as string);\n }\n if (queryOptions.isPiPoint) {\n query.path = this.templateSrv.replace(query.path, queryOptions);\n } else {\n if (query.path === '') {\n query.type = querydepth[0];\n } else {\n query.path = this.templateSrv.replace(query.path, queryOptions); // replace variables in the path\n query.path = query.path.split(';')[0]; // if the attribute is in the path, let's remote it\n if (query.type !== 'attributes') {\n query.type = querydepth[Math.max(0, Math.min(query.path.split('\\\\').length, querydepth.length - 1))];\n }\n }\n query.path = query.path.replace(/\\{([^\\\\])*\\}/gi, (r: string) => r.substring(1, r.length - 2).split(',')[0]);\n }\n\n query.filter = query.filter ?? '*';\n query.max = query.max ?? 10000;\n\n if (query.type === 'servers') {\n return ds.afserver?.name\n ? ds\n .getAssetServer(ds.afserver.name)\n .then((result: PiwebapiRsp) => [result])\n .then(metricQueryTransform)\n : ds.getAssetServers().then(metricQueryTransform);\n } else if (query.type === 'databases' && !!query.afServerWebId) {\n return ds.getDatabases(query.afServerWebId, {}).then(metricQueryTransform);\n } else if (query.type === 'databases') {\n return ds\n .getAssetServer(query.path)\n .then((server) => ds.getDatabases(server.WebId ?? '', {}))\n .then(metricQueryTransform);\n } else if (query.type === 'databaseElements') {\n return ds\n .getDatabase(query.path)\n .then((db) =>\n ds.getDatabaseElements(db.WebId ?? '', {\n selectedFields: 'Items.WebId%3BItems.Name%3BItems.Items%3BItems.Path%3BItems.HasChildren',\n })\n )\n .then(metricQueryTransform);\n } else if (query.type === 'elements') {\n return ds\n .getElement(query.path)\n .then((element) =>\n ds.getElements(element.WebId ?? '', {\n selectedFields:\n 'Items.Description%3BItems.WebId%3BItems.Name%3BItems.Items%3BItems.Path%3BItems.HasChildren',\n nameFilter: query.filter,\n })\n )\n .then(metricQueryTransform);\n } else if (query.type === 'attributes') {\n return ds\n .getElement(query.path)\n .then((element) =>\n ds.getAttributes(element.WebId ?? '', {\n searchFullHierarchy: 'true',\n selectedFields:\n 'Items.Type%3BItems.DefaultUnitsName%3BItems.Description%3BItems.WebId%3BItems.Name%3BItems.Path',\n nameFilter: query.filter,\n maxCount: query.max,\n })\n )\n .then(metricQueryTransform);\n } else if (query.type === 'dataserver') {\n return ds.getDataServers().then(metricQueryTransform);\n } else if (query.type === 'pipoint') {\n return ds.piPointSearch(query.webId, query.pointName).then(metricQueryTransform);\n }\n return Promise.reject('Bad type');\n }\n\n /** PRIVATE SECTION */\n\n /**\n * Builds the PIWebAPI query parameters.\n *\n * @param {any} options - Grafana query and panel options.\n * @returns - PIWebAPI query parameters.\n *\n * @memberOf PiWebApiDatasource\n */\n private buildQueryParameters(options: DataQueryRequest) {\n options.targets = filter(options.targets, (target) => {\n if (!target || !target.target || target.attributes?.length === 0 || target.target === ';' || !!target.hide) {\n return false;\n }\n return !target.target.startsWith('Select AF');\n });\n\n if (options.maxDataPoints) {\n options.maxDataPoints = options.maxDataPoints > 30000 ? 30000 : options.maxDataPoints;\n }\n options.targets = map(options.targets, (target) => {\n const tar = {\n enableStreaming: target.enableStreaming,\n target: this.templateSrv.replace(target.target, options.scopedVars),\n elementPath: this.templateSrv.replace(target.elementPath, options.scopedVars),\n attributes: map(target.attributes, (att) => {\n if (att.value) {\n att.value.value = this.templateSrv.replace(att.value.value, options.scopedVars);\n }\n return att;\n }),\n segments: map(target.segments, (att) => {\n if (att.value) {\n att.value.value = this.templateSrv.replace(att.value.value, options.scopedVars);\n }\n return att;\n }),\n isAnnotation: !!target.isAnnotation,\n display: !!target.display ? this.templateSrv.replace(target.display, options.scopedVars) : undefined,\n refId: target.refId,\n hide: target.hide,\n interpolate: !!target.interpolate\n ? {\n ...target.interpolate,\n interval: this.templateSrv.replace(target.interpolate.interval, options.scopedVars),\n }\n : { enable: false },\n useLastValue: target.useLastValue || { enable: false },\n useUnit: target.useUnit || { enable: false },\n recordedValues: target.recordedValues || { enable: false },\n digitalStates: target.digitalStates || { enable: false },\n webid: target.webid ?? '',\n regex: target.regex || { enable: false },\n expression: target.expression || '',\n summary: target.summary || { enable: false, types: [] },\n nodata: target.nodata,\n startTime: options.range.from,\n endTime: options.range.to,\n isPiPoint: !!target.isPiPoint,\n hideError: !!target.hideError,\n scopedVars: options.scopedVars,\n };\n\n if (tar.expression) {\n tar.expression = this.templateSrv.replace(tar.expression, options.scopedVars);\n }\n\n if (tar.summary.enable) {\n tar.summary.duration = !!tar.summary.duration\n ? this.templateSrv.replace(tar.summary.duration, options.scopedVars)\n : tar.summary.duration;\n tar.summary.sampleTypeInterval = !!tar.summary.sampleTypeInterval;\n tar.summary.sampleInterval = !!tar.summary.sampleInterval\n ? this.templateSrv.replace(tar.summary.sampleInterval, options.scopedVars)\n : tar.summary.sampleInterval;\n }\n\n // recover summary due to format change\n // TODO: remove in 6.0.0\n tar.summary.types = getSummaryTypes(tar.summary);\n\n return tar;\n });\n\n return options;\n }\n\n /**\n * Localize the eventFrame dataFrame records to Grafana Annotations.\n * @param {any} annon - The annotation object.\n * @param {any} data - The dataframe recrords.\n * @returns - Grafana Annotation\n *\n * @memberOf PiWebApiDatasource\n */\n private eventFrameToAnnotation(annon: AnnotationQuery, data: DataFrame[]): AnnotationEvent[] {\n const annotationOptions = annon.target!;\n const events: AnnotationEvent[] = [];\n const currentLocale = Intl.DateTimeFormat().resolvedOptions().locale;\n\n data.forEach((d: DataFrame) => {\n let values = this.transformDataFrameToMap(d);\n for (let i = 0; i < values['time'].length; i++) {\n // replace Dataframe name using Regex\n let title = values['title'][i];\n if (annotationOptions.regex?.enable && annotationOptions.regex.search && annotationOptions.regex.replace) {\n title = title.replace(new RegExp(annotationOptions.regex.search), annotationOptions.regex.replace);\n }\n\n // test if timeEnd is negative and if so, set it to null\n if (values['timeEnd'][i] < 0) {\n values['timeEnd'][i] = null;\n }\n\n // format the text and localize the dates to browser locale\n let text = 'Tag: ' + title;\n if (annotationOptions.attribute && annotationOptions.attribute.enable) {\n text += values['attributeText'][i];\n }\n text += '
Start: ' + new Date(values['time'][i]).toLocaleString(currentLocale) + '
End: ';\n\n if (values['timeEnd'][i]) {\n text += new Date(values['timeEnd'][i]).toLocaleString(currentLocale);\n } else {\n text += 'Eventframe is open';\n }\n\n const event: AnnotationEvent = {\n time: values['time'][i],\n timeEnd: !!annotationOptions.showEndTime ? values['timeEnd'][i] : undefined,\n title: title,\n id: values['id'][i],\n text: text,\n tags: ['OSISoft PI'],\n };\n\n events.push(event);\n }\n });\n return events;\n }\n\n /**\n *\n */\n private transformDataFrameToMap(dataFrame: DataFrame): Record {\n const map: Record = {};\n\n dataFrame.fields.forEach((field) => {\n map[field.name] = field.values.toArray();\n });\n\n return map;\n }\n\n /**\n * Abstraction for calling the PI Web API REST endpoint\n *\n * @param {any} path - the path to append to the base server URL.\n * @returns - The full URL.\n *\n * @memberOf PiWebApiDatasource\n */\n private restGet(path: string): Promise {\n return this.getResource(`${path}`).then((response: any) => {\n return response as PiwebapiRsp;\n });\n }\n\n // Get a list of all data (PI) servers\n private getDataServers(): Promise {\n return this.restGet('/dataservers').then((response) => response.Items ?? []);\n }\n private getDataServer(name: string | undefined): Promise {\n if (!name) {\n return Promise.resolve({});\n }\n return this.restGet('/dataservers?name=' + name).then((response) => response);\n }\n // Get a list of all asset (AF) servers\n private getAssetServers(): Promise {\n return this.restGet('/assetservers').then((response) => response.Items ?? []);\n }\n getAssetServer(name: string | undefined): Promise {\n if (!name) {\n return Promise.resolve({});\n }\n return this.restGet('/assetservers?path=\\\\\\\\' + name).then((response) => response);\n }\n getDatabase(path: string | undefined): Promise {\n if (!path) {\n return Promise.resolve({});\n }\n return this.restGet('/assetdatabases?path=\\\\\\\\' + path).then((response) => response);\n }\n getDatabases(serverId: string, options?: any): Promise {\n if (!serverId) {\n return Promise.resolve([]);\n }\n return this.restGet('/assetservers/' + serverId + '/assetdatabases').then((response) => response.Items ?? []);\n }\n getElement(path: string): Promise {\n if (!path) {\n return Promise.resolve({});\n }\n return this.restGet('/elements?path=\\\\\\\\' + path).then((response) => response);\n }\n getEventFrameTemplates(databaseId: string): Promise {\n if (!databaseId) {\n return Promise.resolve([]);\n }\n return this.restGet(\n '/assetdatabases/' + databaseId + '/elementtemplates?selectedFields=Items.InstanceType%3BItems.Name%3BItems.WebId'\n ).then((response) => {\n return filter(response.Items ?? [], (item) => item.InstanceType === 'EventFrame');\n });\n }\n getElementTemplates(databaseId: string): Promise {\n if (!databaseId) {\n return Promise.resolve([]);\n }\n return this.restGet(\n '/assetdatabases/' + databaseId + '/elementtemplates?selectedFields=Items.InstanceType%3BItems.Name%3BItems.WebId'\n ).then((response) => {\n return filter(response.Items ?? [], (item) => item.InstanceType === 'Element');\n });\n }\n\n /**\n * @description\n * Get the child attributes of the current resource.\n * GET attributes/{webId}/attributes\n * @param {string} elementId - The ID of the parent resource. See WebID for more information.\n * @param {Object} options - Query Options\n * @param {string} options.nameFilter - The name query string used for finding attributes. The default is no filter. See Query String for more information.\n * @param {string} options.categoryName - Specify that returned attributes must have this category. The default is no category filter.\n * @param {string} options.templateName - Specify that returned attributes must be members of this template. The default is no template filter.\n * @param {string} options.valueType - Specify that returned attributes' value type must be the given value type. The default is no value type filter.\n * @param {string} options.searchFullHierarchy - Specifies if the search should include attributes nested further than the immediate attributes of the searchRoot. The default is 'false'.\n * @param {string} options.sortField - The field or property of the object used to sort the returned collection. The default is 'Name'.\n * @param {string} options.sortOrder - The order that the returned collection is sorted. The default is 'Ascending'.\n * @param {string} options.startIndex - The starting index (zero based) of the items to be returned. The default is 0.\n * @param {string} options.showExcluded - Specified if the search should include attributes with the Excluded property set. The default is 'false'.\n * @param {string} options.showHidden - Specified if the search should include attributes with the Hidden property set. The default is 'false'.\n * @param {string} options.maxCount - The maximum number of objects to be returned per call (page size). The default is 1000.\n * @param {string} options.selectedFields - List of fields to be returned in the response, separated by semicolons (;). If this parameter is not specified, all available fields will be returned. See Selected Fields for more information.\n */\n private getAttributes(elementId: string, options: any): Promise {\n let querystring =\n '?' +\n map(options, (value, key) => {\n return key + '=' + value;\n }).join('&');\n\n if (querystring === '?') {\n querystring = '';\n }\n\n return this.restGet('/elements/' + elementId + '/attributes' + querystring).then(\n (response) => response.Items ?? []\n );\n }\n\n /**\n * @description\n * Retrieve elements based on the specified conditions. By default, this method selects immediate children of the current resource.\n * Users can search for the elements based on specific search parameters. If no parameters are specified in the search, the default values for each parameter will be used and will return the elements that match the default search.\n * GET assetdatabases/{webId}/elements\n * @param {string} databaseId - The ID of the parent resource. See WebID for more information.\n * @param {Object} options - Query Options\n * @param {string} options.webId - The ID of the resource to use as the root of the search. See WebID for more information.\n * @param {string} options.nameFilter - The name query string used for finding objects. The default is no filter. See Query String for more information.\n * @param {string} options.categoryName - Specify that returned elements must have this category. The default is no category filter.\n * @param {string} options.templateName - Specify that returned elements must have this template or a template derived from this template. The default is no template filter.\n * @param {string} options.elementType - Specify that returned elements must have this type. The default type is 'Any'. See Element Type for more information.\n * @param {string} options.searchFullHierarchy - Specifies if the search should include objects nested further than the immediate children of the searchRoot. The default is 'false'.\n * @param {string} options.sortField - The field or property of the object used to sort the returned collection. The default is 'Name'.\n * @param {string} options.sortOrder - The order that the returned collection is sorted. The default is 'Ascending'.\n * @param {number} options.startIndex - The starting index (zero based) of the items to be returned. The default is 0.\n * @param {number} options.maxCount - The maximum number of objects to be returned per call (page size). The default is 1000.\n * @param {string} options.selectedFields - List of fields to be returned in the response, separated by semicolons (;). If this parameter is not specified, all available fields will be returned. See Selected Fields for more information.\n */\n private getDatabaseElements(databaseId: string, options: any): Promise {\n let querystring =\n '?' +\n map(options, (value, key) => {\n return key + '=' + value;\n }).join('&');\n\n if (querystring === '?') {\n querystring = '';\n }\n\n return this.restGet('/assetdatabases/' + databaseId + '/elements' + querystring).then(\n (response) => response.Items ?? []\n );\n }\n\n /**\n * @description\n * Retrieve elements based on the specified conditions. By default, this method selects immediate children of the current resource.\n * Users can search for the elements based on specific search parameters. If no parameters are specified in the search, the default values for each parameter will be used and will return the elements that match the default search.\n * GET elements/{webId}/elements\n * @param {string} databaseId - The ID of the resource to use as the root of the search. See WebID for more information.\n * @param {Object} options - Query Options\n * @param {string} options.webId - The ID of the resource to use as the root of the search. See WebID for more information.\n * @param {string} options.nameFilter - The name query string used for finding objects. The default is no filter. See Query String for more information.\n * @param {string} options.categoryName - Specify that returned elements must have this category. The default is no category filter.\n * @param {string} options.templateName - Specify that returned elements must have this template or a template derived from this template. The default is no template filter.\n * @param {string} options.elementType - Specify that returned elements must have this type. The default type is 'Any'. See Element Type for more information.\n * @param {string} options.searchFullHierarchy - Specifies if the search should include objects nested further than the immediate children of the searchRoot. The default is 'false'.\n * @param {string} options.sortField - The field or property of the object used to sort the returned collection. The default is 'Name'.\n * @param {string} options.sortOrder - The order that the returned collection is sorted. The default is 'Ascending'.\n * @param {number} options.startIndex - The starting index (zero based) of the items to be returned. The default is 0.\n * @param {number} options.maxCount - The maximum number of objects to be returned per call (page size). The default is 1000.\n * @param {string} options.selectedFields - List of fields to be returned in the response, separated by semicolons (;). If this parameter is not specified, all available fields will be returned. See Selected Fields for more information.\n */\n private getElements(elementId: string, options: any): Promise {\n let querystring =\n '?' +\n map(options, (value, key) => {\n return key + '=' + value;\n }).join('&');\n\n if (querystring === '?') {\n querystring = '';\n }\n\n return this.restGet('/elements/' + elementId + '/elements' + querystring).then((response) => response.Items ?? []);\n }\n\n /**\n * Retrieve a list of points on a specified Data Server.\n *\n * @param {string} serverId - The ID of the server. See WebID for more information.\n * @param {string} nameFilter - A query string for filtering by point name. The default is no filter. *, ?, [ab], [!ab]\n */\n private piPointSearch(serverId: string, nameFilter: string): Promise {\n let filter1 = this.templateSrv.replace(nameFilter);\n let filter2 = `${filter1}`;\n let doFilter = false;\n if (filter1 !== nameFilter) {\n const regex = /\\{(\\w|,)+\\}/g;\n let m;\n while ((m = regex.exec(filter1)) !== null) {\n // This is necessary to avoid infinite loops with zero-width matches\n if (m.index === regex.lastIndex) {\n regex.lastIndex++;\n }\n\n // The result can be accessed through the `m`-variable.\n m.forEach((match, groupIndex) => {\n if (groupIndex === 0) {\n filter1 = filter1.replace(match, match.replace('{', '(').replace('}', ')').replace(',', '|'));\n filter2 = filter2.replace(match, '*');\n doFilter = true;\n }\n });\n }\n }\n return this.restGet('/dataservers/' + serverId + '/points?maxCount=100&nameFilter=' + filter2).then((results) => {\n if (!!results && !!results?.Items) {\n return doFilter ? results.Items.filter((item) => item.Name?.match(filter1)) : results.Items;\n }\n return [];\n });\n }\n}\n","import { DataSourcePlugin } from '@grafana/data';\nimport { PIWebAPIConfigEditor } from './config/ConfigEditor';\nimport { PIWebAPIQueryEditor } from './query/QueryEditor';\nimport { PiWebAPIDatasource } from './datasource';\nimport { PIWebAPIQuery, PIWebAPIDataSourceJsonData } from './types';\n\nexport const plugin = new DataSourcePlugin(\n PiWebAPIDatasource\n)\n .setQueryEditor(PIWebAPIQueryEditor)\n .setConfigEditor(PIWebAPIConfigEditor);\n"],"names":["module","exports","__WEBPACK_EXTERNAL_MODULE__781__","__WEBPACK_EXTERNAL_MODULE__531__","__WEBPACK_EXTERNAL_MODULE__7__","__WEBPACK_EXTERNAL_MODULE__241__","__WEBPACK_EXTERNAL_MODULE__959__","__WEBPACK_EXTERNAL_MODULE__269__","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","FormField","LegacyForms","coerceOptions","options","jsonData","url","PIWebAPIConfigEditor","PureComponent","render","originalOptions","this","props","div","DataSourceHttpSettings","defaultUrl","dataSourceConfig","onChange","onHttpOptionsChange","showAccessOptions","h3","className","InlineField","label","labelWidth","InlineSwitch","pipoint","onPiPointChange","newFormat","onNewFormatChange","useUnit","onUseUnitChange","useExperimental","onUseExperimentalChange","useStreaming","onUseStreamingChange","inputWidth","onPIServerChange","piserver","placeholder","onAFServerChange","afserver","onAFDatabaseChange","afdatabase","event","onOptionsChange","target","checked","QueryField","tooltip","children","InlineFormLabel","width","QueryRowTerminator","QueryInlineField","QueryEditorRow","QueryRawInlineField","QueryRawEditorRow","defaultQuery","attributes","segments","regex","enable","nodata","summary","types","basis","duration","sampleTypeInterval","sampleInterval","expression","interpolate","useLastValue","recordedValues","boundaryType","digitalStates","enableStreaming","isPiPoint","QueryEditorModeSwitcher","isRaw","isModalOpen","setModalOpen","useState","useEffect","Button","aria-label","icon","variant","type","onClick","ConfirmModal","isOpen","title","body","confirmText","dismissText","onConfirm","onDismiss","getSummaryTypes","filter","item","String","map","t","new_type","expandable","metricQueryTransform","response","text","Name","HasChildren","Path","split","length","Items","WebId","LABEL_WIDTH","MIN_ATTR_INPUT_WIDTH","REMOVE_LABEL","CustomLabelComponent","style","marginRight","Icon","name","PIWebAPIQueryEditor","isValueEmpty","calcBasisValueChanged","segment","metricsQuery","query","getCalcBasisSegments","calculationBasis","recordedBoundaryTypeValueChanged","getRecordedBoundaryTypeSegments","recordedBoundaryTypes","calcNoDataValueChanged","getNoDataSegments","noDataReplacement","onSummaryValueChanged","index","summaries","state","slice","splice","setState","stateCallback","getSummarySegments","summaryTypes","s","indexOf","unshift","removeSummary","part","onSummaryAction","selectableValue","push","summarySegment","removeAttribute","attributeChangeValue","onAttributeAction","Array","isArray","match","getSegmentPathUpTo","arr","reduce","result","startsWith","checkAttributeSegments","data","datasource","ctrl","findQuery","path","metricFindQuery","assign","request","scopedVars","then","attributesResponse","validAttributes","each","attribute","substring","filteredAttributes","attrib","changedValue","templateSrv","replace","availableAttributes","catch","err","error","message","checkPiPointSegments","webId","getSelectedPIServer","pointName","webID","piServer","forEach","parts","textEditorChanged","splitAttributes","splitElements","_","getElementSegments","elements","updateArray","rawQuery","checkAfServer","queryProps","onRunQuery","defaults","hideError","display","piPointConfig","onIsPiPointChange","InlineFieldRow","grow","Input","onBlur","SegmentAsync","Component","onSegmentChange","loadOptions","allowCustomValue","inputMinWidth","disabled","getAttributeSegmentsPI","reloadOptionsOnChange","Segment","onAttributeChange","getAttributeSegmentsAF","attributeSegment","onHideErrorChange","useUnitConfig","interval","maxNumber","parseInt","search","constructor","super","calculationBasisSegment","noDataReplacementSegment","segmentChangeValue","Promise","resolve","remove","currentSegment","afServerWebId","items","altSegments","variables","getVariables","variable","attributeText","forOwn","val","buildFromTarget","segmentsArray","attributesArray","summariesArray","cb","scopedVarsDone","componentDidMount","initialLoad","componentDidUpdate","force","_segmentsArray","e","console","elementPath","tr","join","parseRawQuery","isValidQuery","trim","targetSplit","queryChange","bind","PiWebAPIAnnotationsQueryEditor","memo","annotation","afWebId","setAfWebId","database","setDatabase","getValue","getAssetServer","AsyncSelect","getDatabases","dbs","loadingMessage","template","defaultOptions","getEventFrameTemplates","templ","showEndTime","currentTarget","categoryName","nameFilter","PiWebAPIDatasource","DataSourceWithBackend","applyTemplateVariables","targets","isAnnotation","buildQueryParameters","of","queryOptions","ds","querydepth","JSON","parse","Math","max","min","getAssetServers","server","getDatabase","db","getDatabaseElements","selectedFields","getElement","element","getElements","getAttributes","searchFullHierarchy","maxCount","getDataServers","piPointSearch","reject","hide","maxDataPoints","tar","att","refId","webid","startTime","range","from","endTime","to","annon","annotationOptions","events","currentLocale","Intl","DateTimeFormat","resolvedOptions","locale","values","transformDataFrameToMap","i","RegExp","Date","toLocaleString","time","timeEnd","id","tags","dataFrame","fields","field","toArray","getResource","restGet","getDataServer","serverId","databaseId","InstanceType","getElementTemplates","elementId","querystring","filter1","filter2","doFilter","m","exec","lastIndex","groupIndex","results","instanceSettings","getTemplateSrv","newFormatConfig","annotations","QueryEditor","prepareQuery","anno","queryType","processEvents","eventFrameToAnnotation","all","plugin","DataSourcePlugin","setQueryEditor","setConfigEditor"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/plugin.json b/dist/plugin.json index cf2fca9..216cf9f 100644 --- a/dist/plugin.json +++ b/dist/plugin.json @@ -40,7 +40,7 @@ {"name": "Annotations Editor", "path": "img/annotations.png"} ], "version": "5.1.0", - "updated": "2024-09-19" + "updated": "2024-11-01" }, "dependencies": { "grafanaDependency": ">=10.1.0", diff --git a/go.mod b/go.mod index a2badd0..e850ede 100644 --- a/go.mod +++ b/go.mod @@ -1,14 +1,14 @@ module github.com/GridProtectionAlliance/osisoftpi-grafana -go 1.21 +go 1.22 require ( github.com/go-co-op/gocron v1.37.0 github.com/google/uuid v1.6.0 github.com/gorilla/websocket v1.5.2 - github.com/grafana/grafana-plugin-sdk-go v0.231.0 - go.opentelemetry.io/otel v1.26.0 - go.opentelemetry.io/otel/trace v1.26.0 + github.com/grafana/grafana-plugin-sdk-go v0.250.0 + go.opentelemetry.io/otel v1.29.0 + go.opentelemetry.io/otel/trace v1.29.0 ) require ( @@ -23,7 +23,7 @@ require ( github.com/elazarl/goproxy v0.0.0-20230731152917-f99041a5c027 // indirect github.com/fatih/color v1.15.0 // indirect github.com/getkin/kin-openapi v0.124.0 // indirect - github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/jsonpointer v0.20.2 // indirect github.com/go-openapi/swag v0.22.8 // indirect @@ -33,16 +33,18 @@ require ( github.com/google/flatbuffers v23.5.26+incompatible // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/gorilla/mux v1.8.1 // indirect + github.com/grafana/otel-profiling-go v0.5.1 // indirect + github.com/grafana/pyroscope-go/godeltaprof v0.1.8 // indirect github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1 // indirect github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect github.com/hashicorp/go-hclog v1.6.3 // indirect github.com/hashicorp/go-plugin v1.6.1 // indirect github.com/hashicorp/yamux v0.1.1 // indirect github.com/invopop/yaml v0.2.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/compress v1.16.7 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/magefile/mage v1.15.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect @@ -54,14 +56,15 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oklog/run v1.1.0 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/perimeterx/marshmallow v1.1.5 // indirect github.com/pierrec/lz4/v4 v4.1.18 // indirect - github.com/prometheus/client_golang v1.19.0 // indirect + github.com/prometheus/client_golang v1.20.3 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.53.0 // indirect - github.com/prometheus/procfs v0.14.0 // indirect + github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/procfs v0.15.1 // indirect github.com/robfig/cron/v3 v3.0.1 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/unknwon/bra v0.0.0-20200517080246-1e3013ecaff8 // indirect @@ -69,27 +72,28 @@ require ( github.com/unknwon/log v0.0.0-20150304194804-e617c87089d3 // indirect github.com/urfave/cli v1.22.15 // indirect github.com/zeebo/xxh3 v1.0.2 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.51.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.51.0 // indirect - go.opentelemetry.io/contrib/propagators/jaeger v1.26.0 // indirect - go.opentelemetry.io/contrib/samplers/jaegerremote v0.20.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.26.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.26.0 // indirect - go.opentelemetry.io/otel/metric v1.26.0 // indirect - go.opentelemetry.io/otel/sdk v1.26.0 // indirect - go.opentelemetry.io/proto/otlp v1.2.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.53.0 // indirect + go.opentelemetry.io/contrib/propagators/jaeger v1.29.0 // indirect + go.opentelemetry.io/contrib/samplers/jaegerremote v0.23.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.29.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0 // indirect + go.opentelemetry.io/otel/metric v1.29.0 // indirect + go.opentelemetry.io/otel/sdk v1.29.0 // indirect + go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/atomic v1.9.0 // indirect golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect - golang.org/x/mod v0.13.0 // indirect - golang.org/x/net v0.25.0 // indirect - golang.org/x/sys v0.20.0 // indirect - golang.org/x/text v0.15.0 // indirect - golang.org/x/tools v0.14.0 // indirect + golang.org/x/mod v0.17.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect + golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be // indirect - google.golang.org/grpc v1.63.2 // indirect - google.golang.org/protobuf v1.33.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/grpc v1.66.0 // indirect + google.golang.org/protobuf v1.34.2 // indirect gopkg.in/fsnotify/fsnotify.v1 v1.4.7 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 4a1753b..f9d16aa 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,9 @@ github.com/getkin/kin-openapi v0.124.0/go.mod h1:wb1aSZA/iWmorQP9KTAS/phLj/t17B5 github.com/go-co-op/gocron v1.37.0 h1:ZYDJGtQ4OMhTLKOKMIch+/CY70Brbb1dGdooLEhh7b0= github.com/go-co-op/gocron v1.37.0/go.mod h1:3L/n6BkO7ABj+TrfSVXLRzsP26zmikL4ISkLQ0O8iNY= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= -github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-openapi/jsonpointer v0.20.2 h1:mQc3nmndL8ZBzStEo3JYF8wzmeWffDH4VbXz58sAx6Q= @@ -70,14 +71,18 @@ github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/websocket v1.5.2 h1:qoW6V1GT3aZxybsbC6oLnailWnB+qTMVwMreOso9XUw= github.com/gorilla/websocket v1.5.2/go.mod h1:0n9H61RBAcf5/38py2MCYbxzPIY9rOkpvvMT24Rqs30= -github.com/grafana/grafana-plugin-sdk-go v0.231.0 h1:Qt4PBDR8b4MTUxL48EaZw1fHI1rXUNNhvTU/Nf0Ex2g= -github.com/grafana/grafana-plugin-sdk-go v0.231.0/go.mod h1:8fJk+5J1hMkpqY/7vrXHKgAsqELWNkQvLQ5A5xCVZHk= +github.com/grafana/grafana-plugin-sdk-go v0.250.0 h1:9EBucp9jLqMx2b8NTlOXH+4OuQWUh6L85c6EJUN8Jdo= +github.com/grafana/grafana-plugin-sdk-go v0.250.0/go.mod h1:gCGN9kHY3KeX4qyni3+Kead38Q+85pYOrsDcxZp6AIk= +github.com/grafana/otel-profiling-go v0.5.1 h1:stVPKAFZSa7eGiqbYuG25VcqYksR6iWvF3YH66t4qL8= +github.com/grafana/otel-profiling-go v0.5.1/go.mod h1:ftN/t5A/4gQI19/8MoWurBEtC6gFw8Dns1sJZ9W4Tls= +github.com/grafana/pyroscope-go/godeltaprof v0.1.8 h1:iwOtYXeeVSAeYefJNaxDytgjKtUuKQbJqgAIjlnicKg= +github.com/grafana/pyroscope-go/godeltaprof v0.1.8/go.mod h1:2+l7K7twW49Ct4wFluZD3tZ6e0SjanjcUUBPVD/UuGU= github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1 h1:qnpSQwGEnkcRpTqNOIR6bJbR0gAorgP9CSALpRcKoAA= github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1/go.mod h1:lXGCsh6c22WGtjr+qGHj1otzZpV/1kwTMAqkwZsnWRU= github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0 h1:pRhl55Yx1eC7BZ1N+BBWwnKaMyD8uC+34TLdndZMAKk= github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0/go.mod h1:XKMd7iuf/RGPSMJ/U4HP0zS2Z9Fh8Ps9a+6X26m/tmI= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 h1:/c3QmbOGMGTOumP2iT/rCwB7b0QDGLKzqOmktBjT+Is= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1/go.mod h1:5SN9VR2LTsRFsrEC6FHgRbTWrTHu6tqPeKxEQv15giM= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-plugin v1.6.1 h1:P7MR2UP6gNKGPp+y7EZw2kOiq4IR9WiqLvp0XOsVdwI= @@ -96,8 +101,8 @@ github.com/jtolds/gls v4.2.1+incompatible h1:fSuqC+Gmlu6l/ZYAoZzx2pyucC8Xza35fpR github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I= -github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -109,6 +114,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/magefile/mage v1.15.0 h1:BvGheCMAsG3bWUDbZ8AyXXpCNwU9u5CB6sM+HNb9HYg= github.com/magefile/mage v1.15.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= @@ -137,6 +144,8 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= @@ -148,14 +157,14 @@ github.com/pierrec/lz4/v4 v4.1.18/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFu github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU= -github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k= +github.com/prometheus/client_golang v1.20.3 h1:oPksm4K8B+Vt35tUhw6GbSNSgVlVSBH0qELP/7u83l4= +github.com/prometheus/client_golang v1.20.3/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.53.0 h1:U2pL9w9nmJwJDa4qqLQ3ZaePJ6ZTwt7cMD3AG3+aLCE= -github.com/prometheus/common v0.53.0/go.mod h1:BrxBKv3FWBIGXw89Mg1AeBq7FSyRzXWI3l3e7W3RN5U= -github.com/prometheus/procfs v0.14.0 h1:Lw4VdGGoKEZilJsayHf0B+9YgLGREba2C6xr+Fdfq6s= -github.com/prometheus/procfs v0.14.0/go.mod h1:XL+Iwz8k8ZabyZfMFHPiilCniixqQarAy5Mu67pHlNQ= +github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= +github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= +github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc= @@ -200,30 +209,34 @@ github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ= github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.51.0 h1:A3SayB3rNyt+1S6qpI9mHPkeHTZbD7XILEqWnYZb2l0= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.51.0/go.mod h1:27iA5uvhuRNmalO+iEUdVn5ZMj2qy10Mm+XRIpRmyuU= -go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.51.0 h1:974XTyIwHI4nHa1+uSLxHtUnlJ2DiVtAJjk7fd07p/8= -go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.51.0/go.mod h1:ZvX/taFlN6TGaOOM6D42wrNwPKUV1nGO2FuUXkityBU= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.51.0 h1:Xs2Ncz0gNihqu9iosIZ5SkBbWo5T8JhhLJFMQL1qmLI= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.51.0/go.mod h1:vy+2G/6NvVMpwGX/NyLqcC41fxepnuKHk16E6IZUcJc= -go.opentelemetry.io/contrib/propagators/jaeger v1.26.0 h1:RH76Cl2pfOLLoCtxAPax9c7oYzuL1tiI7/ZPJEmEmOw= -go.opentelemetry.io/contrib/propagators/jaeger v1.26.0/go.mod h1:W/cylm0ZtJK1uxsuTqoYGYPnqpZ8CeVGgW7TwfXPsGw= -go.opentelemetry.io/contrib/samplers/jaegerremote v0.20.0 h1:ja+d7Aea/9PgGxB63+E0jtRFpma717wubS0KFkZpmYw= -go.opentelemetry.io/contrib/samplers/jaegerremote v0.20.0/go.mod h1:Yc1eg51SJy7xZdOTyg1xyFcwE+ghcWh3/0hKeLo6Wlo= -go.opentelemetry.io/otel v1.26.0 h1:LQwgL5s/1W7YiiRwxf03QGnWLb2HW4pLiAhaA5cZXBs= -go.opentelemetry.io/otel v1.26.0/go.mod h1:UmLkJHUAidDval2EICqBMbnAd0/m2vmpf/dAM+fvFs4= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.26.0 h1:1u/AyyOqAWzy+SkPxDpahCNZParHV8Vid1RnI2clyDE= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.26.0/go.mod h1:z46paqbJ9l7c9fIPCXTqTGwhQZ5XoTIsfeFYWboizjs= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.26.0 h1:Waw9Wfpo/IXzOI8bCB7DIk+0JZcqqsyn1JFnAc+iam8= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.26.0/go.mod h1:wnJIG4fOqyynOnnQF/eQb4/16VlX2EJAHhHgqIqWfAo= -go.opentelemetry.io/otel/metric v1.26.0 h1:7S39CLuY5Jgg9CrnA9HHiEjGMF/X2VHvoXGgSllRz30= -go.opentelemetry.io/otel/metric v1.26.0/go.mod h1:SY+rHOI4cEawI9a7N1A4nIg/nTQXe1ccCNWYOJUrpX4= -go.opentelemetry.io/otel/sdk v1.26.0 h1:Y7bumHf5tAiDlRYFmGqetNcLaVUZmh4iYfmGxtmz7F8= -go.opentelemetry.io/otel/sdk v1.26.0/go.mod h1:0p8MXpqLeJ0pzcszQQN4F0S5FVjBLgypeGSngLsmirs= -go.opentelemetry.io/otel/trace v1.26.0 h1:1ieeAUb4y0TE26jUFrCIXKpTuVK7uJGN9/Z/2LP5sQA= -go.opentelemetry.io/otel/trace v1.26.0/go.mod h1:4iDxvGDQuUkHve82hJJ8UqrwswHYsZuWCBllGV2U2y0= -go.opentelemetry.io/proto/otlp v1.2.0 h1:pVeZGk7nXDC9O2hncA6nHldxEjm6LByfA2aN8IOkz94= -go.opentelemetry.io/proto/otlp v1.2.0/go.mod h1:gGpR8txAl5M03pDhMC79G6SdqNV26naRm/KDsgaHD8A= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 h1:9G6E0TXzGFVfTnawRzrPl83iHOAV7L8NJiR8RSGYV1g= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0/go.mod h1:azvtTADFQJA8mX80jIH/akaE7h+dbm/sVuaHqN13w74= +go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.53.0 h1:IVtyPth4Rs5P8wIf0mP2KVKFNTJ4paX9qQ4Hkh5gFdc= +go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.53.0/go.mod h1:ImRBLMJv177/pwiLZ7tU7HDGNdBv7rS0HQ99eN/zBl8= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= +go.opentelemetry.io/contrib/propagators/jaeger v1.29.0 h1:+YPiqF5rR6PqHBlmEFLPumbSP0gY0WmCGFayXRcCLvs= +go.opentelemetry.io/contrib/propagators/jaeger v1.29.0/go.mod h1:6PD7q7qquWSp3Z4HeM3e/2ipRubaY1rXZO8NIHVDZjs= +go.opentelemetry.io/contrib/samplers/jaegerremote v0.23.0 h1:qKi9ntCcronqWqfuKxqrxZlZd82jXJEgGiAWH1+phxo= +go.opentelemetry.io/contrib/samplers/jaegerremote v0.23.0/go.mod h1:1kbAgQa5lgYC3rC6cE3jSxQ/Q13l33wv/WI8U+htwag= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= +go.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw= +go.opentelemetry.io/otel v1.29.0/go.mod h1:N/WtXPs1CNCUEx+Agz5uouwCba+i+bJGFicT8SR4NP8= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.29.0 h1:dIIDULZJpgdiHz5tXrTgKIMLkus6jEFa7x5SOKcyR7E= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.29.0/go.mod h1:jlRVBe7+Z1wyxFSUs48L6OBQZ5JwH2Hg/Vbl+t9rAgI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0 h1:R3X6ZXmNPRR8ul6i3WgFURCHzaXjHdm0karRG/+dj3s= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0/go.mod h1:QWFXnDavXWwMx2EEcZsf3yxgEKAqsxQ+Syjp+seyInw= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/metric v1.29.0 h1:vPf/HFWTNkPu1aYeIsc98l4ktOQaL6LeSoeV2g+8YLc= +go.opentelemetry.io/otel/metric v1.29.0/go.mod h1:auu/QWieFVWx+DmQOUMgj0F8LHWdgalxXqvp7BII/W8= +go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= +go.opentelemetry.io/otel/sdk v1.29.0 h1:vkqKjk7gwhS8VaWb0POZKmIEDimRCMsopNYnriHyryo= +go.opentelemetry.io/otel/sdk v1.29.0/go.mod h1:pM8Dx5WKnvxLCb+8lG1PRNIDxu9g9b9g59Qr7hfAAok= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= +go.opentelemetry.io/otel/trace v1.29.0 h1:J/8ZNK4XgR7a21DZUAsbF8pZ5Jcw1VhACmnYt39JTi4= +go.opentelemetry.io/otel/trace v1.29.0/go.mod h1:eHl3w0sp3paPkYstJOmAimxhiFXPg+MMTlEh3nsQgWQ= +go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= +go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= @@ -235,19 +248,19 @@ golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= -golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= -golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191020152052-9984515f0562/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -260,18 +273,19 @@ golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= -golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= -golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -280,14 +294,14 @@ golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3j golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= gonum.org/v1/gonum v0.12.0 h1:xKuo6hzt+gMav00meVPUlXwSdoEJP46BR+wdxQEFK2o= gonum.org/v1/gonum v0.12.0/go.mod h1:73TDxJfAAHeA8Mk9mf8NlIppyhQNo5GLTcYeqgo2lvY= -google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be h1:Zz7rLWqp0ApfsR/l7+zSHhY3PMiH2xqgxlfYfAfNpoU= -google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be/go.mod h1:dvdCTIoAGbkWbcIKBniID56/7XHTt6WfxXNMxuziJ+w= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be h1:LG9vZxsWGOmUKieR8wPAUR3u3MpnYFQZROPIMaXh7/A= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= -google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= -google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd h1:BBOTEWLuuEGQy9n1y9MhVJ9Qt0BDu21X8qZs71/uPZo= +google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:fO8wJzT2zbQbAjbIoos1285VfEIYKDDY+Dt+WpTkh6g= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= diff --git a/src/datasource.ts b/src/datasource.ts index d23f5f8..ee4c651 100644 --- a/src/datasource.ts +++ b/src/datasource.ts @@ -15,7 +15,7 @@ import { import { getTemplateSrv, TemplateSrv, DataSourceWithBackend } from '@grafana/runtime'; import { PIWebAPIQuery, PIWebAPIDataSourceJsonData, PiDataServer, PiwebapiRsp } from './types'; -import { metricQueryTransform } from 'helper'; +import { getSummaryTypes, metricQueryTransform } from 'helper'; import { PiWebAPIAnnotationsQueryEditor } from 'query/AnnotationsQueryEditor'; @@ -264,10 +264,7 @@ export class PiWebAPIDatasource extends DataSourceWithBackend { - return item !== undefined && item !== null && item !== ''; - }); + if (tar.summary.enable) { tar.summary.duration = !!tar.summary.duration ? this.templateSrv.replace(tar.summary.duration, options.scopedVars) : tar.summary.duration; @@ -277,6 +274,10 @@ export class PiWebAPIDatasource extends DataSourceWithBackend response.Items ?? [] - ); + return this.restGet('/elements/' + elementId + '/elements' + querystring).then((response) => response.Items ?? []); } /** diff --git a/src/helper.ts b/src/helper.ts index 7e4b4a9..a13ef51 100644 --- a/src/helper.ts +++ b/src/helper.ts @@ -1,244 +1,258 @@ -import { each, map } from 'lodash'; - -import { - AnnotationQuery, - DataFrame, - TableData, - MetricFindValue, - Field, - toDataFrame, -} from '@grafana/data'; - -import { PiwebapiElementPath, PiwebapiRsp, PIWebAPIQuery } from 'types'; - -export function parseRawQuery(tr: string): any { - const splitAttributes = tr.split(';'); - const splitElements = splitAttributes[0].split('\\'); - - // remove element hierarchy from attribute collection - splitAttributes.splice(0, 1); - - let attributes: any[] = []; - if (splitElements.length > 1 || (splitElements.length === 1 && splitElements[0] !== '')) { - const elementPath: string = splitElements.join('\\'); - each(splitAttributes, function (item, index) { - if (item !== '') { - attributes.push({ - label: item, - value: { - value: item, - expandable: false, - }, - }); - } - }); - - return { attributes, elementPath }; - } - - return { attributes, elementPath: null }; -} - -export function lowerCaseFirstLetter(string: string): string { - return string.charAt(0).toLocaleLowerCase() + string.slice(1); -} - -/** - * Builds the Grafana metric segment for use on the query user interface. - * - * @param {any} response - response from PI Web API. - * @returns - Grafana metric segment. - * - * @memberOf PiWebApiDatasource - */ -export function metricQueryTransform(response: PiwebapiRsp[]): MetricFindValue[] { - return map(response, (item) => { - return { - text: item.Name, - expandable: - item.HasChildren === undefined || item.HasChildren === true || (item.Path ?? '').split('\\').length <= 3, - HasChildren: item.HasChildren, - Items: item.Items ?? [], - Path: item.Path, - WebId: item.WebId, - } as MetricFindValue; - }); -} - -/** - * Check if all items are selected. - * - * @param {any} current the current variable selection - * @return {boolean} true if all value is selected, false otherwise - */ -export function isAllSelected(current: any): boolean { - if (!current) { - return false; - } - if (Array.isArray(current.text)) { - return current.text.indexOf('All') >= 0; - } - return current.text === 'All'; -} - -export function processAnnotationQuery(annon: AnnotationQuery,data: DataFrame[]): DataFrame[] { - let processedFrames: DataFrame[] = []; - - data.forEach((d: DataFrame) => { - d.fields.forEach((f: Field) => { - - // check if the label has been set, if it hasn't been set then the eventframe annotation is not valid. - if (!f.labels) { - return - } - - if (!('eventframe' in f.labels)) { - return; - } - - let attribute = 'attribute' in f.labels - - // Check whether f.values is an array or not to allow for each. - // Check whether f.values is an array or not to allow for each. - if (Array.isArray(f.values)) { - f.values.forEach((value: any) => { - - if (attribute) { - let annotation = value['1'].Content - let valueData: any[] = [] - for (let i = 2; i in value; i++) { - valueData.push(value[i].Content.Items) - } - - const processedFrame = convertToTableData(annotation.Items!, valueData).map((r) => { - return toDataFrame(r)}); - processedFrames = processedFrames.concat(processedFrame); - } else { - let annotation = value['1'].Content - const processedFrame = convertToTableData(annotation.Items!).map((r) => { - return toDataFrame(r)}); - processedFrames = processedFrames.concat(processedFrame); - } - }); - } - }); - }); - return processedFrames; -} - -export function convertToTableData(items: any[], valueData?: any[]): TableData[] { - const response: TableData[] = items.map((item: any, index: number) => { - const columns = [{ text: 'StartTime' }, { text: 'EndTime' }]; - const rows = [item.StartTime, item.EndTime]; - if (valueData) { - for (let attributeIndex = 0; attributeIndex < valueData.length; attributeIndex++) { - let attributeData = valueData[attributeIndex] - let eventframeAributeData = attributeData[index].Content.Items - eventframeAributeData.forEach((attribute: any) => { - columns.push({ text: attribute.Name }); - rows.push(String(attribute.Value.Value ? attribute.Value.Value.Name || attribute.Value.Value.Value || attribute.Value.Value : '')); - }); - } - } - - return { - name: item.Name, - columns, - rows: [rows], - }; - }); - return response; -} - -/** - * Resolve PIWebAPI response 'value' data to value - timestamp pairs. - * - * @param {any} item - 'Item' object from PIWebAPI - * @param {any} noDataReplacementMode - String state of how to replace 'No Data' - * @param {any} grafanaDataPoint - Single Grafana value pair (value, timestamp). - * @returns grafanaDataPoint - Single Grafana value pair (value, timestamp). - * @returns perviousValue - {any} Grafana value (value only). - * - */ -export function noDataReplace( - item: any, - noDataReplacementMode: any, - grafanaDataPoint: any[] -): { - grafanaDataPoint: any[]; - previousValue: any; - drop: boolean; -} { - let previousValue = null; - let drop = false; - if (!item.Good || item.Value === 'No Data' || (item.Value?.Name && item.Value?.Name === 'No Data')) { - if (noDataReplacementMode === 'Drop') { - drop = true; - } else if (noDataReplacementMode === '0') { - grafanaDataPoint[0] = 0; - } else if (noDataReplacementMode === 'Keep') { - // Do nothing keep - } else if (noDataReplacementMode === 'Null') { - grafanaDataPoint[0] = null; - } else if (noDataReplacementMode === 'Previous' && previousValue !== null) { - grafanaDataPoint[0] = previousValue; - } - } else { - previousValue = item.Value; - } - return { grafanaDataPoint, previousValue, drop }; -} - -/** - * Check if the value is a number. - * - * @param {any} number the value to check - * @returns {boolean} true if the value is a number, false otherwise - */ -export function checkNumber(number: any): boolean { - return typeof number === 'number' && !Number.isNaN(number) && Number.isFinite(number); -} - -/** - * Returns the last item of the element path. - * - * @param {string} path element path - * @returns {string} last item of the element path - */ -export function getLastPath(path: string): string { - let splitPath = path.split('|'); - if (splitPath.length === 0) { - return ''; - } - splitPath = splitPath[0].split('\\'); - return splitPath.length === 0 ? '' : splitPath.pop() ?? ''; -} - -/** - * Returns the last item of the element path plus variable. - * - * @param {PiwebapiElementPath[]} elementPathArray array of element paths - * @param {string} path element path - * @returns {string} last item of the element path - */ -export function getPath(elementPathArray: PiwebapiElementPath[], path: string): string { - 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; -} - -/** - * Replace calculation dot in expression with PI point name. - * - * @param {boolean} replace - is pi point and calculation. - * @param {PiwebapiRsp} webid - Pi web api response object. - * @param {string} url - original url. - * @returns Modified url - */ -export function getFinalUrl(replace: boolean, webid: PiwebapiRsp, url: string) { - const newUrl = replace ? url.replace(/'\.'/g, `'${webid.Name}'`) : url; - return newUrl; -} +import { each, filter, map } from 'lodash'; + +import { + AnnotationQuery, + DataFrame, + TableData, + MetricFindValue, + Field, + toDataFrame, +} from '@grafana/data'; + +import { PiwebapiElementPath, PiwebapiRsp, PIWebAPIQuery, PiWebAPISummary } from 'types'; + +// TODO: remove in 6.0.0 +export function getSummaryTypes(summary: PiWebAPISummary | undefined) { + let types = filter(summary?.types ?? [], (item) => { + return item !== undefined && item !== null && String(item) !== ''; + }); + return types.map((t) => { + if (typeof t === 'string' || t instanceof String) { + const new_type = String(t); + return { label: new_type, value: { value: new_type, expandable: true } }; + } + return t; + }); +} + +export function parseRawQuery(tr: string): any { + const splitAttributes = tr.split(';'); + const splitElements = splitAttributes[0].split('\\'); + + // remove element hierarchy from attribute collection + splitAttributes.splice(0, 1); + + let attributes: any[] = []; + if (splitElements.length > 1 || (splitElements.length === 1 && splitElements[0] !== '')) { + const elementPath: string = splitElements.join('\\'); + each(splitAttributes, function (item, index) { + if (item !== '') { + attributes.push({ + label: item, + value: { + value: item, + expandable: false, + }, + }); + } + }); + + return { attributes, elementPath }; + } + + return { attributes, elementPath: null }; +} + +export function lowerCaseFirstLetter(string: string): string { + return string.charAt(0).toLocaleLowerCase() + string.slice(1); +} + +/** + * Builds the Grafana metric segment for use on the query user interface. + * + * @param {any} response - response from PI Web API. + * @returns - Grafana metric segment. + * + * @memberOf PiWebApiDatasource + */ +export function metricQueryTransform(response: PiwebapiRsp[]): MetricFindValue[] { + return map(response, (item) => { + return { + text: item.Name, + expandable: + item.HasChildren === undefined || item.HasChildren === true || (item.Path ?? '').split('\\').length <= 3, + HasChildren: item.HasChildren, + Items: item.Items ?? [], + Path: item.Path, + WebId: item.WebId, + } as MetricFindValue; + }); +} + +/** + * Check if all items are selected. + * + * @param {any} current the current variable selection + * @return {boolean} true if all value is selected, false otherwise + */ +export function isAllSelected(current: any): boolean { + if (!current) { + return false; + } + if (Array.isArray(current.text)) { + return current.text.indexOf('All') >= 0; + } + return current.text === 'All'; +} + +export function processAnnotationQuery(annon: AnnotationQuery,data: DataFrame[]): DataFrame[] { + let processedFrames: DataFrame[] = []; + + data.forEach((d: DataFrame) => { + d.fields.forEach((f: Field) => { + + // check if the label has been set, if it hasn't been set then the eventframe annotation is not valid. + if (!f.labels) { + return + } + + if (!('eventframe' in f.labels)) { + return; + } + + let attribute = 'attribute' in f.labels + + // Check whether f.values is an array or not to allow for each. + // Check whether f.values is an array or not to allow for each. + if (Array.isArray(f.values)) { + f.values.forEach((value: any) => { + + if (attribute) { + let annotation = value['1'].Content + let valueData: any[] = [] + for (let i = 2; i in value; i++) { + valueData.push(value[i].Content.Items) + } + + const processedFrame = convertToTableData(annotation.Items!, valueData).map((r) => { + return toDataFrame(r)}); + processedFrames = processedFrames.concat(processedFrame); + } else { + let annotation = value['1'].Content + const processedFrame = convertToTableData(annotation.Items!).map((r) => { + return toDataFrame(r)}); + processedFrames = processedFrames.concat(processedFrame); + } + }); + } + }); + }); + return processedFrames; +} + +export function convertToTableData(items: any[], valueData?: any[]): TableData[] { + const response: TableData[] = items.map((item: any, index: number) => { + const columns = [{ text: 'StartTime' }, { text: 'EndTime' }]; + const rows = [item.StartTime, item.EndTime]; + if (valueData) { + for (let attributeIndex = 0; attributeIndex < valueData.length; attributeIndex++) { + let attributeData = valueData[attributeIndex] + let eventframeAributeData = attributeData[index].Content.Items + eventframeAributeData.forEach((attribute: any) => { + columns.push({ text: attribute.Name }); + rows.push(String(attribute.Value.Value ? attribute.Value.Value.Name || attribute.Value.Value.Value || attribute.Value.Value : '')); + }); + } + } + + return { + name: item.Name, + columns, + rows: [rows], + }; + }); + return response; +} + +/** + * Resolve PIWebAPI response 'value' data to value - timestamp pairs. + * + * @param {any} item - 'Item' object from PIWebAPI + * @param {any} noDataReplacementMode - String state of how to replace 'No Data' + * @param {any} grafanaDataPoint - Single Grafana value pair (value, timestamp). + * @returns grafanaDataPoint - Single Grafana value pair (value, timestamp). + * @returns perviousValue - {any} Grafana value (value only). + * + */ +export function noDataReplace( + item: any, + noDataReplacementMode: any, + grafanaDataPoint: any[] +): { + grafanaDataPoint: any[]; + previousValue: any; + drop: boolean; +} { + let previousValue = null; + let drop = false; + if (!item.Good || item.Value === 'No Data' || (item.Value?.Name && item.Value?.Name === 'No Data')) { + if (noDataReplacementMode === 'Drop') { + drop = true; + } else if (noDataReplacementMode === '0') { + grafanaDataPoint[0] = 0; + } else if (noDataReplacementMode === 'Keep') { + // Do nothing keep + } else if (noDataReplacementMode === 'Null') { + grafanaDataPoint[0] = null; + } else if (noDataReplacementMode === 'Previous' && previousValue !== null) { + grafanaDataPoint[0] = previousValue; + } + } else { + previousValue = item.Value; + } + return { grafanaDataPoint, previousValue, drop }; +} + +/** + * Check if the value is a number. + * + * @param {any} number the value to check + * @returns {boolean} true if the value is a number, false otherwise + */ +export function checkNumber(number: any): boolean { + return typeof number === 'number' && !Number.isNaN(number) && Number.isFinite(number); +} + +/** + * Returns the last item of the element path. + * + * @param {string} path element path + * @returns {string} last item of the element path + */ +export function getLastPath(path: string): string { + let splitPath = path.split('|'); + if (splitPath.length === 0) { + return ''; + } + splitPath = splitPath[0].split('\\'); + return splitPath.length === 0 ? '' : splitPath.pop() ?? ''; +} + +/** + * Returns the last item of the element path plus variable. + * + * @param {PiwebapiElementPath[]} elementPathArray array of element paths + * @param {string} path element path + * @returns {string} last item of the element path + */ +export function getPath(elementPathArray: PiwebapiElementPath[], path: string): string { + 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; +} + +/** + * Replace calculation dot in expression with PI point name. + * + * @param {boolean} replace - is pi point and calculation. + * @param {PiwebapiRsp} webid - Pi web api response object. + * @param {string} url - original url. + * @returns Modified url + */ +export function getFinalUrl(replace: boolean, webid: PiwebapiRsp, url: string) { + const newUrl = replace ? url.replace(/'\.'/g, `'${webid.Name}'`) : url; + return newUrl; +} diff --git a/src/query/QueryEditor.tsx b/src/query/QueryEditor.tsx index 40906f6..c9d2909 100644 --- a/src/query/QueryEditor.tsx +++ b/src/query/QueryEditor.tsx @@ -6,10 +6,9 @@ import { QueryEditorProps, SelectableValue, TypedVariableModel } from '@grafana/ import { PiWebAPIDatasource } from '../datasource'; import { QueryInlineField, QueryRawInlineField, QueryRowTerminator } from '../components/Forms'; -import { PIWebAPISelectableValue, PIWebAPIDataSourceJsonData, PIWebAPIQuery, defaultQuery } from '../types'; +import { PIWebAPISelectableValue, PIWebAPIDataSourceJsonData, PIWebAPIQuery, defaultQuery, PiWebAPISummary } from '../types'; import { QueryEditorModeSwitcher } from 'components/QueryEditorModeSwitcher'; -import { parseRawQuery } from 'helper'; -import { types } from '@babel/core'; +import { parseRawQuery, getSummaryTypes } from 'helper'; const LABEL_WIDTH = 24; const LABEL_SWITCH_WIDTH = 49.067 / 8.0; @@ -952,7 +951,7 @@ export class PIWebAPIQueryEditor extends PureComponent { let segmentsArray: Array> = force ? [] : segments?.slice(0) ?? []; let attributesArray: Array> = force ? [] : attributes?.slice(0) ?? []; - let summariesArray = summary?.types ?? []; + let summariesArray = getSummaryTypes(summary); // TODO: remove in 6.0.0 => summary.types ?? []; if (!isPiPoint && segmentsArray.length === 0) { if (query.target && query.target.length > 0 && query.target !== ';') { @@ -995,7 +994,13 @@ export class PIWebAPIQueryEditor extends PureComponent { ';' ); } - const summary = query.summary; + + // recover summary due to format change + // TODO: remove in 6.0.0 + const summary = { + ...defaultQuery.summary, + ...query.summary, + }; if (summary) { summary.types = this.state.summaries; } @@ -1307,7 +1312,7 @@ export class PIWebAPIQueryEditor extends PureComponent { - this.onChange({ ...metricsQuery, interpolate: { ...interpolate, enable: !interpolate.enable, interval: null } }) + this.onChange({ ...metricsQuery, interpolate: { ...interpolate, enable: !interpolate.enable, interval: undefined } }) } /> @@ -1338,7 +1343,7 @@ export class PIWebAPIQueryEditor extends PureComponent { onChange={() => this.onChange({ ...metricsQuery, - recordedValues: { ...recordedValues, enable: !recordedValues.enable, maxNumber: null, boundaryType: 'Inside' }, + recordedValues: { ...recordedValues, enable: !recordedValues.enable, maxNumber: undefined, boundaryType: 'Inside' }, }) } /> diff --git a/src/types.ts b/src/types.ts index 9f388bd..e16346c 100644 --- a/src/types.ts +++ b/src/types.ts @@ -36,36 +36,55 @@ export interface PIWebAPISelectableValue { expandable?: boolean; } +export interface PiWebAPIEnable { + enable: boolean; +} + +export interface PiWebAPIRegex extends PiWebAPIEnable { + search?: string; + replace?: string +} + +export interface PiWebAPIRecordedValue extends PiWebAPIEnable { + maxNumber?: number; + boundaryType?: string; +} + +export interface PiWebAPIInterpolate extends PiWebAPIEnable { + interval?: string; +} + +export interface PiWebAPISummary extends PiWebAPIEnable { + types?: Array>; + basis?: string, + duration?: string, + sampleTypeInterval?: boolean, + sampleInterval?: string +} + export interface PIWebAPIAnnotationsQuery extends DataQuery { target: string; } export interface PIWebAPIQuery extends DataQuery { - target?: string; + target: string; + attributes: Array>; + segments: Array>; + useUnit: PiWebAPIEnable; + regex: PiWebAPIRegex; + interpolate: PiWebAPIInterpolate; + recordedValues: PiWebAPIRecordedValue; + useLastValue: PiWebAPIEnable; + summary: PiWebAPISummary; + digitalStates: PiWebAPIEnable; + isPiPoint: boolean; elementPath?: string; - attributes?: Array>; - segments?: any[]; - isPiPoint?: boolean; hideError?: boolean; isAnnotation?: boolean; webid?: string; display?: any; - interpolate?: any; - recordedValues?: any; - digitalStates?: any; - enableStreaming: any; - useLastValue?: any; - useUnit?: any; - regex?: any; nodata?: string, - summary?: { - enable?: boolean, - types?: any[], - basis?: string, - duration?: string, - sampleTypeInterval?: boolean, - sampleInterval?: string - }; + enableStreaming?: any; expression?: string; rawQuery?: boolean; query?: string;