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BY,GAA0D,IAA5B/C,EAA4B,uDAAlB,iBACvE,UACQ+C,KACNC,EAAAA,EAAAA,KAASC,EAAAA,EAAAA,KAAUC,EAAAA,EAAAA,IAA0BlD,KAC7C,MAAOmD,IACPH,EAAAA,EAAAA,KAASC,EAAAA,EAAAA,KAAUG,EAAAA,EAAAA,IAAwB,0BAA2BD,Q,gDC/BnE,SAAS7B,EAAkB7E,GAChC,MAAO,CACLkF,YAAajF,EAAAA,GAAI;;;;MAKjBgF,WAAYhF,EAAAA,GAAI;;uBAEGD,EAAME,QAAQ;oECR9B,SAAS6E,EAAY6B,GAC1B,MAAO9F,EAAU+F,IAAerF,EAAAA,EAAAA,UAAmB,CAAEnB,MAAO,GAAIU,SAAU,KAAM5B,KAAM,GAAI2G,IAAK,MACxFhB,EAASgC,IAActF,EAAAA,EAAAA,WAAkB,GAehD,OAbAuF,EAAAA,EAAAA,YAAU,KACa5B,WACnB,IAAKyB,EAEH,YADAE,GAAW,GAGb,MAAMjE,QAAaqD,EAAAA,EAAAA,IAAYU,GAC/BC,EAAYhE,GACZiE,GAAW,IAEbE,KACC,CAACJ,IAEG,CAAE9F,SAAAA,EAAUgE,QAAAA","sources":["webpack://grafana/./public/app/features/playlist/PlaylistTableRow.tsx","webpack://grafana/./public/app/features/playlist/PlaylistTableRows.tsx","webpack://grafana/./public/app/features/playlist/PlaylistTable.tsx","webpack://grafana/./public/app/features/playlist/PlaylistForm.tsx","webpack://grafana/./public/app/features/playlist/usePlaylistItems.tsx","webpack://grafana/./public/app/features/playlist/PlaylistNewPage.tsx","webpack://grafana/./public/app/features/playlist/api.ts","webpack://grafana/./public/app/features/playlist/styles.ts","webpack://grafana/./public/app/features/playlist/usePlaylist.tsx"],"sourcesContent":["import { css, cx } from '@emotion/css';\nimport React, { FC, MouseEvent } from 'react';\n\nimport { GrafanaTheme } from '@grafana/data';\nimport { selectors } from '@grafana/e2e-selectors';\nimport { Icon, IconButton, useStyles } from '@grafana/ui';\n\nimport { TagBadge } from '../../core/components/TagFilter/TagBadge';\n\nimport { PlaylistItem } from './types';\n\ninterface PlaylistTableRowProps {\n first: boolean;\n last: boolean;\n item: PlaylistItem;\n onMoveUp: (item: PlaylistItem) => void;\n onMoveDown: (item: PlaylistItem) => void;\n onDelete: (item: PlaylistItem) => void;\n}\n\nexport const PlaylistTableRow: FC = ({ item, onDelete, onMoveDown, onMoveUp, first, last }) => {\n const styles = useStyles(getStyles);\n const onDeleteClick = (event: MouseEvent) => {\n event.preventDefault();\n onDelete(item);\n };\n const onMoveDownClick = (event: MouseEvent) => {\n event.preventDefault();\n onMoveDown(item);\n };\n const onMoveUpClick = (event: MouseEvent) => {\n event.preventDefault();\n onMoveUp(item);\n };\n\n return (\n \n {item.type === 'dashboard_by_id' ? (\n \n \n {item.title}\n \n ) : null}\n {item.type === 'dashboard_by_tag' ? (\n \n \n \n \n ) : null}\n \n {!first ? (\n \n ) : null}\n {!last ? (\n \n ) : null}\n \n \n \n );\n};\n\nfunction getStyles(theme: GrafanaTheme) {\n return {\n td: css`\n label: td;\n line-height: 28px;\n max-width: 335px;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n `,\n item: css`\n label: item;\n span {\n margin-left: ${theme.spacing.xs};\n }\n `,\n settings: css`\n label: settings;\n text-align: right;\n `,\n };\n}\n","import React, { FC } from 'react';\n\nimport { PlaylistTableRow } from './PlaylistTableRow';\nimport { PlaylistItem } from './types';\n\ninterface PlaylistTableRowsProps {\n items: PlaylistItem[];\n onMoveUp: (item: PlaylistItem) => void;\n onMoveDown: (item: PlaylistItem) => void;\n onDelete: (item: PlaylistItem) => void;\n}\n\nexport const PlaylistTableRows: FC = ({ items, onMoveUp, onMoveDown, onDelete }) => {\n if (items.length === 0) {\n return (\n \n \n Playlist is empty. Add dashboards below.\n \n \n );\n }\n\n return (\n <>\n {items.map((item, index) => {\n const first = index === 0;\n const last = index === items.length - 1;\n return (\n \n );\n })}\n \n );\n};\n","import React, { FC } from 'react';\n\nimport { PlaylistTableRows } from './PlaylistTableRows';\nimport { PlaylistItem } from './types';\n\ninterface PlaylistTableProps {\n items: PlaylistItem[];\n onMoveUp: (item: PlaylistItem) => void;\n onMoveDown: (item: PlaylistItem) => void;\n onDelete: (item: PlaylistItem) => void;\n}\n\nexport const PlaylistTable: FC = ({ items, onMoveUp, onMoveDown, onDelete }) => {\n return (\n
\n

Dashboards

\n\n \n \n \n \n
\n
\n );\n};\n","import React, { FC } from 'react';\n\nimport { selectors } from '@grafana/e2e-selectors';\nimport { config } from '@grafana/runtime';\nimport { Button, Field, Form, HorizontalGroup, Input, LinkButton } from '@grafana/ui';\nimport { DashboardPickerByID } from 'app/core/components/editors/DashboardPickerByID';\n\nimport { TagFilter } from '../../core/components/TagFilter/TagFilter';\nimport { SearchSrv } from '../../core/services/search_srv';\n\nimport { PlaylistTable } from './PlaylistTable';\nimport { Playlist } from './types';\nimport { usePlaylistItems } from './usePlaylistItems';\n\ninterface PlaylistFormProps {\n onSubmit: (playlist: Playlist) => void;\n playlist: Playlist;\n}\n\nconst searchSrv = new SearchSrv();\n\nexport const PlaylistForm: FC = ({ onSubmit, playlist }) => {\n const { name, interval, items: propItems } = playlist;\n const { items, addById, addByTag, deleteItem, moveDown, moveUp } = usePlaylistItems(propItems);\n return (\n <>\n
onSubmit({ ...list, items })} validateOn={'onBlur'}>\n {({ register, errors }) => {\n const isDisabled = items.length === 0 || Object.keys(errors).length > 0;\n return (\n <>\n \n \n \n \n \n \n\n \n\n
\n

Add dashboards

\n\n \n \n \n\n \n \n \n
\n\n \n \n \n Cancel\n \n \n \n );\n }}\n \n \n );\n};\n","import { useCallback, useState } from 'react';\n\nimport { DashboardPickerItem } from 'app/core/components/editors/DashboardPickerByID';\n\nimport { PlaylistItem } from './types';\n\nexport function usePlaylistItems(playlistItems?: PlaylistItem[]) {\n const [items, setItems] = useState(playlistItems ?? []);\n\n const addById = useCallback(\n (dashboard?: DashboardPickerItem) => {\n if (!dashboard || items.find((item) => item.id === dashboard.id)) {\n return;\n }\n\n const newItem: PlaylistItem = {\n id: dashboard.id,\n title: dashboard.label as string,\n type: 'dashboard_by_id',\n value: dashboard.id.toString(10),\n order: items.length + 1,\n };\n setItems([...items, newItem]);\n },\n [items]\n );\n\n const addByTag = useCallback(\n (tags: string[]) => {\n const tag = tags[0];\n if (!tag || items.find((item) => item.value === tag)) {\n return;\n }\n\n const newItem: PlaylistItem = {\n title: tag,\n type: 'dashboard_by_tag',\n value: tag,\n order: items.length + 1,\n };\n setItems([...items, newItem]);\n },\n [items]\n );\n\n const movePlaylistItem = useCallback(\n (item: PlaylistItem, offset: number) => {\n const newItems = [...items];\n const currentPosition = newItems.indexOf(item);\n const newPosition = currentPosition + offset;\n\n if (newPosition >= 0 && newPosition < newItems.length) {\n newItems.splice(currentPosition, 1);\n newItems.splice(newPosition, 0, item);\n }\n setItems(newItems);\n },\n [items]\n );\n\n const moveUp = useCallback(\n (item: PlaylistItem) => {\n movePlaylistItem(item, -1);\n },\n [movePlaylistItem]\n );\n\n const moveDown = useCallback(\n (item: PlaylistItem) => {\n movePlaylistItem(item, 1);\n },\n [movePlaylistItem]\n );\n\n const deleteItem = useCallback(\n (item: PlaylistItem) => {\n setItems(items.filter((i) => i !== item));\n },\n [items]\n );\n\n return { items, addById, addByTag, deleteItem, moveDown, moveUp };\n}\n","import React, { FC } from 'react';\nimport { connect, MapStateToProps } from 'react-redux';\n\nimport { NavModel } from '@grafana/data';\nimport { locationService } from '@grafana/runtime';\nimport { useStyles2 } from '@grafana/ui';\nimport Page from 'app/core/components/Page/Page';\nimport { getNavModel } from 'app/core/selectors/navModel';\nimport { StoreState } from 'app/types';\n\nimport { GrafanaRouteComponentProps } from '../../core/navigation/types';\n\nimport { PlaylistForm } from './PlaylistForm';\nimport { createPlaylist } from './api';\nimport { getPlaylistStyles } from './styles';\nimport { Playlist } from './types';\nimport { usePlaylist } from './usePlaylist';\n\ninterface ConnectedProps {\n navModel: NavModel;\n}\n\ninterface Props extends ConnectedProps, GrafanaRouteComponentProps {}\n\nexport const PlaylistNewPage: FC = ({ navModel }) => {\n const styles = useStyles2(getPlaylistStyles);\n const { playlist, loading } = usePlaylist();\n const onSubmit = async (playlist: Playlist) => {\n await createPlaylist(playlist);\n locationService.push('/playlists');\n };\n\n return (\n \n \n

New Playlist

\n\n

\n A playlist rotates through a pre-selected list of dashboards. A playlist can be a great way to build\n situational awareness, or just show off your metrics to your team or visitors.\n

\n\n \n
\n
\n );\n};\n\nconst mapStateToProps: MapStateToProps = (state: StoreState) => ({\n navModel: getNavModel(state.navIndex, 'playlists'),\n});\n\nexport default connect(mapStateToProps)(PlaylistNewPage);\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 {\n const result: Playlist = await getBackendSrv().get(`/api/playlists/${uid}`);\n return result;\n}\n\nexport async function getAllPlaylist(query: string): Promise {\n const result: PlaylistDTO[] = await getBackendSrv().get('/api/playlists/', { query });\n return result;\n}\n\nasync function withErrorHandling(apiCall: () => Promise, 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","import { css } from '@emotion/css';\n\nimport { GrafanaTheme2 } from '@grafana/data';\n\nexport function getPlaylistStyles(theme: GrafanaTheme2) {\n return {\n description: css`\n label: description;\n width: 555px;\n margin-bottom: 20px;\n `,\n subHeading: css`\n label: sub-heading;\n margin-bottom: ${theme.spacing(2)};\n `,\n };\n}\n","import { useEffect, useState } from 'react';\n\nimport { getPlaylist } from './api';\nimport { Playlist } from './types';\n\nexport function usePlaylist(playlistUid?: string) {\n const [playlist, setPlaylist] = useState({ items: [], interval: '5m', name: '', uid: '' });\n const [loading, setLoading] = useState(true);\n\n useEffect(() => {\n const initPlaylist = async () => {\n if (!playlistUid) {\n setLoading(false);\n return;\n }\n const list = await getPlaylist(playlistUid);\n setPlaylist(list);\n setLoading(false);\n };\n initPlaylist();\n }, [playlistUid]);\n\n return { playlist, loading };\n}\n"],"names":["PlaylistTableRow","item","onDelete","onMoveDown","onMoveUp","first","last","styles","useStyles","getStyles","selectors","type","className","cx","td","Icon","name","title","TagBadge","label","removeIcon","count","id","settings","IconButton","size","onClick","event","preventDefault","theme","css","spacing","xs","PlaylistTableRows","items","length","map","index","PlaylistTable","searchSrv","SearchSrv","PlaylistForm","onSubmit","playlist","interval","propItems","addById","addByTag","deleteItem","moveDown","moveUp","playlistItems","setItems","useState","useCallback","dashboard","find","newItem","value","toString","order","tags","tag","movePlaylistItem","offset","newItems","currentPosition","indexOf","newPosition","splice","filter","i","usePlaylistItems","Form","list","validateOn","register","errors","isDisabled","Object","keys","Field","invalid","error","message","Input","required","placeholder","defaultValue","DashboardPickerByID","onChange","isClearable","TagFilter","hideValues","tagOptions","getDashboardTags","HorizontalGroup","Button","variant","disabled","LinkButton","href","config","PlaylistNewPage","navModel","useStyles2","getPlaylistStyles","loading","usePlaylist","isLoading","subHeading","description","async","createPlaylist","locationService","connect","state","getNavModel","navIndex","withErrorHandling","getBackendSrv","post","updatePlaylist","uid","put","deletePlaylist","delete","getPlaylist","get","getAllPlaylist","query","apiCall","dispatch","notifyApp","createSuccessNotification","e","createErrorNotification","playlistUid","setPlaylist","setLoading","useEffect","initPlaylist"],"sourceRoot":""}