vault/ui/app/components/toolbar-secret-link.js
Chelsea Shaw cc90151c98
UI: add backend to secret link (#26683)
* move secret-link template to be collocated with backing class

* Update secret-link to gracefully handle adding backend to link models

* Update ToolbarSecretLink to pass backend to SecretLink

* Pass backend arg to SecretLink in one-off locations:
- transit-form-show
- secret-list/item
- transform-transformation-item
- transit-actions-layout

* fix database tests and usage of ToolbarSecretLink

* update jsdoc

* update required in jsdocs
2024-04-29 13:38:25 -05:00

45 lines
1.3 KiB
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import Component from '@glimmer/component';
/**
* @module ToolbarSecretLink
* `ToolbarSecretLink` styles SecretLink for the Toolbar.
* It should only be used inside of `Toolbar`.
*
* @example
* ```js
* <Toolbar>
* <ToolbarActions>
* <ToolbarSecretLink
* @mode="create"
* @type="add"
* @secret="some-secret"
* @backend="mount-path"
* @queryParams={{hash tab="policy"}}
* @replace={{true}}
* @disabled={{false}}
* data-test-custom-tag
* >
* Create policy
* </ToolbarSecretLink>
* </ToolbarActions>
* </Toolbar>
* ```
*
* @param {string} type - use "add" to change icon from "chevron-right" to "plus"
* @param {string} mode - *required* passed to secret-link, controls route
* @param {string} backend - *required* backend path. Passed to secret-link
* @param {string} secret - secret path. Passed to secret-link
* @param {boolean} replace - passed to secret-link
* @param {boolean} disabled - passed to secret-link
* @param {object} queryParams - passed to secret-link
*/
export default class ToolbarSecretLink extends Component {
get glyph() {
return this.args.type === 'add' ? 'plus' : 'chevron-right';
}
}