From 6171aceafefc77689537cdc03aebaec0f00a0c0d Mon Sep 17 00:00:00 2001 From: Alirie Gray Date: Thu, 14 Feb 2019 16:02:16 -0800 Subject: [PATCH] Create a generic dropdown for creating/importing a resource --- .../dashboard_index/DashboardsIndex.tsx | 9 +- ui/src/organizations/components/Variables.tsx | 89 ++++++++++--------- .../components/AddResourceDropdown.tsx} | 47 ++++++---- 3 files changed, 80 insertions(+), 65 deletions(-) rename ui/src/{dashboards/components/dashboard_index/CreateDashboardDropdown.tsx => shared/components/AddResourceDropdown.tsx} (50%) diff --git a/ui/src/dashboards/components/dashboard_index/DashboardsIndex.tsx b/ui/src/dashboards/components/dashboard_index/DashboardsIndex.tsx index 5d751dde55e..770e229930e 100644 --- a/ui/src/dashboards/components/dashboard_index/DashboardsIndex.tsx +++ b/ui/src/dashboards/components/dashboard_index/DashboardsIndex.tsx @@ -9,7 +9,7 @@ import DashboardsIndexContents from 'src/dashboards/components/dashboard_index/D import {Page} from 'src/pageLayout' import SearchWidget from 'src/shared/components/search_widget/SearchWidget' import {OverlayTechnology} from 'src/clockface' -import CreateDashboardDropdown from 'src/dashboards/components/dashboard_index/CreateDashboardDropdown' +import AddResourceDropdown from 'src/shared/components/AddResourceDropdown' import ImportOverlay from 'src/shared/components/ImportOverlay' import ExportOverlay from 'src/shared/components/ExportOverlay' import EditLabelsOverlay from 'src/shared/components/EditLabelsOverlay' @@ -119,9 +119,10 @@ class DashboardIndex extends PureComponent { placeholderText="Filter dashboards by name..." onSearch={this.filterDashboards} /> - diff --git a/ui/src/organizations/components/Variables.tsx b/ui/src/organizations/components/Variables.tsx index f20b33cecb1..71de8975fc3 100644 --- a/ui/src/organizations/components/Variables.tsx +++ b/ui/src/organizations/components/Variables.tsx @@ -9,6 +9,7 @@ import {Button, ComponentSize} from '@influxdata/clockface' import VariableList from 'src/organizations/components/VariableList' import {Input, OverlayTechnology, EmptyState} from 'src/clockface' import FilterList from 'src/shared/components/Filter' +import AddResourceDropdown from 'src/shared/components/AddResourceDropdown' // Actions import * as NotificationsActions from 'src/types/actions/notifications' @@ -35,21 +36,50 @@ interface Props { interface State { searchTerm: string - overlayState: OverlayState + createOverlayState: OverlayState + importOverlayState: OverlayState } export default class Variables extends PureComponent { + private get emptyState(): JSX.Element { + const {orgName} = this.props + const {searchTerm} = this.state + + if (_.isEmpty(searchTerm)) { + return ( + + +