vault/ui/app/components/flash-toast.js
Vault Automation 0671becbd3
[UI][Bugfix]: General settings page bug fixes pt.2 (#9915) (#9940)
* VAULT-39899 update metadata readonly copy fields to be copy snippet

* VAULT-39912 add bullet buttons to unsaved changes modal

* VAULT-39906 Allow flash message to accept title arg

* Fix failing tests

Co-authored-by: Kianna <30884335+kiannaquach@users.noreply.github.com>
2025-10-07 18:29:37 +00:00

38 lines
918 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import { capitalize } from '@ember/string';
import Component from '@glimmer/component';
/**
* FlashToast components are used to translate flash messages into toast notifications.
* Flash object passed should have a `type` and `message` property at minimum.
*/
export default class FlashToastComponent extends Component {
get color() {
switch (this.args.flash.type) {
case 'info':
return 'highlight';
case 'danger':
return 'critical';
case 'warning':
case 'success':
return this.args.flash.type;
default:
return 'neutral';
}
}
get title() {
if (this.args.flash.title) return this.args.flash.title;
switch (this.args.flash.type) {
case 'danger':
return 'Error';
default:
return capitalize(this.args.flash.type);
}
}
}