-
Notifications
You must be signed in to change notification settings - Fork 916
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
Fix dev tool console autocomplete not loading issue #3775
Fix dev tool console autocomplete not loading issue #3775
Conversation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #3775 +/- ##
==========================================
- Coverage 66.43% 66.43% -0.01%
==========================================
Files 3210 3210
Lines 61677 61681 +4
Branches 9522 9522
==========================================
+ Hits 40977 40978 +1
- Misses 18419 18421 +2
- Partials 2281 2282 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 2 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
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.
@zhongnansu A couple minor questions, but this looks good. Thanks for the jquery updates, too!
let ret = [].concat.apply([], indicesOrAliases); | ||
ret.sort(); | ||
let last; | ||
ret = $.map(ret, function (v) { | ||
const r = last === v ? null : v; | ||
last = v; | ||
return r; | ||
}); | ||
ret = ret.reduce((result, value, index, array) => { | ||
const last = array[index - 1]; | ||
if (last !== value) { | ||
result.push(value); | ||
} | ||
return result; |
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 is fine, but all we're really trying to do is get an array with the unique values, right? Something like
const ret = [...new Set(indicesOrAliases)]]
@Nicksqain If you have a chance, please review and compare to your changes in After this is merged, we can rebase your PR on top. |
@zhongnansu The other thing I forgot to mention in the review - what ideas do you have about the best way to add a regression test for this? It's actually a fairly significant impact to lose this data-based autocompletion, so we'd like to make sure our tests catch it if it breaks in the future. My initial thought is that it makes the most sense as a functional test, because we can make sure it's actually correctly using the data to correctly populate the fields. |
Signed-off-by: Su <szhongna@amazon.com>
2a4b2e2
to
d5f0812
Compare
@zhongnansu why are we skipping the changelog here? |
@joshuarrrr Then maybe I should just copy the modified |
Signed-off-by: Su <szhongna@amazon.com>
@ashwin-pc my bad, I though it was an unreleased bug. Added change log |
good point, I am having similar thoughts. Maybe create an issue in functional test repo to track |
if (typeof indicesOrAliases === 'string') { | ||
indicesOrAliases = [indicesOrAliases]; | ||
} |
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.
How would you feel about changing this chunk and the above condition to:
if (typeof indicesOrAliases === 'string') { | |
indicesOrAliases = [indicesOrAliases]; | |
} | |
if (typeof indicesOrAliases === 'string') { | |
indicesOrAliases = [indicesOrAliases]; | |
} else if (!Array.isArray(indicesOrAliases)) { | |
return; | |
} |
note that unlike the previous code, this is return
nothing.
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.
Since it's a new condition comparing to previous code, can you elaborate on the use case of returning noting, when indicesOrAliases
is not a string and not an Array?
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 kind of change seems more suitable as part of migrating this mappings file from js to ts. @zhongnansu Do you mind opening a stub issue for that?
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.
OK, cool - please create that issue and link it here. |
@joshuarrrr issue created opensearch-project/opensearch-dashboards-functional-test#605 |
if (typeof indicesOrAliases === 'string') { | ||
indicesOrAliases = [indicesOrAliases]; | ||
} |
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 kind of change seems more suitable as part of migrating this mappings file from js to ts. @zhongnansu Do you mind opening a stub issue for that?
* Fix dev tool console autocomplete issue * add changelog Signed-off-by: Su <szhongna@amazon.com> --------- Signed-off-by: Su <szhongna@amazon.com> (cherry picked from commit 29008fa) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
* Fix dev tool console autocomplete issue * add changelog Signed-off-by: Su <szhongna@amazon.com> --------- Signed-off-by: Su <szhongna@amazon.com> (cherry picked from commit 29008fa) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Zhongnan Su <szhongna@amazon.com>
…ct#3775) * Fix dev tool console autocomplete issue * add changelog Signed-off-by: Su <szhongna@amazon.com> --------- Signed-off-by: Su <szhongna@amazon.com> Signed-off-by: David Sinclair <david@sinclair.tech>
Description
Dev tool console dynamic autocomplete is not working, this PR is to fix it . Solution is just pass along the
http
all the way to theopensearch.send()
Issues Resolved
#3515
Check List
yarn test:jest
yarn test:jest_integration
yarn test:ftr