# Backport
This will backport the following commits from `main` to `8.13`:
- [[Profiling] Fix default value of profiling settings
(#177716)](https://github.com/elastic/kibana/pull/177716)
<!--- Backport version: 9.4.3 -->
### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)
<!--BACKPORT [{"author":{"name":"Elena
Stoeva","email":"59341489+ElenaStoeva@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-03-06T17:30:35Z","message":"[Profiling]
Fix default value of profiling settings (#177716)\n\nFixes:
https://github.com/elastic/kibana/issues/177592\r\n\r\n##
Summary\r\n\r\nThis PR changes the format of the default value for
the\r\n`profilingAWSCostDiscountRate` and the
`profilingAzureCostDiscountRate`\r\nsettings from a string to a number.
Since the `type` property is not\r\nspecified in these setting
definitions, the advanced settings components\r\nassume the type of the
settings based on the type of the default value.\r\nSince the default
value was specified as a string, the settings\r\ncomponents used a text
field instead of a number field and so the\r\nvalidation did not work
properly.\r\n\r\nThe PR also adds a small fix to the settings
normalization function\r\nwhere, if the provided `value` property in the
setting definition is\r\n`0`, it is incorrectly translated to
`undefined` rather than `0`.\r\n\r\n**How to test:**\r\n1. Go to Stack
Management -> Advanced settings\r\n2. Verify that the initial value in
the fields is `0` rather than empty\r\nfields.\r\n3. Set an invalid
value (<0 or >100) for these two settings and verify\r\nthat an error
message is displayed.\r\n\r\n\r\n<img width=\"1335\" alt=\"Screenshot
2024-02-23 at 13 53
04\"\r\nsrc=\"9b6f191b-ae17-4f46-9814-2a325d083fd6\">\r\n\r\n<img
width=\"1335\" alt=\"Screenshot 2024-02-23 at 13 41
14\"\r\nsrc=\"95fe4685-4504-44c9-b312-9530dcbe1b2b\">\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by:
Cauê Marcondes
<55978943+cauemarcondes@users.noreply.github.com>","sha":"16bcae8833a7e156372d63b8d3440691a86a9a5f","branchLabelMapping":{"^v8.14.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Deployment
Management","release_note:skip","Feature:uiSettings","backport:prev-minor","Team:obs-ux-management","v8.13.0","v8.14.0"],"title":"[Profiling]
Fix default value of profiling
settings","number":177716,"url":"https://github.com/elastic/kibana/pull/177716","mergeCommit":{"message":"[Profiling]
Fix default value of profiling settings (#177716)\n\nFixes:
https://github.com/elastic/kibana/issues/177592\r\n\r\n##
Summary\r\n\r\nThis PR changes the format of the default value for
the\r\n`profilingAWSCostDiscountRate` and the
`profilingAzureCostDiscountRate`\r\nsettings from a string to a number.
Since the `type` property is not\r\nspecified in these setting
definitions, the advanced settings components\r\nassume the type of the
settings based on the type of the default value.\r\nSince the default
value was specified as a string, the settings\r\ncomponents used a text
field instead of a number field and so the\r\nvalidation did not work
properly.\r\n\r\nThe PR also adds a small fix to the settings
normalization function\r\nwhere, if the provided `value` property in the
setting definition is\r\n`0`, it is incorrectly translated to
`undefined` rather than `0`.\r\n\r\n**How to test:**\r\n1. Go to Stack
Management -> Advanced settings\r\n2. Verify that the initial value in
the fields is `0` rather than empty\r\nfields.\r\n3. Set an invalid
value (<0 or >100) for these two settings and verify\r\nthat an error
message is displayed.\r\n\r\n\r\n<img width=\"1335\" alt=\"Screenshot
2024-02-23 at 13 53
04\"\r\nsrc=\"9b6f191b-ae17-4f46-9814-2a325d083fd6\">\r\n\r\n<img
width=\"1335\" alt=\"Screenshot 2024-02-23 at 13 41
14\"\r\nsrc=\"95fe4685-4504-44c9-b312-9530dcbe1b2b\">\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by:
Cauê Marcondes
<55978943+cauemarcondes@users.noreply.github.com>","sha":"16bcae8833a7e156372d63b8d3440691a86a9a5f"}},"sourceBranch":"main","suggestedTargetBranches":["8.13"],"targetPullRequestStates":[{"branch":"8.13","label":"v8.13.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.14.0","branchLabelMappingKey":"^v8.14.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/177716","number":177716,"mergeCommit":{"message":"[Profiling]
Fix default value of profiling settings (#177716)\n\nFixes:
https://github.com/elastic/kibana/issues/177592\r\n\r\n##
Summary\r\n\r\nThis PR changes the format of the default value for
the\r\n`profilingAWSCostDiscountRate` and the
`profilingAzureCostDiscountRate`\r\nsettings from a string to a number.
Since the `type` property is not\r\nspecified in these setting
definitions, the advanced settings components\r\nassume the type of the
settings based on the type of the default value.\r\nSince the default
value was specified as a string, the settings\r\ncomponents used a text
field instead of a number field and so the\r\nvalidation did not work
properly.\r\n\r\nThe PR also adds a small fix to the settings
normalization function\r\nwhere, if the provided `value` property in the
setting definition is\r\n`0`, it is incorrectly translated to
`undefined` rather than `0`.\r\n\r\n**How to test:**\r\n1. Go to Stack
Management -> Advanced settings\r\n2. Verify that the initial value in
the fields is `0` rather than empty\r\nfields.\r\n3. Set an invalid
value (<0 or >100) for these two settings and verify\r\nthat an error
message is displayed.\r\n\r\n\r\n<img width=\"1335\" alt=\"Screenshot
2024-02-23 at 13 53
04\"\r\nsrc=\"9b6f191b-ae17-4f46-9814-2a325d083fd6\">\r\n\r\n<img
width=\"1335\" alt=\"Screenshot 2024-02-23 at 13 41
14\"\r\nsrc=\"95fe4685-4504-44c9-b312-9530dcbe1b2b\">\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by:
Cauê Marcondes
<55978943+cauemarcondes@users.noreply.github.com>","sha":"16bcae8833a7e156372d63b8d3440691a86a9a5f"}}]}]
BACKPORT-->
---------
Co-authored-by: Elena Stoeva <59341489+ElenaStoeva@users.noreply.github.com>
This folder contains packages that are intended for use in Kibana and Kibana
plugins.
tl;dr:
Don't publish to npm registry
Always use the @kbn namespace
Always set "private": true in package.json
Using these packages
We no longer publish these packages to the npm registry. Now, instead of
specifying a version when including these packages, we rely on yarn workspaces,
which sets up a symlink to the package.
For example if you want to use the @kbn/i18n package in Kibana itself, you
can specify the dependency like this:
"@kbn/i18n": "1.0.0"
However, if you want to use this from a Kibana plugin, you need to use a link:
dependency and account for the relative location of the Kibana repo, so it would
instead be:
Currently there is only one tool being used in order to test packages which is Jest. Below we will explain how it should be done.
Jest
A package should follow the pattern of having .test.js files as siblings of the source code files, and these run by Jest.
A package using the .test.js naming convention will have those tests automatically picked up by Jest and run by the unit test runner, currently mapped to the Kibana test script in the root package.json.
yarn test runs all unit tests.
yarn jest runs all Jest tests in Kibana.
In order for the plugin or package to use Jest, a jest.config.js file must be present in it's root. However, there are safeguards for this in CI should a test file be added without a corresponding config file.
Each package can also specify its own test script in the package's package.json, for cases where you'd prefer to run the tests from the local package directory.