open-nomad/ui/app/components/single-select-dropdown/index.js
2023-04-10 15:36:59 +00:00

19 lines
411 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import Component from '@glimmer/component';
import { action } from '@ember/object';
export default class SingleSelectDropdown extends Component {
get activeOption() {
return this.args.options.findBy('key', this.args.selection);
}
@action
setSelection({ key }) {
this.args.onSelect && this.args.onSelect(key);
}
}