-
Notifications
You must be signed in to change notification settings - Fork 4.6k
add basic routes for secrets recovery #31412
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
Changes from 4 commits
a193a70
06cd58f
40e44eb
304fa74
c3afabb
771a6cc
3284ff6
080d7bf
6c26cb7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| {{#if this.isNotProduction}} | ||
| {{yield}} | ||
| {{/if}} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| /** | ||
| * Copyright (c) HashiCorp, Inc. | ||
| * SPDX-License-Identifier: BUSL-1.1 | ||
| */ | ||
|
|
||
| import Component from '@glimmer/component'; | ||
| import config from 'vault/config/environment'; | ||
|
|
||
| export default class AlphabetEditComponent extends Component { | ||
| get isNotProduction() { | ||
| return config.environment !== 'production'; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| {{! | ||
| Copyright (c) HashiCorp, Inc. | ||
| SPDX-License-Identifier: BUSL-1.1 | ||
| }} | ||
|
|
||
| <h1> test index</h1> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| {{! | ||
| Copyright (c) HashiCorp, Inc. | ||
| SPDX-License-Identifier: BUSL-1.1 | ||
| }} | ||
|
|
||
| <h1> test load</h1> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| {{! | ||
| Copyright (c) HashiCorp, Inc. | ||
| SPDX-License-Identifier: BUSL-1.1 | ||
| }} | ||
|
|
||
| <h1> test manage</h1> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,13 @@ | |
| data-test-sidebar-nav-link="Secrets Sync" | ||
| /> | ||
| {{/if}} | ||
| {{#if this.showSecretsRecovery}} | ||
|
||
| <Nav.Link | ||
| @route="vault.cluster.recovery.snapshots" | ||
| @text="Secrets Recovery" | ||
| data-test-sidebar-nav-link="Secrets Recovery" | ||
| /> | ||
| {{/if}} | ||
| {{#if (has-permission "access")}} | ||
| <Nav.Link | ||
| @route={{get (route-params-for "access") "route"}} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ | |
|
|
||
| import Component from '@glimmer/component'; | ||
| import { service } from '@ember/service'; | ||
| import config from 'vault/config/environment'; | ||
|
Contributor
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. Oh cool, so this acts as a sort of development feature flag. Good idea! (This can be in a separate PR) but this could be formalized a bit and drawn into a helper so you don't need the getter every time.
Contributor
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. Yeah this is definitely a new pattern to use the environment state like this. But with the new release cycle, I foresee us developing more iteratively instead of relying on sidebranches so it would make sense to make an app-wide helper! |
||
|
|
||
| export default class SidebarNavClusterComponent extends Component { | ||
| @service currentCluster; | ||
|
|
@@ -57,4 +58,9 @@ export default class SidebarNavClusterComponent extends Component { | |
| // otherwise we show the link depending on whether or not the feature exists | ||
| return this.version.hasSecretsSync; | ||
| } | ||
|
|
||
| // TODO remove conditional once further feature work for single item recovery for release 1.21 is completed | ||
| get showSecretsRecovery() { | ||
|
||
| return config.environment !== 'production'; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -210,6 +210,17 @@ Router.map(function () { | |||||||||
| this.route('replication-dr-promote', function () { | ||||||||||
| this.route('details'); | ||||||||||
| }); | ||||||||||
| // TODO remove conditional once further feature work for single item recovery for release 1.21 is completed | ||||||||||
| if (config.environment !== 'production') { | ||||||||||
| this.route('recovery', function () { | ||||||||||
| this.route('snapshots', function () { | ||||||||||
| this.route('load'); | ||||||||||
| this.route('snapshot', function () { | ||||||||||
| this.route('manage'); | ||||||||||
| }); | ||||||||||
|
||||||||||
| this.route('snapshot', function () { | |
| this.route('manage'); | |
| }); | |
| this.route('snapshot', { path: '/:snapshot_id } ) |
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.
Yep, didn't mean to leave that out! I've added the dynamic param and removed the manage route for the time being. It'll be easy to add back in later if we decide we need it.
Outdated
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.
I think it might be a little more intuitive if this was moved to below sync on line 19) so it sort of follows the sidebar nav order and makes it easier to find.
It's also hard to tell is the diff, but it looks like this is nested correctly so cluster is the immediate parent.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| /** | ||
| * Copyright (c) HashiCorp, Inc. | ||
| * SPDX-License-Identifier: BUSL-1.1 | ||
| */ | ||
|
|
||
| import Route from '@ember/routing/route'; | ||
|
|
||
| export default class VaultClusterRecoveryRoute extends Route {} | ||
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,8 @@ | ||||||
| /** | ||||||
| * Copyright (c) HashiCorp, Inc. | ||||||
| * SPDX-License-Identifier: BUSL-1.1 | ||||||
| */ | ||||||
|
|
||||||
| import Route from '@ember/routing/route'; | ||||||
|
|
||||||
| export default class VaultClusterRecoverySnapshotsRoute extends Route {} | ||||||
|
||||||
| export default class VaultClusterRecoverySnapshotsRoute extends Route {} | |
| export default class RecoverySnapshotsRoute extends Route {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| {{! | ||
| Copyright (c) HashiCorp, Inc. | ||
| SPDX-License-Identifier: BUSL-1.1 | ||
| }} | ||
|
|
||
| <Recovery> | ||
| <PageHeader as |p|> | ||
| <p.levelLeft> | ||
| <h1 class="title is-3"> | ||
| Secrets Recovery | ||
| </h1> | ||
| </p.levelLeft> | ||
| </PageHeader> | ||
|
|
||
| {{outlet}} | ||
| </Recovery> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| {{! | ||
| Copyright (c) HashiCorp, Inc. | ||
| SPDX-License-Identifier: BUSL-1.1 | ||
| }} | ||
|
|
||
| {{outlet}} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| {{! | ||
| Copyright (c) HashiCorp, Inc. | ||
| SPDX-License-Identifier: BUSL-1.1 | ||
| }} | ||
|
|
||
| <Recovery::Page::Snapshots /> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| {{! | ||
| Copyright (c) HashiCorp, Inc. | ||
| SPDX-License-Identifier: BUSL-1.1 | ||
| }} | ||
|
|
||
| <Recovery::Page::Snapshots::Load /> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| {{! | ||
| Copyright (c) HashiCorp, Inc. | ||
| SPDX-License-Identifier: BUSL-1.1 | ||
| }} | ||
|
|
||
| <Recovery::Page::Snapshots::Snapshot::Manage /> | ||
|
||
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.
Since there's logic wrapping the sidenav link and the route itself, I don't think we also need a check in the component.
Is there a need for a component like this? The titles are mostly the same between views, except for the load form. I have a small re-filing suggestion but I'll open a PR to demonstrate since I think it might be easier to explain that way
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.
I don't think so. I've gone ahead and removed it