Comments (3)
When add a new filter to a saved search, then refresh the url: If saved object id exist, in the following effect
useEffect(() => {
(async () => {
const savedSearchInstance = await getSavedSearchById(savedSearchId);
setSavedSearch(savedSearchInstance);
// sync initial app filters from savedObject to filterManager
const filters = cloneDeep(savedSearchInstance.searchSource.getOwnField('filter'));
const query = savedSearchInstance.searchSource.getField('query') || data.query.queryString.getDefaultQuery();
const actualFilters = [];
if (filters !== undefined) {
const result = typeof filters === 'function' ? filters() : filters;
if (result !== undefined) {
actualFilters.push(...(Array.isArray(result) ? result : [result]));
}
}
filterManager.setAppFilters(actualFilters);
data.query.queryString.setQuery(query);
if (savedSearchInstance !== null && savedSearchInstance !== void 0 && savedSearchInstance.id) {
chrome.recentlyAccessed.add(savedSearchInstance.getFullPath(), savedSearchInstance.title, savedSearchInstance.id);
}
})();
return () => {};
// This effect will only run when getSavedSearchById is called, which is
// only called when the component is first mounted.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [getSavedSearchById, savedSearchId]);
data.query.queryString.setQuery(query);
will reset the filter using the saved filter in data service which will wrap out the data filter.
from opensearch-dashboards.
We could modify the logic in use_search to
useEffect(() => {
(async () => {
const savedSearchInstance = await getSavedSearchById(savedSearchId);
setSavedSearch(savedSearchInstance);
// sync initial app filters from savedObject to filterManager
const savedFilters = cloneDeep(savedSearchInstance.searchSource.getOwnField('filter'));
const savedQuery = savedSearchInstance.searchSource.getField('query');
// data.query.queryString.getDefaultQuery();
const actualFilters = [];
// Load the filters from the filter manager
const filterManagerFilters = data.query.filterManager.getFilters();
const queryStringQuery = data.query.queryString.getDefaultQuery();
// Determine which set of filters to use
let selectedFilters;
let selectedQuery: Query | undefined;
if (!filterManagerFilters || filterManagerFilters.length === 0) {
// when first load, use saved object's filters
selectedFilters = savedFilters;
selectedQuery = savedQuery;
} else {
// allow update filters after load a saved search
selectedFilters = filterManagerFilters;
selectedQuery = queryStringQuery;
}
if (selectedFilters !== undefined) {
const result = typeof selectedFilters === 'function' ? selectedFilters() : selectedFilters;
if (result !== undefined) {
actualFilters.push(...(Array.isArray(result) ? result : [result]));
}
}
filterManager.setAppFilters(actualFilters);
data.query.queryString.setQuery(selectedQuery);
if (savedSearchInstance?.id) {
chrome.recentlyAccessed.add(
savedSearchInstance.getFullPath(),
savedSearchInstance.title,
savedSearchInstance.id
);
}
})();
return () => {};
// This effect will only run when getSavedSearchById is called, which is
// only called when the component is first mounted.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [getSavedSearchById, savedSearchId]);
- when we load the url with id, filterManager should be empty. we just need to capture the saved filter.
- when we modify the filter later, we need to capture the filter from data service.
from opensearch-dashboards.
The query should have the same issue and we need to modify it as well
from opensearch-dashboards.
Related Issues (20)
- Code Complete: Test within the distribution, ensuring integration, backwards compatibility, and performance tests pass.
- [Proposal][Vega] Support PPL in vega visualization HOT 2
- [BUG] Bad format with nested objects HOT 2
- [BUG] Sample TSVB visualization is not rendering data with data source HOT 1
- [BUG] sample vis builder visualizations fail to render with data source HOT 2
- [Meta] [2.15] Workspace features and enhancement
- [AUTOCUT] Distribution Build Failed for OpenSearch-Dashboards-2.15.0 HOT 3
- [BUG] OSD does not support custom x-opaque-id HOT 2
- [Discover-Next] Meta Issue for Bugs, Updates, Fast-Follows HOT 2
- [Meta][2.15 Release] OpenSearch Dashboards Visualization+Discover+CVEs+Maintenance PRs sign-off
- [BUG] Buckets cannot be removed when data table columns are sorted by metrics
- [Meta][2.16] Support Multiple Data Source in OpenSearch Dashboards Plugins
- [BUG] Duplicate timestamp column in legacy table view surrounding document
- [Meta][2.16] Discover Bug Fix / Enhancement Tracking Issue
- [Meta][2.16] VisBuilder Integration and Bug Fix tracking issue HOT 1
- [BUG] is filter not working with numeric Scripted fields HOT 3
- [BUG][Discover] The sort, remove column and move column are not clickable
- [RFC] Alerting Comments
- [MDS] UI polishment for MDS support of Timeline visualization
- Problem with discover in dashboards HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opensearch-dashboards.