-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[data views] Implement content management api #153733
Closed
Closed
Changes from 11 commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
afa704e
initial changes, mostly working...why doesn't find work?
mattkime f9a6231
Merge branch 'main' into data_views_content_mgmt
mattkime 90a3672
fix find request
mattkime 0e2a92d
fix get data view
mattkime c6b79f2
type improvement
mattkime 61f01c7
type fixes
mattkime 3547bfd
fix data view creation
mattkime 76c479d
fix tests
mattkime 931fa7f
Merge branch 'main' into data_views_content_mgmt
mattkime 4019be6
fix saved search expression
mattkime d5c3885
fix mock
mattkime d1833f5
add version update support
mattkime 0d6e1e5
fix data view find functionality
mattkime 036b377
Merge branch 'main' into data_views_content_mgmt
mattkime 07620ad
allow creating with specific id
mattkime 2285966
Merge branch 'data_views_content_mgmt' of github.com:mattkime/kibana …
mattkime e1c6f9e
Merge branch 'main' into data_views_content_mgmt
mattkime 497f042
fix jest, try to fix not found error type
mattkime 1ca4968
attempt at fixing how errors are thrown
mattkime 0cda290
revert error chan
mattkime 6390394
another try at a front end specific get error
mattkime e0a252c
yet another attempt at getting the desired error on missing data view
mattkime 4cac392
Merge branch 'main' into data_views_content_mgmt
mattkime 003f508
Merge branch 'main' into data_views_content_mgmt
mattkime 7d3bf15
fix circular dependency
mattkime d601dbd
abstract types
mattkime 9e06b50
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine 83b1ff5
[CI] Auto-commit changed files from 'node scripts/generate codeowners'
kibanamachine 86e3a85
fix types
mattkime 8daec60
Merge branch 'content_management_api_so_type_abstraction' of github.c…
mattkime aea2173
remove comment
mattkime 28548f7
fix partial types
mattkime 44ca8ee
add readme content
mattkime e1de41a
Merge branch 'content_management_api_so_type_abstraction' into data_v…
mattkime 70799e3
use shared types
mattkime 42e1d38
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine 13077c3
integrate abstract types and data view storage
mattkime 6d95210
Merge branch 'data_views_content_mgmt' of github.com:mattkime/kibana …
mattkime 97490b3
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine 8d9d753
fix jest test
mattkime aa9f5b4
fix saved search and version handling
mattkime caa7ffa
Merge branch 'data_views_content_mgmt' of github.com:mattkime/kibana …
mattkime cf972da
fix saved search
mattkime 12b19bc
fix tabify test
mattkime a1f0c60
fix test
mattkime 333a8bb
correctly specify which fields to query
mattkime 10830bf
correctly specify which fields to query
mattkime 6469d33
cleanup
mattkime e658855
cleanup
mattkime fc0fe17
cleanup
mattkime b0c3849
remove noisy test changes for fields attr
mattkime 3b55776
restore test
mattkime File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
13 changes: 13 additions & 0 deletions
13
.../edit_index_pattern/indexed_fields_table/__snapshots__/indexed_fields_table.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
14 changes: 14 additions & 0 deletions
14
src/plugins/data_views/common/content_management/constants.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
/** | ||
* Data view saved object version. | ||
*/ | ||
export const LATEST_VERSION = 1; | ||
|
||
export const DataViewContentType = 'index-pattern'; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
export { LATEST_VERSION } from './constants'; | ||
|
||
export type { | ||
DataViewSavedObject, | ||
DataViewGetIn, | ||
DataViewGetOut, | ||
DataViewCreateIn, | ||
DataViewCreateOut, | ||
CreateOptions, | ||
DataViewUpdateIn, | ||
DataViewUpdateOut, | ||
UpdateOptions, | ||
DataViewDeleteIn, | ||
DataViewDeleteOut, | ||
DataViewSearchIn, | ||
DataViewSearchOut, | ||
DataViewSearchQuery, | ||
} from './types'; | ||
|
||
export { DataViewContentType } from './constants'; |
115 changes: 115 additions & 0 deletions
115
src/plugins/data_views/common/content_management/types.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import type { | ||
SavedObject, | ||
SavedObjectReference, | ||
SavedObjectsResolveResponse, | ||
SavedObjectsUpdateResponse, | ||
} from '@kbn/core-saved-objects-api-server'; | ||
import type { SavedObjectsMigrationVersion } from '@kbn/core-saved-objects-common'; | ||
|
||
import type { | ||
GetIn, | ||
CreateIn, | ||
SearchIn, | ||
UpdateIn, | ||
DeleteIn, | ||
} from '@kbn/content-management-plugin/common'; | ||
|
||
import { DataViewAttributes } from '../types'; | ||
import { DataViewContentType } from './constants'; | ||
|
||
interface Reference { | ||
type: string; | ||
id: string; | ||
} | ||
|
||
export type DataViewSavedObject = SavedObject<DataViewAttributes>; | ||
|
||
// ----------- GET -------------- | ||
|
||
export type DataViewGetIn = GetIn<typeof DataViewContentType>; | ||
|
||
export interface DataViewGetOut { | ||
savedObject: SavedObjectsResolveResponse<DataViewAttributes>['saved_object']; | ||
outcome: SavedObjectsResolveResponse['outcome']; | ||
aliasTargetId: SavedObjectsResolveResponse['alias_target_id']; | ||
aliasPurpose: SavedObjectsResolveResponse['alias_purpose']; | ||
} | ||
|
||
// ----------- CREATE -------------- | ||
|
||
export interface CreateOptions { | ||
/** If a document with the given `id` already exists, overwrite it's contents (default=false). */ | ||
overwrite?: boolean; | ||
migrationVersion?: SavedObjectsMigrationVersion; | ||
/** A semver value that is used when upgrading objects between Kibana versions. */ | ||
coreMigrationVersion?: string; | ||
/** Array of referenced saved objects. */ | ||
references?: SavedObjectReference[]; | ||
} | ||
|
||
export type DataViewCreateIn = CreateIn< | ||
typeof DataViewContentType, | ||
DataViewAttributes, | ||
CreateOptions | ||
>; | ||
|
||
export type DataViewCreateOut = DataViewSavedObject; | ||
|
||
// ----------- UPDATE -------------- | ||
|
||
export interface UpdateOptions { | ||
/** Array of referenced saved objects. */ | ||
references?: SavedObjectReference[]; | ||
} | ||
|
||
export type DataViewUpdateIn = UpdateIn< | ||
typeof DataViewContentType, | ||
DataViewAttributes, | ||
UpdateOptions | ||
>; | ||
|
||
export type DataViewUpdateOut = SavedObjectsUpdateResponse<DataViewAttributes>; | ||
|
||
// ----------- DELETE -------------- | ||
|
||
export type DataViewDeleteIn = DeleteIn<typeof DataViewContentType>; | ||
|
||
export interface DataViewDeleteOut { | ||
status: 'success'; | ||
} | ||
|
||
// ----------- SEARCH -------------- | ||
|
||
export interface DataViewSearchQuery { | ||
search?: string; | ||
fields?: string[]; | ||
searchFields?: string[]; | ||
perPage?: number; | ||
page?: number; | ||
defaultSearchOperator?: 'AND' | 'OR'; | ||
hasReference?: Reference | Reference[]; | ||
hasNoReference?: Reference | Reference[]; | ||
} | ||
|
||
export type DataViewSearchIn = SearchIn<typeof DataViewContentType, DataViewSearchQuery>; | ||
|
||
export interface DataViewSearchOut { | ||
/** current page in results*/ | ||
page: number; | ||
/** number of results per page */ | ||
perPage: number; | ||
/** total number of results */ | ||
total: number; | ||
/** Array of simple saved objects */ | ||
savedObjects: DataViewSavedObject[]; | ||
/** aggregations from the search query */ | ||
aggregations?: unknown; // TODO: Check if used in Maps | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are explicitely declaring that
DataViewCreateIn
takesCreateOptions
. You now have to pass it in saved_objects_client_wrapper.ts L91