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

[Cases] Split remaining cases types #155444

Conversation

jonathan-buttner
Copy link
Contributor

This PR separates the http API io-ts types from the types that are used in the cases service layer to interact with the saved object client. This PR is splits up the remaining types within the service layer (configure and connector mappings).

Issue: #153726

@jonathan-buttner jonathan-buttner added release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Feature:Cases Cases feature v8.8.0 labels Apr 20, 2023
@jonathan-buttner jonathan-buttner changed the base branch from main to cases-split-types-feature April 20, 2023 20:02
@jonathan-buttner jonathan-buttner marked this pull request as ready for review April 21, 2023 21:14
@jonathan-buttner jonathan-buttner requested a review from a team as a code owner April 21, 2023 21:14
@elasticmachine
Copy link
Contributor

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

@elasticmachine
Copy link
Contributor

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

* 2.0.
*/

export type ConnectorFieldsPersistedAttributes = Array<{
Copy link
Member

Choose a reason for hiding this comment

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

nit: What do you think about CasePersistedConnectorFields?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How do you feel about dropping the Case part? I think it's kind of redundant.

Copy link
Member

@cnasikas cnasikas Apr 26, 2023

Choose a reason for hiding this comment

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

What about ConnectorPersistedFields? I am fine with all options 🙂. Same for CasePersistedConnector.

value: unknown;
}>;

export interface ConnectorPersistedAttributes {
Copy link
Member

Choose a reason for hiding this comment

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

nit: What do you think about CasePersistedConnector?

@@ -41,7 +41,7 @@ export const createMappings = async (
refresh,
});

return theMapping.attributes.mappings;
return theMapping.attributes.mappings as ConnectorMappingsAttributes[];
Copy link
Member

Choose a reason for hiding this comment

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

I think that if we define the return type of the functions and cast in ConnectorMappingsService we can avoid the casting here. Same for the all functions of the configure folder.

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.

LGMT! Should we remove the ESCaseConnector, ESConnectorFields, and ESCasesConfigureAttributes types?

@adcoelho
Copy link
Contributor

@cnasikas

Should we remove the ESCaseConnector, ESConnectorFields, and ESCasesConfigureAttributes types?

I was thinking the same when looking at this PR, at least wrt ESCaseConnector and ESConnectorFields. But it seems they are still used in a couple of places.

ESCaseConnector in x-pack/plugins/cases/server/services/cases/types.ts, and ESConnectorFields in x-pack/plugins/cases/server/saved_object_types/migrations/cases.ts and in the ESCaseConnector definition.

As for ESCasesConfigureAttributes isn't that already done?

@jonathan-buttner
Copy link
Contributor Author

LGMT! Should we remove the ESCaseConnector, ESConnectorFields, and ESCasesConfigureAttributes types?

Yeah I can't find references to these anymore. Although I don't remember removing them 😆 are they still there?

@kibana-ci
Copy link
Collaborator

kibana-ci commented Apr 26, 2023

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] Cases Cypress Tests on Security Solution / Cases Creates a new case with timeline and opens the timeline
  • [job] [logs] FTR Configs #15 / Ingest Pipelines Accessibility Create Pipeline Wizard
  • [job] [logs] FTR Configs #15 / Ingest Pipelines Accessibility Create Pipeline Wizard
  • [job] [logs] FTR Configs #35 / Ingest pipelines app Ingest Pipelines create pipeline "after each" hook for "Creates a pipeline"
  • [job] [logs] FTR Configs #35 / Ingest pipelines app Ingest Pipelines create pipeline "after each" hook for "Creates a pipeline"
  • [job] [logs] FTR Configs #35 / Ingest pipelines app Ingest Pipelines create pipeline Creates a pipeline
  • [job] [logs] FTR Configs #35 / Ingest pipelines app Ingest Pipelines create pipeline Creates a pipeline
  • [job] [logs] FTR Configs #35 / Ingest pipelines app Ingest Pipelines Loads the app
  • [job] [logs] FTR Configs #35 / Ingest pipelines app Ingest Pipelines Loads the app

Metrics [docs]

✅ unchanged

History

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

@cnasikas
Copy link
Member

ESCasesConfigureAttributes

It seems they are gone now!

@jonathan-buttner jonathan-buttner merged commit 4ea7182 into elastic:cases-split-types-feature Apr 27, 2023
@jonathan-buttner jonathan-buttner deleted the cases-split-types-others branch April 27, 2023 12:22
jonathan-buttner added a commit that referenced this pull request Apr 28, 2023
This PR separates the persisted SO attributes from the fields received
in the HTTP API requests.

This is to address step 2 in preparing our HTTP routes as versioned.

Issue: #153726

This PR encompasses a few PRs here which have been reviewed individually
by the cases team members:

#155325 - User actions
#155440 - Attachments
#155444 - Configure, Connector
Mappings
#155277 - Cases

The large number of files is because of renaming some types throughout
the frontend code. There shouldn't be many functionality changes, mostly
just type changes.

---------

Co-authored-by: Christos Nasikas <christos.nasikas@elastic.co>
Co-authored-by: Patryk Kopyciński <contact@patrykkopycinski.com>
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 Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants