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

UI: Move legacy ACLs, KVs and Intentions to use form functionality #4936

Merged
merged 4 commits into from
Nov 19, 2018

Conversation

johncowen
Copy link
Contributor

This PR moves legacy ACLs, KVs and Intentions to use the newer form functionality.

This brings everything consistently together and follows exactly how it is done in the rest of the app.

Also see #4789

Further work here will involve moving the 'stranger' functionality in Intentions and KVs out of the Controllers and into the forms themselves, meaning Controllers will revert to just orchestration not functionality. What is done here has simplified it ever so slightly (especially for intentions) but I'd rather the form deals with this.

@johncowen johncowen added the theme/ui Anything related to the UI label Nov 9, 2018
@johncowen johncowen requested a review from a team November 9, 2018 14:58
}
return prev;
}, model)
);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried simplifying this a little, by Object.assigning instead. Strangely doing that in the token form broke my tests, see further down, I'll comment in where it broke.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah I can't theres no change there 😂 , link instead:

setProperties: function(model) {
// essentially this replaces the data with changesets
this._super(
Object.keys(model).reduce((prev, key, i) => {
switch (key) {
case 'item':
prev[key] = this.form.setData(prev[key]).getData();
break;
case 'policy':
prev[key] = this.form
.form(key)
.setData(prev[key])
.getData();
break;
}
return prev;
}, model)
);
},

So changing that ^ to use Object.assign broke the tests, so I left things as they are for now.

I might look into it a little deeper, but I want to start feature work again on Monday so I don't want to get in a rabbit hole refactoring too much.

@@ -23,7 +25,7 @@ export default Controller.extend({
this._super({
...model,
...{
item: this.changeset,
item: this.form.setData(model.item).getData(),
SourceName: source,
DestinationName: destination,
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one does use Object.assign so I need to take a second look and make them all as similar as possible

// these variables also exist in the template so we know
// the current selection
// basically the difference between
// `item.DestinationName` and just `DestinationName`
set(this, target.name, selected);
break;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Most of this above will eventually end up being done in the form instead

case 'additional':
parent = get(this, 'parent.Key');
set(this.item, 'Key', `${parent !== '/' ? parent : ''}${target.value}`);
break;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Most of this above will eventually end up being done in the form instead. The json one below has nothing to do with the model and is just view state, so will stay here.

@johncowen johncowen merged commit 56fb20f into ui-staging Nov 19, 2018
@johncowen johncowen deleted the feature/ui-acl-kv-forms branch November 19, 2018 14:53
johncowen added a commit that referenced this pull request Nov 26, 2018
…4936)

Change legacy acls, kvs and intentions to use `form`s
johncowen added a commit that referenced this pull request Dec 5, 2018
…4936)

Change legacy acls, kvs and intentions to use `form`s
johncowen added a commit that referenced this pull request Jan 28, 2019
…4936)

Change legacy acls, kvs and intentions to use `form`s
johncowen added a commit that referenced this pull request Feb 21, 2019
…4936)

Change legacy acls, kvs and intentions to use `form`s
johncowen added a commit that referenced this pull request Apr 29, 2019
…4936)

Change legacy acls, kvs and intentions to use `form`s
johncowen added a commit that referenced this pull request May 1, 2019
…4936)

Change legacy acls, kvs and intentions to use `form`s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/ui Anything related to the UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants