-
Notifications
You must be signed in to change notification settings - Fork 55
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
Add access control tab content #992
Merged
derek-ho
merged 11 commits into
opensearch-project:feature/flint-UI
from
derek-ho:access-control
Sep 18, 2023
Merged
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
85619c8
basic rendering for the access control tab
derek-ho 4c720e2
hook up basic radio groups and euicombo boxes for query and accelerat…
derek-ho 3298dad
Merge branch 'feature/flint-UI' of github.com:opensearch-project/dash…
derek-ho 5337b71
refactor and clean up unuseed inports
derek-ho 9feb7dd
remove unused import
derek-ho 14f3ff2
fix import and snapshot
derek-ho 7c40489
fix test
derek-ho c5b6d51
Merge branch 'feature/flint-UI' of github.com:opensearch-project/dash…
derek-ho fc96304
Address PR comments
derek-ho f3ff2f9
Address PR comments
derek-ho 8fd7211
Remove unused files and variables
derek-ho File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { EuiRadioGroupOption } from '@elastic/eui'; | ||
|
||
export interface PermissionsFlexItem { | ||
roles: Array<{ label: string }>; | ||
selectedRoles: Array<{ label: string }>; | ||
selectedRadio: string; | ||
setSelectedRoles: (selectedRoles: Array<{ label: string }>) => void; | ||
setSelectedRadio: (selectedRadio: string) => void; | ||
radios: EuiRadioGroupOption[]; | ||
} |
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
70 changes: 70 additions & 0 deletions
70
public/components/data_connections/components/acceleration_permissions_flex_item.tsx
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,70 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { | ||
EuiComboBox, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
EuiLink, | ||
EuiRadioGroup, | ||
EuiSpacer, | ||
EuiText, | ||
} from '@elastic/eui'; | ||
import React from 'react'; | ||
import { PermissionsFlexItem } from '../../../../common/types/data_connections'; | ||
import { | ||
OPENSEARCH_DOCUMENTATION_URL, | ||
QUERY_ALL, | ||
} from '../../../../common/constants/data_connections'; | ||
|
||
export const AccelerationPermissionsFlexItem = (props: PermissionsFlexItem) => { | ||
const { roles, setSelectedRoles, selectedRoles, selectedRadio, radios, setSelectedRadio } = props; | ||
return ( | ||
<EuiFlexItem> | ||
<EuiFlexGroup direction="row"> | ||
<EuiFlexItem> | ||
<EuiText className="overview-title">Acceleration Permissions</EuiText> | ||
<EuiText size="s" className="overview-content"> | ||
Control which OpenSearch roles have permissions to accelerate external data through | ||
OpenSearch indexing.{' '} | ||
<EuiLink external={true} href={OPENSEARCH_DOCUMENTATION_URL} target="_blank"> | ||
Learn more | ||
</EuiLink> | ||
</EuiText> | ||
</EuiFlexItem> | ||
<EuiFlexItem> | ||
<EuiRadioGroup | ||
options={radios} | ||
idSelected={selectedRadio} | ||
onChange={(id) => setSelectedRadio(id)} | ||
name="acceleration-radio-group" | ||
legend={{ | ||
children: <span>Access level</span>, | ||
}} | ||
/> | ||
{selectedRadio === QUERY_ALL ? ( | ||
<div> | ||
<EuiSpacer size="s" /> | ||
<EuiText>OpenSearch Roles</EuiText> | ||
<EuiText size="xs"> | ||
Select one or more OpenSearch roles that can query this data connection. | ||
</EuiText> | ||
<EuiComboBox | ||
placeholder="Select one or more options" | ||
options={roles} | ||
selectedOptions={selectedRoles} | ||
onChange={setSelectedRoles} | ||
isClearable={true} | ||
data-test-subj="query-permissions-combo-box" | ||
/> | ||
</div> | ||
) : ( | ||
<></> | ||
)} | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</EuiFlexItem> | ||
); | ||
}; |
16 changes: 16 additions & 0 deletions
16
public/components/data_connections/components/access_control_callout.tsx
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,16 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { EuiCallOut } from '@elastic/eui'; | ||
import React from 'react'; | ||
|
||
export const AccessControlCallout = () => { | ||
return ( | ||
<EuiCallOut title="Configurations may be managed elsewhere." iconType="iInCircle"> | ||
Access to data can be managed in other systems outside of OpenSearch. Check with your | ||
administrator for additional configurations. | ||
</EuiCallOut> | ||
); | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Minor, but Ideally types here should be something like:
React.Dispatch<React.SetStateAction<Array<{ label: string }>>
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 in: fc96304, thanks! I didn't know this