⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.78
Server IP:
41.128.143.86
Server:
Linux host.raqmix.cloud 6.8.0-1025-azure #30~22.04.1-Ubuntu SMP Wed Mar 12 15:28:20 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
8.3.23
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
proc
/
self
/
root
/
usr
/
share
/
grafana
/
public
/
build
/
View File Name :
grafanaPlugin.1cb208185a89de28dc3a.js
"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[3648],{62391:(q,S,r)=>{r.r(S),r.d(S,{plugin:()=>K});var R=r(40187),L=r(32196),j=r(55127),A=r.n(j),t=r(96540),E=r(65879),b=r(89667),F=r(83195),D=r(14110),y=r(32264),V=r(17172),$=r(19347),m=r(14186),g=r(88323),z=r(67061),T=r(10354),Q=r(42418),v=r(39268),M=r(76892),I=r(37270),B=r(40845),N=r(2913),C=r(40489),c=r(68706),x=r(32372);function O({value:f,onChange:s}){const[e,n]=(0,t.useState)(""),[a,l]=(0,t.useState)(f.query??"");(0,t.useEffect)(()=>{n(JSON.stringify({...{query:"*",location:"",ds_uid:"",sort:"",tags:[],kind:[],explain:!1,facet:[{field:"kind"},{field:"tags"}],from:0,limit:20},...f},null,2))},[f]);const o=()=>{a!==f.query&&s({...f,query:a})},i=d=>{d.key==="Enter"&&o()},u=d=>{try{const h=JSON.parse(d);s(h),l(h.query??"")}catch(h){console.log("UNABLE TO parse search",d,h)}};return t.createElement(t.Fragment,null,t.createElement(v.C,null,t.createElement(m.I,{label:"Query",grow:!0,labelWidth:12},t.createElement(T.p,{placeholder:"Everything",value:a,onChange:d=>l(d.currentTarget.value),onKeyDown:i,onBlur:o,spellCheck:!1}))),t.createElement(x.B,{height:300,language:"json",value:e,onBlur:u,onSave:u,showMiniMap:!1,showLineNumbers:!0}))}const p=12;class P extends t.PureComponent{constructor(s){super(s),this.state={channels:[],channelFields:{}},this.queryTypes=[{label:"Random Walk",value:c.nj.RandomWalk,description:"Random signal within the selected time range"},{label:"Live Measurements",value:c.nj.LiveMeasurements,description:"Stream real-time measurements from Grafana"},{label:"List public files",value:c.nj.List,description:"Show directory listings for public resources"}],this.onQueryTypeChange=e=>{const{onChange:n,query:a,onRunQuery:l}=this.props;n({...a,queryType:e.value}),l(),this.loadChannelInfo()},this.onChannelChange=e=>{const{onChange:n,query:a,onRunQuery:l}=this.props;n({...a,channel:e?.value}),l()},this.onFieldNamesChange=e=>{const{onChange:n,query:a,onRunQuery:l}=this.props;let o=[];if(Array.isArray(e)?o=e.map(i=>i.value):e.value&&(o=[e.value]),o.length===1&&!a.filter?.fields?.length&&a.channel){const u=(this.state.channelFields[a.channel]??[]).find(d=>d.value==="time"||d.value==="Time");u&&u.value&&u.value!==o[0]&&(o=[u.value,...o])}n({...a,filter:{...a.filter,fields:o}}),l()},this.checkAndUpdateValue=(e,n)=>{const{onChange:a,query:l,onRunQuery:o}=this.props;if(e==="buffer"){let i;if(n)try{i=E.intervalToSeconds(n)*1e3}catch(u){console.warn("ERROR",u)}a({...l,buffer:i})}else a({...l,[e]:n});o()},this.handleEnterKey=e=>{e.key==="Enter"&&this.checkAndUpdateValue("buffer",e.currentTarget.value)},this.handleBlur=e=>{this.checkAndUpdateValue("buffer",e.currentTarget.value)},this.onFolderChanged=e=>{const{onChange:n,query:a,onRunQuery:l}=this.props;n({...a,path:e?.value}),l()},this.fileListRenderer=(e,n)=>null,this.onFileDrop=(e,n,a)=>{C.vI(e).subscribe(l=>{const o=[];l.dataFrames.forEach(i=>{const u=(0,b.Nw)(i);o.push(u)}),this.props.onChange({...this.props.query,file:{name:l.file.name,size:l.file.size},queryType:c.nj.Snapshot,snapshot:o}),this.props.onRunQuery(),(0,D.rR)("grafana_datasource_drop_files",{number_of_files:n.length+e.length,accepted_files:e.map(i=>({type:i.type,size:i.size})),rejected_files:n.map(i=>({type:i.file.type,size:i.file.size}))})})},this.onSearchChange=e=>{const{query:n,onChange:a,onRunQuery:l}=this.props;a({...n,search:e}),l()},y.$.featureToggles.panelTitleSearch&&N.yn&&this.queryTypes.push({label:"Search",value:c.nj.Search,description:"Search for grafana resources"}),y.$.featureToggles.editPanelCSVDragAndDrop&&this.queryTypes.push({label:"Spreadsheet or snapshot",value:c.nj.Snapshot,description:"Query an uploaded spreadsheet or a snapshot"})}loadChannelInfo(){(0,V.AI)().fetch({url:"api/live/list"}).subscribe({next:s=>{const e=s.data?.channels;if(e?.length){const n={},a=e.map(l=>{if(l.data){const o=new Set,i=(0,b.or)(l.data);for(const u of i.fields)o.add(u.name);n[l.channel]=Array.from(o).map(u=>({value:u,label:u}))}return{value:l.channel,label:l.channel+" ["+l.minute_rate+" msg/min]"}});this.setState({channelFields:n,channels:a})}}})}loadFolderInfo(){const s={targets:[{queryType:c.nj.List,refId:"A"}]};(0,$.l)().get("-- Grafana --").then(e=>{e.query(s).subscribe({next:a=>{if(a.data.length){const o=a.data[0].fields[0].values.map(i=>({value:i,label:i}));this.setState({folders:o})}}})})}componentDidMount(){this.loadChannelInfo()}renderMeasurementsQuery(){let{channel:s,filter:e,buffer:n}=this.props.query,{channels:a,channelFields:l}=this.state,o=a.find(h=>h.value===s);s&&!o&&(o={value:s,label:s,description:`Connected to ${s}`},a=[o,...a]);const i=new Set,u=s?l[s]??[]:[];if(e?.fields)for(const h of e.fields)i.has(h)||(u.push({value:h,label:`${h} (not loaded)`,description:"Configured, but not found in the query results"}),i.add(h));let d="";return n&&(d=E.secondsToHms(n/1e3)),t.createElement(t.Fragment,null,t.createElement(m.I,{label:"Channel",grow:!0,labelWidth:p},t.createElement(g.l6,{options:a,value:o||"",onChange:this.onChannelChange,allowCustomValue:!0,backspaceRemovesValue:!0,placeholder:"Select measurements channel",isClearable:!0,noOptionsMessage:"Enter channel name",formatCreateLabel:h=>`Connect to: ${h}`})),s&&t.createElement(z.B,{direction:"row",gap:0},t.createElement(m.I,{label:"Fields",grow:!0,labelWidth:p},t.createElement(g.l6,{options:u,value:e?.fields||[],onChange:this.onFieldNamesChange,allowCustomValue:!0,backspaceRemovesValue:!0,placeholder:"All fields",isClearable:!0,noOptionsMessage:"Unable to list all fields",formatCreateLabel:h=>`Field: ${h}`,isSearchable:!0,isMulti:!0})),t.createElement(m.I,{label:"Buffer"},t.createElement(T.p,{placeholder:"Auto",width:12,defaultValue:d,onKeyDown:this.handleEnterKey,onBlur:this.handleBlur,spellCheck:!1}))),t.createElement(Q.F,{title:"Grafana Live - Measurements",severity:"info"},"This supports real-time event streams in Grafana core. This feature is under heavy development. Expect the interfaces and structures to change as this becomes more production ready."))}renderListPublicFiles(){let{path:s}=this.props.query,{folders:e}=this.state;e||(e=[],this.loadFolderInfo());const n=e.find(a=>a.value===s);return s&&!n&&(e=[...e,{value:s,label:s}]),t.createElement(v.C,null,t.createElement(m.I,{label:"Path",grow:!0,labelWidth:p},t.createElement(g.l6,{options:e,value:n||"",onChange:this.onFolderChanged,allowCustomValue:!0,backspaceRemovesValue:!0,placeholder:"Select folder",isClearable:!0,formatCreateLabel:a=>`Folder: ${a}`})))}renderSnapshotQuery(){const{query:s,theme:e}=this.props,n=s.file,a=J(e),l=(0,F.j_)("decbytes")(n?n.size:0);return t.createElement(t.Fragment,null,t.createElement(v.C,null,t.createElement(m.I,{label:"Snapshot",grow:!0,labelWidth:p},t.createElement(M.c,null,A()("frame",s.snapshot?.length??0,!0)))),y.$.featureToggles.editPanelCSVDragAndDrop&&t.createElement(t.Fragment,null,t.createElement(I.gH,{readAs:"readAsArrayBuffer",fileListRenderer:this.fileListRenderer,options:{onDrop:this.onFileDrop,maxSize:C.o2,multiple:!1,accept:C.ZF}},t.createElement(I.wI,{primaryText:this.props?.query?.file?"Replace file":"Drop file here or click to upload"})),n&&t.createElement("div",{className:a.file},t.createElement("span",null,n?.name),t.createElement("span",null,t.createElement("span",null,(0,F.cN)(l))))))}render(){const s={...c.uJ,...this.props.query},{queryType:e}=s;let n=this.queryTypes;return e===c.nj.Snapshot&&!y.$.featureToggles.editPanelCSVDragAndDrop&&(n=[...this.queryTypes,{label:"Snapshot",value:e}]),t.createElement(t.Fragment,null,e===c.nj.Search&&t.createElement(Q.F,{title:"Grafana Search",severity:"info"},"Using this datasource to call the new search system is experimental, and subject to change at any time without notice."),t.createElement(v.C,null,t.createElement(m.I,{label:"Query type",grow:!0,labelWidth:p},t.createElement(g.l6,{options:n,value:n.find(a=>a.value===e)||n[0],onChange:this.onQueryTypeChange}))),e===c.nj.LiveMeasurements&&this.renderMeasurementsQuery(),e===c.nj.List&&this.renderListPublicFiles(),e===c.nj.Snapshot&&this.renderSnapshotQuery(),e===c.nj.Search&&t.createElement(O,{value:s.search??{},onChange:this.onSearchChange}))}}const U=(0,B.cV)(P);function J(f){return{file:(0,L.css)` width: 100%; display: flex; flex-direction: row; align-items: center; justify-content: space-between; padding: ${f.spacing(2)}; border: 1px dashed ${f.colors.border.medium}; background-color: ${f.colors.background.secondary}; margin-top: ${f.spacing(1)}; `}}var G=r(90183);const K=new R.tD(G.i).setQueryEditor(U)}}]); //# sourceMappingURL=grafanaPlugin.1cb208185a89de28dc3a.js.map