Display key value instead of value in Template Control Dropdown for map type tempvar

pull/3817/head
ebb-tide 2018-07-03 10:59:27 -07:00
parent cab3e5ab7f
commit 8038a25d36
1 changed files with 7 additions and 5 deletions

View File

@ -6,7 +6,7 @@ import TemplateVariableEditor from 'src/tempVars/components/TemplateVariableEdit
import {calculateDropdownWidth} from 'src/dashboards/constants/templateControlBar' import {calculateDropdownWidth} from 'src/dashboards/constants/templateControlBar'
import Authorized, {isUserAuthorized, EDITOR_ROLE} from 'src/auth/Authorized' import Authorized, {isUserAuthorized, EDITOR_ROLE} from 'src/auth/Authorized'
import {Template, Source} from 'src/types' import {Template, Source, TemplateValueType} from 'src/types'
interface Props { interface Props {
template: Template template: Template
@ -43,10 +43,12 @@ class TemplateControlDropdown extends PureComponent<Props, State> {
} = this.props } = this.props
const {isEditing} = this.state const {isEditing} = this.state
const dropdownItems = template.values.map(value => ({ const dropdownItems = template.values.map(value => {
...value, if (value.type === TemplateValueType.Map) {
text: value.value, return {...value, text: value.key}
})) }
return {...value, text: value.value}
})
const dropdownStyle = template.values.length const dropdownStyle = template.values.length
? {minWidth: calculateDropdownWidth(template.values)} ? {minWidth: calculateDropdownWidth(template.values)}