open-nomad/ui/app/components/metadata-kv.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
558 B
JavaScript
Raw Normal View History

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
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;
}
}
}