Skip to content

Commit

Permalink
fix saving of TTL and string array fields generated by Open API (#7094)
Browse files Browse the repository at this point in the history
  • Loading branch information
meirish committed Jul 22, 2019
1 parent 2d460ed commit 1213efc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions ui/app/components/string-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export default Component.extend({
*
*/
inputList: computed(function() {
/* eslint-disable ember/no-side-effects */
return ArrayProxy.create({
content: [],
// trim the `value` when accessing objects
Expand Down
5 changes: 4 additions & 1 deletion ui/app/utils/openapi-to-attrs.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ export const expandOpenApiProps = function(props) {
}
let attrDefn = {
editType: editType,
type: details.type,
helpText: details.description,
sensitive: details['x-vault-displaySensitive'],
label: details['x-vault-displayName'],
possibleValues: details['enum'],
defaultValue:
details['x-vault-displayValue'] || (!isEmpty(details['default']) ? details['default'] : null),
};

if (editType !== 'ttl' && details.type !== 'array') {
attrDefn.type = details.type;
}
// loop to remove empty vals
for (let attrProp in attrDefn) {
if (attrDefn[attrProp] == null) {
Expand Down
3 changes: 0 additions & 3 deletions ui/tests/unit/utils/openapi-to-attrs-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,10 @@ module('Unit | Util | OpenAPI Data Utilities', function() {
ttl: {
helpText: 'this is a TTL!',
editType: 'ttl',
type: 'string',
label: 'TTL',
},
awesomePeople: {
editType: 'stringArray',
type: 'array',
defaultValue: 'Grace Hopper,Lady Ada',
},
favoriteIceCream: {
Expand Down Expand Up @@ -105,7 +103,6 @@ module('Unit | Util | OpenAPI Data Utilities', function() {
}),
ttl: attr('string', {
editType: 'ttl',
type: 'string',
label: 'TTL',
helpText: 'this is a TTL!',
}),
Expand Down

0 comments on commit 1213efc

Please sign in to comment.