Skip to content

[ML] DataFrame bulk actions - #43331

Merged
alvarezmelissa87 merged 21 commits into
elastic:masterfrom
alvarezmelissa87:ml-df-bulk-actions
Aug 22, 2019
Merged

alvarezmelissa87 merged 21 commits into
elastic:masterfrom
alvarezmelissa87:ml-df-bulk-actions

Conversation

@alvarezmelissa87

@alvarezmelissa87 alvarezmelissa87 commented Aug 15, 2019 •

Copy link
Copy Markdown
Contributor

Summary

Adds Start, Stop, and Delete bulk actions to data frames management.
Creates endpoints on the server for listed actions.

If items are selected for bulk actions, the individual actions on every row should be disabled (the anomaly jobs list does this too)

image

If you select stopped jobs for bulk actions the stop action should not be available if one of the jobs is stopped.

image

If one of the jobs selected is already started the start option should not be available

image

If one of the jobs is running, the bulk delete option shouldn't be available.

image

Timeout errors handled by aborting subsequent actions if one times out. Implemented for all actions since they are all bulk actions as well.

image

image

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

- [ ] This was checked for breaking API changes and was labeled appropriately
- [ ] This includes a feature addition or change that requires a release note and was labeled appropriately

@elasticmachine

Copy link
Copy Markdown
Contributor

Pinging @elastic/ml-ui

@elasticmachine

Copy link
Copy Markdown
Contributor

💔 Build Failed

@alvarezmelissa87 alvarezmelissa87 changed the title WIP: [ML] DataFrame bulk actions [ML] DataFrame bulk actions Aug 15, 2019
@elasticmachine

Copy link
Copy Markdown
Contributor

💔 Build Failed

@elasticmachine

Copy link
Copy Markdown
Contributor

💔 Build Failed

@elasticmachine

Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@elasticmachine

Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Comment thread x-pack/legacy/plugins/ml/server/models/data_frame/transforms.ts Outdated
Comment thread x-pack/legacy/plugins/ml/public/services/ml_api_service/index.d.ts Outdated
Comment thread x-pack/legacy/plugins/ml/server/models/data_frame/transforms.ts Outdated
return callWithRequest('ml.deleteDataFrameTransform', { transformId });
}

async function stopTransform(options: {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

stopTransform and startTransform take a very similar options parameter, could the types be combined in a shared interface?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Since these are very small functions I found keeping them separate felt okay right now as we may change/add the options we pass to each and it feels much cleaner keeping them isolated than in the future having the potential of many if else's or ternary operators in a single function. 🤔

Having said that, I'm happy to update it now if everyone feels it's the best options. Otherwise, I'd like to wait and see what we end up adding to Data Frames and update it in the future if needed.

Comment thread x-pack/legacy/plugins/ml/server/models/data_frame/transforms.ts Outdated
@walterra

walterra commented Aug 21, 2019 •

Copy link
Copy Markdown
Contributor

Tested this locally, works great overall! Some feedback on the availability of actions in the bulk dropdown menu:

  • If items are selected for bulk actions, the individual actions on each row should be disabled (the anomaly jobs list does this too)
  • If you select stopped jobs for bulk actions, they can still be stopped again via the bulk action menu. The stop action should not be available if one of the jobs is stopped.
  • The same applies the other way around: If one of the jobs selected is already started, the start option should not be available, otherwise you get an error when trying to do the bulk action:

  • On individual row actions, if a job is started, the Delete action is disabled. The same should be considered in the bulk action menu. If one of the jobs is running, the bulk delete option shouldn't be available

@alvarezmelissa87

alvarezmelissa87 commented Aug 21, 2019 •

Copy link
Copy Markdown
Contributor Author

Thanks for taking a look! All changes have been made and comments responded to.

@walterra - good catch on having the actions disabled appropriately. All suggested changes updated here: 999892d

cc @jgowdyelastic

@elasticmachine

Copy link
Copy Markdown
Contributor

💔 Build Failed

@walterra

walterra commented Aug 22, 2019 •

Copy link
Copy Markdown
Contributor

Great update! I tested the bulk action menu again and the options are now disabled when they're not available for every item. The only missing bit I noticed: Start/Stop gets disabled for individual rows if items are bulk-selected, but the Delete-button on each row is still clickable.

Updated in 45dde00
cc @walterra


import { i18n } from '@kbn/i18n';
// @ts-ignore no declaration file for module
export { isRequestTimeout } from '../job_service/error_utils';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit, this function is so small and used quite a few times in this PR, IMO it would be worth adding a definition file for it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressing in a follow-up 👍

Comment thread x-pack/legacy/plugins/ml/server/models/data_frame/error_utils.ts Outdated

@jgowdyelastic jgowdyelastic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@walterra walterra left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Latest changes LGTM 🎉

@elasticmachine

Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@alvarezmelissa87
alvarezmelissa87 merged commit 5a0fb2c into elastic:master Aug 22, 2019
@alvarezmelissa87
alvarezmelissa87 deleted the ml-df-bulk-actions branch August 22, 2019 17:25
alvarezmelissa87 added a commit that referenced this pull request Aug 22, 2019
* wip: add selection and actions icon

* add bulk delete functionality. use existing delete action component

* add start bulk action

* add stop bulk action

* add label for number of transforms selected

* Action components only accept items array. Update endpoint calls for array param

* update tests

* fix translation error

* update start modal translation

* transformDelete to server side for synchronous looping through ids

* transformsStart to server side for synchronous looping through ids

* transformsStop to server side for synchronous looping through ids

* change request method for delete.

* update deprecated functional component type

* ensure bulk actions disabled when appropriate

* handle timeouts for start,stop,delete actions

* rename DataFrameTransformEndpointRequest type

* disable all row actions when selected items

* fix localization error
patrykkopycinski pushed a commit to patrykkopycinski/kibana that referenced this pull request May 6, 2026
* wip: add selection and actions icon

* add bulk delete functionality. use existing delete action component

* add start bulk action

* add stop bulk action

* add label for number of transforms selected

* Action components only accept items array. Update endpoint calls for array param

* update tests

* fix translation error

* update start modal translation

* transformDelete to server side for synchronous looping through ids

* transformsStart to server side for synchronous looping through ids

* transformsStop to server side for synchronous looping through ids

* change request method for delete.

* update deprecated functional component type

* ensure bulk actions disabled when appropriate

* handle timeouts for start,stop,delete actions

* rename DataFrameTransformEndpointRequest type

* disable all row actions when selected items

* fix localization error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants