"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[9218],{78014:(F,E,e)=>{e.d(E,{Z:()=>g});var t=e(68404),C=e(14747),T=e(31403),D=e(79979);class g extends t.PureComponent{render(){const{searchQuery:y,linkButton:r,setSearchQuery:h,target:f,placeholder:M="Search by name or type",sortPicker:i}=this.props,p={href:r?.href,disabled:r?.disabled};return f&&(p.target=f),t.createElement("div",{className:"page-action-bar"},t.createElement("div",{className:"gf-form gf-form--grow"},t.createElement(C.H,{value:y,onChange:h,placeholder:M})),i&&t.createElement(D.P,{onChange:i.onChange,value:i.value,getSortOptions:i.getSortOptions}),r&&t.createElement(T.Qj,{...p},r.title))}}},21977:(F,E,e)=>{e.r(E),e.d(E,{PlaylistPage:()=>R,default:()=>k});var t=e(68404),C=e(22350),T=e(98102),D=e(69142),g=e(79396),A=e(78014),y=e(82002),r=e(52423),h=e(72648);const f=()=>{const a=(0,h.wW)(M);return t.createElement("div",{className:a.noResult},"No playlist found!")},M=a=>({noResult:r.css`
      padding: ${a.spacing(2)};
      background: ${a.colors.secondary.main};
      font-style: italic;
      margin-top: ${a.spacing(2)};
    `});var i=e(72948),p=e(5191),P=e(31403),$=e(64503),O=e(27677),L=e(35029),x=e(13393),S=e(24799),I=e(2594),N=e(58255),Q=e(46967),Z=e(94599),j=e(89346);const z=({playlistUid:a,onDismiss:m})=>{const[n,c]=(0,t.useState)(!1),[l,o]=(0,t.useState)(!1),u=[{label:"Normal",value:!1},{label:"TV",value:"tv"},{label:"Kiosk",value:!0}],d={};n&&(d.kiosk=n),l&&(d.autofitpanels=!0);const s=O.Cj.renderUrl(`${(0,j.OS)()}/play/${a}`,d);return t.createElement(L.u,{isOpen:!0,title:"Share playlist",onDismiss:m},t.createElement(x.C,null,t.createElement(S.g,{label:"Mode"},t.createElement(I.S,{value:n,options:u,onChange:c})),t.createElement(S.g,null,t.createElement(N.X,{label:"Autofit",description:"Panel heights will be adjusted to fit screen size",name:"autofix",value:l,onChange:v=>o(v.currentTarget.checked)})),t.createElement(S.g,{label:"Link URL"},t.createElement(Q.I,{id:"link-url-input",value:s,readOnly:!0,addonAfter:t.createElement(Z.m,{icon:"copy",variant:"primary",getText:()=>s},"Copy")}))))},K=({playlists:a,setStartPlaylist:m,setPlaylistToDelete:n})=>{const c=(0,h.wW)(V);return t.createElement("ul",{className:c.list},a.map(l=>t.createElement("li",{className:c.listItem,key:l.uid},t.createElement(i.Z,null,t.createElement(i.Z.Heading,null,l.name,t.createElement(p.JY,{key:"button-share"},({showModal:o,hideModal:u})=>t.createElement($.u,{tooltip:"Share playlist",icon:"share-alt",iconSize:"lg",onClick:()=>{o(z,{playlistUid:l.uid,onDismiss:u})}}))),t.createElement(i.Z.Actions,null,t.createElement(P.zx,{variant:"secondary",icon:"play",onClick:()=>m(l)},"Start playlist"),y.Vt.isEditor&&t.createElement(t.Fragment,null,t.createElement(P.Qj,{key:"edit",variant:"secondary",href:`/playlists/edit/${l.uid}`,icon:"cog"},"Edit playlist"),t.createElement(P.zx,{disabled:!1,onClick:()=>n(l),icon:"trash-alt",variant:"destructive"},"Delete playlist")))))))};function V(a){return{list:(0,r.css)({display:"grid"}),listItem:(0,r.css)({listStyle:"none"})}}var W=e(37932);const b=({playlist:a,onDismiss:m})=>{const[n,c]=(0,t.useState)(!1),[l,o]=(0,t.useState)(!1),u=[{label:"Normal",value:!1},{label:"TV",value:"tv"},{label:"Kiosk",value:!0}],d=()=>{const s={};n&&(s.kiosk=n),l&&(s.autofitpanels=!0),W.E1.push(O.Cj.renderUrl(`/playlists/play/${a.uid}`,s))};return t.createElement(L.u,{isOpen:!0,icon:"play",title:"Start playlist",onDismiss:m},t.createElement(x.C,null,t.createElement(S.g,{label:"Mode"},t.createElement(I.S,{value:n,options:u,onChange:c})),t.createElement(N.X,{label:"Autofit",description:"Panel heights will be adjusted to fit screen size",name:"autofix",value:l,onChange:s=>o(s.currentTarget.checked)})),t.createElement(L.u.ButtonRow,null,t.createElement(P.zx,{variant:"primary",onClick:d},"Start ",a.name)))};var B=e(6129);const R=()=>{const[a,m]=(0,t.useState)(0),[n,c]=(0,t.useState)(""),l=(0,C.Z)(()=>(0,B.Dv)(),[a]),o=(0,t.useMemo)(()=>(0,B.Ds)(l.value??[],n),[n,l]),[u,d]=(0,t.useState)(),[s,v]=(0,t.useState)(),H=o&&o.length>0,X=()=>v(void 0),Y=()=>{s&&(0,B.l8)(s.uid).finally(()=>{m(a+1),v(void 0)})},G=t.createElement(D.Z,{title:"There are no playlists created yet",buttonIcon:"plus",buttonLink:"playlists/new",buttonTitle:"Create Playlist",buttonDisabled:!y.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"}),U=o.length>0||n.length>0;return t.createElement(g.T,{navId:"dashboards/playlists"},t.createElement(g.T.Contents,{isLoading:l.loading},U&&t.createElement(A.Z,{searchQuery:n,linkButton:y.Vt.isEditor?{title:"New playlist",href:"/playlists/new"}:void 0,setSearchQuery:c}),!H&&n?t.createElement(f,null):t.createElement(K,{playlists:o,setStartPlaylist:d,setPlaylistToDelete:v}),!U&&G,s&&t.createElement(T.s,{title:s.name,confirmText:"Delete",body:`Are you sure you want to delete '${s.name}' playlist?`,onConfirm:Y,isOpen:Boolean(s),onDismiss:X}),u&&t.createElement(b,{playlist:u,onDismiss:()=>d(void 0)})))},k=R}}]);

//# sourceMappingURL=PlaylistPage.4b70e62ab239b7ecc06d.js.map