Skip to content

Commit

Permalink
fix relationship search bar
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkime committed May 23, 2022
1 parent 916ddad commit 5c3b20f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ export interface EditIndexPatternProps extends RouteComponentProps {
indexPattern: DataView;
}

export interface SavedObjectRelationWithTitle extends SavedObjectRelation {
title: string;
}

const mappingAPILink = i18n.translate(
'indexPatternManagement.editIndexPattern.timeFilterLabel.mappingAPILink',
{
Expand Down Expand Up @@ -70,7 +74,7 @@ export const EditIndexPattern = withRouter(
);
const [defaultIndex, setDefaultIndex] = useState<string>(uiSettings.get('defaultIndex'));
const [tags, setTags] = useState<any[]>([]);
const [relationships, setRelationships] = useState<SavedObjectRelation[]>([]);
const [relationships, setRelationships] = useState<SavedObjectRelationWithTitle[]>([]);
const [allowedTypes, setAllowedTypes] = useState<SavedObjectManagementTypeInfo[]>([]);

useEffect(() => {
Expand All @@ -87,7 +91,7 @@ export const EditIndexPattern = withRouter(
savedObjectsManagement
.getRelationships(DATA_VIEW_SAVED_OBJECT_TYPE, indexPattern.id!, allowedAsString)
.then((resp) => {
setRelationships(resp.relations);
setRelationships(resp.relations.map((r) => ({ ...r, title: r.meta.title! })));
});
}, [savedObjectsManagement, indexPattern, allowedTypes]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import React, { useState } from 'react';
import React from 'react';
import {
EuiInMemoryTable,
HorizontalAlignment,
Expand Down Expand Up @@ -63,14 +63,6 @@ export const RelationshipsTable = ({
relationships: SavedObjectRelation[];
allowedTypes: SavedObjectManagementTypeInfo[];
}) => {
const [query, setQuery] = useState('');

const handleOnChange = ({ queryText, error }: { queryText: string; error: unknown }) => {
if (!error) {
setQuery(queryText);
}
};

const columns = [
{
field: 'type',
Expand All @@ -94,7 +86,7 @@ export const RelationshipsTable = ({
},
},
{
field: 'meta.title',
field: 'title',
name: titleFieldName,
description: titleFieldDescription,
dataType: 'string' as EuiTableDataType,
Expand Down

0 comments on commit 5c3b20f

Please sign in to comment.