From 0688ce577d41f2af9b85b7e7a91aa3c9226c8dd9 Mon Sep 17 00:00:00 2001 From: Alirie Gray Date: Tue, 12 Mar 2019 11:10:46 -0700 Subject: [PATCH] feat(dashboards): add variable control bar for selecting values Co-Authored-By: Alex Paxton --- CHANGELOG.md | 3 +- .../components/empty_state/EmptyState.tsx | 9 +- .../dashboards/components/DashboardHeader.tsx | 13 ++ .../dashboards/components/DashboardPage.tsx | 16 ++- .../variablesControlBar/VariableDropdown.scss | 34 +++++ .../variablesControlBar/VariableDropdown.tsx | 70 ++++++++++ .../VariablesControlBar.scss | 35 +++++ .../VariablesControlBar.tsx | 129 ++++++++++++++++++ ui/src/variables/actions/index.ts | 21 ++- ui/src/variables/reducers/index.ts | 7 + 10 files changed, 331 insertions(+), 6 deletions(-) create mode 100644 ui/src/dashboards/components/variablesControlBar/VariableDropdown.scss create mode 100644 ui/src/dashboards/components/variablesControlBar/VariableDropdown.tsx create mode 100644 ui/src/dashboards/components/variablesControlBar/VariablesControlBar.scss create mode 100644 ui/src/dashboards/components/variablesControlBar/VariablesControlBar.tsx diff --git a/CHANGELOG.md b/CHANGELOG.md index 73a7d43f1ee..68b9de41162 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,13 @@ ## v2.0.0-alpha.6 [unreleased] ### Features + 1. [12496](https://github.com/influxdata/influxdb/pull/12496): Add ability to import a dashboard 1. [12524](https://github.com/influxdata/influxdb/pull/12524): Add ability to import a dashboard from org view 1. [12531](https://github.com/influxdata/influxdb/pull/12531): Add ability to export a dashboard and a task 1. [12615](https://github.com/influxdata/influxdb/pull/12615): Add `run` subcommand to influxd binary. This is also the default when no subcommand is specified. - 1. [12523](https://github.com/influxdata/influxdb/pull/12523): Add ability to save a query as a variable from the Data Explorer. +1. [12655](https://github.com/influxdata/influxdb/pull/12655): Add a variable control bar to dashboards to select values for variables. ### Bug Fixes diff --git a/ui/src/clockface/components/empty_state/EmptyState.tsx b/ui/src/clockface/components/empty_state/EmptyState.tsx index 2597a273f7e..5fba76b0db7 100644 --- a/ui/src/clockface/components/empty_state/EmptyState.tsx +++ b/ui/src/clockface/components/empty_state/EmptyState.tsx @@ -16,6 +16,7 @@ import {ErrorHandling} from 'src/shared/decorators/errors' interface PassedProps { children: JSX.Element | JSX.Element[] + className?: string } interface DefaultProps { @@ -36,12 +37,14 @@ class EmptyState extends Component { public static SubText = EmptyStateSubText public render() { - const {children, size, testID} = this.props + const {children, size, testID, className} = this.props - const className = `empty-state empty-state--${size}` + const classname = className + ? `empty-state empty-state--${size} ${className}` + : `empty-state empty-state--${size}` return ( -
+
{children}
) diff --git a/ui/src/dashboards/components/DashboardHeader.tsx b/ui/src/dashboards/components/DashboardHeader.tsx index 25c1ca0eaba..96e73ccb09a 100644 --- a/ui/src/dashboards/components/DashboardHeader.tsx +++ b/ui/src/dashboards/components/DashboardHeader.tsx @@ -42,6 +42,8 @@ interface OwnProps { showTemplateControlBar: boolean zoomedTimeRange: QueriesModels.TimeRange onRenameDashboard: (name: string) => Promise + toggleVariablesControlBar: () => void + isShowingVariablesControlBar: boolean isHidden: boolean } @@ -69,6 +71,8 @@ class DashboardHeader extends Component { zoomedTimeRange: {upper: zoomedUpper, lower: zoomedLower}, isHidden, onAddNote, + toggleVariablesControlBar, + isShowingVariablesControlBar, } = this.props return ( @@ -94,6 +98,15 @@ class DashboardHeader extends Component { lower: zoomedLower || lower, }} /> +