VictoriaMetrics/app/vmselect/vmui/static/js/main.801aa0ec.chunk.js

1 line
37 KiB
JavaScript
Raw Normal View History

(this.webpackJsonpvmui=this.webpackJsonpvmui||[]).push([[0],{340:function(e,t,n){},348:function(e,t,n){},350:function(e,t,n){"use strict";n.r(t);var a=n(2),c=n(0),r=n.n(c),i=n(24),o=n.n(i),s=(n(340),n(16)),l=n(423),u=n(421),j=Object(c.createContext)({showInfoMessage:function(){}}),d=function(){return Object(c.useContext)(j)},b=function(e){var t=e.children,n=Object(c.useState)({}),r=Object(s.a)(n,2),i=r[0],o=r[1],d=Object(c.useState)(!1),b=Object(s.a)(d,2),O=b[0],h=b[1],f=Object(c.useState)(void 0),x=Object(s.a)(f,2),p=x[0],v=x[1];Object(c.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(413),h=n(403),f=n(417),x=n(92),p=n(391),v=n(405),m=n(384),y=n(386),g=n(387),S=n(426),E=n(207),w=n(184),T=n.n(w),A=n(13),C=n(12),_=n(62),k=n.n(_),R=n(181),U=n.n(R);k.a.extend(U.a);var D=window.screen.availWidth/2,M=[{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"}],I=M.map((function(e){return e.short})),N=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&&I.includes(n[0]))return Object(A.a)({},n[0],t[0])}(t);return n?Object(C.a)(Object(C.a)({},e),n):Object(C.a)({},e)}),{}),c=k.a.duration(a).asSeconds();return{start:n-c,end:n,step:Math.ceil(c/D),date:P(t||new Date)}},P=function(e){return k()(e).format("YYYY-MM-DD[T]HH:mm:ss")},L=function(e){return new Date(1e3*e)},H=function(e,t){t?window.localStorage.setItem(e,JSON.stringify({value:t})):F([e])},B=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}},F=function(e){return e.forEach((function(e){return window.localStorage.removeItem(e)}))},z=["BASIC_AUTH_DATA","BEARER_AUTH_DATA"],q=n(182),Y=n.n(q),Q=n(128),W=n.n(Q),G={query:"g0.expr","time.duration":"g0.range_input","time.period.date":"g0.end_input","time.period.step":"g0.step_input",stacked:"g0.stacked"},J=function(e){var t=new Map(Object.entries(G)),n=[];t.forEach((function(t,a){encodeURIComponent(t);var c=W()(e,a,"");if(c){var r=encodeURIComponent(c);n.push("".concat(t,"=").concat(r))}})),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("&"))},V=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window.location.search,a=Y.a.parse(n,{ignoreQueryPrefix:!0});return W()(a,e,t||"")},Z=V("g0.range_input","1h"),K=V("g0.end_input",void 0),X={serverUrl:window.location.href.replace(/\/(?:prometheus\/)?(?:graph|vmui)\/.*/,"/prometheus/"),displayType:"chart",query:V("g0.expr",B("LAST_QUERY")||"\n"),time:{duration:Z,period:N(Z,K&&new Date(K))},queryControls:{autoRefresh:!1,autocomplete:B("AUTOCOMPLETE")||!1}};function $(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:N(t.payload,L(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:N(e.time.duration,t.payload)})});case"SET_PERIOD":var n=function(e){var t=k.a.duration(e.to.valueOf()-e.from.valueOf());return["d","h","m","s"].map((function(e){return{val:t.get(e),str:e}}