@perses-dev/status-history-chart-plugin 0.9.1 → 0.11.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.
Files changed (27) hide show
  1. package/__mf/css/async/263.d3010b86.css +1 -0
  2. package/__mf/css/async/341.d3010b86.css +1 -0
  3. package/__mf/css/async/759.d3010b86.css +1 -0
  4. package/__mf/js/{StatusHistoryChart.eca15db8.js → StatusHistoryChart.fe2d194a.js} +3 -3
  5. package/__mf/js/async/178.f17e88a4.js +22 -0
  6. package/__mf/js/async/{238.ddc212bc.js → 238.9bd2d0b1.js} +1 -1
  7. package/__mf/js/async/47.1ab6c914.js +39 -0
  8. package/__mf/js/async/{75.37b2ae0f.js → 75.f12728d5.js} +1 -1
  9. package/__mf/js/async/85.752697a3.js +7 -0
  10. package/__mf/js/async/__federation_expose_StatusHistoryChart.ed6afeef.js +23 -0
  11. package/__mf/js/{main.b849aaf2.js → main.a792e1da.js} +3 -3
  12. package/lib/StatusHistoryChartBase.js +1 -1
  13. package/lib/StatusHistoryChartBase.js.map +1 -1
  14. package/lib/cjs/StatusHistoryChartBase.js +1 -1
  15. package/mf-manifest.json +15 -15
  16. package/mf-stats.json +15 -15
  17. package/package.json +5 -5
  18. package/__mf/css/async/263.17332bd7.css +0 -1
  19. package/__mf/css/async/341.17332bd7.css +0 -1
  20. package/__mf/css/async/759.17332bd7.css +0 -1
  21. package/__mf/js/async/288.bb4c227c.js +0 -7
  22. package/__mf/js/async/368.a46eac7c.js +0 -73
  23. package/__mf/js/async/832.58223f7b.js +0 -39
  24. package/__mf/js/async/__federation_expose_StatusHistoryChart.eaa43159.js +0 -23
  25. /package/__mf/js/async/{368.a46eac7c.js.LICENSE.txt → 178.f17e88a4.js.LICENSE.txt} +0 -0
  26. /package/__mf/js/async/{832.58223f7b.js.LICENSE.txt → 47.1ab6c914.js.LICENSE.txt} +0 -0
  27. /package/__mf/js/async/{288.bb4c227c.js.LICENSE.txt → 85.752697a3.js.LICENSE.txt} +0 -0
@@ -1,23 +0,0 @@
1
- "use strict";(self.chunk_StatusHistoryChart=self.chunk_StatusHistoryChart||[]).push([["560"],{17026:function(e,t,i){i.r(t),i.d(t,{StatusHistoryChart:()=>$});var a=i(24246),n=i(87570),r=i(75586),s=i(64010),l=i(48565),o=i(36372),d=i(93098),h=i(54538),u=i(4529);let p="#1f77b4";var m=i(69481),c=i(94776),g=i(27835),f=i(943),y=i(65201),v=i(99635),x=i(23709),M=i(67745),C=i(36232),S=i(50378),b=i(72116);(0,C.D)([g.N,f.N,y.N,v.N,x.N,M.N,S.N]);let w=e=>{var t;let{height:i,data:n,xAxisCategories:r,yAxisCategories:l,timeScale:d,colors:h}=e,{timeZone:u}=(0,s.useTimeZone)(),p=(0,s.useChartsTheme)(),m=(0,c.Z)(),g={tooltip:{appendToBody:!0,formatter:e=>(function(e){let{data:t,label:i,marker:a,xAxisCategories:n,yAxisCategories:r,theme:l}=e,[o,d]=t,h=n[o],{formattedDate:u,formattedTime:p}=(0,s.getDateAndTime)(h),m=(0,b.css)`
2
- border-bottom: 1px solid ${l.palette.grey[500]};
3
- padding-bottom: 8px;
4
- `,c=(0,b.css)`
5
- display: flex;
6
- justify-content: space-between;
7
- padding-top: 8px;
8
- `,g=(0,b.css)`
9
- margin-right: 16px;
10
- `;return`
11
- <div>
12
- <div style="${m.styles}">${u} ${p}</div>
13
- <div style="${c.styles}">
14
- <div style="${g.styles}">
15
- ${a}
16
- <strong>${r[d]}</strong>
17
- </div>
18
- <div>
19
- ${i}
20
- </div>
21
- </div>
22
- </div>
23
- `})({data:e.data.value,label:e.data.label,marker:e.marker,xAxisCategories:r,yAxisCategories:l,theme:m})},grid:{top:"5%",bottom:"5%"},xAxis:{type:"category",data:r,axisLine:{show:!1},splitArea:{show:!1},axisLabel:{hideOverlap:!0,formatter:(t=(null==d?void 0:d.rangeMs)??0,function(e){let i=new Date(Number(e));return t>15768e7?(0,s.formatWithTimeZone)(i,"yyy",u):t>63072e6?(0,s.formatWithTimeZone)(i,"MMM yyy",u):t>864e6&&t<1577664e4?(0,s.formatWithTimeZone)(i,"dd.MM",u):t>1728e5&&t<=864e6?(0,s.formatWithTimeZone)(i,"dd.MM HH:mm",u):(0,s.formatWithTimeZone)(i,"HH:mm",u)})}},yAxis:{type:"category",data:l,axisLine:{show:!1},splitArea:{show:!1,interval:0},splitLine:{show:!1},axisLabel:{interval:0}},visualMap:{show:!1,type:"piecewise",pieces:h},series:[{name:"Status history",type:"heatmap",coordinateSystem:"cartesian2d",data:n,label:{show:!1},itemStyle:{borderWidth:1,borderType:"solid",borderColor:"#ffffff"},emphasis:{itemStyle:{opacity:.5}}}]};return(0,a.jsx)(o.Z,{style:{height:i},sx:{overflow:"auto"},children:(0,a.jsx)(s.EChart,{sx:{width:"100%",height:i},option:g,theme:p.echartsTheme})})},$={PanelComponent:function(e){var t;let{spec:i,contentDimensions:r,queryResults:l}=e,c=(0,h.useMemo)(()=>i.legend&&(0,n.validateLegendSpec)(i.legend)?(0,d.merge)({},i.legend):void 0,[i.legend]),g=(0,s.useChartsTheme)(),f=g.container.padding.default,{statusHistoryData:y,yAxisCategories:v,xAxisCategories:x,legendItems:M,timeScale:C,colors:S}=(t=g.echartsTheme.color,(0,h.useMemo)(()=>{var e;if(!l||0===l.length)return{legendItems:[],statusHistoryData:[],xAxisCategories:[],yAxisCategories:[],colors:[]};let a=function(e){let t=e.map(e=>e.data);return(0,m.C5)(t)}(l),n=[],r=[],s=new Set,o=null==(e=i.mappings)?void 0:e.length,d=function(e){if(!e)return[];let{startMs:t,endMs:i,stepMs:a}=e,n=[];for(let e=t;e<=i;e+=a)n.push(e);return n}(a);l.forEach(e=>{let{data:t}=e;t&&t.series.forEach(e=>{let t=e.formattedName||"";r.push(t);let a=r.length-1;e.values.forEach(e=>{let[t,r]=e,l=d.findIndex(e=>e===t);if(null!==r&&-1!==l){let e=r;o&&(e=(0,u.a)(r,i.mappings).value),s.add(r),n.push({value:[l,a,r],label:String(e)})}})})});let h=Array.from(s),c=t.length>=h.length?t.slice(0,h.length):h.map((e,i)=>i<t.length?t[i]||p:function(e,t){t.match(/^#[0-9A-Fa-f]{6}$/)||(t=p);try{let[i,a,n]=function(e){let t=parseInt(e.slice(1,3),16)/255,i=parseInt(e.slice(3,5),16)/255,a=parseInt(e.slice(5,7),16)/255,n=Math.max(t,i,a),r=Math.min(t,i,a),s=0,l=0,o=(n+r)/2;if(n!==r){let e=n-r;switch(l=o>.5?e/(2-n-r):e/(n+r),n){case t:s=(i-a)/e+6*(i<a);break;case i:s=(a-t)/e+2;break;case a:s=(t-i)/e+4}s/=6}return[360*s,100*l,100*o]}(t);if(isNaN(i)||isNaN(a)||isNaN(n))throw Error("Invalid HSL values");let r=String(e).split("").reduce((e,t)=>e+t.charCodeAt(0),0),s=Math.min(a+10,90),l=function(e,t,i){let a=t*Math.min(i/=100,1-i)/100,n=t=>{let n=(t+e/30)%12;return Math.round(255*(i-a*Math.max(Math.min(n-3,9-n,1),-1))).toString(16).padStart(2,"0")};return`#${n(0)}${n(8)}${n(4)}`}(Math.abs((i+r%6*60)%360),Math.min(Math.max(s,50),90),Math.min(Math.max(n+(r%2?15:-15),30),70));if(!l.match(/^#[0-9A-Fa-f]{6}$/))throw Error("Invalid generated color");return l}catch{return p}}(e,t[0]||p)),g=h.map((e,t)=>{let a=c[t]??p;return o&&(a=(0,u.a)(e,i.mappings).color??a),{value:e,color:a}});return{xAxisCategories:d,yAxisCategories:r,legendItems:h.map((e,t)=>{var a;let n=String(e);o&&(n=String((0,u.a)(e,i.mappings).value));let r=(null==(a=g.find(t=>t.value===e))?void 0:a.color)||p;return{id:`${t}-${e}`,label:n,color:r}}),statusHistoryData:n,timeScale:a,colors:g}},[l,i.mappings,t])),b=r?{width:r.width-2*f,height:r.height-2*f}:void 0;return y&&0!==y.length?(0,a.jsx)(o.Z,{sx:{padding:`${f}px`},children:(0,a.jsx)(s.ContentWithLegend,{width:(null==b?void 0:b.width)??400,height:(null==b?void 0:b.height)??1e3,legendSize:null==c?void 0:c.size,legendProps:c&&{options:c,data:M||[],selectedItems:"ALL",onSelectedItemsChange:()=>null},children:e=>{let{height:t,width:i}=e;return(0,a.jsx)(o.Z,{sx:{height:t,width:i},children:(0,a.jsx)(w,{xAxisCategories:x,yAxisCategories:v,data:y,timeScale:C,height:t,colors:S})})}})}):null},supportedQueryTypes:["TimeSeriesQuery"],panelOptionsEditorComponents:[{label:"Settings",content:function(e){let{onChange:t,value:i}=e;return(0,a.jsxs)(s.OptionsEditorGrid,{children:[(0,a.jsx)(s.OptionsEditorColumn,{children:(0,a.jsx)(n.LegendOptionsEditor,{calculation:"aggregation",showValuesEditor:!1,value:i.legend,onChange:e=>{t((0,r.Uy)(i,t=>{t.legend=e}))}})}),(0,a.jsx)(s.OptionsEditorColumn,{children:(0,a.jsx)(s.OptionsEditorGroup,{title:"Reset Settings",children:(0,a.jsx)(l.Z,{variant:"outlined",color:"secondary",onClick:()=>{t((0,r.Uy)(i,e=>{e.legend=void 0}))},children:"Reset To Defaults"})})})]})}},{label:"Value mapping",content:e=>{let{onChange:t,value:i}=e;return(0,a.jsx)(s.ValueMappingsEditor,{mappings:i.mappings??[],onChange:function(e){t({...i,mappings:e})}})}}],createInitialOptions:function(){return{}}}}}]);