added index attribute to search data to differentiate entities (#414)

This commit is contained in:
Sachin Chaurasiya 2021-09-07 11:26:51 +05:30 committed by GitHub
parent 657962bc4f
commit f0a7ef50f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 5 deletions

View File

@ -20,7 +20,6 @@ import { FormatedTableData } from 'Models';
import PropTypes from 'prop-types';
import React, { ReactNode } from 'react';
import { PAGE_SIZE } from '../../constants/constants';
import { SearchIndex } from '../../enums/search.enum';
import { pluralize } from '../../utils/CommonUtils';
import {
getOwnerFromId,
@ -43,7 +42,6 @@ type SearchedDataProp = {
showResultCount?: boolean;
searchText?: string;
showOnboardingTemplate?: boolean;
indexType?: string;
};
const SearchedData: React.FC<SearchedDataProp> = ({
children,
@ -56,7 +54,6 @@ const SearchedData: React.FC<SearchedDataProp> = ({
searchText,
totalValue,
fetchLeftPanel,
indexType = SearchIndex.TABLE,
}: SearchedDataProp) => {
const highlightSearchResult = () => {
return data.map((table, index) => {
@ -73,7 +70,7 @@ const SearchedData: React.FC<SearchedDataProp> = ({
<TableDataCard
description={description}
fullyQualifiedName={table.fullyQualifiedName}
indexType={indexType}
indexType={table.index}
name={name}
owner={getOwnerFromId(table.owner)?.name}
serviceType={table.serviceType || '--'}

View File

@ -212,6 +212,7 @@ declare module 'Models' {
description: string[];
table_name: string[];
};
index: string;
};
export type NewUser = {

View File

@ -484,7 +484,6 @@ const ExplorePage: React.FC = (): React.ReactElement => {
currentPage={currentPage}
data={data}
fetchLeftPanel={fetchLeftPanel}
indexType={searchIndex}
isLoading={isLoading}
paginate={paginate}
searchText={searchText}

View File

@ -6,6 +6,7 @@ import { getRelativeTime } from './TimeUtils';
export const formatDataResponse = (hits) => {
const formattedData = hits.map((hit) => {
const newData = {};
newData.index = hit._index;
newData.id =
hit._source.table_id || hit._source.topic_id || hit._source.dashboard_id;
newData.name =