"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.closeIndicesStart = exports.closeIndices = 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 closeIndicesStart = (0, _reduxActions.createAction)('INDEX_MANAGEMENT_CLOSE_INDICES_START'); exports.closeIndicesStart = closeIndicesStart; const closeIndices = ({ indexNames }) => async dispatch => { dispatch(closeIndicesStart({ indexNames })); try { await (0, _services.closeIndices)(indexNames); } catch (error) { _notification.notificationService.showDangerToast(error.body.message); return dispatch((0, _.clearRowStatus)({ indexNames })); } dispatch((0, _.reloadIndices)(indexNames)); _notification.notificationService.showSuccessToast(_i18n.i18n.translate('xpack.idxMgmt.closeIndicesAction.successfullyClosedIndicesMessage', { defaultMessage: 'Successfully closed: [{indexNames}]', values: { indexNames: indexNames.join(', ') } })); }; exports.closeIndices = closeIndices;