mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Removes FindQueryHTTP['fields'] option in Saved Objects Management (#152306)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
124b5bee90
commit
527417590f
7 changed files with 5 additions and 24 deletions
|
@ -129,13 +129,6 @@ export interface FindQueryHTTP {
|
|||
sortOrder?: FindSortOrderHTTP;
|
||||
hasReference?: ReferenceHTTP | ReferenceHTTP[];
|
||||
hasReferenceOperator?: FindSearchOperatorHTTP;
|
||||
/**
|
||||
* It is not clear who might be using this API option, the SOM UI only ever passes in "id" here.
|
||||
*
|
||||
* TODO: Determine use. If not in use we should remove this option. If in use we must deprecate and eventually
|
||||
* remove.
|
||||
*/
|
||||
fields?: string | string[];
|
||||
}
|
||||
|
||||
export interface FindResponseHTTP {
|
||||
|
|
|
@ -236,7 +236,6 @@ export class SavedObjectsTable extends Component<SavedObjectsTableProps, SavedOb
|
|||
search: queryText ? `${queryText}*` : undefined,
|
||||
perPage,
|
||||
page: page + 1,
|
||||
fields: ['id'],
|
||||
type: searchTypes,
|
||||
sortField: sort?.field,
|
||||
sortOrder: sort?.direction,
|
||||
|
|
|
@ -46,9 +46,6 @@ export const registerFindRoute = (
|
|||
schema.oneOf([referenceSchema, schema.arrayOf(referenceSchema)])
|
||||
),
|
||||
hasReferenceOperator: searchOperatorSchema,
|
||||
fields: schema.oneOf([schema.string(), schema.arrayOf(schema.string())], {
|
||||
defaultValue: [],
|
||||
}),
|
||||
}),
|
||||
},
|
||||
},
|
||||
|
@ -58,7 +55,6 @@ export const registerFindRoute = (
|
|||
const { getClient, typeRegistry } = (await context.core).savedObjects;
|
||||
|
||||
const searchTypes = Array.isArray(query.type) ? query.type : [query.type];
|
||||
const includedFields = Array.isArray(query.fields) ? query.fields : [query.fields];
|
||||
|
||||
const importAndExportableTypes = searchTypes.filter((type) =>
|
||||
typeRegistry.isImportableAndExportable(type)
|
||||
|
@ -90,9 +86,6 @@ export const registerFindRoute = (
|
|||
saved_objects: savedObjects.map((so) => {
|
||||
const obj = injectMetaAttributes(so, managementService);
|
||||
const result = { ...obj, attributes: {} as Record<string, unknown> };
|
||||
for (const field of includedFields) {
|
||||
result.attributes[field] = (obj.attributes as Record<string, unknown>)[field];
|
||||
}
|
||||
return result;
|
||||
}),
|
||||
total: findResponse.total,
|
||||
|
|
|
@ -37,7 +37,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
|
||||
it('should return 200 with individual responses', async () =>
|
||||
await supertest
|
||||
.get('/api/kibana/management/saved_objects/_find?type=visualization&fields=title')
|
||||
.get('/api/kibana/management/saved_objects/_find?type=visualization')
|
||||
.expect(200)
|
||||
.then((resp: Response) => {
|
||||
expect(resp.body.saved_objects.map((so: { id: string }) => so.id)).to.eql([
|
||||
|
|
|
@ -27,7 +27,7 @@ export default function ({ getService }: PluginFunctionalProviderContext) {
|
|||
|
||||
it('returns empty response for importableAndExportable types', async () =>
|
||||
await supertest
|
||||
.get('/api/saved_objects/_find?type=test-hidden-importable-exportable&fields=title')
|
||||
.get('/api/saved_objects/_find?type=test-hidden-importable-exportable')
|
||||
.set('kbn-xsrf', 'true')
|
||||
.expect(200)
|
||||
.then((resp) => {
|
||||
|
@ -41,7 +41,7 @@ export default function ({ getService }: PluginFunctionalProviderContext) {
|
|||
|
||||
it('returns empty response for non importableAndExportable types', async () =>
|
||||
await supertest
|
||||
.get('/api/saved_objects/_find?type=test-hidden-non-importable-exportable&fields=title')
|
||||
.get('/api/saved_objects/_find?type=test-hidden-non-importable-exportable')
|
||||
.set('kbn-xsrf', 'true')
|
||||
.expect(200)
|
||||
.then((resp) => {
|
||||
|
|
|
@ -27,9 +27,7 @@ export default function ({ getService }: PluginFunctionalProviderContext) {
|
|||
);
|
||||
it('returns saved objects with importableAndExportable types', async () =>
|
||||
await supertest
|
||||
.get(
|
||||
'/api/kibana/management/saved_objects/_find?type=test-hidden-importable-exportable&fields=title'
|
||||
)
|
||||
.get('/api/kibana/management/saved_objects/_find?type=test-hidden-importable-exportable')
|
||||
.set('kbn-xsrf', 'true')
|
||||
.expect(200)
|
||||
.then((resp) => {
|
||||
|
|
|
@ -107,9 +107,7 @@ export default function ({ getService }: PluginFunctionalProviderContext) {
|
|||
describe('find', () => {
|
||||
it('returns saved objects registered as hidden from the http Apis', async () => {
|
||||
await supertest
|
||||
.get(
|
||||
`/api/kibana/management/saved_objects/_find?type=${hiddenFromHttpApisType.type}&fields=title`
|
||||
)
|
||||
.get(`/api/kibana/management/saved_objects/_find?type=${hiddenFromHttpApisType.type}`)
|
||||
.set('kbn-xsrf', 'true')
|
||||
.expect(200)
|
||||
.then((resp) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue