Skip to content

Commit dc8f19c

Browse files
committed
added saved object type
1 parent 688778f commit dc8f19c

4 files changed

Lines changed: 25 additions & 4 deletions

File tree

examples/embeddable_examples/public/todo/combo/todo_combo_embeddable.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {
3030
import { TodoSavedObjectAttributes } from '../../../common';
3131
import { TodoComboEmbeddableComponent } from './todo_combo_component';
3232

33-
export const TODO_COMBO_EMBEDDABLE = 'TODO_COMBO_EMBEDDABLE';
33+
export const TODO_COMBO_EMBEDDABLE = 'todo_Combo';
3434

3535
export type TodoComboInput = TodoComboValInput | TodoComboRefInput;
3636

@@ -91,7 +91,7 @@ export class TodoComboEmbeddable extends Embeddable<TodoComboInput, TodoComboOut
9191
if (this.savedObjectId !== this.input.savedObjectId) {
9292
this.savedObjectId = this.input.savedObjectId;
9393
const todoSavedObject = await this.savedObjectsClient.get<TodoSavedObjectAttributes>(
94-
'todo',
94+
this.type,
9595
this.input.savedObjectId
9696
);
9797
savedAttributes = todoSavedObject?.attributes;

examples/embeddable_examples/public/todo/combo/todo_combo_embeddable_factory.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export class TodoComboEmbeddableFactory
103103
};
104104
if (Math.random() > 0.5) {
105105
const { savedObjectsClient } = await this.getStartServices();
106-
const savedObject = await savedObjectsClient.create('todo', attributes);
106+
const savedObject = await savedObjectsClient.create(this.type, attributes);
107107
return {
108108
inputType: 'reference',
109109
savedObjectId: savedObject.id,

examples/embeddable_examples/server/plugin.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@
1818
*/
1919

2020
import { Plugin, CoreSetup, CoreStart } from 'kibana/server';
21-
import { todoSavedObject } from './todo_saved_object';
21+
import { todoSavedObject, todoComboSavedObject } from './todo_saved_object';
2222

2323
export class EmbeddableExamplesPlugin implements Plugin {
2424
public setup(core: CoreSetup) {
2525
core.savedObjects.registerType(todoSavedObject);
26+
core.savedObjects.registerType(todoComboSavedObject);
2627
}
2728

2829
public start(core: CoreStart) {}

examples/embeddable_examples/server/todo_saved_object.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,23 @@ export const todoSavedObject: SavedObjectsType = {
3838
},
3939
migrations: {},
4040
};
41+
42+
export const todoComboSavedObject: SavedObjectsType = {
43+
name: 'todo_Combo',
44+
hidden: false,
45+
namespaceType: 'agnostic',
46+
mappings: {
47+
properties: {
48+
title: {
49+
type: 'keyword',
50+
},
51+
task: {
52+
type: 'text',
53+
},
54+
icon: {
55+
type: 'keyword',
56+
},
57+
},
58+
},
59+
migrations: {},
60+
};

0 commit comments

Comments
 (0)