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,OACE,SAACmB,EAAA,EAAD,CAAMxB,SAAQ,UAAEjC,MAAAA,OAAF,EAAEA,EAAOqD,oBAAT,QAAyBpB,EAAvC,SACGyB,QAAQrE,EAAAA,OAAAA,eAAAA,mBACP,SAACoE,EAAA,WAAD,CACEE,UAAWvB,EACXzC,UAAW0B,EAAAA,GAAI;;;;YAFjB,UAQE,SAAC,EAAD,CAAqBnD,OAAQ8B,MAAAA,OAAF,EAAEA,EAAO9B,YAGtC,SAACuF,EAAA,WAAD,CAAeE,UAAWvB,EAA1B,UACE,SAACwB,EAAA,EAAD,CAAkB1F,OAAQ8B,MAAAA,OAAF,EAAEA,EAAO9B,gBAO3C6D,EAAkBZ,YAAc,oBAEhC,MAMA,GAAe0C,EAAAA,EAAAA,UAN4EC,IAClF,CACL7B,UAAU8B,EAAAA,EAAAA,GAAYD,EAAME,SAAU,wBAI1C,CAAwCjC","sources":["webpack://grafana/./public/app/features/search/components/ManageDashboardsNew.tsx","webpack://grafana/./public/app/features/search/components/DashboardListPage.tsx","webpack://grafana/./public/app/features/search/loaders.ts"],"sourcesContent":["import { css, cx } from '@emotion/css';\nimport React, { useState } from 'react';\nimport { useDebounce, useLocalStorage } from 'react-use';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { config } from '@grafana/runtime';\nimport { Input, useStyles2, Spinner } from '@grafana/ui';\nimport { contextSrv } from 'app/core/services/context_srv';\nimport { FolderDTO } from 'app/types';\n\nimport { SEARCH_PANELS_LOCAL_STORAGE_KEY } from '../constants';\nimport { useKeyNavigationListener } from '../hooks/useSearchKeyboardSelection';\nimport { useSearchQuery } from '../hooks/useSearchQuery';\nimport { SearchView } from '../page/components/SearchView';\n\nimport { DashboardActions } from './DashboardActions';\n\nexport interface Props {\n folder?: FolderDTO;\n}\n\nexport const ManageDashboardsNew = React.memo(({ folder }: Props) => {\n const styles = useStyles2(getStyles);\n // since we don't use \"query\" from use search... it is not actually loaded from the URL!\n const { query, onQueryChange } = useSearchQuery({});\n const { onKeyDown, keyboardEvents } = useKeyNavigationListener();\n\n // TODO: we need to refactor DashboardActions to use folder.uid instead\n const folderId = folder?.id;\n // const folderUid = folder?.uid;\n const canSave = folder?.canSave;\n const hasEditPermissionInFolders = folder ? canSave : contextSrv.hasEditPermissionInFolders;\n\n let [includePanels, setIncludePanels] = useLocalStorage<boolean>(SEARCH_PANELS_LOCAL_STORAGE_KEY, true);\n if (!config.featureToggles.panelTitleSearch) {\n includePanels = false;\n }\n\n const { isEditor } = contextSrv;\n\n const [inputValue, setInputValue] = useState(query.query ?? '');\n const onSearchQueryChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n e.preventDefault();\n setInputValue(e.currentTarget.value);\n };\n useDebounce(() => onQueryChange(inputValue), 200, [inputValue]);\n\n return (\n <>\n <div className={cx(styles.actionBar, 'page-action-bar')}>\n <div className={cx(styles.inputWrapper, 'gf-form gf-form--grow m-r-2')}>\n <Input\n value={inputValue}\n onChange={onSearchQueryChange}\n onKeyDown={onKeyDown}\n autoFocus\n spellCheck={false}\n placeholder={includePanels ? 'Search for dashboards and panels' : 'Search for dashboards'}\n className={styles.searchInput}\n suffix={false ? <Spinner /> : null}\n />\n </div>\n <DashboardActions isEditor={isEditor} canEdit={hasEditPermissionInFolders || canSave} folderId={folderId} />\n </div>\n\n <SearchView\n showManage={isEditor || hasEditPermissionInFolders || canSave}\n folderDTO={folder}\n queryText={query.query}\n onQueryTextChange={(newQueryText) => {\n setInputValue(newQueryText);\n }}\n hidePseudoFolders={true}\n includePanels={includePanels!}\n setIncludePanels={setIncludePanels}\n keyboardEvents={keyboardEvents}\n />\n </>\n );\n});\n\nManageDashboardsNew.displayName = 'ManageDashboardsNew';\n\nexport default ManageDashboardsNew;\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n actionBar: css`\n ${theme.breakpoints.down('sm')} {\n flex-wrap: wrap;\n }\n `,\n inputWrapper: css`\n ${theme.breakpoints.down('sm')} {\n margin-right: 0 !important;\n }\n `,\n searchInput: css`\n margin-bottom: 6px;\n min-height: ${theme.spacing(4)};\n `,\n unsupported: css`\n padding: 10px;\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n font-size: 18px;\n `,\n noResults: css`\n padding: ${theme.v1.spacing.md};\n background: ${theme.v1.colors.bg2};\n font-style: italic;\n margin-top: ${theme.v1.spacing.md};\n `,\n});\n","import { css } from '@emotion/css';\nimport React, { FC, memo } from 'react';\nimport { connect, MapStateToProps } from 'react-redux';\nimport { useAsync } from 'react-use';\n\nimport { NavModel, locationUtil } from '@grafana/data';\nimport { config, locationService } from '@grafana/runtime';\nimport Page from 'app/core/components/Page/Page';\nimport { getNavModel } from 'app/core/selectors/navModel';\nimport { FolderDTO, StoreState } from 'app/types';\n\nimport { GrafanaRouteComponentProps } from '../../../core/navigation/types';\nimport { loadFolderPage } from '../loaders';\n\nimport ManageDashboards from './ManageDashboards';\nimport ManageDashboardsNew from './ManageDashboardsNew';\n\nexport interface DashboardListPageRouteParams {\n uid?: string;\n slug?: string;\n}\n\ninterface DashboardListPageConnectedProps {\n navModel: NavModel;\n}\ninterface Props extends GrafanaRouteComponentProps<DashboardListPageRouteParams>, DashboardListPageConnectedProps {}\n\nexport const DashboardListPage: FC<Props> = memo(({ navModel, match, location }) => {\n const { loading, value } = useAsync<() => Promise<{ folder?: FolderDTO; pageNavModel: NavModel }>>(() => {\n const uid = match.params.uid;\n const url = location.pathname;\n if (!uid || !url.startsWith('/dashboards')) {\n return Promise.resolve({ pageNavModel: navModel });\n }\n\n return loadFolderPage(uid!).then(({ folder, folderNav }) => {\n const path = locationUtil.stripBaseFromUrl(folder.url);\n\n if (path !== location.pathname) {\n locationService.push(path);\n }\n\n return { folder, pageNavModel: { ...navModel, main: folderNav } };\n });\n }, [match.params.uid]);\n\n return (\n <Page navModel={value?.pageNavModel ?? navModel}>\n {Boolean(config.featureToggles.panelTitleSearch) ? (\n <Page.Contents\n isLoading={loading}\n className={css`\n display: flex;\n flex-direction: column;\n overflow: hidden;\n `}\n >\n <ManageDashboardsNew folder={value?.folder} />\n </Page.Contents>\n ) : (\n <Page.Contents isLoading={loading}>\n <ManageDashboards folder={value?.folder} />\n </Page.Contents>\n )}\n </Page>\n );\n});\n\nDashboardListPage.displayName = 'DashboardListPage';\n\nconst mapStateToProps: MapStateToProps<DashboardListPageConnectedProps, {}, StoreState> = (state) => {\n return {\n navModel: getNavModel(state.navIndex, 'manage-dashboards'),\n };\n};\n\nexport default connect(mapStateToProps)(DashboardListPage);\n","import { backendSrv } from 'app/core/services/backend_srv';\n\nimport { buildNavModel } from '../folders/state/navModel';\n\nexport const loadFolderPage = (uid: string) => {\n return backendSrv.getFolderByUid(uid).then((folder) => {\n const navModel = buildNavModel(folder);\n navModel.children![0].active = true;\n\n return { folder, folderNav: navModel };\n });\n};\n"],"names":["ManageDashboardsNew","React","folder","styles","useStyles2","getStyles","query","onQueryChange","useSearchQuery","onKeyDown","keyboardEvents","useKeyNavigationListener","folderId","id","canSave","hasEditPermissionInFolders","contextSrv","includePanels","setIncludePanels","useLocalStorage","SEARCH_PANELS_LOCAL_STORAGE_KEY","config","isEditor","inputValue","setInputValue","useState","useDebounce","className","cx","actionBar","inputWrapper","Input","value","onChange","e","preventDefault","currentTarget","autoFocus","spellCheck","placeholder","searchInput","suffix","DashboardActions","canEdit","SearchView","showManage","folderDTO","queryText","onQueryTextChange","newQueryText","hidePseudoFolders","displayName","theme","css","breakpoints","down","spacing","unsupported","noResults","v1","md","colors","bg2","DashboardListPage","memo","navModel","match","location","loading","useAsync","uid","params","url","pathname","startsWith","backendSrv","then","buildNavModel","children","active","folderNav","loadFolderPage","path","locationUtil","locationService","pageNavModel","main","Promise","resolve","Page","Boolean","isLoading","ManageDashboards","connect","state","getNavModel","navIndex"],"sourceRoot":""}
|