mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[ML] Lock the delete annotation button on click (#137306)
This commit is contained in:
parent
bcbef78b4d
commit
b378c064c8
1 changed files with 8 additions and 0 deletions
|
@ -78,6 +78,8 @@ interface State {
|
|||
}
|
||||
|
||||
export class AnnotationFlyoutUI extends Component<CommonProps & Props> {
|
||||
private deletionInProgress = false;
|
||||
|
||||
public state: State = {
|
||||
isDeleteModalVisible: false,
|
||||
applyAnnotationToSeries: true,
|
||||
|
@ -121,6 +123,8 @@ export class AnnotationFlyoutUI extends Component<CommonProps & Props> {
|
|||
};
|
||||
|
||||
public deleteHandler = async () => {
|
||||
if (this.deletionInProgress) return;
|
||||
|
||||
const { annotationState } = this.state;
|
||||
const toastNotifications = getToastNotifications();
|
||||
|
||||
|
@ -128,6 +132,8 @@ export class AnnotationFlyoutUI extends Component<CommonProps & Props> {
|
|||
return;
|
||||
}
|
||||
|
||||
this.deletionInProgress = true;
|
||||
|
||||
try {
|
||||
await ml.annotations.deleteAnnotation(annotationState._id);
|
||||
toastNotifications.addSuccess(
|
||||
|
@ -154,6 +160,8 @@ export class AnnotationFlyoutUI extends Component<CommonProps & Props> {
|
|||
|
||||
this.closeDeleteModal();
|
||||
|
||||
this.deletionInProgress = false;
|
||||
|
||||
const { annotationUpdatesService } = this.props;
|
||||
|
||||
annotationUpdatesService.setValue(null);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue