-
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
[ML] Fixes Anomaly Explorer Swimlane race condition, adds tests. #22814
[ML] Fixes Anomaly Explorer Swimlane race condition, adds tests. #22814
Conversation
Pinging @elastic/ml-ui |
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
@@ -55,6 +56,15 @@ uiRoutes | |||
import { uiModules } from 'ui/modules'; | |||
const module = uiModules.get('apps/ml'); | |||
|
|||
function getDefaultViewBySwimlaneData() { | |||
return { | |||
'fieldName': '', |
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.
nit, keys shouldn't be quoted
cellData.laneLabels : $scope.getSelectedJobIds(); | ||
const influencers = getSelectionInfluencers(cellData); | ||
|
||
const listenerData = { jobIds, influencers, start: timerange.earliestMs, end: timerange.latestMs, cellData }; |
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.
nit, this could be broken over a few lines to make it more readable
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
💔 Build Failed |
retest |
💔 Build Failed |
💔 Build Failed |
1963c4e
to
5d2addb
Compare
💔 Build Failed |
…es while they are loading.
5d2addb
to
7ae6643
Compare
💔 Build Failed |
retest |
💔 Build Failed |
💔 Build Failed |
function loadDataForCharts(jobIds, influencers, earliestMs, latestMs) { | ||
const requestTime = new Date().getTime(); |
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 think lastRequestTime
could just be a counter that is incremented on each call
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.
Tested your latest changes and all selection events in the swimlane are behaving correctly for me (tested on Chrome and Edge).
💔 Build Failed |
💔 Build Failed |
} | ||
|
||
const newRequestCount = requestCount + 1; | ||
requestCount = newRequestCount; |
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.
nit, these two lines could be
const newRequestCount = ++requestCount;
💚 Build Succeeded |
…stic#22814) This PR addresses parts of elastic#22642: - It gets rid of the use of var that = this;. - dragSelect's action strings are moved to a constants file. - Adds jest tests for the ExplorerSwimlane component. This also fixes the following bugs: - The way we subscribe listeners to the events of the dragSelect library could result in the same event being triggered multiple times. This in turn could cause race conditions when on each event new data gets fetched but in between angular's scope gets updated and could end up in a non-intended way. The result of this were view-by swimlanes not updating correctly or anomaly charts showing non-related charts. This PR fixes it by filtering out consecutive swimlane click events. - When the angular based chart container wrapper directive gets destroyed/re-esetup when using the job pick, it missed unmounting the react component, it didn't trigger componentWillUnmount()and didn't unsubscribe from dragSelectListener.
) (#22923) This PR addresses parts of #22642: - It gets rid of the use of var that = this;. - dragSelect's action strings are moved to a constants file. - Adds jest tests for the ExplorerSwimlane component. This also fixes the following bugs: - The way we subscribe listeners to the events of the dragSelect library could result in the same event being triggered multiple times. This in turn could cause race conditions when on each event new data gets fetched but in between angular's scope gets updated and could end up in a non-intended way. The result of this were view-by swimlanes not updating correctly or anomaly charts showing non-related charts. This PR fixes it by filtering out consecutive swimlane click events. - When the angular based chart container wrapper directive gets destroyed/re-esetup when using the job pick, it missed unmounting the react component, it didn't trigger componentWillUnmount()and didn't unsubscribe from dragSelectListener.
- This fixes a regression introduced in #22814. The influencer list wouldn't update if no cell in the swimlanes was selected. - Renames getTopInfluencers to loadTopInfluencers to be in line with the other functions loadDataForCharts and loadAnomaliesTableData - Changes the order of arguments for loadDataForCharts so they are the same like in loadTopInfluencers.
- This fixes a regression introduced in elastic#22814. The influencer list wouldn't update if no cell in the swimlanes was selected. - Renames getTopInfluencers to loadTopInfluencers to be in line with the other functions loadDataForCharts and loadAnomaliesTableData - Changes the order of arguments for loadDataForCharts so they are the same like in loadTopInfluencers.
…2989) - This fixes a regression introduced in #22814. The influencer list wouldn't update if no cell in the swimlanes was selected. - Renames getTopInfluencers to loadTopInfluencers to be in line with the other functions loadDataForCharts and loadAnomaliesTableData - Changes the order of arguments for loadDataForCharts so they are the same like in loadTopInfluencers.
- Fixes a regression introduced in #22814. Because of the stricter checking for scope/props updates, resizing the browser window would miss updating the Anomaly Explorer Charts widths. This fixes it by adding a check to trigger anomalyDataChange in redrawOnResize(). - Additionally, if only one chart is up for display, this update makes sure a single chart always spans across the full available width.
- Fixes a regression introduced in elastic#22814. Because of the stricter checking for scope/props updates, resizing the browser window would miss updating the Anomaly Explorer Charts widths. This fixes it by adding a check to trigger anomalyDataChange in redrawOnResize(). - Additionally, if only one chart is up for display, this update makes sure a single chart always spans across the full available width.
- Fixes a regression introduced in #22814. Because of the stricter checking for scope/props updates, resizing the browser window would miss updating the Anomaly Explorer Charts widths. This fixes it by adding a check to trigger anomalyDataChange in redrawOnResize(). - Additionally, if only one chart is up for display, this update makes sure a single chart always spans across the full available width.
Fixes #18344.
This PR addresses parts of #22642.
var that = this;
.dragSelect
's action strings are moved to a constants file.ExplorerSwimlane
component.Note for reviewers: The diff for
explorer_swimlane.js
is rather big - it's because I moved at lot of methods which were defined incomponentDidMount()
likethis.fnName = ...
to be methods on the class itself likefnName() { ... }
, the methods themselves didn't change though.This also fixes the following bugs:
dragSelect
library could result in the same event being triggered multiple times. This in turn could cause race conditions when on each event new data gets fetched but in between angular's scope gets updated and could end up in a non-intended way. The result of this were view-by swimlanes not updating correctly or anomaly charts showing non-related charts. This PR fixes it by filtering out consecutive swimlane click events.componentWillUnmount()
and didn't unsubscribe fromdragSelectListener
.