Display key value instead of value in Template Control Dropdown for map type tempvar
parent
cab3e5ab7f
commit
8038a25d36
|
@ -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)}
|
||||||
|
|
Loading…
Reference in New Issue