Skip to content

Commit

Permalink
modify type to simple dataset
Browse files Browse the repository at this point in the history
Signed-off-by: abbyhu2000 <[email protected]>
  • Loading branch information
abbyhu2000 committed Aug 15, 2024
1 parent c0178df commit 6dd8a42
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/plugins/data/public/query/query_string/query_history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { DataStorage } from 'src/plugins/data/common';
import { DataStorage, SimpleDataSet } from 'src/plugins/data/common';
import { BehaviorSubject } from 'rxjs';
import { Query, TimeRange } from '../..';

Expand Down Expand Up @@ -35,7 +35,7 @@ export class QueryHistory {
return () => subscription.unsubscribe();

Check warning on line 35 in src/plugins/data/public/query/query_string/query_history.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/data/public/query/query_string/query_history.ts#L34-L35

Added lines #L34 - L35 were not covered by tests
}

addQueryToHistory(dataSet: string, query: Query, dateRange?: TimeRange) {
addQueryToHistory(dataSet: SimpleDataSet, query: Query, dateRange?: TimeRange) {
const keys = this.getHistoryKeys();
keys.splice(0, 500); // only maintain most recent X;
keys.forEach((key) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import { BehaviorSubject } from 'rxjs';
import { skip } from 'rxjs/operators';
import { CoreStart } from 'opensearch-dashboards/public';
import { DataStorage, Query, TimeRange, UI_SETTINGS } from '../../../common';
import { DataStorage, Query, SimpleDataSet, TimeRange, UI_SETTINGS } from '../../../common';
import { createHistory, QueryHistory } from './query_history';

export class QueryStringManager {
Expand Down Expand Up @@ -104,7 +104,7 @@ export class QueryStringManager {
};

// Todo: update this function to use the Query object when it is udpated, Query object should include time range and dataset
public addToQueryHistory(dataSet: string, query: Query, timeRange?: TimeRange) {
public addToQueryHistory(dataSet: SimpleDataSet, query: Query, timeRange?: TimeRange) {
if (query.query) {
this.queryHistory.addQueryToHistory(dataSet, query, timeRange);

Check warning on line 109 in src/plugins/data/public/query/query_string/query_string_manager.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/data/public/query/query_string/query_string_manager.ts#L109

Added line #L109 was not covered by tests
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { ReactElement, useEffect, useState } from 'react';
import React from 'react';
import { EuiButtonEmpty, EuiText, EuiTourStep } from '@elastic/eui';
import { i18n } from '@osd/i18n';
import { DataStorage } from 'src/plugins/data/common';
import { DataStorage } from '../../../common';

const NO_DATA_POPOVER_STORAGE_KEY = 'data.noDataPopover';

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/public/ui/search_bar/search_bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ class SearchBarUI extends Component<SearchBarProps, State> {
const dataSet = this.dataSetService.getDataSet();
if (dataSet && queryAndDateRange.query) {
this.queryStringService.addToQueryHistory(
dataSet.id,
dataSet,
queryAndDateRange.query,
queryAndDateRange.dateRange
);
Expand Down

0 comments on commit 6dd8a42

Please sign in to comment.