mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[index management] Remove index unfreeze code (#205617)
## Summary Remove code related to unfreezing indices since the functionality is being removed from v9 due to https://github.com/elastic/elasticsearch/pull/119227
This commit is contained in:
parent
a382d35dd2
commit
2b5b44249f
19 changed files with 1 additions and 202 deletions
|
@ -22348,7 +22348,6 @@
|
|||
"xpack.idxMgmt.indexActionsMenu.showIndexOverviewLabel": "Afficher l'aperçu des index",
|
||||
"xpack.idxMgmt.indexActionsMenu.showIndexSettingsLabel": "Afficher les paramètres des index",
|
||||
"xpack.idxMgmt.indexActionsMenu.showIndexStatsLabel": "Afficher les statistiques des index",
|
||||
"xpack.idxMgmt.indexActionsMenu.unfreezeIndexLabel": "Dégeler {selectedIndexCount, plural, one {l'index} other {les index} }",
|
||||
"xpack.idxMgmt.indexDetails.backToIndicesButtonLabel": "Retour aux index",
|
||||
"xpack.idxMgmt.indexDetails.errorDescription": "Une erreur s'est produite lors du chargement des données pour l'index {indexName}. Assurez-vous que le nom de l'index dans l'URL est correct, puis réessayez.",
|
||||
"xpack.idxMgmt.indexDetails.errorTitle": "Impossible de charger les détails d'index",
|
||||
|
@ -23248,8 +23247,6 @@
|
|||
"xpack.idxMgmt.templateValidation.templateNameRequiredError": "Nom de modèle obligatoire.",
|
||||
"xpack.idxMgmt.templateValidation.templateNameSpacesError": "Les espaces ne sont pas autorisés dans un nom de modèle.",
|
||||
"xpack.idxMgmt.templateValidation.templateNameUnderscoreError": "Un nom de modèle ne doit pas commencer par un trait de soulignement.",
|
||||
"xpack.idxMgmt.unfreezeIndicesAction.indexUnfrozenMessage": "L'index {indexNames} a été débloqué.",
|
||||
"xpack.idxMgmt.unfreezeIndicesAction.successfullyUnfrozeIndicesMessage": "Déverrouillage terminé : [{indexNames}]",
|
||||
"xpack.idxMgmt.validators.string.invalidJSONError": "Format JSON non valide.",
|
||||
"xpack.indexLifecycleMgmt.addLifecyclePolicyActionButtonLabel": "Ajouter une stratégie de cycle de vie",
|
||||
"xpack.indexLifecycleMgmt.appTitle": "Stratégies de cycle de vie des index",
|
||||
|
|
|
@ -22206,7 +22206,6 @@
|
|||
"xpack.idxMgmt.indexActionsMenu.showIndexOverviewLabel": "インデックス概要を表示",
|
||||
"xpack.idxMgmt.indexActionsMenu.showIndexSettingsLabel": "インデックス設定を表示",
|
||||
"xpack.idxMgmt.indexActionsMenu.showIndexStatsLabel": "インデックス統計を表示",
|
||||
"xpack.idxMgmt.indexActionsMenu.unfreezeIndexLabel": "{selectedIndexCount, plural, other {個のインデックス} }の凍結を解除",
|
||||
"xpack.idxMgmt.indexDetails.backToIndicesButtonLabel": "インデックスに戻る",
|
||||
"xpack.idxMgmt.indexDetails.errorDescription": "インデックス{indexName}のデータを読み込む際にエラーが発生しました。URLのインデックス名が正しいことを確認し、もう一度試してください。",
|
||||
"xpack.idxMgmt.indexDetails.errorTitle": "インデックス詳細を読み込めません",
|
||||
|
@ -23107,8 +23106,6 @@
|
|||
"xpack.idxMgmt.templateValidation.templateNameRequiredError": "テンプレート名が必要です。",
|
||||
"xpack.idxMgmt.templateValidation.templateNameSpacesError": "テンプレート名にスペースは使用できません。",
|
||||
"xpack.idxMgmt.templateValidation.templateNameUnderscoreError": "テンプレート名はアンダーラインで始めることはできません。",
|
||||
"xpack.idxMgmt.unfreezeIndicesAction.indexUnfrozenMessage": "インデックス{indexNames}が凍結解除されました。",
|
||||
"xpack.idxMgmt.unfreezeIndicesAction.successfullyUnfrozeIndicesMessage": "[{indexNames}] の凍結が解除されました",
|
||||
"xpack.idxMgmt.validators.string.invalidJSONError": "無効な JSON フォーマット。",
|
||||
"xpack.indexLifecycleMgmt.addLifecyclePolicyActionButtonLabel": "ライフサイクルポリシーを追加",
|
||||
"xpack.indexLifecycleMgmt.appTitle": "インデックスライフサイクルポリシー",
|
||||
|
|
|
@ -21851,7 +21851,6 @@
|
|||
"xpack.idxMgmt.indexActionsMenu.showIndexOverviewLabel": "显示索引概览",
|
||||
"xpack.idxMgmt.indexActionsMenu.showIndexSettingsLabel": "显示索引设置",
|
||||
"xpack.idxMgmt.indexActionsMenu.showIndexStatsLabel": "显示索引统计信息",
|
||||
"xpack.idxMgmt.indexActionsMenu.unfreezeIndexLabel": "取消冻结{selectedIndexCount, plural, other {索引} }",
|
||||
"xpack.idxMgmt.indexDetails.backToIndicesButtonLabel": "返回到索引",
|
||||
"xpack.idxMgmt.indexDetails.errorDescription": "加载索引 {indexName} 的数据时出现错误。请确保 URL 中的索引名称正确,然后重试。",
|
||||
"xpack.idxMgmt.indexDetails.errorTitle": "无法加载索引详情",
|
||||
|
@ -22744,8 +22743,6 @@
|
|||
"xpack.idxMgmt.templateValidation.templateNameRequiredError": "模板名称必填。",
|
||||
"xpack.idxMgmt.templateValidation.templateNameSpacesError": "模板名称不允许包含空格。",
|
||||
"xpack.idxMgmt.templateValidation.templateNameUnderscoreError": "模板名称不得以下划线开头。",
|
||||
"xpack.idxMgmt.unfreezeIndicesAction.indexUnfrozenMessage": "索引 {indexNames} 已取消冻结。",
|
||||
"xpack.idxMgmt.unfreezeIndicesAction.successfullyUnfrozeIndicesMessage": "成功取消冻结:[{indexNames}]",
|
||||
"xpack.idxMgmt.validators.string.invalidJSONError": "JSON 格式无效。",
|
||||
"xpack.indexLifecycleMgmt.addLifecyclePolicyActionButtonLabel": "添加生命周期策略",
|
||||
"xpack.indexLifecycleMgmt.appTitle": "索引生命周期策略",
|
||||
|
|
|
@ -60,7 +60,6 @@ export type TestSubjects =
|
|||
| 'templatesTab'
|
||||
| 'templateTable'
|
||||
| 'title'
|
||||
| 'unfreezeIndexMenuButton'
|
||||
| 'updateEditIndexSettingsButton'
|
||||
| 'updateIndexSettingsErrorCallout'
|
||||
| 'viewButton'
|
||||
|
|
|
@ -336,38 +336,6 @@ describe('<IndexManagementHome />', () => {
|
|||
);
|
||||
});
|
||||
|
||||
test('should be able to unfreeze a frozen index', async () => {
|
||||
const { actions, exists, find } = testBed;
|
||||
|
||||
httpRequestsMockHelpers.setReloadIndicesResponse([{ ...indexMockA, isFrozen: false }]);
|
||||
|
||||
// Open context menu
|
||||
await actions.clickManageContextMenuButton();
|
||||
// Check that the unfreeze action exists for the current index and unfreeze it
|
||||
expect(exists('unfreezeIndexMenuButton')).toBe(true);
|
||||
await actions.clickContextMenuOption('unfreezeIndexMenuButton');
|
||||
|
||||
// After the index is unfrozen, we imediately do a reload. So we need to expect to see
|
||||
// a reload server call also.
|
||||
expect(httpSetup.post).toHaveBeenCalledWith(
|
||||
`${API_BASE_PATH}/indices/unfreeze`,
|
||||
expect.anything()
|
||||
);
|
||||
expect(httpSetup.post).toHaveBeenCalledWith(
|
||||
`${API_BASE_PATH}/indices/reload`,
|
||||
expect.anything()
|
||||
);
|
||||
|
||||
find('indexTableRowCheckbox')
|
||||
.at(0)
|
||||
.simulate('change', { target: { checked: true } });
|
||||
|
||||
// Open context menu once again, since clicking an action will close it.
|
||||
await actions.clickManageContextMenuButton();
|
||||
// The unfreeze action should not be present anymore
|
||||
expect(exists('unfreezeIndexMenuButton')).toBe(false);
|
||||
});
|
||||
|
||||
test('should be able to force merge an index', async () => {
|
||||
const { actions, exists } = testBed;
|
||||
|
||||
|
|
|
@ -1203,29 +1203,6 @@ describe('<IndexDetailsPage />', () => {
|
|||
expect(testBed.routerMock.history.push).toHaveBeenCalledTimes(1);
|
||||
expect(testBed.routerMock.history.push).toHaveBeenCalledWith('/indices');
|
||||
});
|
||||
|
||||
it(`unfreezes a frozen index`, async () => {
|
||||
httpRequestsMockHelpers.setLoadIndexDetailsResponse(testIndexName, {
|
||||
...testIndexMock,
|
||||
isFrozen: true,
|
||||
});
|
||||
|
||||
await act(async () => {
|
||||
testBed = await setup({ httpSetup });
|
||||
});
|
||||
testBed.component.update();
|
||||
|
||||
// already sent 6 requests while setting up the component
|
||||
const numberOfRequests = 6;
|
||||
expect(httpSetup.get).toHaveBeenCalledTimes(numberOfRequests);
|
||||
|
||||
await testBed.actions.contextMenu.clickManageIndexButton();
|
||||
await testBed.actions.contextMenu.clickIndexAction('unfreezeIndexMenuButton');
|
||||
expect(httpSetup.post).toHaveBeenCalledWith(`${API_BASE_PATH}/indices/unfreeze`, {
|
||||
body: JSON.stringify({ indices: [testIndexName] }),
|
||||
});
|
||||
expect(httpSetup.get).toHaveBeenCalledTimes(numberOfRequests + 1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('index name with a percent sign', () => {
|
||||
|
|
|
@ -492,7 +492,6 @@ describe('index table', () => {
|
|||
expect(findTestSubject(rendered, 'refreshIndexMenuButton').length).toBe(0);
|
||||
expect(findTestSubject(rendered, 'clearCacheIndexMenuButton').length).toBe(0);
|
||||
expect(findTestSubject(rendered, 'flushIndexMenuButton').length).toBe(0);
|
||||
expect(findTestSubject(rendered, 'unfreezeIndexMenuButton').length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -36,8 +36,6 @@ export {
|
|||
UIM_INDEX_OPEN_MANY,
|
||||
UIM_INDEX_REFRESH,
|
||||
UIM_INDEX_REFRESH_MANY,
|
||||
UIM_INDEX_UNFREEZE,
|
||||
UIM_INDEX_UNFREEZE_MANY,
|
||||
UIM_INDEX_SETTINGS_EDIT,
|
||||
UIM_TEMPLATE_LIST_LOAD,
|
||||
UIM_TEMPLATE_DELETE,
|
||||
|
|
|
@ -24,8 +24,6 @@ export const UIM_INDEX_OPEN_MANY = 'index_open_many';
|
|||
export const UIM_INDEX_REFRESH = 'index_refresh';
|
||||
export const UIM_INDEX_REFRESH_MANY = 'index_refresh_many';
|
||||
export const UIM_INDEX_SETTINGS_EDIT = 'index_settings_edit';
|
||||
export const UIM_INDEX_UNFREEZE = 'index_unfreeze';
|
||||
export const UIM_INDEX_UNFREEZE_MANY = 'index_unfreeze_many';
|
||||
export const UIM_TEMPLATE_LIST_LOAD = 'template_list_load';
|
||||
export const UIM_TEMPLATE_DELETE = 'template_delete';
|
||||
export const UIM_TEMPLATE_DELETE_MANY = 'template_delete_many';
|
||||
|
|
|
@ -18,7 +18,6 @@ import {
|
|||
forcemergeIndices as forcemergeIndicesRequest,
|
||||
openIndices as openIndicesRequest,
|
||||
refreshIndices as refreshIndicesRequest,
|
||||
unfreezeIndices as unfreezeIndicesRequest,
|
||||
} from '../../../../services';
|
||||
import { notificationService } from '../../../../services/notification';
|
||||
import { httpService } from '../../../../services/http';
|
||||
|
@ -162,24 +161,6 @@ export const ManageIndexButton: FunctionComponent<Props> = ({
|
|||
}
|
||||
}, [reloadIndices, indexNames]);
|
||||
|
||||
const unfreezeIndices = useCallback(async () => {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
await unfreezeIndicesRequest(indexNames);
|
||||
await reloadIndices();
|
||||
setIsLoading(false);
|
||||
notificationService.showSuccessToast(
|
||||
i18n.translate('xpack.idxMgmt.unfreezeIndicesAction.indexUnfrozenMessage', {
|
||||
defaultMessage: 'The index {indexNames} was unfrozen.',
|
||||
values: { indexNames: indexNames.join(', ') },
|
||||
})
|
||||
);
|
||||
} catch (error) {
|
||||
setIsLoading(false);
|
||||
notificationService.showDangerToast(error.body.message);
|
||||
}
|
||||
}, [reloadIndices, indexNames]);
|
||||
|
||||
const forcemergeIndices = useCallback(
|
||||
async (maxNumSegments: string) => {
|
||||
setIsLoading(true);
|
||||
|
@ -251,7 +232,6 @@ export const ManageIndexButton: FunctionComponent<Props> = ({
|
|||
flushIndices={flushIndices}
|
||||
refreshIndices={refreshIndices}
|
||||
clearCacheIndices={clearCacheIndices}
|
||||
unfreezeIndices={unfreezeIndices}
|
||||
forcemergeIndices={forcemergeIndices}
|
||||
deleteIndices={deleteIndices}
|
||||
performExtensionAction={performExtensionAction}
|
||||
|
|
|
@ -17,7 +17,6 @@ import {
|
|||
refreshIndices,
|
||||
performExtensionAction,
|
||||
reloadIndices,
|
||||
unfreezeIndices,
|
||||
} from '../../../../store/actions';
|
||||
|
||||
import { getIndexStatusByIndexName, getIndicesByName } from '../../../../store/selectors';
|
||||
|
@ -53,9 +52,6 @@ const mapDispatchToProps = (dispatch, { indexNames }) => {
|
|||
refreshIndices: () => {
|
||||
dispatch(refreshIndices({ indexNames }));
|
||||
},
|
||||
unfreezeIndices: () => {
|
||||
dispatch(unfreezeIndices({ indexNames }));
|
||||
},
|
||||
forcemergeIndices: (maxNumSegments) => {
|
||||
dispatch(forcemergeIndices({ indexNames, maxNumSegments }));
|
||||
},
|
||||
|
|
|
@ -33,7 +33,6 @@ export interface IndexActionsContextMenuProps {
|
|||
flushIndices: () => Promise<void>;
|
||||
refreshIndices: () => Promise<void>;
|
||||
clearCacheIndices: () => Promise<void>;
|
||||
unfreezeIndices: () => Promise<void>;
|
||||
forcemergeIndices: (maxNumSegments: string) => Promise<void>;
|
||||
deleteIndices: () => Promise<void>;
|
||||
|
||||
|
|
|
@ -67,13 +67,12 @@ export class IndexActionsContextMenu extends Component {
|
|||
performExtensionAction,
|
||||
indices,
|
||||
reloadIndices,
|
||||
unfreezeIndices,
|
||||
indicesListURLParams,
|
||||
} = this.props;
|
||||
const allOpen = every(indexNames, (indexName) => {
|
||||
return indexStatusByName[indexName] === INDEX_OPEN;
|
||||
});
|
||||
const allFrozen = every(indices, (index) => index.isFrozen);
|
||||
|
||||
const selectedIndexCount = indexNames.length;
|
||||
const items = [];
|
||||
if (isOnListView && selectedIndexCount === 1) {
|
||||
|
@ -191,18 +190,6 @@ export class IndexActionsContextMenu extends Component {
|
|||
this.closePopoverAndExecute(flushIndices);
|
||||
},
|
||||
});
|
||||
if (allFrozen) {
|
||||
items.push({
|
||||
'data-test-subj': 'unfreezeIndexMenuButton',
|
||||
name: i18n.translate('xpack.idxMgmt.indexActionsMenu.unfreezeIndexLabel', {
|
||||
defaultMessage: 'Unfreeze {selectedIndexCount, plural, one {index} other {indices} }',
|
||||
values: { selectedIndexCount },
|
||||
}),
|
||||
onClick: () => {
|
||||
this.closePopoverAndExecute(unfreezeIndices);
|
||||
},
|
||||
});
|
||||
}
|
||||
} else if (!allOpen && enableIndexActions) {
|
||||
items.push({
|
||||
'data-test-subj': 'openIndexMenuButton',
|
||||
|
|
|
@ -28,8 +28,6 @@ import {
|
|||
UIM_INDEX_OPEN_MANY,
|
||||
UIM_INDEX_REFRESH,
|
||||
UIM_INDEX_REFRESH_MANY,
|
||||
UIM_INDEX_UNFREEZE,
|
||||
UIM_INDEX_UNFREEZE_MANY,
|
||||
UIM_TEMPLATE_DELETE,
|
||||
UIM_TEMPLATE_DELETE_MANY,
|
||||
UIM_TEMPLATE_CREATE,
|
||||
|
@ -214,17 +212,6 @@ export async function clearCacheIndices(indices: string[]) {
|
|||
return response;
|
||||
}
|
||||
|
||||
export async function unfreezeIndices(indices: string[]) {
|
||||
const body = JSON.stringify({
|
||||
indices,
|
||||
});
|
||||
const response = await httpService.httpClient.post(`${API_BASE_PATH}/indices/unfreeze`, { body });
|
||||
// Only track successful requests.
|
||||
const eventName = indices.length > 1 ? UIM_INDEX_UNFREEZE_MANY : UIM_INDEX_UNFREEZE;
|
||||
uiMetricService.trackMetric(METRIC_TYPE.COUNT, eventName);
|
||||
return response;
|
||||
}
|
||||
|
||||
export async function loadIndexSettings(indexName: string) {
|
||||
const response = await httpService.httpClient.get(
|
||||
`${API_BASE_PATH}/settings/${encodeURIComponent(indexName)}`
|
||||
|
|
|
@ -15,7 +15,6 @@ export {
|
|||
flushIndices,
|
||||
forcemergeIndices,
|
||||
clearCacheIndices,
|
||||
unfreezeIndices,
|
||||
loadIndexSettings,
|
||||
updateIndexSettings,
|
||||
loadIndexStats,
|
||||
|
|
|
@ -14,7 +14,6 @@ export * from './forcemerge_indices';
|
|||
export * from './load_indices';
|
||||
export * from './open_indices';
|
||||
export * from './refresh_indices';
|
||||
export * from './unfreeze_indices';
|
||||
export * from './reload_indices';
|
||||
export * from './table_state';
|
||||
export * from './extension_action';
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import { createAction } from 'redux-actions';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { unfreezeIndices as request } from '../../services';
|
||||
import { clearRowStatus, reloadIndices } from '.';
|
||||
import { notificationService } from '../../services/notification';
|
||||
|
||||
export const unfreezeIndicesStart = createAction('INDEX_MANAGEMENT_UNFREEZE_INDICES_START');
|
||||
|
||||
export const unfreezeIndices =
|
||||
({ indexNames }) =>
|
||||
async (dispatch) => {
|
||||
dispatch(unfreezeIndicesStart({ indexNames }));
|
||||
try {
|
||||
await request(indexNames);
|
||||
} catch (error) {
|
||||
notificationService.showDangerToast(error.body.message);
|
||||
return dispatch(clearRowStatus({ indexNames }));
|
||||
}
|
||||
dispatch(reloadIndices(indexNames));
|
||||
notificationService.showSuccessToast(
|
||||
i18n.translate('xpack.idxMgmt.unfreezeIndicesAction.successfullyUnfrozeIndicesMessage', {
|
||||
defaultMessage: 'Successfully unfroze: [{indexNames}]',
|
||||
values: { indexNames: indexNames.join(', ') },
|
||||
})
|
||||
);
|
||||
};
|
|
@ -16,7 +16,6 @@ import { registerOpenRoute } from './register_open_route';
|
|||
import { registerRefreshRoute } from './register_refresh_route';
|
||||
import { registerReloadRoute } from './register_reload_route';
|
||||
import { registerDeleteRoute } from './register_delete_route';
|
||||
import { registerUnfreezeRoute } from './register_unfreeze_route';
|
||||
import { registerGetRoute } from './register_get_route';
|
||||
import { registerCreateRoute } from './register_create_route';
|
||||
|
||||
|
@ -30,7 +29,6 @@ export function registerIndicesRoutes(dependencies: RouteDependencies) {
|
|||
registerRefreshRoute(dependencies);
|
||||
registerReloadRoute(dependencies);
|
||||
registerDeleteRoute(dependencies);
|
||||
registerUnfreezeRoute(dependencies);
|
||||
registerGetRoute(dependencies);
|
||||
registerCreateRoute(dependencies);
|
||||
}
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import { schema } from '@kbn/config-schema';
|
||||
|
||||
import { RouteDependencies } from '../../../types';
|
||||
import { addBasePath } from '..';
|
||||
|
||||
const bodySchema = schema.object({
|
||||
indices: schema.arrayOf(schema.string()),
|
||||
});
|
||||
|
||||
export function registerUnfreezeRoute({ router, lib: { handleEsError } }: RouteDependencies) {
|
||||
router.post(
|
||||
{
|
||||
path: addBasePath('/indices/unfreeze'),
|
||||
security: {
|
||||
authz: {
|
||||
enabled: false,
|
||||
reason: 'Relies on es client for authorization',
|
||||
},
|
||||
},
|
||||
validate: { body: bodySchema },
|
||||
},
|
||||
async (context, request, response) => {
|
||||
const { client } = (await context.core).elasticsearch;
|
||||
const { indices = [] } = request.body as typeof bodySchema.type;
|
||||
|
||||
try {
|
||||
await client.asCurrentUser.indices.unfreeze({
|
||||
index: indices.join(','),
|
||||
});
|
||||
return response.ok();
|
||||
} catch (error) {
|
||||
return handleEsError({ error, response });
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue