open-vault/ui/app/components/wrap-ttl.js
2022-12-01 09:33:30 -06:00

27 lines
673 B
JavaScript

import { assert } from '@ember/debug';
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
export default class WrapTtlComponent extends Component {
@tracked
wrapResponse = true;
constructor() {
super(...arguments);
assert('`onChange` handler is a required attr in `' + this.toString() + '`.', this.args.onChange);
}
get wrapTTL() {
const { wrapResponse, ttl } = this;
return wrapResponse ? ttl : null;
}
@action
changedValue(ttlObj) {
this.wrapResponse = ttlObj.enabled;
this.ttl = ttlObj.goSafeTimeString;
this.args.onChange(this.wrapTTL);
}
}