-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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 nav bar item to show HCP link status and encourage folks to link #20370
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
2dd5ecf
Convert consul-hcp to a simpler component
chris-hut bcfd789
update existing test to use envStub helper
chris-hut f42152a
Merge branch 'main' into CC-7146/convert-consul-hcp-to-a-simpler-comp…
chris-hut e2e9af5
An hcp link item for the navbar
chris-hut 6acfe1c
A method of linking to HCP
chris-hut 247c18e
Merge branch 'main' of github.com:hashicorp/consul into CC-7146/hcp-l…
chris-hut 026ee28
Hook up fetching linking status to the nav-item
chris-hut 7d4e39f
Hooking up fetching link status to the hcp link friend
chris-hut 5451806
Adding some tests
chris-hut eeb6a70
Merge branch 'main' of github.com:hashicorp/consul into CC-7146/hcp-l…
chris-hut e125f98
Merge branch 'main' of github.com:hashicorp/consul into CC-7146/hcp-l…
chris-hut 4f8d369
remove a comment - but also fix padding justify-content
chris-hut 21b019f
Fix the banner tests
chris-hut f40ad19
Adding permission tests as well
chris-hut cb4a35d
some more sane formatting
chris-hut db22d5d
Rename function with its now multipurpose use
chris-hut 85555d3
Feature change: No more NEW Badge since it breaks padding - instead a…
chris-hut 1436ce6
Merge branch 'main' of github.com:hashicorp/consul into CC-7146/hcp-l…
chris-hut ce347ef
Removing unused class
chris-hut 9f99acd
Merge branch 'main' into CC-7146/hcp-link-item-in-the-nav-bar
chris-hut 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* Copyright (c) HashiCorp, Inc. | ||
* SPDX-License-Identifier: BUSL-1.1 | ||
*/ | ||
|
||
import BaseAbility from './base'; | ||
|
||
export default class OperatorAbility extends BaseAbility { | ||
resource = 'operator'; | ||
} | ||
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
32 changes: 32 additions & 0 deletions
32
ui/packages/consul-ui/app/helpers/hcp-resource-id-to-link.js
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,32 @@ | ||
/** | ||
* Copyright (c) HashiCorp, Inc. | ||
* SPDX-License-Identifier: BUSL-1.1 | ||
*/ | ||
|
||
import Helper from '@ember/component/helper'; | ||
|
||
/** | ||
* A resourceId Looks like: | ||
* organization/b4432207-bb9c-438e-a160-b98923efa979/project/4b09958c-fa91-43ab-8029-eb28d8cee9d4/hashicorp.consul.global-network-manager.cluster/test-from-api | ||
* organization/${organizationId}/project/${projectId}/hashicorp.consul.global-network-manager.cluster/${clusterName} | ||
* | ||
* A HCP URL looks like: | ||
* https://portal.hcp.dev/services/consul/clusters/self-managed/test-from-api?project_id=4b09958c-fa91-43ab-8029-eb28d8cee9d4 | ||
* ${HCP_PREFIX}/${clusterName}?project_id=${projectId} | ||
*/ | ||
export const HCP_PREFIX = | ||
'https://portal.cloud.hashicorp.com/services/consul/clusters/self-managed'; | ||
export default class hcpResourceIdToLink extends Helper { | ||
// TODO: How can we figure out different HCP environments? | ||
compute([resourceId], hash) { | ||
let url = HCP_PREFIX; | ||
// Array looks like: ["organization", organizationId, "project", projectId, "hashicorp.consul.global-network-manager.cluster", "Cluster Id"] | ||
const [, , , projectId, , clusterName] = resourceId.split('/'); | ||
if (!projectId || !clusterName) { | ||
return ''; | ||
} | ||
|
||
url += `/${clusterName}?project_id=${projectId}`; | ||
return url; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
{ | ||
"status": { | ||
"consul.io/hcp/link": { | ||
"conditions": [ | ||
{ | ||
"message": "Successfully linked to cluster 'organization/f53e5646-6529-4698-ae29-d74f8bd22a01/project/6994bb7a-5561-4d5c-8bb0-cf40177e5b77/hashicorp.consul.global-network-manager.cluster/mkam-vm'", | ||
"reason": "SUCCESS", | ||
"state": "STATE_FALSE", | ||
"type": "linked" | ||
} | ||
], | ||
"observedGeneration":"01HMA2VPHVKNF6QR8TD07KDN5K", | ||
"updatedAt":"2024-01-16T21:29:25.923140Z" | ||
} | ||
"data": { | ||
"clientId": "5wZyAPvDFbgDdO3439m8tufwO9hElphu", | ||
"clientSecret": "SWX0XShcp3doc7RF8YCjJ-WATyeMAjFaf1eA0mnzlNHLF4IXbFz6xyjSZvHzAR_i", | ||
"resourceId": "organization/b4432207-bb9c-438e-a160-b98923efa979/project/4b09958c-fa91-43ab-8029-eb28d8cee9d4/hashicorp.consul.global-network-manager.cluster/test-from-api" | ||
}, | ||
"status": { | ||
"consul.io/hcp/link": { | ||
"conditions": [ | ||
{ | ||
"message": "Successfully linked to cluster 'organization/f53e5646-6529-4698-ae29-d74f8bd22a01/project/6994bb7a-5561-4d5c-8bb0-cf40177e5b77/hashicorp.consul.global-network-manager.cluster/mkam-vm'", | ||
"reason": "SUCCESS", | ||
"state": "STATE_FALSE", | ||
"type": "linked" | ||
} | ||
], | ||
"observedGeneration":"01HMA2VPHVKNF6QR8TD07KDN5K", | ||
"updatedAt":"2024-01-16T21:29:25.923140Z" | ||
} | ||
} | ||
} |
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
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.
Would love some eyes on this, from Melissa, we need the
operator
write permission, is this enough?By adding this I'm able to do
this.abilities.can('write operators')
, and it seems to be checking the right permissionThere 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.
lgtm