Skip to content

Commit

Permalink
update schema and README
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Nov 20, 2020
1 parent 0235025 commit 7b6d76e
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 1 deletion.
52 changes: 51 additions & 1 deletion x-pack/plugins/saved_objects_tagging/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,53 @@
# SavedObjectsTagging

Add tagging capability to saved objects
Add tagging capability to saved objects

## Integrating tagging on a new object type

In addition to use the UI api to plug the tagging feature in your application, there is a couple
things that needs to be done on the server:

### Add read-access to the `tag` SO type to your feature's capabilities

In order to be able to fetch the tags assigned to an object, the user must have read permission
for the `tag` saved object type. Which is why all features relying on SO tagging must update
their capabilities.

```typescript
features.registerKibanaFeature({
id: 'myFeature',
// ...
privileges: {
all: {
// ...
savedObject: {
all: ['some-type'],
read: ['tag'], // <-- HERE
},
},
read: {
// ...
savedObject: {
all: [],
read: ['some-type', 'tag'], // <-- AND HERE
},
},
},
});
```

### Update the SOT telemetry collector schema to add the new type

The schema is located here: `x-pack/plugins/saved_objects_tagging/server/usage/schema.ts`. You
just need to add the name of the SO type you are adding.

```ts
export const tagUsageCollectorSchema: MakeSchemaFrom<TaggingUsageData> = {
// ...
types: {
dashboard: perTypeSchema,
visualization: perTypeSchema,
// <-- add your type here
},
};
```
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ export const tagUsageCollectorSchema: MakeSchemaFrom<TaggingUsageData> = {
types: {
dashboard: perTypeSchema,
visualization: perTypeSchema,
map: perTypeSchema,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -3165,6 +3165,16 @@
"type": "integer"
}
}
},
"map": {
"properties": {
"usedTags": {
"type": "integer"
},
"taggedObjects": {
"type": "integer"
}
}
}
}
}
Expand Down

0 comments on commit 7b6d76e

Please sign in to comment.