-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Variables: current value #1005
base: main
Are you sure you want to change the base?
Variables: current value #1005
Conversation
public getOptionsForSelect(): VariableValueOption[] { | ||
public getOptionsForSelectWithoutCurrentValue(): VariableValueOption[] { | ||
let options = this.state.options; | ||
|
||
if (this.state.includeAll) { | ||
options = [{ value: ALL_VARIABLE_VALUE, label: ALL_VARIABLE_TEXT }, ...options]; | ||
} | ||
|
||
return options; | ||
} | ||
|
||
public getOptionsForSelect(): VariableValueOption[] { | ||
let options = this.getOptionsForSelectWithoutCurrentValue(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks simper to just have an optional param for getOptionsForSelect(includeCurrentValue?: boolean)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for your review. i modified getOptionsForSelect
and add one parameter. please take a look.
@torkelo bro ,could you please take a look this pr, i followed you comment and modified code, thanks |
fixes grafana/grafana#98005
i think the variable edit page don't need current value to show. so i add a function
getOptionsForSelectWithoutCurrentValue
.after this pr merged. i would change this line (https://github.com/grafana/grafana/blob/main/public/app/features/dashboard-scene/settings/variables/VariableEditorForm.tsx#L116) to use
getOptionsForSelectWithoutCurrentValue