-
Notifications
You must be signed in to change notification settings - Fork 86
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
sort by managed policy feature #950
sort by managed policy feature #950
Conversation
Signed-off-by: Mansi Shinde <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #950 +/- ##
=======================================
Coverage 63.37% 63.37%
=======================================
Files 341 341
Lines 11554 11554
Branches 2243 2243
=======================================
Hits 7322 7322
Misses 3658 3658
Partials 574 574 ☔ View full report in Codecov by Sentry. |
server/services/IndexService.ts
Outdated
expand_wildcards?: string; | ||
} = { | ||
index: getSearchString(terms, indices, dataStreams), | ||
format: "json", | ||
s: `${sortField}:${sortDirection}`, | ||
// s: `${sortField}:${sortDirection}`, |
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
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.
done!
server/services/IndexService.ts
Outdated
let flag; | ||
const aManaged = a.managed as string; | ||
const bManaged = b.managed as string; | ||
|
||
if (sortDirection === "asc") { | ||
flag = aManaged < bManaged; | ||
} else { | ||
flag = aManaged > bManaged; | ||
} | ||
|
||
return flag ? -1 : 1; |
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.
Extract this out as a function, can be reused. And this sort should only apply when sortField is "managed"
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.
done
Signed-off-by: Mansi Shinde <[email protected]>
server/services/IndexService.ts
Outdated
managed: managedStatus[catIndex.index] ? "Yes" : "No", | ||
managedPolicy: managedStatus[catIndex.index], | ||
})), | ||
indices: customSort( |
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 sort on managed would only apply when the sortField is chosen to be managed as I understand.
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.
Hello @bowenlan-amzn, thank you for bringing this to my attention. I noticed that the code was displaying indices based on the "managed" field, regardless of whether the sort field was "managed" or not. I have updated the logic, and it is now functioning as expected. Could you please take a look?
Signed-off-by: Mansi Shinde <[email protected]>
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.
Looks great to me!
b516933
into
opensearch-project:main
* sort by managed policy feature Signed-off-by: Mansi Shinde <[email protected]> * add customSort function and remove comment Signed-off-by: Mansi Shinde <[email protected]> * update managed by policy sorting logic Signed-off-by: Mansi Shinde <[email protected]> --------- Signed-off-by: Mansi Shinde <[email protected]> (cherry picked from commit b516933) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* sort by managed policy feature * add customSort function and remove comment * update managed by policy sorting logic --------- (cherry picked from commit b516933) Signed-off-by: Mansi Shinde <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
Make managed by policy field sortable.
Fix unsupported operation exception error while sorting by Data stream field.
Ascending order
Descending order
Issues Resolved
List any issues this PR will resolve - 106 , 948
Check List
By 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.