Reload engines when an Elasticsearch index based engine is deleted (#138001) (#138046)

(cherry picked from commit 595a048128)

Co-authored-by: Efe Gürkan YALAMAN <efeguerkan.yalaman@elastic.co>
This commit is contained in:
Kibana Machine 2022-08-03 17:13:57 -04:00 committed by GitHub
parent 9e9e0d6a68
commit 44d60ef9e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View file

@ -227,6 +227,17 @@ describe('EnginesLogic', () => {
expect(EnginesLogic.actions.loadEngines).toHaveBeenCalled();
});
it('should call loadEngines if engine.type === elasticsearch', () => {
jest.spyOn(EnginesLogic.actions, 'loadEngines');
EnginesLogic.actions.onDeleteEngineSuccess({
...MOCK_ENGINE,
type: 'elasticsearch' as EngineTypes.elasticsearch,
});
expect(EnginesLogic.actions.loadEngines).toHaveBeenCalled();
});
it('should call loadMetaEngines if engine.type === meta', () => {
jest.spyOn(EnginesLogic.actions, 'loadMetaEngines');

View file

@ -150,7 +150,9 @@ export const EnginesLogic = kea<MakeLogicType<EnginesValues, EnginesActions>>({
},
onDeleteEngineSuccess: async ({ engine }) => {
flashSuccessToast(DELETE_ENGINE_MESSAGE(engine.name));
if ([EngineTypes.default, EngineTypes.indexed].includes(engine.type)) {
if (
[EngineTypes.default, EngineTypes.indexed, EngineTypes.elasticsearch].includes(engine.type)
) {
actions.loadEngines();
} else if (engine.type === EngineTypes.meta) {
actions.loadMetaEngines();