@perses-dev/splunk-plugin 0.1.0-beta.2 → 0.1.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mf/js/Splunk.adc49882.js +7 -0
- package/__mf/js/async/{66.27401ebb.js → 116.9f39e2dc.js} +5 -5
- package/__mf/js/async/332.fc51c4d5.js +139 -0
- package/__mf/js/async/699.34c8a420.js +24 -0
- package/__mf/js/async/{__federation_expose_SplunkDatasource.d65260ca.js → __federation_expose_SplunkDatasource.85a2d61e.js} +2 -2
- package/__mf/js/async/{__federation_expose_SplunkLogQuery.bc89a361.js → __federation_expose_SplunkLogQuery.54f369bf.js} +2 -2
- package/__mf/js/async/{__federation_expose_SplunkTimeSeriesQuery.073d1add.js → __federation_expose_SplunkTimeSeriesQuery.1f9530b7.js} +2 -2
- package/__mf/js/{main.6b3c4bd1.js → main.8628f918.js} +2 -2
- package/mf-manifest.json +22 -22
- package/mf-stats.json +22 -22
- package/package.json +4 -4
- package/__mf/js/Splunk.b0a1a443.js +0 -7
- package/__mf/js/async/527.bf2bfc37.js +0 -24
- package/__mf/js/async/905.1e0fbd81.js +0 -139
- /package/__mf/css/async/{66.85c2cbf6.css → 116.85c2cbf6.css} +0 -0
- /package/__mf/js/async/{66.27401ebb.js.LICENSE.txt → 116.9f39e2dc.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{905.1e0fbd81.js.LICENSE.txt → 332.fc51c4d5.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{527.bf2bfc37.js.LICENSE.txt → 699.34c8a420.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{__federation_expose_SplunkDatasource.d65260ca.js.LICENSE.txt → __federation_expose_SplunkDatasource.85a2d61e.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{__federation_expose_SplunkLogQuery.bc89a361.js.LICENSE.txt → __federation_expose_SplunkLogQuery.54f369bf.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{__federation_expose_SplunkTimeSeriesQuery.073d1add.js.LICENSE.txt → __federation_expose_SplunkTimeSeriesQuery.1f9530b7.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! For license information please see __federation_expose_SplunkDatasource.
|
|
2
|
-
"use strict";(self.chunk_Splunk=self.chunk_Splunk||[]).push([["631"],{2192(e,t,r){var s=r(70451),a=Symbol.for("react.element"),o=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function d(e,t,r){var s,o={},d=null,p=null;for(s in void 0!==r&&(d=""+r),void 0!==t.key&&(d=""+t.key),void 0!==t.ref&&(p=t.ref),t)n.call(t,s)&&!c.hasOwnProperty(s)&&(o[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps)void 0===o[s]&&(o[s]=t[s]);return{$$typeof:a,type:e,key:d,ref:p,props:o,_owner:i.current}}t.Fragment=o,t.jsx=d,t.jsxs=d},62540(e,t,r){e.exports=r(2192)},13558(e,t,r){r.r(t),r.d(t,{SplunkDatasourceEditor:()=>h,SplunkDatasource:()=>m});var s=r(42648);function a(e,t){if(t.startsWith("http://")||t.startsWith("https://"))return new URL(e,t);return new URL(t.endsWith("/")&&e.startsWith("/")?t+e.slice(1):t.endsWith("/")||e.startsWith("/")?t+e:t+"/"+e,window.location.origin)}async function o(e,t){let r=a("/services/search/v2/jobs",t.datasourceUrl),o=new URLSearchParams;return o.append("search",e.search),e.earliest_time&&o.append("earliest_time",e.earliest_time),e.latest_time&&o.append("latest_time",e.latest_time),o.append("output_mode",e.output_mode||"json"),await (0,s.fetchJson)(r.toString(),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",...t.headers},body:o.toString()})}async function n(e,t){let r=a(`/services/search/v2/jobs/${e}`,t.datasourceUrl);return r.searchParams.append("output_mode","json"),await (0,s.fetchJson)(r.toString(),{method:"GET",headers:{"Content-Type":"application/json",...t.headers},credentials:"include"})}async function i(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,o=a(`/services/search/v2/jobs/${e}/results`,r.datasourceUrl);return o.searchParams.append("output_mode",t.output_mode||"json"),t.count&&o.searchParams.append("count",t.count.toString()),t.offset&&o.searchParams.append("offset",t.offset.toString()),await (0,s.fetchJson)(o.toString(),{method:"GET",headers:{"Content-Type":"application/json",...r.headers}})}async function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,o=a(`/services/search/v2/jobs/${e}/events`,r.datasourceUrl);return o.searchParams.append("output_mode",t.output_mode||"json"),t.count&&o.searchParams.append("count",t.count.toString()),t.offset&&o.searchParams.append("offset",t.offset.toString()),await (0,s.fetchJson)(o.toString(),{method:"GET",headers:{"Content-Type":"application/json",...r.headers}})}async function d(e,t){let r=a("/services/search/v2/jobs/export",t.datasourceUrl),s=new URLSearchParams;s.append("search",e.search),e.earliest_time&&s.append("earliest_time",e.earliest_time),e.latest_time&&s.append("latest_time",e.latest_time),s.append("output_mode",e.output_mode||"json");let o=await fetch(r.toString(),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",...t.headers},body:s});if(!o.ok){let e=await o.text();throw Error(`Splunk Export API error: ${o.status} ${o.statusText} ${e}`)}return{results:(await o.text()).trim().split("\n").filter(e=>e.trim()).map(e=>JSON.parse(e).result),preview:!1,init_offset:0}}async function p(e){let t=a("/services/data/indexes",e.datasourceUrl);return t.searchParams.append("output_mode","json"),t.searchParams.append("count","0"),await (0,s.fetchJson)(t.toString(),{method:"GET",headers:{"Content-Type":"application/json",...e.headers}})}var u=r(62540),l=r(
|
|
1
|
+
/*! For license information please see __federation_expose_SplunkDatasource.85a2d61e.js.LICENSE.txt */
|
|
2
|
+
"use strict";(self.chunk_Splunk=self.chunk_Splunk||[]).push([["631"],{2192(e,t,r){var s=r(70451),a=Symbol.for("react.element"),o=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function d(e,t,r){var s,o={},d=null,p=null;for(s in void 0!==r&&(d=""+r),void 0!==t.key&&(d=""+t.key),void 0!==t.ref&&(p=t.ref),t)n.call(t,s)&&!c.hasOwnProperty(s)&&(o[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps)void 0===o[s]&&(o[s]=t[s]);return{$$typeof:a,type:e,key:d,ref:p,props:o,_owner:i.current}}t.Fragment=o,t.jsx=d,t.jsxs=d},62540(e,t,r){e.exports=r(2192)},13558(e,t,r){r.r(t),r.d(t,{SplunkDatasourceEditor:()=>h,SplunkDatasource:()=>m});var s=r(42648);function a(e,t){if(t.startsWith("http://")||t.startsWith("https://"))return new URL(e,t);return new URL(t.endsWith("/")&&e.startsWith("/")?t+e.slice(1):t.endsWith("/")||e.startsWith("/")?t+e:t+"/"+e,window.location.origin)}async function o(e,t){let r=a("/services/search/v2/jobs",t.datasourceUrl),o=new URLSearchParams;return o.append("search",e.search),e.earliest_time&&o.append("earliest_time",e.earliest_time),e.latest_time&&o.append("latest_time",e.latest_time),o.append("output_mode",e.output_mode||"json"),await (0,s.fetchJson)(r.toString(),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",...t.headers},body:o.toString()})}async function n(e,t){let r=a(`/services/search/v2/jobs/${e}`,t.datasourceUrl);return r.searchParams.append("output_mode","json"),await (0,s.fetchJson)(r.toString(),{method:"GET",headers:{"Content-Type":"application/json",...t.headers},credentials:"include"})}async function i(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,o=a(`/services/search/v2/jobs/${e}/results`,r.datasourceUrl);return o.searchParams.append("output_mode",t.output_mode||"json"),t.count&&o.searchParams.append("count",t.count.toString()),t.offset&&o.searchParams.append("offset",t.offset.toString()),await (0,s.fetchJson)(o.toString(),{method:"GET",headers:{"Content-Type":"application/json",...r.headers}})}async function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,o=a(`/services/search/v2/jobs/${e}/events`,r.datasourceUrl);return o.searchParams.append("output_mode",t.output_mode||"json"),t.count&&o.searchParams.append("count",t.count.toString()),t.offset&&o.searchParams.append("offset",t.offset.toString()),await (0,s.fetchJson)(o.toString(),{method:"GET",headers:{"Content-Type":"application/json",...r.headers}})}async function d(e,t){let r=a("/services/search/v2/jobs/export",t.datasourceUrl),s=new URLSearchParams;s.append("search",e.search),e.earliest_time&&s.append("earliest_time",e.earliest_time),e.latest_time&&s.append("latest_time",e.latest_time),s.append("output_mode",e.output_mode||"json");let o=await fetch(r.toString(),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",...t.headers},body:s});if(!o.ok){let e=await o.text();throw Error(`Splunk Export API error: ${o.status} ${o.statusText} ${e}`)}return{results:(await o.text()).trim().split("\n").filter(e=>e.trim()).map(e=>JSON.parse(e).result),preview:!1,init_offset:0}}async function p(e){let t=a("/services/data/indexes",e.datasourceUrl);return t.searchParams.append("output_mode","json"),t.searchParams.append("count","0"),await (0,s.fetchJson)(t.toString(),{method:"GET",headers:{"Content-Type":"application/json",...e.headers}})}var u=r(62540),l=r(39420);function h(e){let{value:t,onChange:r,isReadonly:s}=e;return(0,u.jsx)(l.HTTPSettingsEditor,{value:t,onChange:r,isReadonly:s,initialSpecDirect:{directUrl:""},initialSpecProxy:{proxy:{kind:"HTTPProxy",spec:{allowedEndpoints:[{endpointPattern:"/services/search/v2/jobs",method:"POST"},{endpointPattern:"/services/search/v2/jobs/([a-zA-Z0-9_.-]+)",method:"GET"},{endpointPattern:"/services/search/v2/jobs/([a-zA-Z0-9_.-]+)/results",method:"GET"},{endpointPattern:"/services/search/v2/jobs/([a-zA-Z0-9_.-]+)/events",method:"GET"},{endpointPattern:"/services/search/v2/jobs/export",method:"POST"},{endpointPattern:"/services/data/indexes",method:"GET"}],url:""}}}})}let m={createClient:(e,t)=>{let{directUrl:r,proxy:s}=e,{proxyUrl:a}=t,u=r??a;if(void 0===u)throw Error("No URL specified for Splunk client. You can use directUrl in the spec to configure it.");let l=null==s?void 0:s.spec.headers;return{options:{datasourceUrl:u},createJob:(e,t)=>o(e,{datasourceUrl:u,headers:t??l}),getJobStatus:(e,t)=>n(e,{datasourceUrl:u,headers:t??l}),getJobResults:(e,t,r)=>i(e,t,{datasourceUrl:u,headers:r??l}),getJobEvents:(e,t,r)=>c(e,t,{datasourceUrl:u,headers:r??l}),exportSearch:(e,t)=>d(e,{datasourceUrl:u,headers:t??l}),getIndexes:e=>p({datasourceUrl:u,headers:e??l})}},OptionsEditorComponent:h,createInitialOptions:()=>({directUrl:""})}}}]);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! For license information please see __federation_expose_SplunkLogQuery.
|
|
2
|
-
"use strict";(self.chunk_Splunk=self.chunk_Splunk||[]).push([["800"],{2192(e,t,r){var a=r(70451),n=Symbol.for("react.element"),l=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,i=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function u(e,t,r){var a,l={},u=null,c=null;for(a in void 0!==r&&(u=""+r),void 0!==t.key&&(u=""+t.key),void 0!==t.ref&&(c=t.ref),t)o.call(t,a)&&!s.hasOwnProperty(a)&&(l[a]=t[a]);if(e&&e.defaultProps)for(a in t=e.defaultProps)void 0===l[a]&&(l[a]=t[a]);return{$$typeof:n,type:e,key:u,ref:c,props:l,_owner:i.current}}t.Fragment=l,t.jsx=u,t.jsxs=u},62540(e,t,r){e.exports=r(2192)},7140(e,t,r){r.d(t,{S:()=>a});let a={kind:"SplunkDatasource"}},4404(e,t,r){r.r(t),r.d(t,{SplunkLogQueryEditor:()=>m,getSplunkLogData:()=>l,SplunkLogQuery:()=>f});var a=r(
|
|
1
|
+
/*! For license information please see __federation_expose_SplunkLogQuery.54f369bf.js.LICENSE.txt */
|
|
2
|
+
"use strict";(self.chunk_Splunk=self.chunk_Splunk||[]).push([["800"],{2192(e,t,r){var a=r(70451),n=Symbol.for("react.element"),l=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,i=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function u(e,t,r){var a,l={},u=null,c=null;for(a in void 0!==r&&(u=""+r),void 0!==t.key&&(u=""+t.key),void 0!==t.ref&&(c=t.ref),t)o.call(t,a)&&!s.hasOwnProperty(a)&&(l[a]=t[a]);if(e&&e.defaultProps)for(a in t=e.defaultProps)void 0===l[a]&&(l[a]=t[a]);return{$$typeof:n,type:e,key:u,ref:c,props:l,_owner:i.current}}t.Fragment=l,t.jsx=u,t.jsxs=u},62540(e,t,r){e.exports=r(2192)},7140(e,t,r){r.d(t,{S:()=>a});let a={kind:"SplunkDatasource"}},4404(e,t,r){r.r(t),r.d(t,{SplunkLogQueryEditor:()=>m,getSplunkLogData:()=>l,SplunkLogQuery:()=>f});var a=r(39420),n=r(7140);let l=async(e,t)=>{var r,l,o,i,s,u,c,d,p;let g,m;if(!e.query)return{logs:{entries:[],totalCount:0},timeRange:{start:t.timeRange.start,end:t.timeRange.end}};let f=(0,a.replaceVariables)(e.query,t.variableState),y=await t.datasourceStore.getDatasourceClient(e.datasource??n.S),S=await t.datasourceStore.getDatasource(e.datasource??n.S),h=(null==(o=S.plugin.spec)||null==(l=o.proxy)||null==(r=l.spec)?void 0:r.allowedEndpoints)||[],_=h.some(e=>{var t;return null==(t=e.endpointPattern)?void 0:t.includes("/export")}),v=h.some(e=>{var t;return null==(t=e.endpointPattern)?void 0:t.includes("/indexes")}),{start:b,end:w}=t.timeRange,x=Math.floor(b.getTime()/1e3).toString(),k=Math.floor(w.getTime()/1e3).toString();if(_||S.plugin.spec.directUrl)g=await y.exportSearch({search:f,earliest_time:e.earliest||x,latest_time:e.latest||k});else if(v||S.plugin.spec.directUrl){let e=await y.getIndexes(),t=(null==e?void 0:e.entry)?e.entry.map(e=>({timestamp:new Date().getTime()/1e3,line:e.name,labels:Object.fromEntries(Object.entries(e).filter(e=>{let[t]=e;return"name"!==t}).map(e=>{let[t,r]=e;return[t,"object"==typeof r?JSON.stringify(r):String(r)]}))})):[];return{logs:{entries:t,totalCount:t.length},timeRange:{start:b,end:w},metadata:{executedQueryString:f}}}else{let t,r=(await y.createJob({search:f,earliest_time:e.earliest||x,latest_time:e.latest||k})).sid;do if(await new Promise(e=>setTimeout(e,500)),!(t=await y.getJobStatus(r))||!(null==(d=t.entry)||null==(c=d[0])?void 0:c.content)){console.warn("Failed to get job status or job status response is malformed",{jobStatus:t});break}while(!(null==(u=t.entry)||null==(s=u[0])||null==(i=s.content)?void 0:i.isDone));g=await y.getJobResults(r)}return{logs:{entries:m=(Array.isArray(p=g.results)?p:[p]).map(e=>({timestamp:new Date(e._time).getTime()/1e3,line:e._raw||JSON.stringify(e),labels:Object.fromEntries(Object.entries(e).filter(e=>{let[t]=e;return"_time"!==t&&"_raw"!==t}))})),totalCount:m.length},timeRange:{start:b,end:w},metadata:{executedQueryString:f}}};var o=r(62540),i=r(315),s=r(74628),u=r(54227),c=r(93648),d=r(43945);let p="SplunkDatasource",g={kind:p};function m(e){let{onChange:t,value:r}=e,{datasource:n,query:l}=r,m=(0,a.useDatasourceSelectValueToSelector)(n??g,p);return(0,o.jsxs)(i.A,{spacing:1.5,paddingBottom:1,children:[(0,o.jsxs)(s.A,{children:[(0,o.jsx)(u.A,{sx:{display:"block",marginBottom:"4px",fontWeight:500},children:"Datasource"}),(0,o.jsx)(a.DatasourceSelect,{datasourcePluginKind:p,value:m,onChange:e=>{if(!(0,a.isVariableDatasource)(e)&&e.kind===p)return void t((0,d.produce)(r,t=>{t.datasource=e}));throw Error("Got unexpected non SplunkQuery datasource selection")},label:"Splunk Datasource",notched:!0})]}),(0,o.jsxs)(s.A,{children:[(0,o.jsx)(u.A,{sx:{display:"block",marginBottom:"4px",fontWeight:500},children:"SPL Query"}),(0,o.jsx)(c.A,{fullWidth:!0,multiline:!0,rows:4,value:l,onChange:e=>{var a;return a=e.target.value,void t((0,d.produce)(r,e=>{e.query=a}))},placeholder:"search index=main error"})]})]})}let f={getLogData:l,OptionsEditorComponent:m,createInitialOptions:()=>({query:""}),dependsOn:e=>({variables:[...new Set([...(0,a.parseVariables)(e.query)])]})}}}]);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! For license information please see __federation_expose_SplunkTimeSeriesQuery.
|
|
2
|
-
"use strict";(self.chunk_Splunk=self.chunk_Splunk||[]).push([["8"],{2192(e,t,r){var a=r(70451),n=Symbol.for("react.element"),s=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,l=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function u(e,t,r){var a,s={},u=null,c=null;for(a in void 0!==r&&(u=""+r),void 0!==t.key&&(u=""+t.key),void 0!==t.ref&&(c=t.ref),t)i.call(t,a)&&!o.hasOwnProperty(a)&&(s[a]=t[a]);if(e&&e.defaultProps)for(a in t=e.defaultProps)void 0===s[a]&&(s[a]=t[a]);return{$$typeof:n,type:e,key:u,ref:c,props:s,_owner:l.current}}t.Fragment=s,t.jsx=u,t.jsxs=u},62540(e,t,r){e.exports=r(2192)},7140(e,t,r){r.d(t,{S:()=>a});let a={kind:"SplunkDatasource"}},81608(e,t,r){r.r(t),r.d(t,{getSplunkTimeSeriesData:()=>s,SplunkTimeSeriesQuery:()=>g,SplunkTimeSeriesQueryEditor:()=>S});var a=r(
|
|
1
|
+
/*! For license information please see __federation_expose_SplunkTimeSeriesQuery.1f9530b7.js.LICENSE.txt */
|
|
2
|
+
"use strict";(self.chunk_Splunk=self.chunk_Splunk||[]).push([["8"],{2192(e,t,r){var a=r(70451),n=Symbol.for("react.element"),s=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,l=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function u(e,t,r){var a,s={},u=null,c=null;for(a in void 0!==r&&(u=""+r),void 0!==t.key&&(u=""+t.key),void 0!==t.ref&&(c=t.ref),t)i.call(t,a)&&!o.hasOwnProperty(a)&&(s[a]=t[a]);if(e&&e.defaultProps)for(a in t=e.defaultProps)void 0===s[a]&&(s[a]=t[a]);return{$$typeof:n,type:e,key:u,ref:c,props:s,_owner:l.current}}t.Fragment=s,t.jsx=u,t.jsxs=u},62540(e,t,r){e.exports=r(2192)},7140(e,t,r){r.d(t,{S:()=>a});let a={kind:"SplunkDatasource"}},81608(e,t,r){r.r(t),r.d(t,{getSplunkTimeSeriesData:()=>s,SplunkTimeSeriesQuery:()=>g,SplunkTimeSeriesQueryEditor:()=>S});var a=r(39420),n=r(7140);let s=async(e,t)=>{var r,s,i,l,o,u,c,d;let p;if(!e.query)return{series:[],timeRange:{start:t.timeRange.start,end:t.timeRange.end},stepMs:6e4};let m=(0,a.replaceVariables)(e.query,t.variableState),S=await t.datasourceStore.getDatasourceClient(e.datasource??n.S),g=((null==(i=(await t.datasourceStore.getDatasource(e.datasource??n.S)).plugin.spec)||null==(s=i.proxy)||null==(r=s.spec)?void 0:r.allowedEndpoints)||[]).some(e=>{var t;return null==(t=e.endpointPattern)?void 0:t.includes("/export")}),{start:f,end:y}=t.timeRange,h=Math.floor(f.getTime()/1e3).toString(),_=Math.floor(y.getTime()/1e3).toString();if(g)p=await S.exportSearch({search:m,earliest_time:e.earliest||h,latest_time:e.latest||_});else{let t,r=(await S.createJob({search:m,earliest_time:e.earliest||h,latest_time:e.latest||_})).sid;do if(await new Promise(e=>setTimeout(e,500)),!(t=await S.getJobStatus(r))||!(null==(d=t.entry)||null==(c=d[0])?void 0:c.content)){console.warn("Failed to get job status or job status response is malformed",{jobStatus:t});break}while(!(null==(u=t.entry)||null==(o=u[0])||null==(l=o.content)?void 0:l.isDone));p=await S.getJobResults(r)}return{series:function(e){let t=Array.isArray(e)?e:[e];if(0===t.length)return[];let r=t[0];return r?Object.keys(r).filter(e=>"_time"!==e).map(e=>({name:e,values:t.map(t=>[new Date(t._time).getTime()/1e3,Number(t[e])||0]),labels:{metric:e}})):[]}(p.results),timeRange:{start:f,end:y},stepMs:t.suggestedStepMs||6e4,metadata:{executedQueryString:m}}};var i=r(62540),l=r(315),o=r(74628),u=r(54227),c=r(93648),d=r(43945);let p="SplunkDatasource",m={kind:p};function S(e){let{onChange:t,value:r}=e,{datasource:n,query:s}=r,S=(0,a.useDatasourceSelectValueToSelector)(n??m,p);return(0,i.jsxs)(l.A,{spacing:1.5,paddingBottom:1,children:[(0,i.jsxs)(o.A,{children:[(0,i.jsx)(u.A,{sx:{display:"block",marginBottom:"4px",fontWeight:500},children:"Datasource"}),(0,i.jsx)(a.DatasourceSelect,{datasourcePluginKind:p,value:S,onChange:e=>{if(!(0,a.isVariableDatasource)(e)&&e.kind===p)return void t((0,d.produce)(r,t=>{t.datasource=e}));throw Error("Got unexpected non SplunkQuery datasource selection")},label:"Splunk Datasource",notched:!0})]}),(0,i.jsxs)(o.A,{children:[(0,i.jsx)(u.A,{sx:{display:"block",marginBottom:"4px",fontWeight:500},children:"SPL Query"}),(0,i.jsx)(c.A,{fullWidth:!0,multiline:!0,rows:4,value:s,onChange:e=>{var a;return a=e.target.value,void t((0,d.produce)(r,e=>{e.query=a}))},placeholder:"search index=main | timechart count"})]})]})}let g={getTimeSeriesData:s,OptionsEditorComponent:S,createInitialOptions:()=>({query:""}),dependsOn:e=>({variables:[...new Set([...(0,a.parseVariables)(e.query)])]})}}}]);
|