Skip to content

Commit 13954f7

Browse files
committed
Merge branch 'master' into ml-fix-list-action-buttons
2 parents d7cf579 + 77e4019 commit 13954f7

File tree

268 files changed

+13773
-3527
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

268 files changed

+13773
-3527
lines changed

docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.destroy.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ export declare class IndexPattern implements IIndexPattern
3939
| [\_fetchFields()](./kibana-plugin-plugins-data-public.indexpattern._fetchfields.md) | | |
4040
| [addScriptedField(name, script, fieldType, lang)](./kibana-plugin-plugins-data-public.indexpattern.addscriptedfield.md) | | |
4141
| [create(allowOverride)](./kibana-plugin-plugins-data-public.indexpattern.create.md) | | |
42-
| [destroy()](./kibana-plugin-plugins-data-public.indexpattern.destroy.md) | | |
4342
| [getAggregationRestrictions()](./kibana-plugin-plugins-data-public.indexpattern.getaggregationrestrictions.md) | | |
4443
| [getComputedFields()](./kibana-plugin-plugins-data-public.indexpattern.getcomputedfields.md) | | |
4544
| [getFieldByName(name)](./kibana-plugin-plugins-data-public.indexpattern.getfieldbyname.md) | | |

docs/user/alerting/action-types/pre-configured-connectors.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ two out-of-the box connectors: <<slack-action-type, Slack>> and <<webhook-action
2828
my-slack1: <1>
2929
actionTypeId: .slack <2>
3030
name: 'Slack #xyz' <3>
31-
secrets: <4>
31+
secrets:
3232
webhookUrl: 'https://hooks.slack.com/services/abcd/efgh/ijklmnopqrstuvwxyz'
3333
webhook-service:
3434
actionTypeId: .webhook
3535
name: 'Email service'
36-
config:
36+
config: <4>
3737
url: 'https://email-alert-service.elastic.co'
3838
method: post
3939
headers:

src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ export class IndexPattern implements IIndexPattern {
224224
this.sourceFilters = spec.sourceFilters;
225225

226226
// ignoring this because the same thing happens elsewhere but via _.assign
227-
// @ts-ignore
227+
// @ts-expect-error
228228
this.fields = spec.fields || [];
229229
this.typeMeta = spec.typeMeta;
230230
this.fieldFormatMap = _.mapValues(fieldFormatMap, (mapping) => {
@@ -473,21 +473,8 @@ export class IndexPattern implements IIndexPattern {
473473
async create(allowOverride: boolean = false) {
474474
const _create = async (duplicateId?: string) => {
475475
if (duplicateId) {
476-
const duplicatePattern = new IndexPattern(duplicateId, {
477-
getConfig: this.getConfig,
478-
savedObjectsClient: this.savedObjectsClient,
479-
apiClient: this.apiClient,
480-
patternCache: this.patternCache,
481-
fieldFormats: this.fieldFormats,
482-
onNotification: this.onNotification,
483-
onError: this.onError,
484-
uiSettingsValues: {
485-
shortDotsEnable: this.shortDotsEnable,
486-
metaFields: this.metaFields,
487-
},
488-
});
489-
490-
await duplicatePattern.destroy();
476+
this.patternCache.clear(duplicateId);
477+
await this.savedObjectsClient.delete(savedObjectType, duplicateId);
491478
}
492479

493480
const body = this.prepBody();
@@ -634,11 +621,4 @@ export class IndexPattern implements IIndexPattern {
634621
toString() {
635622
return '' + this.toJSON();
636623
}
637-
638-
destroy() {
639-
if (this.id) {
640-
this.patternCache.clear(this.id);
641-
return this.savedObjectsClient.delete(savedObjectType, this.id);
642-
}
643-
}
644624
}

src/plugins/data/common/index_patterns/index_patterns/index_patterns.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ describe('IndexPatterns', () => {
5353
Array<SavedObject<any>>
5454
>
5555
);
56+
savedObjectsClient.delete = jest.fn(() => Promise.resolve({}) as Promise<any>);
5657

5758
indexPatterns = new IndexPatternsService({
5859
uiSettings: ({
@@ -98,4 +99,13 @@ describe('IndexPatterns', () => {
9899
await indexPatterns.getFields(['id', 'title'], true);
99100
expect(savedObjectsClient.find).toHaveBeenCalledTimes(3);
100101
});
102+
103+
test('deletes the index pattern', async () => {
104+
const id = '1';
105+
const indexPattern = await indexPatterns.get(id);
106+
107+
expect(indexPattern).toBeDefined();
108+
await indexPatterns.delete(id);
109+
expect(indexPattern).not.toBe(await indexPatterns.get(id));
110+
});
101111
});

src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,15 @@ export class IndexPatternsService {
228228

229229
return indexPattern.init();
230230
}
231+
232+
/**
233+
* Deletes an index pattern from .kibana index
234+
* @param indexPatternId: Id of kibana Index Pattern to delete
235+
*/
236+
async delete(indexPatternId: string) {
237+
indexPatternCache.clear(indexPatternId);
238+
return this.savedObjectsClient.delete('index-pattern', indexPatternId);
239+
}
231240
}
232241

233242
export type IndexPatternsContract = PublicMethodsOf<IndexPatternsService>;

src/plugins/data/public/public.api.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -988,8 +988,6 @@ export class IndexPattern implements IIndexPattern {
988988
// (undocumented)
989989
create(allowOverride?: boolean): Promise<string | false>;
990990
// (undocumented)
991-
destroy(): Promise<{}> | undefined;
992-
// (undocumented)
993991
_fetchFields(): Promise<void>;
994992
// (undocumented)
995993
fieldFormatMap: any;

src/plugins/index_pattern_management/public/components/edit_index_pattern/edit_index_pattern.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,14 @@ const confirmModalOptionsDelete = {
8383

8484
export const EditIndexPattern = withRouter(
8585
({ indexPattern, history, location }: EditIndexPatternProps) => {
86-
const { uiSettings, indexPatternManagementStart, overlays, savedObjects, chrome } = useKibana<
87-
IndexPatternManagmentContext
88-
>().services;
86+
const {
87+
uiSettings,
88+
indexPatternManagementStart,
89+
overlays,
90+
savedObjects,
91+
chrome,
92+
data,
93+
} = useKibana<IndexPatternManagmentContext>().services;
8994
const [fields, setFields] = useState<IndexPatternField[]>(indexPattern.getNonScriptedFields());
9095
const [conflictedFields, setConflictedFields] = useState<IndexPatternField[]>(
9196
indexPattern.fields.filter((field) => field.type === 'conflict')
@@ -138,10 +143,11 @@ export const EditIndexPattern = withRouter(
138143
uiSettings.set('defaultIndex', otherPatterns[0].id);
139144
}
140145
}
141-
142-
Promise.resolve(indexPattern.destroy()).then(function () {
143-
history.push('');
144-
});
146+
if (indexPattern.id) {
147+
Promise.resolve(data.indexPatterns.delete(indexPattern.id)).then(function () {
148+
history.push('');
149+
});
150+
}
145151
}
146152

147153
overlays.openConfirm('', confirmModalOptionsDelete).then((isConfirmed) => {

test/plugin_functional/plugins/index_patterns/server/plugin.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ export class IndexPatternsTestPlugin
9696
const [, { data }] = await core.getStartServices();
9797
const id = (req.params as Record<string, string>).id;
9898
const service = await data.indexPatterns.indexPatternsServiceFactory(req);
99-
const ip = await service.get(id);
100-
await ip.destroy();
99+
await service.delete(id);
101100
return res.ok();
102101
}
103102
);

x-pack/index.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,7 @@ import { monitoring } from './legacy/plugins/monitoring';
99
import { security } from './legacy/plugins/security';
1010
import { beats } from './legacy/plugins/beats_management';
1111
import { spaces } from './legacy/plugins/spaces';
12-
import { ingestManager } from './legacy/plugins/ingest_manager';
1312

1413
module.exports = function (kibana) {
15-
return [
16-
xpackMain(kibana),
17-
monitoring(kibana),
18-
spaces(kibana),
19-
security(kibana),
20-
ingestManager(kibana),
21-
beats(kibana),
22-
];
14+
return [xpackMain(kibana), monitoring(kibana), spaces(kibana), security(kibana), beats(kibana)];
2315
};

0 commit comments

Comments
 (0)