mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-22 08:26:19 +01:00
1 line
35 KiB
JavaScript
1 line
35 KiB
JavaScript
|
(this.webpackJsonpvmui=this.webpackJsonpvmui||[]).push([[0],{338:function(e,t,n){},346:function(e,t,n){},348:function(e,t,n){"use strict";n.r(t);var a=n(2),r=n(0),c=n.n(r),i=n(24),o=n.n(i),s=(n(338),n(16)),l=n(421),u=n(419),j=Object(r.createContext)({showInfoMessage:function(){}}),d=function(){return Object(r.useContext)(j)},b=function(e){var t=e.children,n=Object(r.useState)({}),c=Object(s.a)(n,2),i=c[0],o=c[1],d=Object(r.useState)(!1),b=Object(s.a)(d,2),O=b[0],h=b[1],f=Object(r.useState)(void 0),x=Object(s.a)(f,2),p=x[0],v=x[1];Object(r.useEffect)((function(){p&&(o({message:p,key:(new Date).getTime()}),h(!0))}),[p]);return Object(a.jsxs)(j.Provider,{value:{showInfoMessage:v},children:[Object(a.jsx)(l.a,{open:O,autoHideDuration:4e3,onClose:function(e,t){"clickaway"!==t&&(v(void 0),h(!1))},children:Object(a.jsx)(u.a,{children:i.message})},i.key),t]})},O=n(411),h=n(401),f=n(415),x=n(92),p=n(389),v=n(403),m=n(382),y=n(424),g=n(204),S=n(385),E=n(386),w=n(182),T=n.n(w),A=n(183),_=n.n(A),R=n(13),C=n(12),k=n(62),U=n.n(k),D=n(180),M=n.n(D);U.a.extend(M.a);var I=[{long:"days",short:"d",possible:"day"},{long:"weeks",short:"w",possible:"week"},{long:"months",short:"M",possible:"mon"},{long:"years",short:"y",possible:"year"},{long:"hours",short:"h",possible:"hour"},{long:"minutes",short:"m",possible:"min"},{long:"seconds",short:"s",possible:"sec"},{long:"milliseconds",short:"ms",possible:"millisecond"}],N=I.map((function(e){return e.short})),P=function(e,t){var n=(t||new Date).valueOf()/1e3,a=e.trim().split(" ").reduce((function(e,t){var n=function(e){var t=e.match(/\d+/g),n=e.match(/[a-zA-Z]+/g);if(n&&t&&N.includes(n[0]))return Object(R.a)({},n[0],t[0])}(t);return n?Object(C.a)(Object(C.a)({},e),n):Object(C.a)({},e)}),{}),r=U.a.duration(a).asSeconds();return{start:n-r,end:n,step:r/30}},H=function(e){return new Date(1e3*e)},L=function(e,t){t?window.localStorage.setItem(e,JSON.stringify({value:t})):B([e])},F=function(e){var t=window.localStorage.getItem(e);if(null!==t)try{var n;return null===(n=JSON.parse(t))||void 0===n?void 0:n.value}catch(a){return t}},B=function(e){return e.forEach((function(e){return window.localStorage.removeItem(e)}))},z=["BASIC_AUTH_DATA","BEARER_AUTH_DATA"],Y={serverUrl:F("PREFERRED_URL")||"https://",displayType:"chart",query:F("LAST_QUERY")||"\n",time:{duration:"1h",period:P("1h")},queryControls:{autoRefresh:!1}};function Q(e,t){switch(t.type){case"SET_DISPLAY_TYPE":return Object(C.a)(Object(C.a)({},e),{},{displayType:t.payload});case"SET_SERVER":return Object(C.a)(Object(C.a)({},e),{},{serverUrl:t.payload});case"SET_QUERY":return Object(C.a)(Object(C.a)({},e),{},{query:t.payload});case"SET_DURATION":return Object(C.a)(Object(C.a)({},e),{},{time:Object(C.a)(Object(C.a)({},e.time),{},{duration:t.payload,period:P(t.payload,H(e.time.period.end))})});case"SET_UNTIL":return Object(C.a)(Object(C.a)({},e),{},{time:Object(C.a)(Object(C.a)({},e.time),{},{period:P(e.time.duration,t.payload)})});case"SET_PERIOD":var n=function(e){var t=U.a.duration(e.to.valueOf()-e.from.valueOf());return["d","h","m","s"].map((function(e){return{val:t.get(e),str:e}})).filter((function(e){return 0!==e.val})).map((function(e){return"".concat(e.val).concat(e.str)})).join(" ")}(t.payload);return Object(C.a)(Object(C.a)({},e),{},{queryControls:Object(C.a)(Object(C.a)({},e.queryControls),{},{autoRefresh:!1}),time:Object(C.a)(Object(C.a)({},e.time),{},{duration:n,period:P(n,t.payload.to)})});case"TOGGLE_AUTOREFRESH":return Object(C.a)(Object(C.a)({},e),{},{queryControls:Object(C.a)(Object(C.a)({},e.queryControls),{},{autoRefresh:!e.queryControls.autoRefresh})});case"RUN_QUERY":return Object(C.a)(Object(C.a)({},e),{},{time:Object(C.a)(Object(C.a)({},e.time),{},{period:P(e.time.duration,H(e.time.period.end))})});case"RUN_QUERY_TO_NOW":return Object(C.a)(Object(C.a)({},e),{},{time:Object(C.a)(Object(C.a)({},e.time),{},{period:P(e.time.duration)})});default:throw new Error}}var q=n(114),W=n.n(q),G=function(e){if(/^(\d+|\d*\.\d+)$/.test(e))return parseFloat(e);var t={true:!0,false:!1,null:null,undefined:void 0};return e in t?t[e]:decodeURI(e)},J
|