-
Notifications
You must be signed in to change notification settings - Fork 70
forecasting frontend #1038
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
forecasting frontend #1038
Conversation
| {/* HISTORY */} | ||
| <Field name="history" validate={validatePositiveInteger}> | ||
| {({ field, form }: FieldProps<number>) => { | ||
| const interval = (form as FormikProps<any>).values.interval; |
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: maybe try to define the full form type once to avoid casting it as . Leaving this as a nit comment because only seeing usage for this interface twice so far. If we're using it somewhere else or in the future we're going to use it again, definitely consider to define an interface for this
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.
Thanks for your understanding.
public/pages/CreateForecasterSteps/hooks/useFetchForecasterInfo.ts
Outdated
Show resolved
Hide resolved
public/pages/CreateForecasterSteps/hooks/useFetchForecasterInfo.ts
Outdated
Show resolved
Hide resolved
| await dispatch(getMappings(selectedIndices, dataSourceId)); | ||
| } | ||
| }; | ||
| console.log('forecasterId', forecasterId); |
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.
remove console.log code
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.
removed
| : 'history,horizon,window_delay'; | ||
|
|
||
| try { | ||
| console.log('forecasterBody', forecasterBody); |
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.
remove console.log code
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.
removed
| sliderPanelRef.current && | ||
| !sliderPanelRef.current.contains(e.target as Node) | ||
| ) { | ||
| console.log('Outside slider => Hiding slider'); |
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.
remove console.log code
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.
removed
| expect(validateQuery('{"a":{"b":{}}}')).toBeUndefined(); | ||
| }); | ||
| test('should return error message if invalid query', () => { | ||
| console.log = jest.fn(); |
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.
remove console.log code
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.
removed
| try { | ||
| JSON.parse(value); | ||
| } catch (err) { | ||
| console.log('Returning error', err); |
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.
remove console log code
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.
Logging the error would help debug production issues.
| onChange={(e) => { | ||
| const raw = e.target.value; | ||
| form.setFieldValue(field.name, raw === '' ? '' : Number(raw)); | ||
| }} |
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: seeing repeat onChange blocks with identical logic multiple times in this file. Maybe consider to extract it out as a common method
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.
extracted a method:
const toNumberOrEmpty = (value: string): number | '' => {
return value === '' ? '' : Number(value);
};
| onChange={(e) => { | ||
| const raw = e.target.value; | ||
| form.setFieldValue(field.name, raw === '' ? '' : Number(raw)); | ||
| }} |
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.
Same as in the AdvancedSetting file above, the onChange method here is identical and repeated multiple times
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.
changed
| > | ||
| <EuiFlexItem grow={false}> | ||
| <Field | ||
| name={`imputationOption.custom_value.${index}.data`} |
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.
from line 258, it seems like we don't have data key in imputationOption.custom_value?
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.
What is the data key you are referring to?
| // FIXME: EuiRadio doesn't support readOnly prop. readOnly would be preferred as disabled makes the radio look gray. | ||
| // Consider creating a custom radio component that supports readOnly if this styling is important. |
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.
should we clean up this comment?
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, it is still relevant
| @@ -0,0 +1,289 @@ | |||
| import React, { useState } from 'react'; | |||
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.
missing license session
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.
added
| @@ -0,0 +1,331 @@ | |||
| import React, { Fragment, useEffect, useRef, useState } from 'react'; | |||
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.
missing license header
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.
added
| @@ -0,0 +1,74 @@ | |||
| import React from 'react'; | |||
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.
missing license header
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.
added
| @@ -0,0 +1,337 @@ | |||
| import { useEffect, useState } from 'react'; | |||
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.
missing license header
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.
added
| } | ||
| }); | ||
| }); | ||
| } catch (e) { |
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.
empty catch(e) block?
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.
added catch block
Signed-off-by: Kaituo Li <[email protected]>
Signed-off-by: Kaituo Li <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1038 +/- ##
==========================================
- Coverage 53.81% 48.67% -5.15%
==========================================
Files 170 232 +62
Lines 6955 10630 +3675
Branches 1430 2277 +847
==========================================
+ Hits 3743 5174 +1431
- Misses 2783 4924 +2141
- Partials 429 532 +103 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Install Dashboard with Plugin fails with Run OpenSearch. Looks like a problem of backend image issue: github flow: CI log: |
|
codecov failure: will more tests later. Currently prioritizing IT that codecov does not consider: kaituo/opensearch-dashboards-functional-test@d89f945#diff-3c1decf4ad1bc8b8ce0c2aad9e09a282a70b0284e95c1622d571ad46a8506d16 |
| throw get(result, 'error', ''); | ||
| } | ||
| } catch (error) { | ||
| console.log('Processed error in middleware:', error); |
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.
remove console.log
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.
This would help prod failure.
public/pages/utils/helpers.ts
Outdated
| items.length > 0 | ||
| ? groupIndicesOrAliasesByCluster(items, localClusterName, label) | ||
| : [{ label, options: items }]; | ||
| console.log('getVisibleOptions', indices, aliases, localClusterName); |
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.
remove console.log
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.
removed
Signed-off-by: Kaituo Li <[email protected]>
|
The backport to To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-1038-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 a1657ecce6839a1573c70bb42aba2400cfd741a5
# Push it to GitHub
git push --set-upstream origin backport/backport-1038-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.xThen, create a pull request where the |
Description
The PR covers creating and managing forecasting jobs from a data source and consuming forecasting results visualized on a graph. Forecasting will show the user where their metrics are headed so that they can prepare accordingly (e.g. disk space, server instance upgrades, inventory planning).
Testing done:
Issues Resolved
#577
#576
#575
#574
#573
#441
Check List
--signoffBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.