Updated show lease with toggle ttl picker (#11256)
* Updated show lease with toggle ttl picker For lease renewal, pass increment param instead of interval * Fixed formatting * Added changelog
This commit is contained in:
parent
f9ade25674
commit
e598f6d5c2
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug
|
||||
ui: Fixed and updated lease renewal picker
|
||||
```
|
|
@ -14,12 +14,12 @@ export default ApplicationAdapter.extend({
|
|||
return this.ajax(url, 'PUT');
|
||||
},
|
||||
|
||||
renew(lease_id, interval) {
|
||||
renew(lease_id, increment) {
|
||||
let url = this.buildURL() + '/leases/renew';
|
||||
return this.ajax(url, 'PUT', {
|
||||
data: {
|
||||
lease_id,
|
||||
interval,
|
||||
increment,
|
||||
},
|
||||
});
|
||||
},
|
||||
|
|
|
@ -24,11 +24,11 @@ export default Controller.extend({
|
|||
});
|
||||
},
|
||||
|
||||
renewLease(model, interval) {
|
||||
renewLease(model, increment) {
|
||||
const adapter = model.store.adapterFor('lease');
|
||||
const flash = this.flashMessages;
|
||||
adapter
|
||||
.renew(model.id, interval)
|
||||
.renew(model.id, increment?.seconds)
|
||||
.then(() => {
|
||||
this.send('refreshModel');
|
||||
// lol this is terrible, but there's no way to get the promise from the route refresh
|
||||
|
|
|
@ -52,16 +52,22 @@
|
|||
{{model.expireTime}}
|
||||
</code>
|
||||
</InfoTableRow>
|
||||
<InfoTableRow @label="Expires in" @value={{date-from-now model.expireTime interval=1000 hideSuffix=true}} />
|
||||
<InfoTableRow @label="Expires in" @value={{date-from-now model.expireTime increment=1000 hideSuffix=true}} />
|
||||
{{/if}}
|
||||
<InfoTableRow @label="TTL" @value={{model.ttl}} />
|
||||
</div>
|
||||
{{#if (and (not model.isAuthLease) model.renewable capabilities.renew.canUpdate)}}
|
||||
<div class="box is-shadowless" data-test-lease-renew-picker=true>
|
||||
<h2 class="title is-6">Renew Lease</h2>
|
||||
<form {{action "renewLease" model interval on="submit"}}>
|
||||
<TtlPicker @labelText="Interval" @labelClass="is-label" @onChange={{action (mut interval)}} @outputSeconds={{true}} />
|
||||
<div class="field">
|
||||
<form {{action "renewLease" model increment on="submit"}}>
|
||||
<TtlPicker2
|
||||
@label="Increment"
|
||||
@helperTextEnabled="Lease will expire after"
|
||||
@helperTextDisabled="Vault will use the default lease duration"
|
||||
@labelClass="is-label"
|
||||
@onChange={{action (mut increment)}} @unit="s"
|
||||
/>
|
||||
<div class="field has-top-margin-s">
|
||||
<div class="control">
|
||||
<button
|
||||
type="submit"
|
||||
|
|
Loading…
Reference in New Issue