Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

yincongcyincong
Copy link

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

@CLAassistant
Copy link

CLAassistant commented Dec 17, 2024

CLA assistant check
All committers have signed the CLA.

Comment on lines 328 to 339
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();
Copy link
Member

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)

Copy link
Author

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.

@yincongcyincong
Copy link
Author

@torkelo bro ,could you please take a look this pr, i followed you comment and modified code, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Variables: auto add empty string variable
3 participants