vault/ui/app/components/generate-credentials-database.js
Vault Automation 601e2cea29
[UI][VAULT-40916] Update page headers ui/app/components (#11104) (#11417)
* Update page headers for database components

* Update generate forms and license info

* Mount backend form page headers..

* Raft page headers

* Update role-aws-edit page header

* Tools, role-ssh, mount-backend-form and fix tests

* OIDC, TOTP and userpass page headers and tsts

* odic, keymgmt, and dashboard

* Fix dashboard title tests

* Fix breadcrumbs

* MFA, idenitity, and generated item

* Fix mfa enforcement page header tests

* Move tabs out of page header

Co-authored-by: Kianna <30884335+kiannaquach@users.noreply.github.com>
2025-12-18 11:29:04 -05:00

43 lines
1.4 KiB
JavaScript

/**
* Copyright IBM Corp. 2016, 2025
* SPDX-License-Identifier: BUSL-1.1
*/
/**
* @module GenerateCredentialsDatabase
* GenerateCredentialsDatabase component is used on the credentials route for the Database metrics.
* The component assumes that you will need to make an ajax request using queryRecord to return a model for the component that has username, password, leaseId and leaseDuration
*
* @example
* ```js
* <GenerateCredentialsDatabase @backendPath="database" @backendType="database" @roleName="my-role"/>
* ```
* @param {string} backendPath - the secret backend name. This is used in the breadcrumb.
* @param {string} roleType - either 'static', 'dynamic', or falsey.
* @param {string} roleName - the id of the credential returning.
* @param {object} model - database/credential model passed in. If no data, should have errorTitle, errorMessage, and errorHttpStatus
*/
import Component from '@glimmer/component';
import { action } from '@ember/object';
export default class GenerateCredentialsDatabase extends Component {
get breadcrumbs() {
return [
{
label: this.args.backendPath,
route: 'vault.cluster.secrets.backend.overview',
model: this.args.backendPath,
},
{ label: this.args.roleName },
];
}
get errorTitle() {
return this.args.model.errorTitle || 'Something went wrong';
}
@action redirectPreviousPage() {
window.history.back();
}
}