Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
ppisljar committed Jul 6, 2020
1 parent 4a861f3 commit 0bb7507
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 26 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export declare class IndexPattern implements IIndexPattern
| [\_fetchFields()](./kibana-plugin-plugins-data-public.indexpattern._fetchfields.md) | | |
| [addScriptedField(name, script, fieldType, lang)](./kibana-plugin-plugins-data-public.indexpattern.addscriptedfield.md) | | |
| [create(allowOverride)](./kibana-plugin-plugins-data-public.indexpattern.create.md) | | |
| [destroy()](./kibana-plugin-plugins-data-public.indexpattern.destroy.md) | | |
| [getAggregationRestrictions()](./kibana-plugin-plugins-data-public.indexpattern.getaggregationrestrictions.md) | | |
| [getComputedFields()](./kibana-plugin-plugins-data-public.indexpattern.getcomputedfields.md) | | |
| [getFieldByName(name)](./kibana-plugin-plugins-data-public.indexpattern.getfieldbyname.md) | | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,13 @@ describe('IndexPatterns', () => {
await indexPatterns.getFields(['id', 'title'], true);
expect(savedObjectsClient.find).toHaveBeenCalledTimes(3);
});

test('deletes the index pattern', async () => {
const id = '1';
const indexPattern = await indexPatterns.get(id);

expect(indexPattern).toBeDefined();
await indexPatterns.delete(id);
expect(indexPattern).not.toBe(await indexPatterns.get(id));
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,11 @@ export class IndexPatternsService {

/**
* Deletes an index pattern from .kibana index
* @param indexPattern: IndexPattern instance to delete
* @param indexPatternId: Id of kibana Index Pattern to delete
*/
async delete(indexPattern: IndexPattern) {
if (indexPattern.id) {
indexPatternCache.clear(indexPattern.id);
return this.savedObjectsClient.delete('index-pattern', indexPattern.id);
}
async delete(indexPatternId: string) {
indexPatternCache.clear(indexPatternId);
return this.savedObjectsClient.delete('index-pattern', indexPatternId);
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/plugins/data/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -988,8 +988,6 @@ export class IndexPattern implements IIndexPattern {
// (undocumented)
create(allowOverride?: boolean): Promise<string | false>;
// (undocumented)
destroy(): Promise<{}> | undefined;
// (undocumented)
_fetchFields(): Promise<void>;
// (undocumented)
fieldFormatMap: any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ export class IndexPatternsTestPlugin
const [, { data }] = await core.getStartServices();
const id = (req.params as Record<string, string>).id;
const service = await data.indexPatterns.indexPatternsServiceFactory(req);
const ip = await service.get(id);
await ip.destroy();
await service.delete(id);
return res.ok();
}
);
Expand Down

0 comments on commit 0bb7507

Please sign in to comment.