-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should respect pinned filters #13019
Should respect pinned filters #13019
Conversation
const responseHandler = getHandler(responseHandlers, $scope.vis.type.responseHandler); | ||
|
||
$scope.fetch = _.debounce(function () { | ||
.directive('visualize', function (Notifier, Private, timefilter, getAppState) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems github messed up this comparison ? shows whole file is different where only a couple of lines changed ....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure. maybe a lintroller thing..
const requestHandlers = Private(VisRequestHandlersRegistryProvider); | ||
const responseHandlers = Private(VisResponseHandlersRegistryProvider); | ||
const ResizeChecker = Private(ResizeCheckerProvider); | ||
const queryFilter = Private(FilterBarQueryFilterProvider); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am not really sure about using queryFilter here ...
what about using globalState service to retrieve the filters from there ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
queryFilter is more more specific, but much easier to use .... appState + globalState are more generic .... but we shouldn't probably use them directly if we already have abstractions on top of it.
src/ui/public/visualize/visualize.js
Outdated
|
||
// searchSource is only there for courier request handler | ||
requestHandler($scope.vis, $scope.appState, $scope.uiState, $scope.savedObj.searchSource) | ||
requestHandler($scope.vis, $scope.appState, $scope.uiState, $scope.savedObj.searchSource, queryFilter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put the queryFilter before searchSource (searchSource is kind of BWC parameter which only courier request handler should use
also we should get rid of appState (query filter can retrieve the query and the filters right ?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if we should. appState has that .linked
flag we require. would keep this a spot fix for now.
src/ui/public/visualize/visualize.js
Outdated
if (keys[0] === 'uiState') { | ||
$scope.$on('fetch', reload); | ||
queryFilter.on('update', () => { | ||
$scope.fetch(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to wrap this function ....
queryFilter.on('update', $scope.fetch);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- please change the requestHandler as mentioned above
- other requestHandlers need to be updated as well (timelion, tsvb)
…ges in the app-state
86e3ba0
to
a807147
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM,
but this removes some of the work we tried to do with refactor. When reusing <visualize> you now no longer have control over filters (<visualize> is tightly coupled to queryFilter)
Closes #13011.
Not sure if this is the best solution, but wanted something up that we can use to discuss around.
The problem is that Visualize is not refreshing when there are changes in the filters of the
globalState
. A pinned filter is a global filter, and not present in theappState
, so when we pin the filter, it does not create a refresh, and neither are they applied..the
queryFilter
object provides a listener on both fitlers in the app and global state, and provides access to both the filter and the query object.It may be worth considering just to remove the usage of
appState
in the courier request handler and visualize-directirve to retrieve query/filters and usequeryFilters
for that purpose instead. But not sure if that is going to have any other impact.