ui: Reformat MaxTokenTTL to sortBy as an integer (#9969)
* Install Duration JS * Use Duration.js to sortBy reformatted MaxTokenTTL * Remove @icholy/duration package * Install parse-duration package * Use parse-duration in auth-method model
This commit is contained in:
parent
d235ac2e6a
commit
0e0d54d15d
|
@ -122,8 +122,8 @@ as |key value|}}
|
||||||
{{#let (from-entries (array
|
{{#let (from-entries (array
|
||||||
(array "MethodName:asc" (t "common.sort.alpha.asc"))
|
(array "MethodName:asc" (t "common.sort.alpha.asc"))
|
||||||
(array "MethodName:desc" (t "common.sort.alpha.desc"))
|
(array "MethodName:desc" (t "common.sort.alpha.desc"))
|
||||||
(array "MaxTokenTTL:desc" (t "common.sort.duration.asc"))
|
(array "TokenTTL:desc" (t "common.sort.duration.asc"))
|
||||||
(array "MaxTokenTTL:asc" (t "common.sort.duration.desc"))
|
(array "TokenTTL:asc" (t "common.sort.duration.desc"))
|
||||||
))
|
))
|
||||||
as |selectable|
|
as |selectable|
|
||||||
}}
|
}}
|
||||||
|
@ -138,8 +138,8 @@ as |key value|}}
|
||||||
<Option @value="MethodName:desc" @selected={{eq "MethodName:desc" @sort.value}}>{{t "common.sort.alpha.desc"}}</Option>
|
<Option @value="MethodName:desc" @selected={{eq "MethodName:desc" @sort.value}}>{{t "common.sort.alpha.desc"}}</Option>
|
||||||
</Optgroup>
|
</Optgroup>
|
||||||
<Optgroup @label={{t "common.ui.maxttl"}}>
|
<Optgroup @label={{t "common.ui.maxttl"}}>
|
||||||
<Option @value="MaxTokenTTL:desc" @selected={{eq "MaxTokenTTL:desc" @sort.value}}>{{t "common.sort.duration.asc"}}</Option>
|
<Option @value="TokenTTL:desc" @selected={{eq "TokenTTL:desc" @sort.value}}>{{t "common.sort.duration.asc"}}</Option>
|
||||||
<Option @value="MaxTokenTTL:asc" @selected={{eq "MaxTokenTTL:asc" @sort.value}}>{{t "common.sort.duration.desc"}}</Option>
|
<Option @value="TokenTTL:asc" @selected={{eq "TokenTTL:asc" @sort.value}}>{{t "common.sort.duration.desc"}}</Option>
|
||||||
</Optgroup>
|
</Optgroup>
|
||||||
{{/let}}
|
{{/let}}
|
||||||
</BlockSlot>
|
</BlockSlot>
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import Model, { attr } from '@ember-data/model';
|
import Model, { attr } from '@ember-data/model';
|
||||||
import { or } from '@ember/object/computed';
|
import { or } from '@ember/object/computed';
|
||||||
|
import parse from 'parse-duration';
|
||||||
|
import { computed } from '@ember/object';
|
||||||
|
|
||||||
export const PRIMARY_KEY = 'uid';
|
export const PRIMARY_KEY = 'uid';
|
||||||
export const SLUG_KEY = 'Name';
|
export const SLUG_KEY = 'Name';
|
||||||
|
@ -22,4 +24,9 @@ export default class AuthMethod extends Model {
|
||||||
@attr('number') ModifyIndex;
|
@attr('number') ModifyIndex;
|
||||||
@attr() Datacenters; // string[]
|
@attr() Datacenters; // string[]
|
||||||
@attr() meta; // {}
|
@attr() meta; // {}
|
||||||
|
|
||||||
|
@computed('MaxTokenTTL')
|
||||||
|
get TokenTTL() {
|
||||||
|
return parse(this.MaxTokenTTL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
export default ({ properties }) => (key = 'MethodName:asc') => {
|
export default ({ properties }) => (key = 'MethodName:asc') => {
|
||||||
return properties(['MethodName', 'MaxTokenTTL'])(key);
|
return properties(['MethodName', 'TokenTTL'])(key);
|
||||||
};
|
};
|
||||||
|
|
|
@ -150,6 +150,7 @@
|
||||||
"loader.js": "^4.7.0",
|
"loader.js": "^4.7.0",
|
||||||
"mnemonist": "^0.38.0",
|
"mnemonist": "^0.38.0",
|
||||||
"ngraph.graph": "^19.1.0",
|
"ngraph.graph": "^19.1.0",
|
||||||
|
"parse-duration": "^1.0.0",
|
||||||
"pretender": "^3.2.0",
|
"pretender": "^3.2.0",
|
||||||
"prettier": "^1.10.2",
|
"prettier": "^1.10.2",
|
||||||
"qunit-dom": "^1.0.0",
|
"qunit-dom": "^1.0.0",
|
||||||
|
|
|
@ -11046,6 +11046,11 @@ parse-asn1@^5.0.0, parse-asn1@^5.1.5:
|
||||||
pbkdf2 "^3.0.3"
|
pbkdf2 "^3.0.3"
|
||||||
safe-buffer "^5.1.1"
|
safe-buffer "^5.1.1"
|
||||||
|
|
||||||
|
parse-duration@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/parse-duration/-/parse-duration-1.0.0.tgz#8605651745f61088f6fb14045c887526c291858c"
|
||||||
|
integrity sha512-X4kUkCTHU1N/kEbwK9FpUJ0UZQa90VzeczfS704frR30gljxDG0pSziws06XlK+CGRSo/1wtG1mFIdBFQTMQNw==
|
||||||
|
|
||||||
parse-entities@^1.1.0:
|
parse-entities@^1.1.0:
|
||||||
version "1.2.2"
|
version "1.2.2"
|
||||||
resolved "https://registry.yarnpkg.com/parse-entities/-/parse-entities-1.2.2.tgz#c31bf0f653b6661354f8973559cb86dd1d5edf50"
|
resolved "https://registry.yarnpkg.com/parse-entities/-/parse-entities-1.2.2.tgz#c31bf0f653b6661354f8973559cb86dd1d5edf50"
|
||||||
|
|
Loading…
Reference in New Issue