diff --git a/ui/app/app.js b/ui/app/app.js index c6edb86ddc..bbb78f6a17 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -169,10 +169,19 @@ export default class App extends Application { 'api', 'capabilities', 'version', + // services needed for Secrets sidebar component + 'current-cluster', + 'permissions', + '-portal', + 'namespace', ], externalRoutes: { kvSecretOverview: 'vault.cluster.secrets.backend.kv.secret.index', clientCountOverview: 'vault.cluster.clients', + // routes needed for Secrets sidebar component + secrets: 'vault.cluster.secrets', + sync: 'vault.cluster.sync', + vault: 'vault.cluster', }, }, }, diff --git a/ui/app/templates/vault/cluster/secrets.hbs b/ui/app/templates/vault/cluster/secrets.hbs new file mode 100644 index 0000000000..3986c47a51 --- /dev/null +++ b/ui/app/templates/vault/cluster/secrets.hbs @@ -0,0 +1,8 @@ +{{! + Copyright IBM Corp. 2016, 2025 + SPDX-License-Identifier: BUSL-1.1 +}} + + + +{{outlet}} \ No newline at end of file diff --git a/ui/lib/core/addon/components/sidebar/nav/cluster.hbs b/ui/lib/core/addon/components/sidebar/nav/cluster.hbs index ced596c000..41c114ce5d 100644 --- a/ui/lib/core/addon/components/sidebar/nav/cluster.hbs +++ b/ui/lib/core/addon/components/sidebar/nav/cluster.hbs @@ -7,15 +7,7 @@ Vault - - {{#if this.showSecretsSync}} - - {{/if}} + {{#if (display-nav-item this.navSection.resilienceAndRecovery)}} + + Secrets + + {{#if (display-nav-item this.routeName.secretsSync)}} + + {{/if}} + \ No newline at end of file diff --git a/ui/lib/core/addon/components/sidebar/nav/secrets.ts b/ui/lib/core/addon/components/sidebar/nav/secrets.ts new file mode 100644 index 0000000000..12f4119439 --- /dev/null +++ b/ui/lib/core/addon/components/sidebar/nav/secrets.ts @@ -0,0 +1,22 @@ +/** + * Copyright IBM Corp. 2016, 2025 + * SPDX-License-Identifier: BUSL-1.1 + */ + +import Component from '@glimmer/component'; +import { service } from '@ember/service'; + +import type FlagsService from 'vault/services/flags'; +import { RouteName } from 'core/helpers/display-nav-item'; + +interface Args { + isEngine?: boolean; +} + +export default class SidebarNavSecretsComponent extends Component { + @service declare readonly flags: FlagsService; + + routeName = { + secretsSync: RouteName.SECRETS_SYNC, + }; +} diff --git a/ui/lib/core/addon/helpers/display-nav-item.ts b/ui/lib/core/addon/helpers/display-nav-item.ts index d01dc86c39..a6b27d1be2 100644 --- a/ui/lib/core/addon/helpers/display-nav-item.ts +++ b/ui/lib/core/addon/helpers/display-nav-item.ts @@ -15,6 +15,7 @@ import type PermissionsService from 'vault/services/permissions'; import type FlagsService from 'vault/services/flags'; export enum RouteName { + SECRETS_SYNC = 'secrets-sync', SECRETS_RECOVERY = 'secrets-recovery', SEAL = 'seal', REPLICATION = 'replication', @@ -36,10 +37,13 @@ export default class NavBar extends Helper { @service declare readonly flags: FlagsService; compute([navItem]: string[]) { - const { SECRETS_RECOVERY, SEAL, REPLICATION, VAULT_USAGE, LICENSE } = RouteName; + const { SECRETS_RECOVERY, SEAL, REPLICATION, VAULT_USAGE, LICENSE, SECRETS_SYNC } = RouteName; const { RESILIENCE_AND_RECOVERY, REPORTING, CLIENT_COUNT } = NavSection; switch (navItem) { + // secrets sync nav items + case SECRETS_SYNC: + return this.supportsSecretsSync; // client count nav items case CLIENT_COUNT: return this.supportsClientCount; @@ -131,6 +135,21 @@ export default class NavBar extends Helper { !this.version.hasPKIOnly ); } + + get supportsSecretsSync() { + // always show for HVD managed clusters + if (this.flags.isHvdManaged) return true; + + if (this.flags.secretsSyncIsActivated) { + // activating the feature requires different permissions than using the feature. + // we want to show the link to allow activation regardless of permissions to sys/sync + // and only check permissions if the feature has been activated + return this.permissions.hasNavPermission('sync'); + } + + // otherwise we show the link depending on whether or not the feature exists + return this.version.hasSecretsSync; + } } export function computeNavBar(context: object, navItem: string): boolean { diff --git a/ui/lib/core/app/components/sidebar/nav/secrets.js b/ui/lib/core/app/components/sidebar/nav/secrets.js new file mode 100644 index 0000000000..c664b6405e --- /dev/null +++ b/ui/lib/core/app/components/sidebar/nav/secrets.js @@ -0,0 +1,6 @@ +/** + * Copyright IBM Corp. 2016, 2025 + * SPDX-License-Identifier: BUSL-1.1 + */ + +export { default } from 'core/components/sidebar/nav/secrets'; diff --git a/ui/lib/sync/addon/components/secrets/destination-header.hbs b/ui/lib/sync/addon/components/secrets/destination-header.hbs index 9dadfbe7b7..29aedaed7e 100644 --- a/ui/lib/sync/addon/components/secrets/destination-header.hbs +++ b/ui/lib/sync/addon/components/secrets/destination-header.hbs @@ -7,7 +7,8 @@ @icon={{get (find-by "type" @destination.type (sync-destinations)) "icon"}} @title={{@destination.name}} @breadcrumbs={{array - (hash label="Secrets Sync" route="secrets.overview") + (hash label="Vault" route="vault" icon="vault" linkExternal=true) + (hash label="Secrets sync" route="secrets.overview") (hash label="Destinations" route="secrets.destinations") (hash label="Destination") }} diff --git a/ui/lib/sync/addon/components/secrets/landing-cta.hbs b/ui/lib/sync/addon/components/secrets/landing-cta.hbs index 11d8da976c..1ebca5b52c 100644 --- a/ui/lib/sync/addon/components/secrets/landing-cta.hbs +++ b/ui/lib/sync/addon/components/secrets/landing-cta.hbs @@ -3,7 +3,10 @@ SPDX-License-Identifier: BUSL-1.1 }} - + + <:breadcrumbs> + + <:badges> {{#if this.flags.isHvdManaged}} diff --git a/ui/lib/sync/addon/components/secrets/landing-cta.ts b/ui/lib/sync/addon/components/secrets/landing-cta.ts index 3a58e8d070..ad43651159 100644 --- a/ui/lib/sync/addon/components/secrets/landing-cta.ts +++ b/ui/lib/sync/addon/components/secrets/landing-cta.ts @@ -14,4 +14,16 @@ interface Args { export default class LandingCtaComponent extends Component { @service declare readonly flags: FlagsService; + + breadcrumbs = [ + { + label: 'Vault', + route: 'vault', + icon: 'vault', + linkExternal: true, + }, + { + label: 'Secrets sync', + }, + ]; } diff --git a/ui/lib/sync/addon/components/secrets/page/destinations/create-and-edit.ts b/ui/lib/sync/addon/components/secrets/page/destinations/create-and-edit.ts index f768eccfbd..ddd5216e26 100644 --- a/ui/lib/sync/addon/components/secrets/page/destinations/create-and-edit.ts +++ b/ui/lib/sync/addon/components/secrets/page/destinations/create-and-edit.ts @@ -55,22 +55,24 @@ export default class DestinationsCreateForm extends Component { ? { title: `Create Destination for ${typeDisplayName}`, breadcrumbs: [ - { label: 'Secrets Sync', route: 'secrets.overview' }, - { label: 'Select Destination', route: 'secrets.destinations.create' }, - { label: 'Create Destination' }, + { label: 'Vault', route: 'vault', icon: 'vault', linkExternal: true }, + { label: 'Secrets sync', route: 'secrets.overview' }, + { label: 'Select destination', route: 'secrets.destinations.create' }, + { label: 'Create destination' }, ], } : { title: `Edit ${name}`, breadcrumbs: [ - { label: 'Secrets Sync', route: 'secrets.overview' }, + { label: 'Vault', route: 'vault', icon: 'vault', linkExternal: true }, + { label: 'Secrets sync', route: 'secrets.overview' }, { label: 'Destinations', route: 'secrets.destinations' }, { label: 'Destination', route: 'secrets.destinations.destination.secrets', model: { name, type }, }, - { label: 'Edit Destination' }, + { label: 'Edit destination' }, ], }; } diff --git a/ui/lib/sync/addon/components/secrets/page/destinations/select-type.hbs b/ui/lib/sync/addon/components/secrets/page/destinations/select-type.hbs index 01aa1b522d..6a01eba83a 100644 --- a/ui/lib/sync/addon/components/secrets/page/destinations/select-type.hbs +++ b/ui/lib/sync/addon/components/secrets/page/destinations/select-type.hbs @@ -5,7 +5,11 @@ {{#each (array "cloud" "dev-tools") as |category|}} diff --git a/ui/lib/sync/addon/components/secrets/page/overview.hbs b/ui/lib/sync/addon/components/secrets/page/overview.hbs index 8440f1526b..aabe4545c4 100644 --- a/ui/lib/sync/addon/components/secrets/page/overview.hbs +++ b/ui/lib/sync/addon/components/secrets/page/overview.hbs @@ -41,7 +41,7 @@ {{/if}} {{#if @destinations}} - +