Allow a source override on SourceIndicator
Use SourceIndicator server icon with tooltip on cells Signed-off-by: Jared Scheib <jared.scheib@gmail.com>pull/10616/head
parent
37c3a1948e
commit
9fda754042
|
@ -1,6 +1,7 @@
|
||||||
import React, {PropTypes} from 'react'
|
import React, {PropTypes} from 'react'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
|
|
||||||
|
import SourceIndicator from 'shared/components/SourceIndicator'
|
||||||
import CustomTimeIndicator from 'shared/components/CustomTimeIndicator'
|
import CustomTimeIndicator from 'shared/components/CustomTimeIndicator'
|
||||||
|
|
||||||
import {NEW_DEFAULT_DASHBOARD_CELL} from 'src/dashboards/constants/index'
|
import {NEW_DEFAULT_DASHBOARD_CELL} from 'src/dashboards/constants/index'
|
||||||
|
@ -30,9 +31,7 @@ const LayoutCellHeader = (
|
||||||
{cellName}
|
{cellName}
|
||||||
<div className="dash-graph--custom-indicators">
|
<div className="dash-graph--custom-indicators">
|
||||||
{querySource && querySource.id !== defaultSource.id
|
{querySource && querySource.id !== defaultSource.id
|
||||||
? <span className="custom-indicator">
|
? <SourceIndicator sourceOverride={querySource} />
|
||||||
{querySource.name}
|
|
||||||
</span>
|
|
||||||
: null}
|
: null}
|
||||||
{queries && queries.length
|
{queries && queries.length
|
||||||
? <CustomTimeIndicator queries={queries} />
|
? <CustomTimeIndicator queries={queries} />
|
||||||
|
|
|
@ -1,11 +1,19 @@
|
||||||
import React, {PropTypes} from 'react'
|
import React, {PropTypes} from 'react'
|
||||||
|
import _ from 'lodash'
|
||||||
import ReactTooltip from 'react-tooltip'
|
import ReactTooltip from 'react-tooltip'
|
||||||
|
|
||||||
const SourceIndicator = (_, {source: {name: sourceName, url}}) => {
|
const SourceIndicator = ({sourceOverride}, {source: {name, url}}) => {
|
||||||
|
const sourceName = _.get(sourceOverride, 'name', null)
|
||||||
|
? sourceOverride.name
|
||||||
|
: name
|
||||||
|
const sourceUrl = _.get(sourceOverride, 'url', null)
|
||||||
|
? sourceOverride.url
|
||||||
|
: url
|
||||||
|
|
||||||
if (!sourceName) {
|
if (!sourceName) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
const sourceNameTooltip = `Connected to <code>${sourceName} @ ${url}</code>`
|
const sourceNameTooltip = `Connected to <code>${sourceName} @ ${sourceUrl}</code>`
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="source-indicator"
|
className="source-indicator"
|
||||||
|
@ -27,6 +35,13 @@ const SourceIndicator = (_, {source: {name: sourceName, url}}) => {
|
||||||
|
|
||||||
const {shape, string} = PropTypes
|
const {shape, string} = PropTypes
|
||||||
|
|
||||||
|
SourceIndicator.propTypes = {
|
||||||
|
sourceOverride: shape({
|
||||||
|
name: string,
|
||||||
|
url: string,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
|
||||||
SourceIndicator.contextTypes = {
|
SourceIndicator.contextTypes = {
|
||||||
source: shape({
|
source: shape({
|
||||||
name: string,
|
name: string,
|
||||||
|
|
Loading…
Reference in New Issue