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

[ResponseOps][Cases] Allow users to create case using templates #187138

Merged
merged 21 commits into from
Jul 2, 2024

Commits on May 14, 2024

  1. [Cases] Case templates configure api (#183231)

    ## Summary
    
    Implements #181573
    
    This PR allows users to create, update and delete templates using
    existing configure API
    
    Flaky test runner:
    https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5846
    
    Test via Postman: 
    - Can create the template 
    - Can update the template
    - Can delete the template
    - Maximum 10 templates allowed
    - Template cases fields are validated as per the existing schema
    - custom fields within templates are validated as per the existing
    schema
    
    ### Checklist
    
    - [x] [Unit or functional
    tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
    were updated or added to match the most common scenarios
    - [x] [Flaky Test
    Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
    used on any tests changed
    js-jankisalvi committed May 14, 2024
    Configuration menu
    Copy the full SHA
    b8293c3 View commit details
    Browse the repository at this point in the history

Commits on May 16, 2024

  1. Configuration menu
    Copy the full SHA
    6322b02 View commit details
    Browse the repository at this point in the history

Commits on May 21, 2024

  1. Configuration menu
    Copy the full SHA
    5eb9e81 View commit details
    Browse the repository at this point in the history
  2. [ResponseOps][Cases] Add tags to template in configure api (#183743)

    ## Summary
    
    Parent issue: #181309
    
    This PR adds optional tags field in template. 
    
    ### Checklist
    
    - [x] [Unit or functional
    tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
    were updated or added to match the most common scenarios
    
    ---------
    
    Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
    js-jankisalvi and kibanamachine committed May 21, 2024
    Configuration menu
    Copy the full SHA
    b7fec99 View commit details
    Browse the repository at this point in the history

Commits on May 30, 2024

  1. Configuration menu
    Copy the full SHA
    46d2bd8 View commit details
    Browse the repository at this point in the history

Commits on Jun 7, 2024

  1. Configuration menu
    Copy the full SHA
    5986cc9 View commit details
    Browse the repository at this point in the history
  2. [ResponseOps][Cases] Allow users to create templates (#184104)

    ## Summary
    Merging into feature branch.
    
    Implements create functionality
    #181864
    
    Add template from case settings page.
    
    <img width="1728" alt="image"
    src="https://github.com/elastic/kibana/assets/117571355/4a4565e5-3ca8-4a7c-a5c9-0ac15b72a0d0">
    
    **How to test**
    - Go to Cases > Settings
    - Click on add templates
    - Fill the form
    - Save
    
    Scenarios: 
    - Create template with different custom fields
    - Create template  with connector
    
    Flaky test runner
    [here](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/6213)
    
    ### Checklist
    
    Delete any items that are not applicable to this PR.
    
    - [x] Any text added follows [EUI's writing
    guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
    sentence case text and includes [i18n
    support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
    - [ ]
    [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
    was added for features that require explanation or tutorials
    - [x] [Unit or functional
    tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
    were updated or added to match the most common scenarios
    - [x] [Flaky Test
    Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
    used on any tests changed
    - [x] Any UI touched in this PR is usable by keyboard only (learn more
    about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
    - [x] This renders correctly on smaller devices using a responsive
    layout. (You can test this [in your
    browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
    
    ---------
    
    Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
    js-jankisalvi and kibanamachine committed Jun 7, 2024
    Configuration menu
    Copy the full SHA
    c511009 View commit details
    Browse the repository at this point in the history

Commits on Jun 10, 2024

  1. Configuration menu
    Copy the full SHA
    7a86857 View commit details
    Browse the repository at this point in the history

Commits on Jun 17, 2024

  1. Configuration menu
    Copy the full SHA
    f975c33 View commit details
    Browse the repository at this point in the history

Commits on Jun 19, 2024

  1. [ResponseOps][Cases] Allow users to edit or delete template (#185877)

    ## Summary
    
    Merging into feature branch.
    
    Implements edit and delete functionality
    #181864
    
    Edit or delete template from case settings page.
    
    
    https://github.com/elastic/kibana/assets/117571355/f6fd45fa-c1eb-45ab-8936-02c764dbadc4
    
    
    **How to test**
    - Go to Cases > Settings
    - Add a template
    - Click on edit template icon
    - Update the fields
    - Click save
    
    - Click on delete template icon
    - Click on confirm modal
    - Click save
    
    **Scenarios:** 
    - Edit template with different custom fields
    - Edit template  with connector
    - Delete template
    
    **Flaky Test**
    [here](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/6331)
    
    ### Checklist
    
    - [x] [Unit or functional
    tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
    were updated or added to match the most common scenarios
    - [x] [Flaky Test
    Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
    used on any tests changed
    - [x] Any UI touched in this PR is usable by keyboard only (learn more
    about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
    
    ---------
    
    Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
    js-jankisalvi and kibanamachine committed Jun 19, 2024
    Configuration menu
    Copy the full SHA
    c3b0759 View commit details
    Browse the repository at this point in the history

Commits on Jun 20, 2024

  1. Configuration menu
    Copy the full SHA
    7e92302 View commit details
    Browse the repository at this point in the history

Commits on Jun 25, 2024

  1. [ResponseOps][Cases] Remove configuration's deleted custom field from…

    … template's custom fields via API (#186608)
    
    ## Summary
    
    Parent issue: #181309
    
    This PR takes care of below scenario:
    When user deletes custom fields via API, those custom fields need to be
    removed from templates as well.
    
    [Flaky test
    runner](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/6377)
    
    **Testing**
    
    - create a custom field in settings page
    - create a template with that custom field in settings page
    - Get configuration via postman for same owner, should have customFields
    and templates attribute similar to this:
    ```
    [
        {
            "customFields": [
                {
                      "key": "new_custom_field_key_2",
                      "type": "toggle",
                      "label": "My toggle custom field",
                      "required": "false",
                }
             ],
            "templates": [
                {
                    "key": "template_key_1",
                    "name": "Template with CF1",
                    "caseFields": {
                         "customFields": [
                            {
                                "key": "new_custom_field_key_2",
                                "type": "toggle",
                                "value": false
                            }
                        ]
                    },
                
                },
            ],
            "version": ${config_version}
            "id": ${config_id}
        }
    ]
    ```
    - run the patch request via postman to delete the custom field, e.g:
    ```
    path: https://localhost:5601/api/cases/configure/config_id
    
    body: 
    {
            "customFields": [],
            "templates": [
                {
                    "key": "new_template_key_1",
                    "name": "New template",
                    "caseFields": {
                        "customFields": [
                            {
                                "key": "new_custom_field_key_2",
                                "type": "toggle",
                                "value": true
                            }
                        ]
                    }
                }
            ],
        "version": "test-version"
    }
    ```
    - validate that custom field is removed from templates as well
    
    ### Checklist
    - [x] [Unit or functional
    tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
    were updated or added to match the most common scenarios
    
    ---------
    
    Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
    js-jankisalvi and kibanamachine committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    822d78c View commit details
    Browse the repository at this point in the history

Commits on Jun 27, 2024

  1. Configuration menu
    Copy the full SHA
    eee6564 View commit details
    Browse the repository at this point in the history

Commits on Jun 28, 2024

  1. Configuration menu
    Copy the full SHA
    9369d61 View commit details
    Browse the repository at this point in the history
  2. [Cases] Use templates when creating a case (#185880)

    ## Summary
    
    This PR adds the ability for users to select a template when creating a
    case. When a user selects a template the cases form fields are populated
    with the values from the template. The solution picker in the flyout
    changed as:
    
    <img width="1281" alt="Screenshot 2024-06-20 at 1 26 14 PM"
    src="https://github.com/elastic/kibana/assets/7871006/30859c61-94e7-4f0a-97d1-cb081bd72c36">
    
    ## Bug fixes
    
    1. Changing the solution through the solution picket in the flyout would
    not respect the connector's configuration.
    2. Bug where the lazy loading of connectors' icons was causing the
    flyout to open and close when you selected a solution picket. This bug
    appeared when the first bug was fixed.
    
    ## Testing
    
    1. Go to all solutions and create cases setting all fields (including
    all fields of all supported connectors) without using templates. Verify
    that everything is working as expected.
    2. Go to all solutions, create different templates on each solution, and
    verify that when creating a case you can use templates and everything is
    working as expected.
    3. Go to the alerts table of o11y and security and attach alerts to a
    new case. Verify that in the flyout the templates are working as
    expected.
    4. Go to ML and try to attach an ML visualization to a new case. Verify
    that the solution picker is working as expected and it resets the form
    when changing solutions.
    
    Fixes: #181871
    Depends on: #185877
    
    ### Checklist
    
    Delete any items that are not applicable to this PR.
    
    - [x] [Unit or functional
    tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
    were updated or added to match the most common scenarios
    - [ ] [Flaky Test
    Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
    used on any tests changed
    
    ### For maintainers
    
    - [x] This was checked for breaking API changes and was [labeled
    appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
    
    ---------
    
    Co-authored-by: Janki Salvi <117571355+js-jankisalvi@users.noreply.github.com>
    Co-authored-by: adcoelho <antonio.coelho@elastic.co>
    3 people committed Jun 28, 2024
    Configuration menu
    Copy the full SHA
    97dadf7 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9a8b629 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    db94f1c View commit details
    Browse the repository at this point in the history

Commits on Jul 1, 2024

  1. Configuration menu
    Copy the full SHA
    4632959 View commit details
    Browse the repository at this point in the history
  2. Fix tags style

    js-jankisalvi committed Jul 1, 2024
    Configuration menu
    Copy the full SHA
    6319822 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    daebf7f View commit details
    Browse the repository at this point in the history

Commits on Jul 2, 2024

  1. Configuration menu
    Copy the full SHA
    5c9a65b View commit details
    Browse the repository at this point in the history