Skip to content
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

filter high level groups and action groups by cluster and index #1482

Merged
merged 11 commits into from
Jul 11, 2023

Conversation

derek-ho
Copy link
Collaborator

@derek-ho derek-ho commented Jun 21, 2023

Description

Filters high level groups based on cluster or index panel and also filters the actiongroups based on their associated type

Category

[Enhancement, New feature, Bug fix, Test fix, Refactoring, Maintenance, Documentation]

Why these changes are required?

What is the old behavior before changes and new behavior after changes?

Issues Resolved

fix: #1346
fix: #1347

Testing

[Please provide details of testing done: unit testing, integration testing and manual testing]

Check List

  • New functionality includes testing
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

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.

Signed-off-by: Derek Ho <dxho@amazon.com>
derek-ho added 4 commits June 21, 2023 16:22
Signed-off-by: Derek Ho <dxho@amazon.com>
Signed-off-by: Derek Ho <dxho@amazon.com>
Signed-off-by: Derek Ho <dxho@amazon.com>
Signed-off-by: Derek Ho <dxho@amazon.com>
@cwperks
Copy link
Member

cwperks commented Jun 21, 2023

Thank you for the PR @derek-ho ! Would you be able to add a test to verify the new behavior?

@codecov
Copy link

codecov bot commented Jun 21, 2023

Codecov Report

Merging #1482 (5b059d5) into main (8dab6a3) will decrease coverage by 0.12%.
The diff coverage is 44.44%.

❗ Current head 5b059d5 differs from pull request most recent head e692169. Consider uploading reports for the commit e692169 to get more accurate results

@@            Coverage Diff             @@
##             main    #1482      +/-   ##
==========================================
- Coverage   65.62%   65.51%   -0.12%     
==========================================
  Files          93       93              
  Lines        2307     2314       +7     
  Branches      314      315       +1     
==========================================
+ Hits         1514     1516       +2     
- Misses        725      730       +5     
  Partials       68       68              
Impacted Files Coverage Δ
.../apps/configuration/panels/role-edit/role-edit.tsx 71.66% <42.85%> (-4.70%) ⬇️
public/plugin.ts 13.84% <50.00%> (+1.14%) ⬆️

@cwperks
Copy link
Member

cwperks commented Jun 21, 2023

@derek-ho Does this fix #1347 too or just #1346? I took a quick glance at the code and it looks like this fixes #1346 , but not #1347

@cwperks cwperks added the backport 2.x backport to 2.x branch label Jun 21, 2023
@DarshitChanpura
Copy link
Member

@derek-ho Would you please fetch the latest changes from main.

Copy link
Collaborator

@RyanL1997 RyanL1997 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @derek-ho, thanks for taking this on, and it is looking good to me. Just like Craig mentioned above, a testing case would be great.

@@ -106,12 +106,12 @@ export function RoleEdit(props: RoleEditDeps) {
}
}, [addToast, props.action, props.coreStart.http, props.sourceRoleName]);

const [actionGroups, setActionGroups] = useState<string[]>([]);
const [actionGroups, setActionGroups] = useState<Array<[string, ActionGroupItem]>>([]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for my understanding, why are we needing this ActionGroupItem, or can we use the original Action here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If i'm understanding your question correctly I need the whole item here in order to tell whether it is a cluster/index one later on in order to filter them accordingly

Signed-off-by: Derek Ho <dxho@amazon.com>
@derek-ho derek-ho force-pushed the filter-in-dropdown branch from 5b059d5 to a8f27ce Compare July 10, 2023 15:08
Signed-off-by: Derek Ho <dxho@amazon.com>
Signed-off-by: Derek Ho <dxho@amazon.com>
@derek-ho derek-ho force-pushed the filter-in-dropdown branch from 60ed3c7 to f66725a Compare July 10, 2023 16:08
derek-ho added 2 commits July 10, 2023 12:10
Signed-off-by: Derek Ho <dxho@amazon.com>
},
{
label: 'Cluster permissions',
options: CLUSTER_PERMISSIONS.map((x) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much more robust and less lines of code :)

Copy link
Member

@cwperks cwperks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Thank you for solving this pesky issue @derek-ho !

@derek-ho
Copy link
Collaborator Author

@derek-ho Does this fix #1347 too or just #1346? I took a quick glance at the code and it looks like this fixes #1346 , but not #1347

This should fix both. It is both filtering action groups (which comes from the network call), and also creates a separate variable, so that only cluster/index respectively permissions from the constants file is included

Copy link
Collaborator

@RyanL1997 RyanL1997 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work @derek-ho and I'm approving these changes. However, I think your PR is also impacted by this issue: #1506

@cwperks cwperks merged commit 5fd8018 into opensearch-project:main Jul 11, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jul 11, 2023
* filter high level groups and action groups by cluster and index

Signed-off-by: Derek Ho <dxho@amazon.com>

* remove unecessary console

Signed-off-by: Derek Ho <dxho@amazon.com>

* add semicolon back

Signed-off-by: Derek Ho <dxho@amazon.com>

* use map instead of flat map

Signed-off-by: Derek Ho <dxho@amazon.com>

* fix lint

Signed-off-by: Derek Ho <dxho@amazon.com>

* fix tests

Signed-off-by: Derek Ho <dxho@amazon.com>

* revert file

Signed-off-by: Derek Ho <dxho@amazon.com>

* fix up tests

Signed-off-by: Derek Ho <dxho@amazon.com>

* lint

Signed-off-by: Derek Ho <dxho@amazon.com>

---------

Signed-off-by: Derek Ho <dxho@amazon.com>
(cherry picked from commit 5fd8018)
cwperks pushed a commit that referenced this pull request Jul 11, 2023
… (#1508)

* filter high level groups and action groups by cluster and index

Signed-off-by: Derek Ho <dxho@amazon.com>

* remove unecessary console

Signed-off-by: Derek Ho <dxho@amazon.com>

* add semicolon back

Signed-off-by: Derek Ho <dxho@amazon.com>

* use map instead of flat map

Signed-off-by: Derek Ho <dxho@amazon.com>

* fix lint

Signed-off-by: Derek Ho <dxho@amazon.com>

* fix tests

Signed-off-by: Derek Ho <dxho@amazon.com>

* revert file

Signed-off-by: Derek Ho <dxho@amazon.com>

* fix up tests

Signed-off-by: Derek Ho <dxho@amazon.com>

* lint

Signed-off-by: Derek Ho <dxho@amazon.com>

---------

Signed-off-by: Derek Ho <dxho@amazon.com>
(cherry picked from commit 5fd8018)

Co-authored-by: Derek Ho <dxho@amazon.com>
samuelcostae pushed a commit to samuelcostae/security-dashboards-plugin that referenced this pull request Aug 10, 2023
…search-project#1482)

* filter high level groups and action groups by cluster and index

Signed-off-by: Derek Ho <dxho@amazon.com>

* remove unecessary console

Signed-off-by: Derek Ho <dxho@amazon.com>

* add semicolon back

Signed-off-by: Derek Ho <dxho@amazon.com>

* use map instead of flat map

Signed-off-by: Derek Ho <dxho@amazon.com>

* fix lint

Signed-off-by: Derek Ho <dxho@amazon.com>

* fix tests

Signed-off-by: Derek Ho <dxho@amazon.com>

* revert file

Signed-off-by: Derek Ho <dxho@amazon.com>

* fix up tests

Signed-off-by: Derek Ho <dxho@amazon.com>

* lint

Signed-off-by: Derek Ho <dxho@amazon.com>

---------

Signed-off-by: Derek Ho <dxho@amazon.com>
Signed-off-by: Sam <samuel.costa@eliatra.com>
@cwperks cwperks mentioned this pull request Jan 25, 2024
3 tasks
@cwperks cwperks mentioned this pull request Mar 21, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x backport to 2.x branch
Projects
None yet
5 participants