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] Assign users when creating a case #139754

Merged

Conversation

cnasikas
Copy link
Member

@cnasikas cnasikas commented Aug 30, 2022

Summary

This PR implements the assignment of users when creating a case. It does not implement suggestions. It will be addressed in another PR.

Assignment of users

create_case_assign_users.mp4

Self assignment

create_case_assign_self.mp4

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@cnasikas cnasikas 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.5.0 labels Aug 30, 2022
@cnasikas cnasikas assigned cnasikas and unassigned cnasikas Aug 30, 2022
@cnasikas cnasikas force-pushed the create_case_assign_user branch from 8fc555f to c7aa27e Compare August 31, 2022 17:05
@cnasikas cnasikas marked this pull request as ready for review September 1, 2022 08:49
@cnasikas cnasikas requested a review from a team as a code owner September 1, 2022 08:49
@elasticmachine
Copy link
Contributor

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

@elasticmachine
Copy link
Contributor

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

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Tested locally and LGTM

@@ -296,3 +296,7 @@ export const READ_ACTIONS_PERMISSIONS_ERROR_MSG = i18n.translate(
'You do not have permission to view connectors. If you would like to view connectors, contact your Kibana administrator.',
}
);

export const ASSIGNEES = i18n.translate('xpack.cases.common.assigneesTitle', {
Copy link
Contributor

Choose a reason for hiding this comment

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

I've moved this to the user_profiles/translations should we keep it in common like you have it instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

I put it in the common because multiple components use it. I am fine with both. It is up to you :).

{(field) => {
const { setValue } = field;

const onComboChange = (currentOptions: EuiComboBoxOptionOption[]) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should onComboChange and onSelfAssign be useCallbacks?

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct, I forgot about it. Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

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

I get this linting error because the functions are inside another function:

Screenshot 2022-09-02 at 3 19 30 PM

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like we might be able to get around that by using the component prop of UseField:

x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/other_type_name_parameter.tsx

Maybe that's overkill though 🤷‍♂️

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice, I wasn't aware of that. I will take a look.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

selectedOptions={selectedOptions}
isDisabled={isLoading}
onChange={onComboChange}
onSearchChange={onSearchComboChange}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we pass setSearchTerm here directly? useSuggestUserProfiles currently checks for an empty string and returns null but depending on the outcome of the suggestions discussion we'll likely want to return whatever the hook returns even if we search with an empty string.

Copy link
Member Author

@cnasikas cnasikas Sep 2, 2022

Choose a reason for hiding this comment

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

If you search and click on a user suggestion then the onSearchChange is called with an empty string. This will call the backend and return null making the suggestion list disappear. For that reason, we need to check if the search term is an empty string and prevent the call to the backend.

1.mp4

@kibana-ci
Copy link
Collaborator

kibana-ci commented Sep 6, 2022

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #25 / Cases Attachment framework Attachment hooks Flyout attaches correctly
  • [job] [logs] FTR Configs #25 / Cases Attachment framework Attachment hooks Flyout attaches correctly
  • [job] [logs] Jest Tests #6 / EditableTitle renders
  • [job] [logs] Jest Tests #6 / EditConnector displays the callout message when none is selected
  • [job] [logs] Jest Tests #6 / HeaderPage it renders
  • [job] [logs] FTR Configs #7 / machine learning - anomaly detection anomaly explorer with farequote based multi metric job Anomaly Swim Lane as embeddable attaches swim lane embeddable to a case
  • [job] [logs] FTR Configs #7 / machine learning - anomaly detection anomaly explorer with farequote based multi metric job Anomaly Swim Lane as embeddable attaches swim lane embeddable to a case

Metrics [docs]

‼️ ERROR: no builds found for mergeBase sha [8103bd3]

History

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

cc @cnasikas

@cnasikas cnasikas merged commit 01006bf into elastic:cases-user-assignment Sep 6, 2022
@cnasikas cnasikas deleted the create_case_assign_user branch September 6, 2022 14:26
jonathan-buttner added a commit that referenced this pull request Sep 12, 2022
* [ResponseOps][Cases] Assign users on cases sidebar section (#138108)

* Add reusable user profile selector component

* Refactoring services, auth

* Adding suggest api and tests

* Move to package and add examples

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* Working integration tests

* Switching suggest api tags

* Adding assignees field

* Adding tests for size and owner

* Add server side example

* CI Fixes

* Adding assignee integration tests

* fix tests

* Addd tests

* Starting user actions changes

* Adding api tag tests

* Addressing feedback

* Using lodash for array comparison logic and tests

* Fixing type error

* Create suggest query

* Adding assignees user action

* [ResponseOps][Cases] Refactoring client args and authentication (#137345)

* Refactoring services, auth

* Fixing type errors

* Adding assignees migration and tests

* Fixing types and added more tests

* Fixing cypress test

* Fixing test

* Add tests

* Add security as dependency and fix types

* Add bulk get profiles query

* Rename folder

* Addressed suggestions from code review

* Fix types

* Adding migration for assignees field and tests

* Adding comments and a few more tests

* Updating comments and spelling

* Revert security solution optional

* PR feedback

* Updated user avatar component

* Reduce size

* Make security required

* Fix tests

* Addressing feedback

* Do not retry suggestions

* Assign users to a case

* Restructure components

* Move assignees to case view

* Show assigned users

* Refactoring bulk get and display name

* Adding tests for user tooltip

* Adding tests

* Hovering and tests

* Fixing errors

* Some pr clean up

* Fixing tests and adding more

* Adding functional tests

* Fixing jest test failure

* Passing in current user profile

* Refactoring assignment with useEffect

* Fixing icon alignment and removal render bug

* Fixing type errors

* Fixing test errors

* Adding bulk get privs and tests

* Fixing popover tests

* Handling unknown users

* Adding tests for unknown users

* Adding wait for popover calls

* Addressing design feedback

* Addressing remaining feedback

* Refactoring css and name prop

* Refactoring popover

* Refactoring search component

* Addressing some feedback

* Adjusting sorting

* Fixing tests

* Fixing type error

* Fixing test error

* Fixing test errors

* Removing display name

Co-authored-by: Thom Heymann <[email protected]>
Co-authored-by: Jonathan Buttner <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Thom Heymann <[email protected]>
Co-authored-by: Jonathan Buttner <[email protected]>

* [ResponseOps][Cases] Add assignee user actions (#139392)

* Adding user actions for assignees

* Fixing merge issues

* Fixing test mock errors

* Fixing display name errors and themselves

* Fixing test for time being

* Addressing feedback

* Addressing comma and uniq feedback

* Using core getUserDisplayName

* Fixing import and removing flickering

* Fixing tests

Co-authored-by: Kibana Machine <[email protected]>

* Detect when user is typing

* Use select to tranform data

* [Cases] Assign users when creating a case (#139754)

* Init

* Render users

* Assign yourself

* Add tests

* Fix tests

* PR feedback

* [ResponseOps][Cases] Filter by assignees (#139441)

* Starting the filtering

* Rough draft working for assignees filtering

* Adding integration tests for new route

* Starting to write tests

* Fixing tests

* Cleaning up more tests

* Removing duplicate call for current user

* Fixing type errors and tests

* Adding tests for filtering

* Adding rbac tests

* Fixing translations

* Fixing api integration tests

* Fixing severity tests

* Really fixing arrays equal

* Fixing ml tests and refactoring find assignees

* Fixing cypress tests

* Fixing types

* Fix tests

* Addressing first round of feedback

* Reverting the recent cases changes

* Fixing tests

* Fixing more tests and types

* Allowing multi select

* Fixing attachment framework issue

* Addressing feedback

* Fixing type error

* Fixing tests

* Sort users and improve loading

* Fix ml security dependecies

* Fix permissions when fetching suggestions

* Fixing read permissions and suggest api

* Hiding assignee delete icon

* Hiding the assign yourself text when undefined

* Create page fixes

Co-authored-by: Christos Nasikas <[email protected]>
Co-authored-by: Thom Heymann <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Thom Heymann <[email protected]>
jonathan-buttner added a commit that referenced this pull request Sep 14, 2022
* [ResponseOps][Cases] Assign users on cases sidebar section (#138108)

* Add reusable user profile selector component

* Refactoring services, auth

* Adding suggest api and tests

* Move to package and add examples

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* Working integration tests

* Switching suggest api tags

* Adding assignees field

* Adding tests for size and owner

* Add server side example

* CI Fixes

* Adding assignee integration tests

* fix tests

* Addd tests

* Starting user actions changes

* Adding api tag tests

* Addressing feedback

* Using lodash for array comparison logic and tests

* Fixing type error

* Create suggest query

* Adding assignees user action

* [ResponseOps][Cases] Refactoring client args and authentication (#137345)

* Refactoring services, auth

* Fixing type errors

* Adding assignees migration and tests

* Fixing types and added more tests

* Fixing cypress test

* Fixing test

* Add tests

* Add security as dependency and fix types

* Add bulk get profiles query

* Rename folder

* Addressed suggestions from code review

* Fix types

* Adding migration for assignees field and tests

* Adding comments and a few more tests

* Updating comments and spelling

* Revert security solution optional

* PR feedback

* Updated user avatar component

* Reduce size

* Make security required

* Fix tests

* Addressing feedback

* Do not retry suggestions

* Assign users to a case

* Restructure components

* Move assignees to case view

* Show assigned users

* Refactoring bulk get and display name

* Adding tests for user tooltip

* Adding tests

* Hovering and tests

* Fixing errors

* Some pr clean up

* Fixing tests and adding more

* Adding functional tests

* Fixing jest test failure

* Passing in current user profile

* Refactoring assignment with useEffect

* Fixing icon alignment and removal render bug

* Fixing type errors

* Fixing test errors

* Adding bulk get privs and tests

* Fixing popover tests

* Handling unknown users

* Adding tests for unknown users

* Adding wait for popover calls

* Addressing design feedback

* Addressing remaining feedback

* Refactoring css and name prop

* Refactoring popover

* Refactoring search component

* Addressing some feedback

* Adjusting sorting

* Fixing tests

* Fixing type error

* Fixing test error

* Fixing test errors

* Removing display name

Co-authored-by: Thom Heymann <[email protected]>
Co-authored-by: Jonathan Buttner <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Thom Heymann <[email protected]>
Co-authored-by: Jonathan Buttner <[email protected]>

* [ResponseOps][Cases] Add assignee user actions (#139392)

* Adding user actions for assignees

* Fixing merge issues

* Fixing test mock errors

* Fixing display name errors and themselves

* Fixing test for time being

* Addressing feedback

* Addressing comma and uniq feedback

* Using core getUserDisplayName

* Fixing import and removing flickering

* Fixing tests

Co-authored-by: Kibana Machine <[email protected]>

* Detect when user is typing

* Use select to tranform data

* [Cases] Assign users when creating a case (#139754)

* Init

* Render users

* Assign yourself

* Add tests

* Fix tests

* PR feedback

* [ResponseOps][Cases] Filter by assignees (#139441)

* Starting the filtering

* Rough draft working for assignees filtering

* Adding integration tests for new route

* Starting to write tests

* Fixing tests

* Cleaning up more tests

* Removing duplicate call for current user

* Fixing type errors and tests

* Adding tests for filtering

* Adding rbac tests

* Fixing translations

* Fixing api integration tests

* Fixing severity tests

* Really fixing arrays equal

* Fixing ml tests and refactoring find assignees

* Fixing cypress tests

* Fixing types

* Fix tests

* Addressing first round of feedback

* Reverting the recent cases changes

* Fixing tests

* Fixing more tests and types

* Allowing multi select

* Fixing attachment framework issue

* Addressing feedback

* Fixing type error

* Fixing tests

* Refactoring components

* Refactoring the users lists

* Switching all user action avatars

* Fixing merge issues

* Fixing types

* Addressing feedback

* Fixing type errors

Co-authored-by: Christos Nasikas <[email protected]>
Co-authored-by: Thom Heymann <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Thom Heymann <[email protected]>
cnasikas added a commit that referenced this pull request Sep 14, 2022
* [ResponseOps][Cases] Assign users on cases sidebar section (#138108)

* Add reusable user profile selector component

* Refactoring services, auth

* Adding suggest api and tests

* Move to package and add examples

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* Working integration tests

* Switching suggest api tags

* Adding assignees field

* Adding tests for size and owner

* Add server side example

* CI Fixes

* Adding assignee integration tests

* fix tests

* Addd tests

* Starting user actions changes

* Adding api tag tests

* Addressing feedback

* Using lodash for array comparison logic and tests

* Fixing type error

* Create suggest query

* Adding assignees user action

* [ResponseOps][Cases] Refactoring client args and authentication (#137345)

* Refactoring services, auth

* Fixing type errors

* Adding assignees migration and tests

* Fixing types and added more tests

* Fixing cypress test

* Fixing test

* Add tests

* Add security as dependency and fix types

* Add bulk get profiles query

* Rename folder

* Addressed suggestions from code review

* Fix types

* Adding migration for assignees field and tests

* Adding comments and a few more tests

* Updating comments and spelling

* Revert security solution optional

* PR feedback

* Updated user avatar component

* Reduce size

* Make security required

* Fix tests

* Addressing feedback

* Do not retry suggestions

* Assign users to a case

* Restructure components

* Move assignees to case view

* Show assigned users

* Refactoring bulk get and display name

* Adding tests for user tooltip

* Adding tests

* Hovering and tests

* Fixing errors

* Some pr clean up

* Fixing tests and adding more

* Adding functional tests

* Fixing jest test failure

* Passing in current user profile

* Refactoring assignment with useEffect

* Fixing icon alignment and removal render bug

* Fixing type errors

* Fixing test errors

* Adding bulk get privs and tests

* Fixing popover tests

* Handling unknown users

* Adding tests for unknown users

* Adding wait for popover calls

* Addressing design feedback

* Addressing remaining feedback

* Refactoring css and name prop

* Refactoring popover

* Refactoring search component

* Addressing some feedback

* Adjusting sorting

* Fixing tests

* Fixing type error

* Fixing test error

* Fixing test errors

* Removing display name

Co-authored-by: Thom Heymann <[email protected]>
Co-authored-by: Jonathan Buttner <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Thom Heymann <[email protected]>
Co-authored-by: Jonathan Buttner <[email protected]>

* [ResponseOps][Cases] Add assignee user actions (#139392)

* Adding user actions for assignees

* Fixing merge issues

* Fixing test mock errors

* Fixing display name errors and themselves

* Fixing test for time being

* Addressing feedback

* Addressing comma and uniq feedback

* Using core getUserDisplayName

* Fixing import and removing flickering

* Fixing tests

Co-authored-by: Kibana Machine <[email protected]>

* Detect when user is typing

* Use select to tranform data

* [Cases] Assign users when creating a case (#139754)

* Init

* Render users

* Assign yourself

* Add tests

* Fix tests

* PR feedback

* [ResponseOps][Cases] Filter by assignees (#139441)

* Starting the filtering

* Rough draft working for assignees filtering

* Adding integration tests for new route

* Starting to write tests

* Fixing tests

* Cleaning up more tests

* Removing duplicate call for current user

* Fixing type errors and tests

* Adding tests for filtering

* Adding rbac tests

* Fixing translations

* Fixing api integration tests

* Fixing severity tests

* Really fixing arrays equal

* Fixing ml tests and refactoring find assignees

* Fixing cypress tests

* Fixing types

* Fix tests

* Addressing first round of feedback

* Reverting the recent cases changes

* Fixing tests

* Fixing more tests and types

* Allowing multi select

* Fixing attachment framework issue

* Addressing feedback

* Fixing type error

* Fixing tests

* Sort users and improve loading

* Fix ml security dependecies

* Fix permissions when fetching suggestions

* Fixing read permissions and suggest api

* Hiding assignee delete icon

* Hiding the assign yourself text when undefined

* Show licensing callout to the all cases page

* Hide assignees column

* Hide assignees & connectors column

* Renames

* Check licensing when assigning users to a case

* Hide assinee from create case page

* Hide assignee filtering

* Check license when filtering by assignees

* Add UI tests & fixes

* Add integration tests

* Fix tests

* Fix i18n

* Revert core changes

* PR feedback and fix tests

* PR feedback

Co-authored-by: Thom Heymann <[email protected]>
Co-authored-by: Jonathan Buttner <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Thom Heymann <[email protected]>
Co-authored-by: Jonathan Buttner <[email protected]>
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.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants