"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[9218],{49332:(e,s,t)=>{t.d(s,{Z:()=>r});var l=t(76687),i=t(3357),a=t(55312),n=t(52010);class r extends l.PureComponent{render(){const{searchQuery:e,linkButton:s,setSearchQuery:t,target:l,placeholder:r="Search by name or type"}=this.props,o={href:null==s?void 0:s.href,disabled:null==s?void 0:s.disabled};return l&&(o.target=l),(0,n.jsxs)("div",{className:"page-action-bar",children:[(0,n.jsx)("div",{className:"gf-form gf-form--grow",children:(0,n.jsx)(i.H,{value:e,onChange:t,placeholder:r})}),s&&(0,n.jsx)(a.Qj,Object.assign({},o,{children:s.title}))]})}}},63950:(e,s,t)=>{t.r(s),t.d(s,{PlaylistPage:()=>Q,default:()=>V});var l=t(76687),i=t(68021),a=t(97867),n=t(97726),r=t(28781),o=t(49332),d=t(69369),c=t(77813),u=t(27668),h=t(52010);const p=()=>{const e=(0,u.wW)(y);return(0,h.jsx)("div",{className:e.noResult,children:"No playlist found!"})},y=e=>({noResult:c.css`
      padding: ${e.spacing(2)};
      background: ${e.colors.secondary.main};
      font-style: italic;
      margin-top: ${e.spacing(2)};
    `});var x=t(3351),j=t(63672),g=t(55312),v=t(42246),m=t(85994),b=t(99397),f=t(72660),k=t(45550),S=t(81377),C=t(59249),T=t(9120),w=t(63352),D=t(29917);const P=e=>{let{playlistUid:s,onDismiss:t}=e;const[i,a]=(0,l.useState)(!1),[n,r]=(0,l.useState)(!1),o={};i&&(o.kiosk=i),n&&(o.autofitpanels=!0);const d=m.Cj.renderUrl(`${(0,D.OS)()}/play/${s}`,o);return(0,h.jsx)(b.u,{isOpen:!0,title:"Share playlist",onDismiss:t,children:(0,h.jsxs)(f.C,{children:[(0,h.jsx)(k.g,{label:"Mode",children:(0,h.jsx)(S.S,{value:i,options:[{label:"Normal",value:!1},{label:"TV",value:"tv"},{label:"Kiosk",value:!0}],onChange:a})}),(0,h.jsx)(k.g,{children:(0,h.jsx)(C.X,{label:"Autofit",description:"Panel heights will be adjusted to fit screen size",name:"autofix",value:n,onChange:e=>r(e.currentTarget.checked)})}),(0,h.jsx)(k.g,{label:"Link URL",children:(0,h.jsx)(T.I,{id:"link-url-input",value:d,readOnly:!0,addonAfter:(0,h.jsx)(w.m,{icon:"copy",variant:"primary",getText:()=>d,children:"Copy"})})})]})})},N=e=>{let{playlists:s,setStartPlaylist:t,setPlaylistToDelete:l}=e;const i=(0,u.wW)($);return(0,h.jsx)("ul",{className:i.list,children:s.map((e=>(0,h.jsx)("li",{className:i.listItem,children:(0,h.jsxs)(x.Z,{children:[(0,h.jsxs)(x.Z.Heading,{children:[e.name,(0,h.jsx)(j.JY,{children:s=>{let{showModal:t,hideModal:l}=s;return(0,h.jsx)(v.u,{tooltip:"Share playlist",icon:"share-alt",iconSize:"lg",onClick:()=>{t(P,{playlistUid:e.uid,onDismiss:l})}})}},"button-share")]}),(0,h.jsxs)(x.Z.Actions,{children:[(0,h.jsx)(g.zx,{variant:"secondary",icon:"play",onClick:()=>t(e),children:"Start playlist"}),d.Vt.isEditor&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(g.Qj,{variant:"secondary",href:`/playlists/edit/${e.uid}`,icon:"cog",children:"Edit playlist"},"edit"),(0,h.jsx)(g.zx,{disabled:!1,onClick:()=>l(e),icon:"trash-alt",variant:"destructive",children:"Delete playlist"})]})]})]})},e.uid)))})};function $(e){return{list:(0,c.css)({display:"grid"}),listItem:(0,c.css)({listStyle:"none"})}}var L=t(49622);const Z=e=>{let{playlist:s,onDismiss:t}=e;const[i,a]=(0,l.useState)(!1),[n,r]=(0,l.useState)(!1);return(0,h.jsxs)(b.u,{isOpen:!0,icon:"play",title:"Start playlist",onDismiss:t,children:[(0,h.jsxs)(f.C,{children:[(0,h.jsx)(k.g,{label:"Mode",children:(0,h.jsx)(S.S,{value:i,options:[{label:"Normal",value:!1},{label:"TV",value:"tv"},{label:"Kiosk",value:!0}],onChange:a})}),(0,h.jsx)(C.X,{label:"Autofit",description:"Panel heights will be adjusted to fit screen size",name:"autofix",value:n,onChange:e=>r(e.currentTarget.checked)})]}),(0,h.jsx)(b.u.ButtonRow,{children:(0,h.jsxs)(g.zx,{variant:"primary",onClick:()=>{const e={};i&&(e.kiosk=i),n&&(e.autofitpanels=!0),L.E1.push(m.Cj.renderUrl(`/playlists/play/${s.uid}`,e))},children:["Start ",s.name]})})]})};var z,O=t(59163);const Q=()=>{const[e,s]=(0,l.useState)(0),[t,c]=(0,l.useState)(""),u=(0,i.Z)((()=>(0,O.Dv)()),[e]),y=(0,l.useMemo)((()=>{var e;return(0,O.Ds)(null!==(e=u.value)&&void 0!==e?e:[],t)}),[t,u]),[x,j]=(0,l.useState)(),[g,v]=(0,l.useState)(),m=y&&y.length>0,b=(0,h.jsx)(n.Z,{title:"There are no playlists created yet",buttonIcon:"plus",buttonLink:"playlists/new",buttonTitle:"Create Playlist",buttonDisabled:!d.Vt.isEditor,proTip:"You can use playlists to cycle dashboards on TVs without user control",proTipLink:"http://docs.grafana.org/reference/playlist/",proTipLinkTitle:"Learn more",proTipTarget:"_blank"}),f=y.length>0||t.length>0;return(0,h.jsx)(r.T,{navId:"dashboards/playlists",children:(0,h.jsxs)(r.T.Contents,{isLoading:u.loading,children:[f&&(0,h.jsx)(o.Z,{searchQuery:t,linkButton:d.Vt.isEditor&&{title:"New playlist",href:"/playlists/new"},setSearchQuery:c}),!m&&t?z||(z=(0,h.jsx)(p,{})):(0,h.jsx)(N,{playlists:y,setStartPlaylist:j,setPlaylistToDelete:v}),!f&&b,g&&(0,h.jsx)(a.s,{title:g.name,confirmText:"Delete",body:`Are you sure you want to delete '${g.name}' playlist?`,onConfirm:()=>{g&&(0,O.l8)(g.uid).finally((()=>{s(e+1),v(void 0)}))},isOpen:Boolean(g),onDismiss:()=>v(void 0)}),x&&(0,h.jsx)(Z,{playlist:x,onDismiss:()=>j(void 0)})]})})},V=Q}}]);
//# sourceMappingURL=PlaylistPage.281f2527766bf2f2aca7.js.map