diff options
Diffstat (limited to '')
-rw-r--r-- | web/gui/v2/9020.618bce1feb9efd7ead50.chunk.js | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/web/gui/v2/9020.618bce1feb9efd7ead50.chunk.js b/web/gui/v2/9020.618bce1feb9efd7ead50.chunk.js deleted file mode 100644 index cb41e0bb1..000000000 --- a/web/gui/v2/9020.618bce1feb9efd7ead50.chunk.js +++ /dev/null @@ -1 +0,0 @@ -!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6318f37b-c085-40d8-9cf9-ff420fe82250",e._sentryDebugIdIdentifier="sentry-dbid-6318f37b-c085-40d8-9cf9-ff420fe82250")}catch(e){}}();var _global="undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:{};_global.SENTRY_RELEASE={id:"8b7b01b6c705cf50f8050ce0fb8fc6b58fe68567"},(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[9020],{9020:function(e,t,n){n.r(t),n.d(t,{default:function(){return de}});n(21249),n(57640),n(9924);var a=n(67294),l=n(93416),o=n(91008),r=n(25185),s=n(87462),i=n(29439),c=n(45987),u=(n(69720),n(50308)),d=n.n(u),m=n(82351),f=n(35539),p=["scope","setScope","isDisabled"],b=function(e){var t=e.scope,n=e.setScope,o=void 0===n?d():n,r=e.isDisabled,u=(0,c.Z)(e,p);return a.createElement(l.Flex,(0,s.Z)({gap:3},u),Object.entries(f.k0).map((function(e){var n=(0,i.Z)(e,2),s=n[0],c=n[1],u=c.text,d=c.tooltip;return a.createElement(l.RadioButton,{key:s,checked:s===t,onChange:function(){return o(s)},disabled:r},a.createElement(m.Z,{content:d,align:"bottom"},a.createElement(l.TextSmall,{color:"textDescription"},u)))})))},g=n(36412),h=(n(38862),n(46667)),v=n(4942),E=function(e){var t=e.selectedKey,n=e.selectedValue,o=e.onAddHostLabel,r=void 0===o?d():o,s=e.onRemoveHostLabel,c=void 0===s?d():s,u=e.isDefault,f=void 0!==u&&u,p=e.showPlaceholder,b=void 0===p?d():p,h=e.isDisabled,E=(0,a.useState)(t||""),C=(0,i.Z)(E,2),D=C[0],x=C[1],y=(0,a.useState)(n||""),Z=(0,i.Z)(y,2),S=Z[0],O=Z[1],k=function(){D&&S&&(r((0,v.Z)({},D,S)),b())};return a.createElement(l.Flex,{gap:2},a.createElement(g.Z,{component:"input",onChange:x,onBlur:k,placeholder:"Host key",value:D,disabled:h||!f}),a.createElement(g.Z,{component:"input",onChange:O,onBlur:k,placeholder:"Host value",value:S,disabled:h||!f||!D}),f?a.createElement(m.Z,{content:"Save label pair",align:"bottom"},a.createElement(l.Button,{flavour:"borderless",disabled:!D||!S},a.createElement(l.Icon,{name:"check",color:"primary",size:"small"}))):a.createElement(m.Z,{content:"Remove label pair",align:"bottom"},a.createElement(l.Button,{flavour:"borderless",onClick:function(){return c(t)}},a.createElement(l.Icon,{name:"x",color:"primary",size:"small"}))))},C=function(e){var t=e.hostLabels,n=e.onAddHostLabel,l=e.onRemoveHostLabel;return Object.entries(t).map((function(e){var t=(0,i.Z)(e,2),o=t[0],r=t[1];return a.createElement(E,{key:o,onAddHostLabel:n,selectedKey:o,selectedValue:r,onRemoveHostLabel:l})}))},D=function(e){var t=e.hostLabels,n=e.onAddHostLabel,o=void 0===n?d():n,r=e.onRemoveHostLabel,s=void 0===r?d():r,c=e.isEdit,u=e.isDisabled,m=!!Object.entries(t||{}).length,f=(0,h.Z)(!1),p=(0,i.Z)(f,3),b=p[0],g=p[2];return a.createElement(l.Flex,{column:!0,gap:1},a.createElement(l.TextSmall,{color:"textLite"},"Host labels"),m&&a.createElement(C,{hostLabels:t,onAddHostLabel:o,onRemoveHostLabel:s}),(!m||b)&&a.createElement(E,{key:JSON.stringify(t),onAddHostLabel:o,isDefault:!0,showPlaceholder:g,isDisabled:u}),c&&!b&&m&&a.createElement(l.Flex,{justifyContent:"end"},a.createElement(l.Button,{flavour:"borderless",onClick:g},"Add host label")))},x=n(95665);function y(){var e=new Date,t=e.getFullYear(),n=e.getMonth(),a=e.getDate(),l=new Date(0);return l.setFullYear(t,n,a+1),l.setHours(0,0,0,0),l}var Z=n(69119),S=n(29422),O=n(4822),k=Object.entries(f.lI).map((function(e){var t=(0,i.Z)(e,2),n=t[0];return{label:t[1],value:n}})),w=y(),L=(0,Z.default)((0,S.Z)(w,{years:1})),A=function(e){var t=e.duration,n=e.setDuration,o=e.setDate,r=e.endDate,s=e.isDisabled,i=(0,O.by)("offset");return a.createElement(l.Flex,{gap:2},a.createElement(g.Z,{component:"select",title:"Duration",onChange:n,options:k,placeholder:"Select duration",value:t,isDisabled:s}),"custom"===t.value&&a.createElement(l.Flex,{alignSelf:"end"},a.createElement(x.Z,{isSinglePicker:!0,values:{singleDate:r},minDate:w,maxDate:L,utc:i,onChange:o,isPlaying:!1,accessorProps:f.mD,padding:[4,0],width:"auto",accessorTooltipContent:"Select end date"})))};function R(){return(0,Z.default)(Date.now())}var H=R(),I=y(),j=function(e){var t=e.start,n=e.end,o=e.onChange,r=e.isDisabled,s=e.isEdit,c=(0,a.useState)(s?"schedule":f.JG),u=(0,i.Z)(c,2),d=u[0],p=u[1],b=(0,a.useState)(f.yu),g=(0,i.Z)(b,2),h=g[0],v=g[1],E=(0,a.useState)(0),C=(0,i.Z)(E,2),D=C[0],k=C[1],w=(0,O.by)("offset"),L=(0,a.useState)(t?new Date(t):s?null:H),j=(0,i.Z)(L,2),P=j[0],F=j[1],_=(0,a.useState)(n?new Date(n):s?null:I),N=(0,i.Z)(_,2),U=N[0],B=N[1],M=(0,a.useState)((0,Z.default)((0,S.Z)(P,{days:1}))),T=(0,i.Z)(M,2),z=T[0],K=T[1];(0,a.useEffect)((function(){var e=(0,S.Z)(P,{days:1});K(e),!s&&P>=U&&B(e)}),[P]),(0,a.useEffect)((function(){o({start:P,end:U,scheduleOption:d,duration:h})}),[P,U,d,h]);var V=y(),Q=(0,Z.default)((0,S.Z)(V,{years:1}));return a.createElement(l.Flex,{column:!0,gap:3},!s&&a.createElement(l.Flex,{gap:3},Object.entries(f.Zg).map((function(e){var t=(0,i.Z)(e,2),n=t[0],o=t[1],s=o.text,c=o.tooltip;return a.createElement(l.RadioButton,{key:n,checked:n===d,onChange:function(){return p(n)},disabled:r},a.createElement(m.Z,{content:c,align:"bottom"},a.createElement(l.TextSmall,{color:"textDescription"},s)))}))),"now"===d?a.createElement(A,{duration:h,setDuration:v,setDate:function(e){F(Date.now()),B(e)},endDate:U,isDisabled:r}):a.createElement(l.Flex,{gap:2},a.createElement(l.Flex,{column:!0,gap:2,flex:{grow:1,shrink:1},basis:0},a.createElement(l.TextSmall,null,"Start date"),a.createElement(x.Z,{isSinglePicker:!0,values:{singleDate:new Date(P)},minDate:R(),maxDate:Q,utc:w,onChange:function(e){F(e),k((function(e){return e+1}))},isPlaying:!1,accessorProps:f.mD,padding:[4,0],width:"auto",accessorTooltipContent:"Select start date"})),a.createElement(l.Flex,{column:!0,gap:2,flex:{grow:1,shrink:1},basis:0},a.createElement(l.TextSmall,null,"End date"),a.createElement(x.Z,{key:D,isSinglePicker:!0,values:{singleDate:U?new Date(U):U},minDate:z,maxDate:Q,utc:w,onChange:B,isPlaying:!1,accessorProps:f.mD,padding:[4,0],width:"auto",accessorTooltipContent:"Select end date"}))))},P=function(e){var t=e.content,n=void 0===t?"Loading alerts...":t;return a.createElement(l.Flex,{height:45,alignItems:"center",justifyContent:"center"},a.createElement(l.Text,null,n))},F=n(27308),_=function(e){return a.createElement(l.Flex,(0,s.Z)({gap:2,alignItems:"center"},e),a.createElement(l.Icon,{size:"small",color:"warning",name:"warning_triangle"}),a.createElement(l.Text,null,"This feature is only available to paid plans"),a.createElement(F.Z,null))},N=(n(82526),n(38880),n(15581),n(34514),n(54747),n(49337),n(33321),n(69070),n(57327),n(41539),n(88449),n(2490),n(59849),n(47941),n(69826),n(31672),n(59461),n(26699),n(32023),n(88674),n(17727),n(89250)),U=n(13477),B=n(33335),M=n(74059),T=n(96929),z=n(3689),K=n(93742),V=n(25403),Q=n(4480),Y=n(48450),G=(0,Q.CG)({key:"spaceAlertMetas",get:function(e){return function(){return(0,Y.uk)(e)}}}),J=n(62447),W=n(45396),$=n(93017),q=["id","name"],X=["rooms","nodes","hostLabels","startsAt","lastsUntil"],ee=["accountId","scope","rooms","nodes","hostLabels","startsAt","lastsUntil","scheduleOption","duration"];function te(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function ne(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?te(Object(n),!0).forEach((function(t){(0,v.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):te(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ae={name:"",rooms:[],nodes:[],hostLabels:null,alertNames:[],alertContexts:[],alertRoles:[],startsAt:null,lastsUntil:null},le=function(e){var t=e.id;return ne({label:e.name,value:t},(0,c.Z)(e,q))},oe=function(e){return{label:e,value:e}},re=function(e){return e.value},se=function(e,t){e.accountId;var n=e.scope,a=e.rooms,l=e.nodes,o=e.hostLabels,r=e.startsAt,s=e.lastsUntil,i=e.scheduleOption,u=e.duration,d=(0,c.Z)(e,ee),m=a.filter((function(e){return e.value!==f.sr.value})).map(re),p=l.map(re),b=!!Object.keys(o||{}).length,g=function(e){var t=e.startsAt,n=e.lastsUntil,a=e.scheduleOption,l=e.duration;if("schedule"==a)return{start:t,end:n};var o=Date.now(),r=void 0;switch(l){case"oneHour":r=(0,S.Z)(o,{hours:1});break;case"sixHours":r=(0,S.Z)(o,{hours:6});break;case"twelveHours":r=(0,S.Z)(o,{hours:12});break;case"oneDay":r=(0,S.Z)(o,{days:1});break;case"custom":r=n}return ne({start:o},r?{end:r}:{})}({startsAt:r,lastsUntil:s,scheduleOption:i,duration:u}),h=g.start,v=g.end;return ne(ne(ne(ne(ne(ne(ne({},d),"personal"==n?{account_id:t}:{}),m.length?{room_ids:m}:{}),p.length?{node_ids:p}:{}),b?{host_labels:o}:{}),h?{starts_at:new Date(h).toISOString()}:{}),v?{lasts_until:new Date(v).toISOString()}:{})},ie=function(e){var t,n=e.rule,l=e.onClose,o=e.isEdit,r=(0,U.jr)(),s=(0,N.s0)(),u=(0,M.uk)(),d=(0,h.Z)(),m=(0,i.Z)(d,2),p=m[0],b=m[1],g=(0,K.Z)({all:!0}),E=null===(t=g.find((function(e){return"All nodes"==e.label})))||void 0===t?void 0:t.value,C=function(){var e,t=(0,M.th)(),n=(0,Q.$P)(G(t));return{loaded:"loading"!==n.state,value:(null===(e=n.contents)||void 0===e?void 0:e.data)||Y.ND,hasError:"hasError"===n.state}}(),D=C.loaded,x=C.value,y=C.hasError,Z=(0,V.wK)(),S=(0,V.j6)(),O=o?S:Z,k=(0,V._A)(),w=(0,$.Z)(),L=(0,i.Z)(w,3)[2],A=(0,a.useState)({alertNameOptions:[],alertContextOptions:[],alertRoleOptions:[]}),R=(0,i.Z)(A,2),H=R[0],I=R[1],j=H.alertNameOptions,P=H.alertContextOptions,F=H.alertRoleOptions,_=(0,a.useState)((function(){return ne(ne({},ae),function(e){var t,n=e.rooms,a=e.nodes,l=e.hostLabels,o=e.startsAt,r=e.lastsUntil,s=(0,c.Z)(e,X);return ne(ne(ne(ne(ne({},s),{},{scope:s.accountId?"personal":f.xQ,canSubmit:!(null===s||void 0===s||null===(t=s.name)||void 0===t||!t.length),rooms:null!==n&&void 0!==n&&n.length?n.map(le):[z.k_]},null!==a&&void 0!==a&&a.length?{nodes:a.map(le).filter((function(e){return!e.notAvailable}))}:{}),l?{hostLabels:l}:{}),o?{startsAt:o}:{}),r?{lastsUntil:r}:{})}(n))})),q=(0,i.Z)(_,2),ee=q[0],te=q[1],re=(0,T.IW)(ee.roomIds||[E]),ie=(0,a.useCallback)((function(e){return te((function(t){return ne(ne({},t),{},{scope:e})}))}),[]),ce=(0,a.useCallback)((function(e){return te((function(t){return ne(ne({},t),{},{name:e,canSubmit:!(null===e||void 0===e||!e.length)})}))}),[]),ue=(0,a.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=function(e){return e.length<=1?e:e[e.length-1].value==f.sr.value?[f.sr]:e.filter((function(e){return!!e.value}))}(e),a=n.map((function(e){return e.value||E})),l=t.length<n.length?n.filter((function(e){var n=e.value;return!t.includes(n)}))[0]:null;te((function(e){return ne(ne({},e),{},{rooms:n,roomIds:a,lastRoomAdded:l||null})}))}),[E]),de=(0,a.useCallback)((function(e){return te((function(t){return ne(ne({},t),{},{nodeIds:e.map((function(e){return e.value})),nodes:e})}))}),[]),me=(0,a.useCallback)((function(e){return te((function(t){return ne(ne({},t),{},{hostLabels:ne(ne({},t.hostLabels),e)})}))}),[]),fe=(0,a.useCallback)((function(e){return te((function(t){var n=ne({},t.hostLabels);return delete n[e],ne(ne({},t),{},{hostLabels:n})}))}),[]),pe=(0,a.useCallback)((function(e){return function(t){return te((function(n){return ne(ne({},n),{},(0,v.Z)({},e,t.map((function(e){return e.value}))))}))}}),[]),be=(0,a.useCallback)((function(e){var t=e.start,n=e.end,a=e.scheduleOption,l=e.duration;return te((function(e){return ne(ne({},e),{},{startsAt:t,lastsUntil:n,scheduleOption:a,duration:l.value})}))}),[]),ge=(0,a.useCallback)((function(){b(),O(se(ee,r)).then((function(){l(),k()})).catch((function(e){return L((0,J._)(e))})).finally(b)}),[ee,r]),he=(0,W.Z)();(0,a.useEffect)((function(){var e,t=(null===(e=ee.lastRoomAdded)||void 0===e?void 0:e.value)||E,n=null;return t&&(n=he(t)),function(){var e;return!(null===(e=n)||void 0===e||!e.cancel)&&n.cancel()}}),[ee.roomIds,he]),(0,a.useEffect)((function(){if(D){var e=x||{},t=e.contexts,n=e.names,a=e.roles;I({alertNameOptions:n?n.map(oe):[],alertContextOptions:t?t.map(oe):[],alertRoleOptions:a?a.map(oe):[]})}}),[D]);var ve=(0,B.gI)("space:CreatePersonalSilencingRule"),Ee=(0,a.useCallback)((function(){return s("/spaces/".concat(u,"/settings/billing"))}),[u]);return{state:ee,onScopeChange:ie,onRuleNameChange:ce,onRoomsSelectionChange:ue,roomOptions:g,onNodesSelectionChange:de,nodesOptions:re,alertMetasLoaded:D,alertMetas:x,alertNameOptions:j,alertContextOptions:P,alertRoleOptions:F,alertMetasError:y,onAlertValueChange:pe,onAddHostLabel:me,onRemoveHostLabel:fe,onDatesChange:be,loading:p,onSave:ge,spaceCreatePersonalSilencingRule:ve,onUpdateButtonClick:Ee}},ce=function(e){return null!==e&&void 0!==e&&e.length?e.map(oe):[]},ue=function(){return a.createElement(l.Box,{as:"hr",height:"1px",width:"100%",sx:{borderWidth:"1px 0px 0px 0px",borderColor:"borderSecondary",borderStyle:"solid"}})},de=function(e){var t=e.rule,n=void 0===t?{}:t,s=e.onClose,i=e.isEdit,c=ie({rule:n,onClose:s,isEdit:i}),u=c.state,d=c.onScopeChange,f=c.onRuleNameChange,p=c.onRoomsSelectionChange,h=c.roomOptions,v=c.onNodesSelectionChange,E=c.nodesOptions,C=c.alertMetasLoaded,x=c.alertNameOptions,y=c.alertContextOptions,Z=c.alertRoleOptions,S=c.onAlertValueChange,O=c.onAddHostLabel,k=c.onRemoveHostLabel,w=c.onDatesChange,L=c.loading,A=c.onSave,R=c.spaceCreatePersonalSilencingRule,H=c.onUpdateButtonClick;return a.createElement(l.Modal,{onEsc:s},a.createElement(r.hz,{style:{maxHeight:"800px"}},a.createElement(l.ModalHeader,{padding:[6,4,3]},a.createElement(l.Flex,{column:!0,gap:2},a.createElement(l.Flex,{flex:!0,alignItems:"center",justifyContent:"between"},a.createElement(l.H4,null,"Add silencing rule"),s&&a.createElement(r.A3,{onClose:s})),a.createElement(l.Text,null,"Define an alert notification silencing rule that will apply to all users or just you."," ",a.createElement(o.Z,{"data-ga":"alert-silencing::click-link-docs::rule-modal","data-testid":"silencing-rules-doc",href:"https://learn.netdata.cloud/docs/alerts-and-notifications/notifications/netdata-cloud-notifications/manage-alert-notification-silencing-rules",rel:"noopener noreferrer",target:"_blank"},"Learn how to configure silencing rules.")),!R&&a.createElement(_,null))),a.createElement(l.ModalBody,{padding:[0]},a.createElement(r.QD,null,a.createElement(l.Flex,{column:!0,gap:3},a.createElement(b,{scope:u.scope,setScope:d,padding:[0,0,1,0],isDisabled:!R}),a.createElement(g.Z,{component:"input",onChange:f,placeholder:"Add rule name",title:"Rule name*",value:u.name,disabled:!R}),a.createElement(g.Z,{component:"select",isMulti:!0,onChange:function(e){return p(e,u.roomIds)},options:h,placeholder:"Select rooms",title:"Rooms*",value:u.rooms,isDisabled:!R}),a.createElement(g.Z,{component:"select",isMulti:!0,onChange:v,options:E,placeholder:"Select nodes",title:"Nodes",value:u.nodes,isDisabled:!R||!E.length}),a.createElement(D,{hostLabels:u.hostLabels,onAddHostLabel:O,onRemoveHostLabel:k,isEdit:i,isDisabled:!R}),C?a.createElement(a.Fragment,null,a.createElement(ue,null),a.createElement(g.Z,{component:"select",isMulti:!0,onChange:S("alertNames"),options:x,placeholder:"Select alert name",title:"Alert name",value:ce(u.alertNames),isDisabled:!R}),a.createElement(g.Z,{component:"select",isMulti:!0,onChange:S("alertContexts"),options:y,placeholder:"Select alert context",title:"Alert context",value:ce(u.alertContexts),isDisabled:!R}),a.createElement(g.Z,{component:"select",isMulti:!0,onChange:S("alertRoles"),options:Z,placeholder:"Select alert role",title:"Alert role",value:ce(u.alertRoles),isDisabled:!R})):a.createElement(P,null),a.createElement(ue,null),a.createElement(j,{start:u.startsAt,end:u.lastsUntil,onChange:w,isEdit:i,isDisabled:!R}))),a.createElement(r.QD,{alignItems:"end",justifyContent:"center"},a.createElement(l.Flex,{gap:4},a.createElement(l.Button,{flavour:"borderless",label:"Cancel",onClick:s,disabled:L}),R?a.createElement(m.Z,{content:i?"Update the rule":"Create the rule",align:"bottom"},a.createElement(l.Button,{label:"OK",onClick:A,"data-ga":"alert-silencing::click-save-".concat(i?"edit":"new","-rule::rule-modal"),"data-testid":"saveRule-button",textTransform:"uppercase",isLoading:L,disabled:L||!u.canSubmit})):a.createElement(m.Z,{content:"Update to a paid plan in order to be able to create silencing rules",align:"bottom"},a.createElement(l.Button,{label:"Upgrade!",onClick:H})))))))}}}]);
\ No newline at end of file |