-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[ML] Transforms: Add ability to delete dest index & index pattern when deleting transform job #67922
[ML] Transforms: Add ability to delete dest index & index pattern when deleting transform job #67922
Conversation
My thoughts on the three questions you asked @qn895 :
As long as the user has permission to delete one of the indexes, I would show the 'Delete destination index` option in the modal. I would keep the permission checks on the client-side to a minimum, and then do the full permission checks in the server-side endpoint for each destination index, returning an error to display in a toast for each index the user doesn't have permission to delete.
I think we should show the
For the bulk delete, I think it would be best to just show one success message for each operation i.e. one toast for the transform, one for the destination index, and one for the index pattern delete. So if you delete 5 transforms, you only get 3 toasts. But for error messages, I would show a toast for each individual transform / operation that has failed. For bulk delete, the text I would use for the options in the modal are |
Pinging @elastic/ml-ui (:ml) |
x-pack/test/api_integration/apis/transform/delete_transforms.ts
Outdated
Show resolved
Hide resolved
x-pack/test/api_integration/apis/transform/delete_transforms.ts
Outdated
Show resolved
Hide resolved
x-pack/test/api_integration/apis/transform/delete_transforms.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/transform/public/app/hooks/use_delete_transform.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/transform/public/app/hooks/use_delete_transform.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/transform/public/app/hooks/use_delete_transform.tsx
Outdated
Show resolved
Hide resolved
x-pack/test/api_integration/apis/transform/delete_transforms.ts
Outdated
Show resolved
Hide resolved
x-pack/test/api_integration/apis/transform/delete_transforms.ts
Outdated
Show resolved
Hide resolved
x-pack/test/api_integration/apis/transform/delete_transforms.ts
Outdated
Show resolved
Hide resolved
x-pack/test/api_integration/apis/transform/delete_transforms.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job overall, and great to have some integration tests! Added a few comments/questions.
x-pack/plugins/transform/public/app/hooks/use_delete_transform.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/transform/public/app/hooks/use_delete_transform.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/transform/public/app/hooks/use_delete_transform.tsx
Outdated
Show resolved
Hide resolved
...ansform/public/app/sections/transform_management/components/transform_list/action_delete.tsx
Outdated
Show resolved
Hide resolved
...ansform/public/app/sections/transform_management/components/transform_list/action_delete.tsx
Outdated
Show resolved
Hide resolved
...ansform/public/app/sections/transform_management/components/transform_list/action_delete.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some minor comments about labelling. Tested and functionally all looks good.
...ansform/public/app/sections/transform_management/components/transform_list/action_delete.tsx
Outdated
Show resolved
Hide resolved
...ansform/public/app/sections/transform_management/components/transform_list/action_delete.tsx
Outdated
Show resolved
Hide resolved
const deleteModalContent = ( | ||
<> | ||
<p> | ||
<FormattedMessage | ||
id="xpack.transform.transformList.deleteModalBody" | ||
defaultMessage="Are you sure you want to delete this transform?" | ||
/> | ||
</p> | ||
<EuiFlexGroup direction="column" gutterSize="none"> | ||
<EuiFlexItem> | ||
{userCanDeleteIndex && ( | ||
<EuiSwitch | ||
data-test-subj="transformDeleteIndexSwitch" | ||
style={{ paddingBottom: 10 }} | ||
label={i18n.translate( | ||
'xpack.transform.actionDeleteTransform.deleteDestinationIndexTitle', | ||
{ | ||
defaultMessage: 'Delete destination index {destinationIndex}', | ||
values: { destinationIndex: items[0] && items[0].config.dest.index }, | ||
} | ||
)} | ||
checked={deleteDestIndex} | ||
onChange={toggleDeleteIndex} | ||
/> | ||
)} | ||
</EuiFlexItem> | ||
<EuiFlexItem> | ||
{userCanDeleteIndex && indexPatternExists && ( | ||
<EuiSwitch | ||
data-test-subj="transformDeleteIndexPatternSwitch" | ||
label={i18n.translate( | ||
'xpack.transform.actionDeleteTransform.deleteDestIndexPatternTitle', | ||
{ | ||
defaultMessage: 'Delete index pattern {destinationIndex}', | ||
values: { destinationIndex: items[0] && items[0].config.dest.index }, | ||
} | ||
)} | ||
checked={deleteIndexPattern} | ||
onChange={toggleDeleteIndexPattern} | ||
/> | ||
)} | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this block looks the same expect i18n strings are different. I'd prefer to have only one and just have conditional rendering of the labels.
) { | ||
const response = await savedObjectsClient.find<IIndexPattern>({ | ||
type: 'index-pattern', | ||
perPage: 10, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it require 10 results per page?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in def2ccf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Latest changes LGTM.
…index-when-del-job # Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functional tests LGTM
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…n deleting transform job (elastic#67922)
A reference to the removed file was added in https://github.com/elastic/kibana/pull/68462/files#diff-0b479419da389da8e3bf4ee485c9fe25R24 which was merged after this PR went green. This resulted in CI master failing. This PR was reverted to unblock downstream teams and can be re-opened. |
…n deleting transform job (elastic#67922)
This PR adds the option to delete destination index & index pattern when deleting transform job(s) in two scenarios: single delete vs bulk delete.
When we are deleting transforms in bulk:
Delete message
Delete toast messages when all tasks succeed (in this case one transform job didn't have any index pattern)
Delete toast messages when some tasks failed
When we are deleting just one transform job individually:
If all operations succeed
If one of the tasks failed
Checklist
Delete any items that are not applicable to this PR.
For maintainers