mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-22 08:26:19 +01:00
1 line
30 KiB
JavaScript
1 line
30 KiB
JavaScript
|
(this.webpackJsonpvmui=this.webpackJsonpvmui||[]).push([[0],{229:function(e,t,n){},342:function(e,t,n){"use strict";n.r(t);var a=n(3),r=n(0),c=n.n(r),o=n(26),i=n.n(o),s=(n(229),n(20)),l=n(415),u=n(413),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),o=c[0],i=c[1],d=Object(r.useState)(!1),b=Object(s.a)(d,2),O=b[0],h=b[1],p=Object(r.useState)(void 0),f=Object(s.a)(p,2),x=f[0],m=f[1];Object(r.useEffect)((function(){x&&(i({message:x,key:(new Date).getTime()}),h(!0))}),[x]);return Object(a.jsxs)(j.Provider,{value:{showInfoMessage:m},children:[Object(a.jsx)(l.a,{open:O,autoHideDuration:4e3,onClose:function(e,t){"clickaway"!==t&&(m(void 0),h(!1))},children:Object(a.jsx)(u.a,{children:o.message})},o.key),t]})},O=n(406),h=n(396),p=n(410),f=n(95),x=n(389),m=n(398),v=n(377),y=n(379),g=n(380),E=n(418),S=n(208),T=n(182),A=n.n(T),C=n(13),w=n(14),_=n(44),R=n.n(_),U=n(178),k=n.n(U),D=n(179),H=n.n(D);R.a.extend(k.a),R.a.extend(H.a);var M,I=window.screen.availWidth/7.68,N=1e3,P=1578e8,L="YYYY-MM-DD[T]HH:mm:ss",B=[{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"}],z=B.map((function(e){return e.short})),q=function(e){var t=e.match(/\d+/g),n=e.match(/[a-zA-Z]+/g);if(n&&t&&z.includes(n[0]))return Object(C.a)({},n[0],t[0])},Y=function(e,t){var n=(t||new Date).valueOf()/1e3,a=e.trim().split(" ").reduce((function(e,t){var n=q(t);return n?Object(w.a)(Object(w.a)({},e),n):Object(w.a)({},e)}),{}),r=R.a.duration(a).asSeconds();return{start:n-r,end:n,step:Math.ceil(r/I),date:F(t||new Date)}},F=function(e){return R()(e).utc().format(L)},Q=function(e){var t=Math.floor(e/1e3%60),n=Math.floor(e/1e3/60%60),a=Math.floor(e/1e3/3600%24),r=Math.floor(e/864e5),c=["d","h","m","s"];return[r,a,n,t].map((function(e,t){return e?"".concat(e).concat(c[t]):""})).filter((function(e){return e})).join(" ")},W=function(e){return new Date(1e3*e)},G=function(e,t){t?window.localStorage.setItem(e,JSON.stringify({value:t})):V([e])},J=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}},V=function(e){return e.forEach((function(e){return window.localStorage.removeItem(e)}))},Z=["BASIC_AUTH_DATA","BEARER_AUTH_DATA"],K=n(180),X=n.n(K),$=n(144),ee=n.n($),te={query:"g0.expr","time.duration":"g0.range_input","time.period.date":"g0.end_input","time.period.step":"g0.step_input",stacked:"g0.stacked"},ne=function(e){var t=new Map(Object.entries(te)),n=[];t.forEach((function(t,a){encodeURIComponent(t);var r=ee()(e,a,"");if(r){var c=encodeURIComponent(r);n.push("".concat(t,"=").concat(c))}})),function(e){var t=window;if(t){var n="".concat(t.location.protocol,"//").concat(t.location.host).concat(t.location.pathname,"?").concat(e);t.history.pushState({path:n},"",n)}}(n.join("&"))},ae=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window.location.search,a=X.a.parse(n,{ignoreQueryPrefix:!0});return ee()(a,e,t||"")},re=ae("g0.range_input","1h"),ce=(M=ae("g0.end_input",new Date(R()().utc().format(L))),R()(M).utcOffset(0,!0).local().format(L)),oe={serverUrl:window.location.href.replace(/\/(?:prometheus\/)?(?:graph|vmui)\/.*/,"/prometheus/"),displayType:"chart",query:ae("g0.expr",J("LAST_QUERY")||"\n"),time:{duration:re,period:Y(re,new Date(ce))},queryControls:{autoRefresh:!1,autocomplete:J("AUTOCOMPLETE")||!1}};function ie(e,t){switch(t.type){case"SET_DISPLAY_TYPE":return Object(w.a)(Object(w.a)({},e),{},{displayType:t.payload});case"SET_SERVER":return Object(w.a)(Object(w.a)({},e),{},{serverUrl:t.payload});case"SET_QUERY":return Object(w.a)(Object(w.a)({},e),{},{query:t.payload});case"SET_DURATION":return Object(w.a)(Object(w.a)({},e),{},{time:Object(w.a)(O
|