Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix saving of TTL and string array fields generated by Open API #7094

Merged
merged 1 commit into from
Jul 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what side effect are we allowing here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the rule: https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/no-side-effects.md And looking at this now, I think we should change this to happen on init, but since this is a backport I didn't want to do it here. I'll make a follow up PR!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But why do we need it?

Copy link
Contributor Author

@meirish meirish Jul 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linting was failing on this - looks like the ignore was added at some point in master after 1.1.3.

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