github.com/hernad/nomad@v1.6.112/ui/app/components/single-select-dropdown/index.js (about) 1 /** 2 * Copyright (c) HashiCorp, Inc. 3 * SPDX-License-Identifier: MPL-2.0 4 */ 5 6 import Component from '@glimmer/component'; 7 import { action } from '@ember/object'; 8 9 export default class SingleSelectDropdown extends Component { 10 get activeOption() { 11 return this.args.options.findBy('key', this.args.selection); 12 } 13 14 @action 15 setSelection({ key }) { 16 this.args.onSelect && this.args.onSelect(key); 17 } 18 }