"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[8595],{84457:(S,y,e)=>{e.d(y,{l:()=>R});var n=e(68404),C=e(19677),p=e(41818),D=e(86647),M=e(36584);class R extends n.PureComponent{constructor(){super(...arguments),this.onRemoveQuery=t=>{this.props.onQueriesChange(this.props.queries.filter(a=>a!==t))},this.onDragStart=t=>{const{queries:a,dsSettings:s}=this.props;(0,p.ff)("query_row_reorder_started",{startIndex:t.source.index,numberOfQueries:a.length,datasourceType:s.type})},this.onDragEnd=t=>{const{queries:a,onQueriesChange:s,dsSettings:u}=this.props;if(!t||!t.destination)return;const r=t.source.index,o=t.destination.index;if(r===o){(0,p.ff)("query_row_reorder_canceled",{startIndex:r,endIndex:o,numberOfQueries:a.length,datasourceType:u.type});return}const i=Array.from(a),[l]=i.splice(r,1);i.splice(o,0,l),s(i),(0,p.ff)("query_row_reorder_ended",{startIndex:r,endIndex:o,numberOfQueries:a.length,datasourceType:u.type})}}onChangeQuery(t,a){const{queries:s,onQueriesChange:u}=this.props;u(s.map((r,o)=>o===a?t:r))}onDataSourceChange(t,a){const{queries:s,onQueriesChange:u}=this.props;u(s.map((r,o)=>{if(o!==a)return r;const i={type:t.type,uid:t.uid};return r.datasource&&(0,D.F)().getInstanceSettings(r.datasource)?.type===t.type?{...r,datasource:i}:{refId:r.refId,hide:r.hide,datasource:i}}))}render(){const{dsSettings:t,data:a,queries:s,app:u,history:r,eventBus:o,onAddQuery:i,onRunQueries:l,onQueryCopied:g,onQueryRemoved:P,onQueryToggled:d}=this.props;return n.createElement(C.Z5,{onDragStart:this.onDragStart,onDragEnd:this.onDragEnd},n.createElement(C.bK,{droppableId:"transformations-list",direction:"vertical"},c=>n.createElement("div",{ref:c.innerRef,...c.droppableProps},s.map((f,O)=>{const T=h(f,t),v=t.meta.mixed?m=>this.onDataSourceChange(m,O):void 0;return n.createElement(M.x,{id:f.refId,index:O,key:f.refId,data:a,query:f,dataSource:T,onChangeDataSource:v,onChange:m=>this.onChangeQuery(m,O),onRemoveQuery:this.onRemoveQuery,onAddQuery:i,onRunQuery:l,onQueryCopied:g,onQueryRemoved:P,onQueryToggled:d,queries:s,app:u,history:r,eventBus:o})}),c.placeholder)))}}const h=(E,t)=>E.datasource&&(0,D.F)().getInstanceSettings(E.datasource)||t},42594:(S,y,e)=>{e.r(y),e.d(y,{TestStuffPage:()=>o,default:()=>l,getDefaultState:()=>i});var n=e(68404),C=e(3499),p=e(89050),D=e(21053),M=e(66926),R=e(88144),h=e(31403),E=e(79396),t=e(47694),a=e(60499),s=e(98141),u=e(98016),r=e(78800);const o=()=>{const[g,P]=(0,n.useState)(i()),{queryOptions:d,queryRunner:c}=g,f=()=>{const _={from:"now-1h",to:"now"};c.run({queries:d.queries,datasource:d.dataSource,timezone:"browser",timeRange:{from:D.parse(_.from),to:D.parse(_.to),raw:_},maxDataPoints:d.maxDataPoints??100,minInterval:d.minInterval})},O=_=>{P({...g,queryOptions:_})},T=(0,n.useMemo)(()=>c.getData({withFieldConfig:!0,withTransforms:!0}),[c]),v=(0,C.Z)(T),m={id:"test-page",text:"Test page",icon:"dashboard",subTitle:"FOR TESTING!",url:"sandbox/test"},I=(0,a.iG)();return n.createElement(E.T,{navModel:{node:m,main:m}},n.createElement(E.T.Contents,null,v&&n.createElement(p.Z,{style:{width:"100%",height:"600px"}},({width:_})=>n.createElement("div",null,n.createElement(s.$,{title:"Hello",pluginId:"timeseries",width:_,height:300,data:v,options:{},fieldConfig:{defaults:{},overrides:[]},timeZone:"browser"}),n.createElement(R.i,{data:v.series[0],width:_,height:300}))),n.createElement("div",{style:{marginTop:"16px",height:"45%"}},n.createElement(u.D,{options:d,queryRunner:c,onRunQueries:f,onOptionsChange:O})),n.createElement("div",{style:{display:"flex",gap:"1em"}},n.createElement(h.zx,{onClick:()=>I.success("Success toast","some more text goes here"),variant:"primary"},"Success"),n.createElement(h.zx,{onClick:()=>I.warning("Warning toast","some more text goes here","bogus-trace-99999"),variant:"secondary"},"Warning"),n.createElement(h.zx,{onClick:()=>I.error("Error toast","some more text goes here","bogus-trace-fdsfdfsfds"),variant:"destructive"},"Error"))))};function i(){const g={fieldConfig:{defaults:{color:{mode:M.S.PaletteClassic}},overrides:[]},replaceVariables:d=>d,theme:t.vc.theme2},P={getTransformations:()=>[],getFieldOverrideOptions:()=>g,getDataSupport:()=>({annotations:!1,alertStates:!1})};return{queryRunner:new r.o(P),queryOptions:{queries:[],dataSource:{name:"gdev-testdata"},maxDataPoints:100,savedQueryUid:null}}}const l=o}}]);

//# sourceMappingURL=TestStuffPage.7346bd5e4ab0c6d6310b.js.map