|
|
|
|
@ -4,11 +4,11 @@ import { useAsync } from 'react-use'; |
|
|
|
|
|
|
|
|
|
import { locationUtil, NavModelItem } from '@grafana/data'; |
|
|
|
|
import { config, locationService } from '@grafana/runtime'; |
|
|
|
|
import { Badge, Link, Tooltip } from '@grafana/ui'; |
|
|
|
|
import { Page } from 'app/core/components/Page/Page'; |
|
|
|
|
import { GrafanaRouteComponentProps } from 'app/core/navigation/types'; |
|
|
|
|
import NewBrowseDashboardsPage from 'app/features/browse-dashboards/BrowseDashboardsPage'; |
|
|
|
|
import { FolderDTO } from 'app/types'; |
|
|
|
|
|
|
|
|
|
import { GrafanaRouteComponentProps } from '../../../core/navigation/types'; |
|
|
|
|
import { loadFolderPage } from '../loaders'; |
|
|
|
|
|
|
|
|
|
import ManageDashboardsNew from './ManageDashboardsNew'; |
|
|
|
|
@ -20,7 +20,16 @@ export interface DashboardListPageRouteParams { |
|
|
|
|
|
|
|
|
|
interface Props extends GrafanaRouteComponentProps<DashboardListPageRouteParams> {} |
|
|
|
|
|
|
|
|
|
export const DashboardListPage = memo(({ match, location }: Props) => { |
|
|
|
|
export const DashboardListPageFeatureToggle = memo((props: Props) => { |
|
|
|
|
if (config.featureToggles.nestedFolders) { |
|
|
|
|
return <NewBrowseDashboardsPage {...props} />; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return <DashboardListPage {...props} />; |
|
|
|
|
}); |
|
|
|
|
DashboardListPageFeatureToggle.displayName = 'DashboardListPageFeatureToggle'; |
|
|
|
|
|
|
|
|
|
const DashboardListPage = memo(({ match, location }: Props) => { |
|
|
|
|
const { loading, value } = useAsync<() => Promise<{ folder?: FolderDTO; pageNav?: NavModelItem }>>(() => { |
|
|
|
|
const uid = match.params.uid; |
|
|
|
|
const url = location.pathname; |
|
|
|
|
@ -41,21 +50,7 @@ export const DashboardListPage = memo(({ match, location }: Props) => { |
|
|
|
|
}, [match.params.uid]); |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<Page |
|
|
|
|
navId="dashboards/browse" |
|
|
|
|
pageNav={value?.pageNav} |
|
|
|
|
actions={ |
|
|
|
|
config.featureToggles.nestedFolders && ( |
|
|
|
|
<Link href="/nested-dashboards"> |
|
|
|
|
<Tooltip content="New Browse Dashboards for nested folders is still under development and may be missing features"> |
|
|
|
|
<span> |
|
|
|
|
<Badge icon="folder" color="blue" text="Preview new Browse Dashboards" /> |
|
|
|
|
</span> |
|
|
|
|
</Tooltip> |
|
|
|
|
</Link> |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
> |
|
|
|
|
<Page navId="dashboards/browse" pageNav={value?.pageNav}> |
|
|
|
|
<Page.Contents |
|
|
|
|
isLoading={loading} |
|
|
|
|
className={css` |
|
|
|
|
@ -72,4 +67,4 @@ export const DashboardListPage = memo(({ match, location }: Props) => { |
|
|
|
|
|
|
|
|
|
DashboardListPage.displayName = 'DashboardListPage'; |
|
|
|
|
|
|
|
|
|
export default DashboardListPage; |
|
|
|
|
export default DashboardListPageFeatureToggle; |
|
|
|
|
|