mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
* [Security Solutions] Removes tech debt of exporting all from linter rule for cases plugin in the common section (#120310) See: https://github.com/elastic/kibana/issues/110903, https://github.com/elastic/kibana/issues/120234 This removes as many top level API `export *` spots from: * `cases` plugin within the common section as we can. This reduces the number of metrics and warning about undocumented functions and reduces the page load size from `cases/common/index.ts`. Look at the metrics from the build below and you will see drop off numbers across the board for required API documentation to the page load size. In the file `cases/common/index.ts` I now put the advice of: ``` // Careful of exporting anything from this file as any file(s) you export here will cause your page bundle size to increase. // If you're using functions/types/etc... internally or within integration tests it's best to import directly from their paths // than expose the functions/types/etc... here. You should _only_ expose functions/types/etc... that need to be shared with other plugins here. // When you do have to add things here you might want to consider creating a package such as kbn-cases-constants to share with // other plugins instead as packages are easier to break down and you do not have to carry the cost of extra plugin weight on // first download since the other plugins/areas of your code can directly pull from the package in their async imports. // For example, constants below could eventually be in a "kbn-cases-constants" instead. // See: https://docs.elastic.dev/kibana-dev-docs/key-concepts/platform-intro#public-plugin-api ``` Some of those that are exposed such as `throwErrors` might actually be small simple mistakes as `security_solution` is using it but it has a "copy" of the same utility within just its server section rather than within its common section. That can be done in a different cleanup PR and cases team can decide what to do moving forward with their API before or post 8.0.0 release. For the metric increasing of: | id | [before]( |
||
---|---|---|
.. | ||
mock | ||
sub_cases | ||
check_env_variables.sh | ||
delete_cases.sh | ||
delete_comment.sh | ||
find_cases.sh | ||
find_cases_by_filter.sh | ||
find_cases_sort.sh | ||
generate_case_and_comment_data.sh | ||
generate_case_data.sh | ||
get_case.sh | ||
get_case_comments.sh | ||
get_comment.sh | ||
get_reporters.sh | ||
get_status.sh | ||
get_tags.sh | ||
hard_reset.sh | ||
patch_cases.sh | ||
patch_comment.sh | ||
post_case.sh | ||
post_comment.sh | ||
README.md |
README.md for developers working on the Case API on how to get started using the CURL scripts in the scripts folder.
The scripts rely on CURL and jq:
Install curl and jq
brew update
brew install curl
brew install jq
Open $HOME/.zshrc
or ${HOME}.bashrc
depending on your SHELL output from echo $SHELL
and add these environment variables:
export ELASTICSEARCH_USERNAME=${user}
export ELASTICSEARCH_PASSWORD=${password}
export ELASTICSEARCH_URL=https://${ip}:9200
export KIBANA_URL=http://localhost:5601
export TASK_MANAGER_INDEX=.kibana-task-manager-${your user id}
export KIBANA_INDEX=.kibana-${your user id}
source $HOME/.zshrc
or ${HOME}.bashrc
to ensure variables are set:
source ~/.zshrc
Restart Kibana and ensure that you are using --no-base-path
as changing the base path is a feature but will
get in the way of the CURL scripts written as is.
Go to the scripts folder cd kibana/x-pack/plugins/cases/server/scripts
and run:
./hard_reset.sh
which will:
- Delete any existing cases you have
- Delete any existing comments you have
- Posts the sample case from
./mock/case/post_case.json
- Posts the sample comment from
./mock/comment/post_comment.json
to the new case
Now you can run
./find_cases.sh
You should see the new case created like so:
{
"page": 1,
"per_page": 20,
"total": 1,
"cases": [
{
"id": "2e0afbc0-658c-11ea-85c8-1d8f792cbc08",
"version": "Wzc5NSwxXQ==",
"comments": [],
"comment_ids": [
"2ecec0f0-658c-11ea-85c8-1d8f792cbc08"
],
"created_at": "2020-03-14T00:38:53.004Z",
"created_by": {
"full_name": "Steph Milovic",
"username": "smilovic"
},
"updated_at": null,
"updated_by": null,
"description": "This looks not so good",
"title": "Bad meanie defacing data",
"status": "open",
"tags": [
"defacement"
]
}
],
"count_open_cases": 1,
"count_closed_cases": 1
}