"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7317],{39053(I,u,o){o.r(u),o.d(u,{plugin:()=>R});var x=o(16207),y=o(83340),t=o(92745),s=o(14553),P=o(41811),U=o(55501),S=o(78529),j=o(29147),z=o(34072);const C=({width:e,height:r,data:a,options:n})=>{const c=(0,S.JQ)(a.timeRange),l=(0,U.useId)();if(!a||!a.series.length)return(0,s.jsx)("div",{className:"panel-empty",children:(0,s.jsx)("p",{children:(0,s.jsx)(t.x6,{i18nKey:"nodeGraph.node-graph-panel.no-data-found-in-response",children:"No data found in response"})})});const m=(0,P.default)(z.BR);return(0,s.jsx)("div",{style:{width:e,height:r},children:(0,s.jsx)(j.F,{dataFrames:m(a.series,n),getLinks:c,panelId:l,zoomMode:n.zoomMode,layoutAlgorithm:n.layoutAlgorithm})})};var G=o(22803),N=o(63142),A=o(35427),f=o(45861),O=o(48457);const L=({value:e,onChange:r,context:a})=>{const n=(0,N.of)(M),c=()=>{const i={field:"",color:""};r(e?[...e,i]:[i])},l=i=>{const d=e?.slice();d.splice(i,1),r(d)},m=(i,d,g)=>{let F=e?.slice()??[];F[i][d]=g,r(F)};return(0,s.jsxs)(s.Fragment,{children:[e?.map((i,d)=>(0,s.jsxs)("div",{className:n.section,children:[(0,s.jsx)(O.O,{context:a,value:i.field??"",onChange:g=>{m(d,"field",g)},item:{settings:{filter:g=>g.name.includes("arc__")},id:`arc-field-${d}`,name:`arc-field-${d}`}}),(0,s.jsx)(A.sk,{color:i.color||"#808080",onChange:g=>{m(d,"color",g)}}),(0,s.jsx)(f.$n,{size:"sm",icon:"minus",variant:"secondary",onClick:()=>l(d),"aria-label":(0,t.t)("nodeGraph.arc-options-editor.title-remove-arc","Remove arc")})]},d)),(0,s.jsx)(f.$n,{size:"sm",icon:"plus",onClick:c,variant:"secondary",children:(0,s.jsx)(t.x6,{i18nKey:"nodeGraph.arc-options-editor.add-arc",children:"Add arc"})})]})},M=e=>({section:(0,G.css)({display:"flex",alignItems:"center",justifyContent:"space-between",gap:`0 ${e.spacing(1)}`,marginBottom:e.spacing(1)})});var h=o(18209),p=o(95004),$=o(63660);function v(e,r){let a=!0;for(const n of e){const[c,l]=n,m=r.fields.find(i=>i.name===c);if(!m||l!==m.type){a=!1;break}}return a}function B(e){let r=!1,a=!1;const n=[["id",p.PU.string],["title",p.PU.string],["mainstat",p.PU.number]],c=[["id",p.PU.string],["source",p.PU.string],["target",p.PU.string]];for(const l of e)v(n,l)&&(r=!0),v(c,l)&&(a=!0);return r&&a}const E=e=>{if(!e.rawFrames)return;const r=B(e.rawFrames),a=e.hasPreferredVisualisationType("nodeGraph");if(!(!r&&!a))return[{score:$.nQ.Best}]},R=new x.m(C).useFieldConfig({disableStandardOptions:Object.values(y.uo).filter(e=>e!==y.uo.Links)}).setPanelOptions((e,r)=>{const a=[(0,t.t)("node-graph.category-node-graph","Node graph")];e.addSelect({name:(0,t.t)("node-graph.name-zoom-mode","Zoom mode"),category:a,path:"zoomMode",defaultValue:"cooperative",settings:{options:[{value:"cooperative",label:(0,t.t)("node-graph.zoom-mode-options.label-cooperative","Cooperative"),description:(0,t.t)("node-graph.zoom-mode-options.description-cooperative","Lets you scroll the page normally")},{value:"greedy",label:(0,t.t)("node-graph.zoom-mode-options.label-greedy","Greedy"),description:(0,t.t)("node-graph.zoom-mode-options.description-greedy","Reacts to all zoom gestures")}]}}),e.addSelect({name:(0,t.t)("node-graph.name-layout-algorithm","Layout algorithm"),category:a,path:"layoutAlgorithm",defaultValue:h.S.Layered,settings:{options:[{label:(0,t.t)("node-graph.layout-algorithm-options.label-layered","Layered"),value:h.S.Layered,description:(0,t.t)("node-graph.layout-algorithm-options.description-layered","Use a layered layout")},{label:(0,t.t)("node-graph.layout-algorithm-options.label-force","Force"),value:h.S.Force,description:(0,t.t)("node-graph.layout-algorithm-options.description-force","Use a force-directed layout")},{label:(0,t.t)("node-graph.layout-algorithm-options.label-grid","Grid"),value:h.S.Grid,description:(0,t.t)("node-graph.layout-algorithm-options.description-grid","Use a grid layout")}]}}),e.addNestedOptions({category:[(0,t.t)("node-graph.category-nodes","Nodes")],path:"nodes",build:n=>{n.addUnitPicker({name:(0,t.t)("node-graph.name-main-stat-unit","Main stat unit"),path:"mainStatUnit"}),n.addUnitPicker({name:(0,t.t)("node-graph.name-secondary-stat-unit","Secondary stat unit"),path:"secondaryStatUnit"}),n.addCustomEditor({name:(0,t.t)("node-graph.name-arc-sections","Arc sections"),path:"arcs",id:"arcs",editor:L})}}),e.addNestedOptions({category:[(0,t.t)("node-graph.category-edges","Edges")],path:"edges",build:n=>{n.addUnitPicker({name:(0,t.t)("node-graph.name-main-stat-unit","Main stat unit"),path:"mainStatUnit"}),n.addUnitPicker({name:(0,t.t)("node-graph.name-secondary-stat-unit","Secondary stat unit"),path:"secondaryStatUnit"})}})}).setSuggestionsSupplier(E)}}]);

//# sourceMappingURL=nodeGraphPanel-react19.2d32256a4383b74f1c98.js.map