2023-04-10 15:36:59 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2023-02-07 22:42:25 +00:00
|
|
|
import Component from '@glimmer/component';
|
|
|
|
import { tracked } from '@glimmer/tracking';
|
|
|
|
import { action } from '@ember/object';
|
|
|
|
|
|
|
|
export default class MetadataKvComponent extends Component {
|
|
|
|
@tracked editing = false;
|
|
|
|
@tracked value = this.args.value;
|
|
|
|
get prefixedKey() {
|
|
|
|
return this.args.prefix
|
|
|
|
? `${this.args.prefix}.${this.args.key}`
|
|
|
|
: this.args.key;
|
|
|
|
}
|
|
|
|
|
|
|
|
@action onEdit(event) {
|
|
|
|
if (event.key === 'Escape') {
|
|
|
|
this.editing = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|