-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport 1.12.x: Backport TTL picker changes (#20792)
* cherry picked: * clean up from merge
- Loading branch information
1 parent
f126fef
commit 439c904
Showing
34 changed files
with
808 additions
and
911 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:improvement | ||
ui: update TTL picker for consistency | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div class="field"> | ||
<TtlPicker | ||
@label="Wrap response" | ||
@helperTextDisabled="Will not wrap response" | ||
@helperTextEnabled="Will wrap response with a lease of" | ||
@initialEnabled={{true}} | ||
@initialValue="30m" | ||
@onChange={{this.changedValue}} | ||
@changeOnInit={{true}} | ||
data-test-wrap-ttl-picker | ||
/> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,26 @@ | ||
import { assert } from '@ember/debug'; | ||
import Component from '@ember/component'; | ||
import { set, computed } from '@ember/object'; | ||
import hbs from 'htmlbars-inline-precompile'; | ||
import Component from '@glimmer/component'; | ||
import { action } from '@ember/object'; | ||
import { tracked } from '@glimmer/tracking'; | ||
|
||
export default Component.extend({ | ||
// passed from outside | ||
onChange: null, | ||
wrapResponse: true, | ||
export default class WrapTtlComponent extends Component { | ||
@tracked | ||
wrapResponse = true; | ||
|
||
ttl: '30m', | ||
constructor() { | ||
super(...arguments); | ||
assert('`onChange` handler is a required attr in `' + this.toString() + '`.', this.args.onChange); | ||
} | ||
|
||
wrapTTL: computed('wrapResponse', 'ttl', function () { | ||
get wrapTTL() { | ||
const { wrapResponse, ttl } = this; | ||
return wrapResponse ? ttl : null; | ||
}), | ||
} | ||
|
||
didRender() { | ||
this._super(...arguments); | ||
this.onChange(this.wrapTTL); | ||
}, | ||
|
||
init() { | ||
this._super(...arguments); | ||
assert('`onChange` handler is a required attr in `' + this.toString() + '`.', this.onChange); | ||
}, | ||
|
||
layout: hbs` | ||
<div class="field"> | ||
{{ttl-picker2 | ||
data-test-wrap-ttl-picker=true | ||
label='Wrap response' | ||
helperTextDisabled='Will not wrap response' | ||
helperTextEnabled='Will wrap response with a lease of' | ||
enableTTL=wrapResponse | ||
initialValue=ttl | ||
onChange=(action 'changedValue') | ||
}} | ||
</div> | ||
`, | ||
|
||
actions: { | ||
changedValue(ttlObj) { | ||
set(this, 'wrapResponse', ttlObj.enabled); | ||
set(this, 'ttl', `${ttlObj.seconds}s`); | ||
this.onChange(this.wrapTTL); | ||
}, | ||
}, | ||
}); | ||
@action | ||
changedValue(ttlObj) { | ||
this.wrapResponse = ttlObj.enabled; | ||
this.ttl = ttlObj.goSafeTimeString; | ||
this.args.onChange(this.wrapTTL); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.