-
Notifications
You must be signed in to change notification settings - Fork 22
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
fix: boolean values are converted to 1 and 0 only on configuration page #1347
base: develop
Are you sure you want to change the base?
fix: boolean values are converted to 1 and 0 only on configuration page #1347
Conversation
|
|
getValueMapTruthyFalse(currentFieldValue) === getValueMapTruthyFalse(mod.fieldValue) && | ||
// values are directly equal or they are equal after type convertion | ||
(currentFieldValue === mod.fieldValue || | ||
// here convertion is needed as splunk keeps boolsih data on cponfiguration page as 1 and 0 |
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.
// here convertion is needed as splunk keeps boolsih data on cponfiguration page as 1 and 0 | |
// here conversion is needed as splunk keeps boolish data on configuration page as 1 and 0 |
// here type convertion is needed as splunk keeps all data as string | ||
// and users can put numbers or booleans inside global config | ||
getValueMapTruthyFalse(currentFieldValue) === getValueMapTruthyFalse(mod.fieldValue) && | ||
// values are directly equal or they are equal after type convertion |
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.
// values are directly equal or they are equal after type convertion | |
// values are directly equal or they are equal after type conversion |
export function getValueMapTruthyFalse<T>(value: string | T) { | ||
return (isFalse(value) && '0') || (isTrue(value) && '1') || value; | ||
export function getValueMapTruthyFalse<T>(value: string | T, currentPageName?: StandardPages) { | ||
return ( |
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.
can it be simplified like that?
if (currentPageName === 'configuration') {
return (isFalse(value) && '0') || (isTrue(value) && '1') || value;
}
return value;
any clue why is that? Previously we thought we cannot influence on that, but Splunk itself is not aware of our UCC pages, does it? |
It looks like there is a different backend handling those configuration and inputs forms, inputs is handled by
where
and configuration by
where
|
Issue number:
https://splunk.atlassian.net/browse/ADDON-73559
Summary
1 justification:
Looks like splunk is using backend values mapping only on forms used on configuration page.
By backend values mapping i mean converting
values like ‘TRUE’, ‘T’, ‘Y’, ‘YES’, true will be converted into ‘1’
values like ‘FALSE’, ‘F’, ‘N’, ‘NO’, ‘NONE’, false will be converted into ‘0’
values on inputs page are saved and retrieved correctly, so I assume that on any different page than configuration that mapping is not needed.
Thats why for function used to map values
getValueMapTruthyFalse
there is added another parametercurrentPageName
. If the page is configuration values are mappend into 1 and 0 if not values are left as they are.Changes
On Input page values are shared to backend correctly, only on configuration page they are mapped.
User experience
Users can use mapped till now words on inputs page.
Checklist
If your change doesn't seem to apply, please leave them unchecked.