forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Explain Log Rate Spikes: Fix loading state for grouping. (elasti…
…c#141770) Fix loading state messages for grouping: - Fixes the progress bar messages to include the grouping step. - If progress stalls, it might look to the user like the analysis got stuck when there are steps like the grouping that take a longer time. This updates the progress bar to show an animated background as long as the analysis is running. When the analysis finishes or gets canceled the animated background gets disabled and shows a static background. (cherry picked from commit 5203f1b)
- Loading branch information
Showing
5 changed files
with
108 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...ackages/ml/aiops_components/src/progress_controls/use_animated_progress_bar_background.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { useMemo } from 'react'; | ||
|
||
import { css } from '@emotion/react'; | ||
|
||
export const useAnimatedProgressBarBackground = (color: string) => { | ||
return useMemo(() => { | ||
const progressBackground = { | ||
background: `repeating-linear-gradient( | ||
-45deg, | ||
transparent 0 6px, | ||
rgba(0, 0, 0, 0.1) 6px 12px | ||
), | ||
${color}`, | ||
// 0.707 = cos(45deg) | ||
backgroundSize: 'calc(12px / 0.707) 100%, 100% 800%', | ||
backgroundPosition: 'inherit', | ||
}; | ||
|
||
return css({ | ||
'progress[value]': { | ||
animation: 'aiopsAnimatedProgress 4s infinite linear', | ||
|
||
'::-webkit-progress-inner-element': { | ||
overflow: 'hidden', | ||
backgroundPosition: 'inherit', | ||
}, | ||
'::-webkit-progress-bar': { | ||
backgroundColor: 'transparent', | ||
backgroundPosition: 'inherit', | ||
}, | ||
|
||
'::-webkit-progress-value': progressBackground, | ||
'::-moz-progress-bar': progressBackground, | ||
|
||
'@keyframes aiopsAnimatedProgress': { | ||
'0%': { | ||
backgroundPosition: '0 0', | ||
}, | ||
'100%': { | ||
backgroundPosition: 'calc(10 * (12px / 0.707)) 100%', | ||
}, | ||
}, | ||
}, | ||
}); | ||
}, [color]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters