12 |
- "use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[743],{48167:(e,a,t)=>{t.r(a),t.d(a,{NotificationsPage:()=>N,default:()=>Z});var n=t(68404),s=t(18745),r=t(33801),i=t(8674),o=t(36636),c=t(37784),l=t(69783),d=t(31704),f=t(61514);function u(e,a){return(0,f.Z)(1,arguments),(0,d.Z)(e,Date.now(),a)}var p=t(90923),m=t(45916);const h=e=>{let{children:a,className:t,isSelected:n,onClick:s,severity:r="error",title:i,traceId:o,timestamp:c}=e;const d=(0,l.useTheme2)(),f=x(d),h=p.config.featureToggles.tracing&&o;return(0,m.jsxs)(l.Card,{className:t,onClick:s,children:[(0,m.jsx)(l.Card.Heading,{children:i}),(0,m.jsx)(l.Card.Description,{children:a}),(0,m.jsx)(l.Card.Figure,{children:(0,m.jsx)(l.Checkbox,{onChange:s,tabIndex:-1,value:n})}),(0,m.jsxs)(l.Card.Tags,{className:f.trace,children:[h&&(0,m.jsx)("span",{children:`Trace ID: ${o}`}),c&&u(c,{addSuffix:!0})]})]})},x=e=>({trace:(0,o.css)({alignItems:"flex-end",alignSelf:"flex-end",color:e.colors.text.secondary,display:"flex",flexDirection:"column",fontSize:e.typography.pxToRem(10),justifySelf:"flex-end"})});var v,g,D,y,j=t(49842),b=t(58170);function w(){const e=(0,b.I0)(),a=(0,b.v9)((e=>(0,j.mE)(e.appNotifications))),[t,s]=(0,n.useState)([]),r=a.every((e=>t.includes(e.id))),i=(0,n.useRef)((0,b.v9)((e=>(0,j.Av)(e.appNotifications)))),d=(0,l.useStyles2)(I);(0,c.Z)((()=>{e((0,j.Jk)(Date.now()))}));return 0===a.length?(0,m.jsxs)("div",{className:d.noNotifsWrapper,children:[v||(v=(0,m.jsx)(l.Icon,{name:"bell",size:"xxl"})),g||(g=(0,m.jsx)("span",{children:"Notifications you have received will appear here."}))]}):(0,m.jsxs)("div",{className:d.wrapper,children:[D||(D=(0,m.jsx)(l.Alert,{severity:"info",title:"This page displays past errors and warnings. Once dismissed, they cannot be retrieved."})),(0,m.jsxs)("div",{className:d.topRow,children:[(0,m.jsx)(l.Checkbox,{value:r,onChange:e=>{return t=e.target.checked,void s(t?a.map((e=>e.id)):[]);var t}}),(0,m.jsx)(l.Button,{disabled:0===t.length,onClick:()=>{r?e((0,j.F6)()):t.forEach((a=>{e((0,j.hS)(a))})),s([])},children:"Dismiss notifications"})]}),(0,m.jsx)("ul",{className:d.list,children:a.map((e=>(0,m.jsx)("li",{className:d.listItem,children:(0,m.jsx)(h,{className:(0,o.cx)({[d.newItem]:e.timestamp>i.current}),isSelected:t.includes(e.id),onClick:()=>{return a=e.id,void s((e=>e.includes(a)?e.filter((e=>e!==a)):[...e,a]));var a},severity:e.severity,title:e.title,timestamp:e.timestamp,traceId:e.traceId,children:(0,m.jsx)("span",{children:e.text})})},e.id)))})]})}function I(e){return{topRow:(0,o.css)({alignItems:"center",display:"flex",gap:e.spacing(2)}),list:(0,o.css)({display:"flex",flexDirection:"column"}),listItem:(0,o.css)({alignItems:"center",display:"flex",gap:e.spacing(2),listStyle:"none",position:"relative"}),newItem:(0,o.css)({"&::before":{content:'""',height:"100%",position:"absolute",left:"-7px",top:0,background:e.colors.gradients.brandVertical,width:e.spacing(.5),borderRadius:e.shape.borderRadius(1)}}),noNotifsWrapper:(0,o.css)({display:"flex",flexDirection:"column",alignItems:"center",gap:e.spacing(1)}),wrapper:(0,o.css)({display:"flex",flexDirection:"column",gap:e.spacing(2)})}}const M=e=>({navModel:(0,i.h)(e.navIndex,"notifications")}),N=((0,s.connect)(M,void 0),e=>{let{navModel:a}=e;return(0,m.jsx)(r.Z,{navModel:a,children:y||(y=(0,m.jsx)(r.Z.Contents,{children:(0,m.jsx)(w,{})}))})}),Z=(0,s.connect)(M)(N)},31704:(e,a,t)=>{t.d(a,{Z:()=>p});var n=t(32795),s=t(34340),r=t(96186),i=t(17745),o=t(17204);function c(e){return function(e,a){if(null==e)throw new TypeError("assign requires that input parameter not be null or undefined");for(var t in a=a||{})Object.prototype.hasOwnProperty.call(a,t)&&(e[t]=a[t]);return e}({},e)}var l=t(51341),d=t(61514),f=1440,u=43200;function p(e,a){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};(0,d.Z)(2,arguments);var p=t.locale||i.Z;if(!p.formatDistance)throw new RangeError("locale must contain formatDistance property");var m=(0,n.Z)(e,a);if(isNaN(m))throw new RangeError("Invalid time value");var h,x,v=c(t);v.addSuffix=Boolean(t.addSuffix),v.comparison=m,m>0?(h=(0,o.Z)(a),x=(0,o.Z)(e)):(h=(0,o.Z)(e),x=(0,o.Z)(a));var g,D=(0,r.Z)(x,h),y=((0,l.Z)(x)-(0,l.Z)(h))/1e3,j=Math.round((D-y)/60);if(j<2)return t.includeSeconds?D<5?p.formatDistance("lessThanXSeconds",5,v):D<10?p.formatDistance("lessThanXSeconds",10,v):D<20?p.formatDistance("lessThanXSeconds",20,v):D<40?p.formatDistance("halfAMinute",null,v):D<60?p.formatDistance("lessThanXMinutes",1,v):p.formatDistance("xMinutes",1,v):0===j?p.formatDistance("lessThanXMinutes",1,v):p.formatDistance("xMinutes",j,v);if(j<45)return p.formatDistance("xMinutes",j,v);if(j<90)return p.formatDistance("aboutXHours",1,v);if(j<f){var b=Math.round(j/60);return p.formatDistance("aboutXHours",b,v)}if(j<2520)return p.formatDistance("xDays",1,v);if(j<u){var w=Math.round(j/f);return p.formatDistance("xDays",w,v)}if(j<86400)return g=Math.round(j/u),p.formatDistance("aboutXMonths",g,v);if((g=(0,s.Z)(x,h))<12){var I=Math.round(j/u);return p.formatDistance("xMonths",I,v)}var M=g%12,N=Math.floor(g/12);return M<3?p.formatDistance("aboutXYears",N,v):M<9?p.formatDistance("overXYears",N,v):p.formatDistance("almostXYears",N+1,v)}}}]);
- //# sourceMappingURL=NotificationsPage.e1bd81fdd81212ec2405.js.map
|