-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Web: Add MarkInverse and ResourceLabelTooltip contents #50532
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
88f1a0f
Add a inverse Mark version inside tooltips
kimlisa 8463540
Add tooltip contents for resource labels
kimlisa 34df730
Fix spacing for ButtonTextWithAddIcon
kimlisa 3ccefe0
Add index file for export
kimlisa 08c490a
Rename MarkForTooltip to MarkInverse
kimlisa 6fe2e30
Address CRs
kimlisa 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
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
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
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
29 changes: 29 additions & 0 deletions
29
...packages/teleport/src/Discover/Shared/ResourceLabelTooltip/ResourceLabelTooltip.story.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,29 @@ | ||
/** | ||
* Teleport | ||
* Copyright (C) 2024 Gravitational, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import { ResourceLabelTooltip } from './ResourceLabelTooltip'; | ||
|
||
export default { | ||
title: 'Teleport/Discover/Shared/ResourceLabelTooltip', | ||
}; | ||
|
||
export const RDS = () => <ResourceLabelTooltip resourceKind="rds" />; | ||
export const EKS = () => <ResourceLabelTooltip resourceKind="eks" />; | ||
export const Server = () => <ResourceLabelTooltip resourceKind="server" />; | ||
export const Database = () => <ResourceLabelTooltip resourceKind="db" />; | ||
export const Kube = () => <ResourceLabelTooltip resourceKind="kube" />; |
137 changes: 137 additions & 0 deletions
137
web/packages/teleport/src/Discover/Shared/ResourceLabelTooltip/ResourceLabelTooltip.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,137 @@ | ||
/** | ||
* Teleport | ||
* Copyright (C) 2024 Gravitational, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import Link from 'design/Link'; | ||
import { MarkInverse } from 'design/Mark'; | ||
import { Position } from 'design/Popover/Popover'; | ||
import { IconTooltip } from 'design/Tooltip'; | ||
import styled from 'styled-components'; | ||
|
||
export function ResourceLabelTooltip({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: JSDoc |
||
resourceKind, | ||
toolTipPosition, | ||
}: { | ||
resourceKind: 'server' | 'eks' | 'rds' | 'kube' | 'db'; | ||
toolTipPosition?: Position; | ||
}) { | ||
let tip; | ||
|
||
switch (resourceKind) { | ||
case 'server': { | ||
tip = ( | ||
<> | ||
Labels allow you to do the following: | ||
<Ul> | ||
<li> | ||
Filter servers by labels when using tsh, tctl, or the web UI | ||
</li> | ||
<li> | ||
Restrict access to this server with{' '} | ||
<Link | ||
target="_blank" | ||
href="https://goteleport.com/docs/enroll-resources/server-access/rbac/" | ||
> | ||
Teleport RBAC | ||
</Link> | ||
. Only roles with <MarkInverse>node_labels</MarkInverse> that | ||
match these labels will be allowed to access this server. | ||
</li> | ||
</Ul> | ||
</> | ||
); | ||
break; | ||
} | ||
case 'kube': | ||
case 'eks': { | ||
tip = ( | ||
<> | ||
Labels allow you to do the following: | ||
<Ul> | ||
<li> | ||
Filter Kubernetes clusters by labels when using tsh, tctl, or the | ||
web UI | ||
</li> | ||
<li> | ||
Restrict access to this Kubernetes cluster with{' '} | ||
<Link | ||
target="_blank" | ||
href="https://goteleport.com/docs/enroll-resources/kubernetes-access/controls/" | ||
> | ||
Teleport RBAC | ||
</Link> | ||
. Only roles with <MarkInverse>kubernetes_labels</MarkInverse>{' '} | ||
that match these labels will be allowed to access this Kubernetes | ||
cluster. | ||
</li> | ||
{resourceKind === 'eks' && ( | ||
<li> | ||
All the AWS tags from the selected EKS will be included upon | ||
enrollment. | ||
</li> | ||
)} | ||
</Ul> | ||
</> | ||
); | ||
break; | ||
} | ||
case 'rds': | ||
case 'db': { | ||
tip = ( | ||
<> | ||
Labels allow you to do the following: | ||
<Ul> | ||
<li> | ||
Filter databases by labels when using tsh, tctl, or the web UI | ||
</li> | ||
<li> | ||
Restrict access to this database with{' '} | ||
<Link | ||
target="_blank" | ||
href="https://goteleport.com/docs/enroll-resources/database-access/rbac/" | ||
> | ||
Teleport RBAC | ||
</Link> | ||
. Only roles with <MarkInverse>db_labels</MarkInverse> that match | ||
these labels will be allowed to access this database. | ||
</li> | ||
{resourceKind === 'rds' && ( | ||
<li> | ||
All the AWS tags from the selected RDS will be included upon | ||
enrollment. | ||
</li> | ||
)} | ||
</Ul> | ||
</> | ||
); | ||
break; | ||
} | ||
default: | ||
resourceKind satisfies never; | ||
} | ||
|
||
return ( | ||
<IconTooltip sticky={true} position={toolTipPosition}> | ||
{tip} | ||
</IconTooltip> | ||
); | ||
} | ||
|
||
const Ul = styled.ul` | ||
margin: 0; | ||
padding-left: ${p => p.theme.space[4]}px; | ||
`; |
19 changes: 19 additions & 0 deletions
19
web/packages/teleport/src/Discover/Shared/ResourceLabelTooltip/index.ts
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,19 @@ | ||
/** | ||
* Teleport | ||
* Copyright (C) 2024 Gravitational, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
export { ResourceLabelTooltip } from './ResourceLabelTooltip'; |
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.
nit: JSdoc on exported function/var/types/styles etc.