Files
vault/ui/lib/core/addon/components/toolbar-link.js
Jordan Reimer 91407e1968 KV automatic delete state issue in UI (#13166)
* converts secret-v2-version model to native class -- fixes issues with cached values for deleted prop

* adds changelog entry

* adds disabled state to ToolbarLink component and disables create new version action when users cannot read metadata

* updates secret-edit acceptance test
2021-11-23 14:17:37 -07:00

42 lines
1.1 KiB
JavaScript

/**
* @module ToolbarLink
* `ToolbarLink` components style links and buttons for the Toolbar
* It should only be used inside of `Toolbar`.
*
* @example
* ```js
* <Toolbar>
* <ToolbarActions>
* <ToolbarLink @params={{array 'vault.cluster.policies.create'}} @type="add" @disabled={{true}} @disabledTooltip="This link is disabled">
* Create policy
* </ToolbarLink>
* </ToolbarActions>
* </Toolbar>
* ```
*
* @param {array} params - Array to pass to LinkTo
* @param {string} type - Use "add" to change icon
* @param {boolean} disabled - pass true to disable link
* @param {string} disabledTooltip - tooltip to display on hover when disabled
*/
import Component from '@ember/component';
import { computed } from '@ember/object';
import layout from '../templates/components/toolbar-link';
export default Component.extend({
layout,
tagName: '',
supportsDataTestProperties: true,
type: null,
disabled: false,
disabledTooltip: null,
glyph: computed('type', function() {
if (this.type == 'add') {
return 'plus-plain';
} else {
return 'chevron-right';
}
}),
});