-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 permissions check to show/hide activate button #26840
Changes from 4 commits
c04df2d
ed698a2
50b3be3
8662682
da262f9
bf087b1
48fd97b
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 |
---|---|---|
|
@@ -16,20 +16,24 @@ import type FlashMessageService from 'vault/services/flash-messages'; | |
import type StoreService from 'vault/services/store'; | ||
import type RouterService from '@ember/routing/router-service'; | ||
import type VersionService from 'vault/services/version'; | ||
import type FlagsService from 'vault/services/flags'; | ||
import type { SyncDestinationAssociationMetrics } from 'vault/vault/adapters/sync/association'; | ||
import type SyncDestinationModel from 'vault/vault/models/sync/destination'; | ||
|
||
interface Args { | ||
destinations: Array<SyncDestinationModel>; | ||
totalVaultSecrets: number; | ||
activatedFeatures: Array<string>; | ||
isActivated: boolean; | ||
licenseHasSecretsSync: boolean; | ||
isHvdManaged: boolean; | ||
} | ||
|
||
export default class SyncSecretsDestinationsPageComponent extends Component<Args> { | ||
@service declare readonly flashMessages: FlashMessageService; | ||
@service declare readonly store: StoreService; | ||
@service declare readonly router: RouterService; | ||
@service declare readonly version: VersionService; | ||
@service declare readonly flags: FlagsService; | ||
|
||
@tracked destinationMetrics: SyncDestinationAssociationMetrics[] = []; | ||
@tracked page = 1; | ||
|
@@ -71,11 +75,14 @@ export default class SyncSecretsDestinationsPageComponent extends Component<Args | |
@task | ||
@waitFor | ||
*onFeatureConfirm() { | ||
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. These changes below are a mix of issues from merging in main and a miss on my end of another PR into this side branch that mis-handled the namespace header in this post. The changes restore to what it should be, however we will do extensive testing with the backend to make sure the contract on namespaces is correct. |
||
// must return null instead of root for non managed cluster. | ||
const namespace = this.args.isHvdManaged ? 'admin' : null; | ||
try { | ||
yield this.store | ||
.adapterFor('application') | ||
.ajax('/v1/sys/activation-flags/secrets-sync/activate', 'POST'); | ||
this.router.transitionTo('vault.cluster.sync.secrets.overview'); | ||
.ajax('/v1/sys/activation-flags/secrets-sync/activate', 'POST', { namespace }); | ||
// must refresh and not transition because transition does not refresh the model from within a namespace | ||
yield this.router.refresh(); | ||
} catch (error) { | ||
this.error = errorMessage(error); | ||
this.flashMessages.danger(`Error enabling feature \n ${errorMessage(error)}`); | ||
|
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.
flag service is used in the hbs file