"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.deleteIndicesSuccess = exports.deleteIndices = void 0; var _reduxActions = require("redux-actions"); var _i18n = require("@kbn/i18n"); var _services = require("../../services"); var _notification = require("../../services/notification"); var _ = require("."); /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ const deleteIndicesSuccess = (0, _reduxActions.createAction)('INDEX_MANAGEMENT_DELETE_INDICES_SUCCESS'); exports.deleteIndicesSuccess = deleteIndicesSuccess; const deleteIndices = ({ indexNames }) => async dispatch => { try { await (0, _services.deleteIndices)(indexNames); } catch (error) { _notification.notificationService.showDangerToast(error.body.message); return dispatch((0, _.clearRowStatus)({ indexNames })); } _notification.notificationService.showSuccessToast(_i18n.i18n.translate('xpack.idxMgmt.deleteIndicesAction.successfullyDeletedIndicesMessage', { defaultMessage: 'Successfully deleted: [{indexNames}]', values: { indexNames: indexNames.join(', ') } })); dispatch(deleteIndicesSuccess({ indexNames })); }; exports.deleteIndices = deleteIndices;