Skip to content

[Cases] Case templates configure api#183231

Merged
js-jankisalvi merged 11 commits intoelastic:feat/case_templatesfrom
js-jankisalvi:case-templates-configure-api
May 14, 2024
Merged

[Cases] Case templates configure api#183231
js-jankisalvi merged 11 commits intoelastic:feat/case_templatesfrom
js-jankisalvi:case-templates-configure-api

Conversation

@js-jankisalvi
Copy link
Contributor

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

@js-jankisalvi js-jankisalvi added release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// Feature:Cases Cases feature v8.15.0 labels May 13, 2024
@js-jankisalvi js-jankisalvi self-assigned this May 13, 2024
@js-jankisalvi js-jankisalvi requested review from a team as code owners May 13, 2024 08:02
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops-cases (Feature:Cases)

@js-jankisalvi
Copy link
Contributor Author

@elasticmachine merge upstream

@js-jankisalvi js-jankisalvi force-pushed the case-templates-configure-api branch from 7c18ad1 to e3775af Compare May 13, 2024 10:23
Copy link
Member

@cnasikas cnasikas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great PR! Great code coverage!!

);
}

licensingService.notifyUsage(LICENSING_CASE_ASSIGNMENT_FEATURE);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to first check if there are assignees before notifying? Also, should we notify once outside the loop? Example:

const hasAssigneesInTemplate = templates.some((template) => Boolean(template.caseFields?.assignees && template.caseFields?.assignees.length > 0))

if (hasAssigneesInTemplate && !hasPlatinumLicenseOrGreater) {
        throw Boom.forbidden(
          'In order to assign users to cases, you must be subscribed to an Elastic Platinum license'
        );
      }

if (hasAssigneesInTemplate) {
 licensingService.notifyUsage(LICENSING_CASE_ASSIGNMENT_FEATURE);
}

templates.forEach((template, index) => { /// the validation }

Copy link
Contributor Author

@js-jankisalvi js-jankisalvi May 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in d9bcdbc

No need of forEach loop anymore

@kibana-ci
Copy link

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
cases 479.3KB 479.3KB +37.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
cases 150.9KB 151.7KB +822.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @js-jankisalvi

@js-jankisalvi js-jankisalvi merged commit b8293c3 into elastic:feat/case_templates May 14, 2024
@js-jankisalvi js-jankisalvi deleted the case-templates-configure-api branch May 14, 2024 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature:Cases Cases feature release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// v8.15.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants