Skip to content

Commit

Permalink
Revert "Saved object datasource backward compatibility fixes (opensea…
Browse files Browse the repository at this point in the history
…rch-project#1208) (opensearch-project#1210)"

This reverts commit 467a0b3.

Signed-off-by: Eric <menwe@amazon.com>
  • Loading branch information
mengweieric committed Nov 8, 2023
1 parent 415e73c commit 40d21ab
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 40 deletions.
2 changes: 1 addition & 1 deletion public/components/common/search/sql_search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ export const DirectSearch = (props: any) => {
dispatch(
changeQuery({ tabId, query: { [RAW_QUERY]: tempQuery.replaceAll(PPL_NEWLINE_REGEX, '') } })
);
dispatch(updateSearchMetaData({ tabId, data: { isPolling: true, lang } }));
});
dispatch(updateSearchMetaData({ tabId, data: { isPolling: true, lang } }));
const sessionId = getAsyncSessionId();
const requestPayload = {
lang: lang.toLowerCase(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ import { coreRefs } from '../../../framework/core_refs';
import { UsePolling } from '../../../components/hooks/use_polling';
import { getAsyncSessionId, setAsyncSessionId } from '../../../../common/utils/query_session_utils';
import { get as getObjValue } from '../../../../common/utils/shared';
import {
ASYNC_POLLING_INTERVAL,
DEFAULT_DATA_SOURCE_NAME,
DEFAULT_DATA_SOURCE_TYPE,
} from '../../../../common/constants/data_sources';
import { ASYNC_POLLING_INTERVAL } from '../../../../common/constants/data_sources';

enum DIRECT_DATA_SOURCE_TYPES {
DEFAULT_INDEX_PATTERNS = 'DEFAULT_INDEX_PATTERNS',
Expand Down Expand Up @@ -322,31 +318,6 @@ export class ExplorerSavedObjectLoader extends SavedObjectLoaderBase implements
return true;
};

loadWODataSource = ({ tabId }: { tabId: string }) => {
const { dispatch, batch } = this.dispatchers;
const { fetchData } = this.loadContext;

// default datasource
batch(() => {
dispatch(
updateSearchMetaData({
tabId,
data: {
datasources: [
{
name: DEFAULT_DATA_SOURCE_NAME,
type: DEFAULT_DATA_SOURCE_TYPE,
label: DEFAULT_DATA_SOURCE_NAME,
value: DEFAULT_DATA_SOURCE_NAME,
},
],
},
})
);
fetchData();
});
};

loadDefaultIndexPattern = () => {
const { fetchData } = this.loadContext;
fetchData();
Expand Down Expand Up @@ -409,15 +380,7 @@ export class ExplorerSavedObjectLoader extends SavedObjectLoaderBase implements

async loadDataFromSavedObject(objectData, tabId: string) {
const dataSources = parseStringDataSource(objectData.data_sources, this.notifications);

// backward compatibility for saved object that doesn't contain datasource
if (dataSources.length === 0) {
this.loadWODataSource({ tabId });
return;
}

// saved object contains data source information
if (dataSources[0].type) {
if (dataSources.length > 0 && dataSources[0].type) {
switch (dataSources[0].type) {
case DIRECT_DATA_SOURCE_TYPES.DEFAULT_INDEX_PATTERNS:
this.loadDefaultIndexPattern();
Expand Down

0 comments on commit 40d21ab

Please sign in to comment.