[Component templates] Add APIs#66684
Merged
alisonelizabeth merged 11 commits intoelastic:feature/component_templatesfrom May 27, 2020
Merged
[Component templates] Add APIs#66684alisonelizabeth merged 11 commits intoelastic:feature/component_templatesfrom
alisonelizabeth merged 11 commits intoelastic:feature/component_templatesfrom
Conversation
Contributor
|
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
Contributor
Author
|
@elasticmachine merge upstream |
sebelga
approved these changes
May 25, 2020
Contributor
sebelga
left a comment
There was a problem hiding this comment.
LGTM! Great job @alisonelizabeth
x-pack/plugins/index_management/server/routes/api/component_templates/get.ts
Show resolved
Hide resolved
| import { RouteDependencies } from '../../../types'; | ||
| import { addBasePath } from '../index'; | ||
|
|
||
| const bodySchema = schema.object({ |
Contributor
There was a problem hiding this comment.
I think it would be better to have a validate_schemas.ts like in index templates and import a common schema in both places (create and update).
|
|
||
| expect(testComponentTemplate).to.eql({ | ||
| name: COMPONENT_NAME, | ||
| component_template: { |
Contributor
There was a problem hiding this comment.
Or simply
component_template: COMPONENT😊
|
|
||
| expect(body).to.eql({ | ||
| itemsDeleted: [COMPONENT_ONE_NAME], | ||
| errors: [ |
Contributor
There was a problem hiding this comment.
I am not sure I would have gone in so much details to match the ES error in our tests. ES could change it anytime.
WDYT of testing just this
expect(body.itemsDeleted).to.eql([COMPONENT_ONE_NAME]);
expect(body.errors[0].name).to.eql(COMPONENT_DOES_NOT_EXIST);
expect(body.errors[0].error.msg).to.include('index_template_missing_exception');
Contributor
Author
There was a problem hiding this comment.
Great point! I updated the test.
…na into component_templates/apis
…na into component_templates/apis
Contributor
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds the server routes for the components templates UI.
Endpoints
GET /api/index_management/component_templatesFetch all component templates
GET /api/index_management/component_templates/<name>Fetch single component template
DELETE /api/index_management/component_templates/<names>Delete one or multiple component templates
POST /api/index_management/component_templatesCreate a new component template
Body args:
PUT /api/index_management/component_templates/<component_name>Update an existing component template
Body args: