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A,EAAAA,KAASC,EAAAA,EAAAA,KAAUE,EAAAA,EAAAA,IAAwB,0BAA2B9F","sources":["webpack://grafana/./public/app/core/components/PageActionBar/PageActionBar.tsx","webpack://grafana/./public/app/features/playlist/EmptyQueryListBanner.tsx","webpack://grafana/./public/app/features/playlist/ShareModal.tsx","webpack://grafana/./public/app/features/playlist/PlaylistPageList.tsx","webpack://grafana/./public/app/features/playlist/StartModal.tsx","webpack://grafana/./public/app/features/playlist/PlaylistPage.tsx","webpack://grafana/./public/app/features/playlist/api.ts"],"sourcesContent":["import React, { PureComponent } from 'react';\n\nimport { LinkButton, FilterInput } from '@grafana/ui';\n\nexport interface Props {\n searchQuery: string;\n setSearchQuery: (value: string) => void;\n linkButton?: { href: string; title: string; disabled?: boolean };\n target?: string;\n placeholder?: string;\n}\n\nexport default class PageActionBar extends PureComponent<Props> {\n render() {\n const { searchQuery, linkButton, setSearchQuery, target, placeholder = 'Search by name or type' } = this.props;\n const linkProps: typeof LinkButton.defaultProps = { href: linkButton?.href, disabled: linkButton?.disabled };\n\n if (target) {\n linkProps.target = target;\n }\n\n return (\n <div className=\"page-action-bar\">\n <div className=\"gf-form gf-form--grow\">\n <FilterInput value={searchQuery} onChange={setSearchQuery} placeholder={placeholder} />\n </div>\n {linkButton && <LinkButton {...linkProps}>{linkButton.title}</LinkButton>}\n </div>\n );\n }\n}\n","import { css } from '@emotion/css';\nimport React from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { useStyles2 } from '@grafana/ui';\n\nexport const EmptyQueryListBanner = () => {\n const styles = useStyles2(getStyles);\n return <div className={styles.noResult}>No playlist found!</div>;\n};\n\nconst getStyles = (theme: GrafanaTheme2) => {\n return {\n noResult: css`\n padding: ${theme.spacing(2)};\n background: ${theme.colors.secondary.main};\n font-style: italic;\n margin-top: ${theme.spacing(2)};\n `,\n };\n};\n","import React, { useState } from 'react';\n\nimport { AppEvents, SelectableValue, UrlQueryMap, urlUtil } from '@grafana/data';\nimport { Checkbox, ClipboardButton, Field, FieldSet, Icon, Input, Modal, RadioButtonGroup } from '@grafana/ui';\nimport appEvents from 'app/core/app_events';\n\nimport { buildBaseUrl } from '../dashboard/components/ShareModal/utils';\n\nimport { PlaylistMode } from './types';\n\ninterface ShareModalProps {\n playlistUid: string;\n onDismiss: () => void;\n}\n\nexport const ShareModal = ({ playlistUid, onDismiss }: ShareModalProps) => {\n const [mode, setMode] = useState<PlaylistMode>(false);\n const [autoFit, setAutofit] = useState(false);\n\n const modes: Array<SelectableValue<PlaylistMode>> = [\n { label: 'Normal', value: false },\n { label: 'TV', value: 'tv' },\n { label: 'Kiosk', value: true },\n ];\n\n const onShareUrlCopy = () => {\n appEvents.emit(AppEvents.alertSuccess, ['Content copied to clipboard']);\n };\n\n const params: UrlQueryMap = {};\n if (mode) {\n params.kiosk = mode;\n }\n if (autoFit) {\n params.autofitpanels = true;\n }\n\n const shareUrl = urlUtil.renderUrl(`${buildBaseUrl()}/play/${playlistUid}`, params);\n\n return (\n <Modal isOpen={true} title=\"Share playlist\" onDismiss={onDismiss}>\n <FieldSet>\n <Field label=\"Mode\">\n <RadioButtonGroup value={mode} options={modes} onChange={setMode} />\n </Field>\n <Field>\n <Checkbox\n label=\"Autofit\"\n description=\"Panel heights will be adjusted to fit screen size\"\n name=\"autofix\"\n value={autoFit}\n onChange={(e) => setAutofit(e.currentTarget.checked)}\n />\n </Field>\n\n <Field label=\"Link URL\">\n <Input\n id=\"link-url-input\"\n value={shareUrl}\n readOnly\n addonAfter={\n <ClipboardButton variant=\"primary\" getText={() => shareUrl} onClipboardCopy={onShareUrlCopy}>\n <Icon name=\"copy\" /> Copy\n </ClipboardButton>\n }\n />\n </Field>\n </FieldSet>\n </Modal>\n );\n};\n","import { css } from '@emotion/css';\nimport React from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Button, Card, LinkButton, ModalsController, useStyles2 } from '@grafana/ui';\nimport { contextSrv } from 'app/core/services/context_srv';\n\nimport { DashNavButton } from '../dashboard/components/DashNav/DashNavButton';\n\nimport { ShareModal } from './ShareModal';\nimport { PlaylistDTO } from './types';\n\ninterface Props {\n setStartPlaylist: (playlistItem: PlaylistDTO) => void;\n setPlaylistToDelete: (playlistItem: PlaylistDTO) => void;\n playlists: PlaylistDTO[] | undefined;\n}\n\nexport const PlaylistPageList = ({ playlists, setStartPlaylist, setPlaylistToDelete }: Props) => {\n const styles = useStyles2(getStyles);\n return (\n <ul className={styles.list}>\n {playlists!.map((playlist: PlaylistDTO) => (\n <li className={styles.listItem} key={playlist.uid}>\n <Card>\n <Card.Heading>\n {playlist.name}\n <ModalsController key=\"button-share\">\n {({ showModal, hideModal }) => (\n <DashNavButton\n tooltip=\"Share playlist\"\n icon=\"share-alt\"\n iconSize=\"lg\"\n onClick={() => {\n showModal(ShareModal, {\n playlistUid: playlist.uid,\n onDismiss: hideModal,\n });\n }}\n />\n )}\n </ModalsController>\n </Card.Heading>\n <Card.Actions>\n <Button variant=\"secondary\" icon=\"play\" onClick={() => setStartPlaylist(playlist)}>\n Start playlist\n </Button>\n {contextSrv.isEditor && (\n <>\n <LinkButton key=\"edit\" variant=\"secondary\" href={`/playlists/edit/${playlist.uid}`} icon=\"cog\">\n Edit playlist\n </LinkButton>\n <Button\n disabled={false}\n onClick={() => setPlaylistToDelete({ id: playlist.id, uid: playlist.uid, name: playlist.name })}\n icon=\"trash-alt\"\n variant=\"destructive\"\n >\n Delete playlist\n </Button>\n </>\n )}\n </Card.Actions>\n </Card>\n </li>\n ))}\n </ul>\n );\n};\n\nfunction getStyles(theme: GrafanaTheme2) {\n return {\n list: css({\n display: 'grid',\n }),\n listItem: css({\n listStyle: 'none',\n }),\n };\n}\n","import React, { FC, useState } from 'react';\n\nimport { SelectableValue, urlUtil } from '@grafana/data';\nimport { locationService } from '@grafana/runtime';\nimport { Button, Checkbox, Field, FieldSet, Modal, RadioButtonGroup } from '@grafana/ui';\n\nimport { PlaylistDTO, PlaylistMode } from './types';\n\nexport interface StartModalProps {\n playlist: PlaylistDTO;\n onDismiss: () => void;\n}\n\nexport const StartModal: FC<StartModalProps> = ({ playlist, onDismiss }) => {\n const [mode, setMode] = useState<PlaylistMode>(false);\n const [autoFit, setAutofit] = useState(false);\n\n const modes: Array<SelectableValue<PlaylistMode>> = [\n { label: 'Normal', value: false },\n { label: 'TV', value: 'tv' },\n { label: 'Kiosk', value: true },\n ];\n\n const onStart = () => {\n const params: any = {};\n if (mode) {\n params.kiosk = mode;\n }\n if (autoFit) {\n params.autofitpanels = true;\n }\n locationService.push(urlUtil.renderUrl(`/playlists/play/${playlist.uid}`, params));\n };\n\n return (\n <Modal isOpen={true} icon=\"play\" title=\"Start playlist\" onDismiss={onDismiss}>\n <FieldSet>\n <Field label=\"Mode\">\n <RadioButtonGroup value={mode} options={modes} onChange={setMode} />\n </Field>\n <Checkbox\n label=\"Autofit\"\n description=\"Panel heights will be adjusted to fit screen size\"\n name=\"autofix\"\n value={autoFit}\n onChange={(e) => setAutofit(e.currentTarget.checked)}\n />\n </FieldSet>\n <Modal.ButtonRow>\n <Button variant=\"primary\" onClick={onStart}>\n Start {playlist.name}\n </Button>\n </Modal.ButtonRow>\n </Modal>\n );\n};\n","import React, { FC, useState } from 'react';\nimport { connect, MapStateToProps } from 'react-redux';\nimport { useDebounce } from 'react-use';\n\nimport { NavModel } from '@grafana/data';\nimport { ConfirmModal } from '@grafana/ui';\nimport Page from 'app/core/components/Page/Page';\nimport PageActionBar from 'app/core/components/PageActionBar/PageActionBar';\nimport { getNavModel } from 'app/core/selectors/navModel';\nimport { contextSrv } from 'app/core/services/context_srv';\nimport { StoreState } from 'app/types';\n\nimport EmptyListCTA from '../../core/components/EmptyListCTA/EmptyListCTA';\nimport { GrafanaRouteComponentProps } from '../../core/navigation/types';\n\nimport { EmptyQueryListBanner } from './EmptyQueryListBanner';\nimport { PlaylistPageList } from './PlaylistPageList';\nimport { StartModal } from './StartModal';\nimport { deletePlaylist, getAllPlaylist } from './api';\nimport { PlaylistDTO } from './types';\n\ninterface ConnectedProps {\n navModel: NavModel;\n}\nexport interface PlaylistPageProps extends ConnectedProps, GrafanaRouteComponentProps {}\n\nexport const PlaylistPage: FC<PlaylistPageProps> = ({ navModel }) => {\n const [searchQuery, setSearchQuery] = useState('');\n const [debouncedSearchQuery, setDebouncedSearchQuery] = useState(searchQuery);\n const [hasFetched, setHasFetched] = useState(false);\n const [startPlaylist, setStartPlaylist] = useState<PlaylistDTO | undefined>();\n const [playlistToDelete, setPlaylistToDelete] = useState<PlaylistDTO | undefined>();\n const [forcePlaylistsFetch, setForcePlaylistsFetch] = useState(0);\n\n const [playlists, setPlaylists] = useState<PlaylistDTO[]>([]);\n\n useDebounce(\n async () => {\n const playlists = await getAllPlaylist(searchQuery);\n if (!hasFetched) {\n setHasFetched(true);\n }\n setPlaylists(playlists);\n setDebouncedSearchQuery(searchQuery);\n },\n 350,\n [forcePlaylistsFetch, searchQuery]\n );\n\n const hasPlaylists = playlists && playlists.length > 0;\n const onDismissDelete = () => setPlaylistToDelete(undefined);\n const onDeletePlaylist = () => {\n if (!playlistToDelete) {\n return;\n }\n deletePlaylist(playlistToDelete.uid).finally(() => {\n setForcePlaylistsFetch(forcePlaylistsFetch + 1);\n setPlaylistToDelete(undefined);\n });\n };\n\n const emptyListBanner = (\n <EmptyListCTA\n title=\"There are no playlists created yet\"\n buttonIcon=\"plus\"\n buttonLink=\"playlists/new\"\n buttonTitle=\"Create Playlist\"\n buttonDisabled={!contextSrv.isEditor}\n proTip=\"You can use playlists to cycle dashboards on TVs without user control\"\n proTipLink=\"http://docs.grafana.org/reference/playlist/\"\n proTipLinkTitle=\"Learn more\"\n proTipTarget=\"_blank\"\n />\n );\n\n const showSearch = playlists.length > 0 || searchQuery.length > 0 || debouncedSearchQuery.length > 0;\n\n return (\n <Page navModel={navModel}>\n <Page.Contents isLoading={!hasFetched}>\n {showSearch && (\n <PageActionBar\n searchQuery={searchQuery}\n linkButton={contextSrv.isEditor && { title: 'New playlist', href: '/playlists/new' }}\n setSearchQuery={setSearchQuery}\n />\n )}\n\n {!hasPlaylists && searchQuery ? (\n <EmptyQueryListBanner />\n ) : (\n <PlaylistPageList\n playlists={playlists}\n setStartPlaylist={setStartPlaylist}\n setPlaylistToDelete={setPlaylistToDelete}\n />\n )}\n {!showSearch && emptyListBanner}\n {playlistToDelete && (\n <ConfirmModal\n title={playlistToDelete.name}\n confirmText=\"Delete\"\n body={`Are you sure you want to delete '${playlistToDelete.name}' playlist?`}\n onConfirm={onDeletePlaylist}\n isOpen={Boolean(playlistToDelete)}\n onDismiss={onDismissDelete}\n />\n )}\n {startPlaylist && <StartModal playlist={startPlaylist} onDismiss={() => setStartPlaylist(undefined)} />}\n </Page.Contents>\n </Page>\n );\n};\n\nconst mapStateToProps: MapStateToProps<ConnectedProps, {}, StoreState> = (state: StoreState) => ({\n navModel: getNavModel(state.navIndex, 'playlists'),\n});\n\nexport default connect(mapStateToProps)(PlaylistPage);\n","import { getBackendSrv } from '@grafana/runtime';\n\nimport { notifyApp } from '../../core/actions';\nimport { createErrorNotification, createSuccessNotification } from '../../core/copy/appNotification';\nimport { dispatch } from '../../store/store';\n\nimport { Playlist, PlaylistDTO } from './types';\n\nexport async function createPlaylist(playlist: Playlist) {\n await withErrorHandling(() => getBackendSrv().post('/api/playlists', playlist));\n}\n\nexport async function updatePlaylist(uid: string, playlist: Playlist) {\n await withErrorHandling(() => getBackendSrv().put(`/api/playlists/${uid}`, playlist));\n}\n\nexport async function deletePlaylist(uid: string) {\n await withErrorHandling(() => getBackendSrv().delete(`/api/playlists/${uid}`), 'Playlist deleted');\n}\n\nexport async function getPlaylist(uid: string): Promise<Playlist> {\n const result: Playlist = await getBackendSrv().get(`/api/playlists/${uid}`);\n return result;\n}\n\nexport async function getAllPlaylist(query: string): Promise<PlaylistDTO[]> {\n const result: PlaylistDTO[] = await getBackendSrv().get('/api/playlists/', { query });\n return result;\n}\n\nasync function withErrorHandling(apiCall: () => Promise<void>, message = 'Playlist saved') {\n try {\n await apiCall();\n dispatch(notifyApp(createSuccessNotification(message)));\n } catch (e) {\n dispatch(notifyApp(createErrorNotification('Unable to save playlist', e)));\n }\n}\n"],"names":["PageActionBar","PureComponent","render","searchQuery","linkButton","setSearchQuery","target","placeholder","this","props","linkProps","href","disabled","className","FilterInput","value","onChange","LinkButton","title","EmptyQueryListBanner","styles","useStyles2","getStyles","noResult","theme","css","spacing","colors","secondary","main","ShareModal","playlistUid","onDismiss","mode","setMode","useState","autoFit","setAutofit","params","kiosk","autofitpanels","shareUrl","urlUtil","buildBaseUrl","Modal","isOpen","FieldSet","Field","label","RadioButtonGroup","options","Checkbox","description","name","e","currentTarget","checked","Input","id","readOnly","addonAfter","ClipboardButton","variant","getText","onClipboardCopy","appEvents","AppEvents","Icon","PlaylistPageList","playlists","setStartPlaylist","setPlaylistToDelete","list","map","playlist","listItem","Card","ModalsController","showModal","hideModal","DashNavButton","tooltip","icon","iconSize","onClick","uid","Button","contextSrv","display","listStyle","StartModal","locationService","PlaylistPage","navModel","debouncedSearchQuery","setDebouncedSearchQuery","hasFetched","setHasFetched","startPlaylist","playlistToDelete","forcePlaylistsFetch","setForcePlaylistsFetch","setPlaylists","useDebounce","async","getAllPlaylist","hasPlaylists","length","emptyListBanner","EmptyListCTA","buttonIcon","buttonLink","buttonTitle","buttonDisabled","proTip","proTipLink","proTipLinkTitle","proTipTarget","showSearch","Page","isLoading","ConfirmModal","confirmText","body","onConfirm","deletePlaylist","finally","undefined","Boolean","connect","state","getNavModel","navIndex","createPlaylist","withErrorHandling","getBackendSrv","post","updatePlaylist","put","delete","getPlaylist","get","query","apiCall","message","dispatch","notifyApp","createSuccessNotification","createErrorNotification"],"sourceRoot":""}