mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-11 14:53:49 +00:00
1 line
37 KiB
JavaScript
1 line
37 KiB
JavaScript
|
(this.webpackJsonpvmui=this.webpackJsonpvmui||[]).push([[0],{339:function(e,t,n){},347:function(e,t,n){},349: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(339),n(16)),l=n(422),u=n(420),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(412),h=n(402),f=n(416),x=n(92),p=n(390),v=n(404),m=n(383),y=n(385),g=n(386),S=n(425),E=n(206),T=n(183),w=n.n(T),A=n(13),C=n(12),R=n(62),_=n.n(R),k=n(181),U=n.n(k);_.a.extend(U.a);var D=[{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"}],M=D.map((function(e){return e.short})),I=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&&M.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=_.a.duration(a).asSeconds();return{start:n-c,end:n,step:c/30}},N=function(e){return new Date(1e3*e)},P=function(e,t){t?window.localStorage.setItem(e,JSON.stringify({value:t})):H([e])},L=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}},H=function(e){return e.forEach((function(e){return window.localStorage.removeItem(e)}))},F=["BASIC_AUTH_DATA","BEARER_AUTH_DATA"],B={serverUrl:L("PREFERRED_URL")||function(){var e=window.location.href.match(/^http.+\/vmui/)||["https://"];return Object(s.a)(e,1)[0].replace("vmui","prometheus")}(),displayType:"chart",query:L("LAST_QUERY")||"\n",time:{duration:"1h",period:I("1h")},queryControls:{autoRefresh:!1,autocomplete:L("AUTOCOMPLETE")||!1}};function z(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:I(t.payload,N(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:I(e.time.duration,t.payload)})});case"SET_PERIOD":var n=function(e){var t=_.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:I(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"TOGGLE_AUTOCOMPLETE":return Object(C.a)(Object(C.a)({},e),{},{queryControls:Object(C.a)(Object(C.a)({},e.queryControls),{},{autocomplete:!e.queryControls.autocomplete})});case"RUN_QUERY":return Object(C.a)(Object(C.a)({},e),{},{time:Object(C.a)(Object(C.a)({},e.time),{},{period:I(e.time.duration,N(e.time.period.end))})});case"RUN_QUERY_TO_NO
|