"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[9218],{67694:(F,E,e)=>{e.d(E,{Z:()=>g});var t=e(65237),C=e(27496),T=e(48389),D=e(66624);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))}}},54065:(F,E,e)=>{e.r(E),e.d(E,{PlaylistPage:()=>R,default:()=>k});var t=e(65237),C=e(15804),T=e(22324),D=e(76044),g=e(38992),A=e(67694),y=e(96237),r=e(60234),h=e(93048);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(60631),p=e(72889),P=e(48389),$=e(38887),O=e(31667),L=e(90931),x=e(37885),S=e(5263),I=e(12007),N=e(58190),Q=e(96682),Z=e(44840),j=e(3090);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(38002);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(42423);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.3c6c406fa42e34fde8dc.js.map